annotate data/fileio/FileFinder.h @ 308:14e0f60435b8

* Make it possible to drop audio files, layer files, session files and images onto SV panes. Need to do a bit more work on where we expect the dropped file to go, particularly in the case of audio files -- at the moment they're always opened in new panes, but it may be better to by default replace whatever is in the target pane.
author Chris Cannam
date Wed, 10 Oct 2007 15:18:02 +0000
parents 73537d900d4b
children
rev   line source
Chris@210 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@210 2
Chris@210 3 /*
Chris@210 4 Sonic Visualiser
Chris@210 5 An audio file viewer and annotation editor.
Chris@210 6 Centre for Digital Music, Queen Mary, University of London.
Chris@210 7 This file copyright 2007 QMUL.
Chris@210 8
Chris@210 9 This program is free software; you can redistribute it and/or
Chris@210 10 modify it under the terms of the GNU General Public License as
Chris@210 11 published by the Free Software Foundation; either version 2 of the
Chris@210 12 License, or (at your option) any later version. See the file
Chris@210 13 COPYING included with this distribution for more information.
Chris@210 14 */
Chris@210 15
Chris@210 16 #ifndef _FILE_FINDER_H_
Chris@210 17 #define _FILE_FINDER_H_
Chris@210 18
Chris@210 19 #include <QString>
Chris@211 20 #include <QObject>
Chris@210 21
Chris@211 22 class FileFinder : public QObject
Chris@210 23 {
Chris@211 24 Q_OBJECT
Chris@211 25
Chris@210 26 public:
Chris@210 27 virtual ~FileFinder();
Chris@210 28
Chris@211 29 enum FileType {
Chris@211 30 SessionFile,
Chris@211 31 AudioFile,
Chris@211 32 LayerFile,
Chris@301 33 LayerFileNoMidi,
Chris@211 34 SessionOrAudioFile,
Chris@250 35 ImageFile,
Chris@211 36 AnyFile
Chris@211 37 };
Chris@211 38
Chris@211 39 QString getOpenFileName(FileType type, QString fallbackLocation = "");
Chris@211 40 QString getSaveFileName(FileType type, QString fallbackLocation = "");
Chris@211 41 void registerLastOpenedFilePath(FileType type, QString path);
Chris@211 42
Chris@211 43 QString find(FileType type, QString location, QString lastKnownLocation = "");
Chris@211 44
Chris@211 45 static FileFinder *getInstance();
Chris@210 46
Chris@210 47 protected:
Chris@211 48 FileFinder();
Chris@211 49 static FileFinder *m_instance;
Chris@211 50
Chris@211 51 QString findRelative(QString location, QString relativeTo);
Chris@211 52 QString locateInteractive(FileType type, QString thing);
Chris@211 53
Chris@210 54 QString m_lastLocatedLocation;
Chris@210 55 };
Chris@210 56
Chris@210 57 #endif
Chris@210 58