Chris@210: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@210: 
Chris@210: /*
Chris@210:     Sonic Visualiser
Chris@210:     An audio file viewer and annotation editor.
Chris@210:     Centre for Digital Music, Queen Mary, University of London.
Chris@210:     This file copyright 2007 QMUL.
Chris@210:     
Chris@210:     This program is free software; you can redistribute it and/or
Chris@210:     modify it under the terms of the GNU General Public License as
Chris@210:     published by the Free Software Foundation; either version 2 of the
Chris@210:     License, or (at your option) any later version.  See the file
Chris@210:     COPYING included with this distribution for more information.
Chris@210: */
Chris@210: 
Chris@210: #ifndef _FILE_FINDER_H_
Chris@210: #define _FILE_FINDER_H_
Chris@210: 
Chris@210: #include <QString>
Chris@211: #include <QObject>
Chris@210: 
Chris@211: class FileFinder : public QObject
Chris@210: {
Chris@211:     Q_OBJECT
Chris@211: 
Chris@210: public:
Chris@210:     virtual ~FileFinder();
Chris@210: 
Chris@211:     enum FileType {
Chris@211:         SessionFile,
Chris@211:         AudioFile,
Chris@211:         LayerFile,
Chris@301:         LayerFileNoMidi,
Chris@211:         SessionOrAudioFile,
Chris@250:         ImageFile,
Chris@211:         AnyFile
Chris@211:     };
Chris@211: 
Chris@211:     QString getOpenFileName(FileType type, QString fallbackLocation = "");
Chris@211:     QString getSaveFileName(FileType type, QString fallbackLocation = "");
Chris@211:     void registerLastOpenedFilePath(FileType type, QString path);
Chris@211: 
Chris@211:     QString find(FileType type, QString location, QString lastKnownLocation = "");
Chris@211: 
Chris@211:     static FileFinder *getInstance();
Chris@210: 
Chris@210: protected:
Chris@211:     FileFinder();
Chris@211:     static FileFinder *m_instance;
Chris@211: 
Chris@211:     QString findRelative(QString location, QString relativeTo);
Chris@211:     QString locateInteractive(FileType type, QString thing);
Chris@211: 
Chris@210:     QString m_lastLocatedLocation;
Chris@210: };
Chris@210: 
Chris@210: #endif
Chris@210: