Chris@529: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@529: 
Chris@529: /*
Chris@529:     Sonic Visualiser
Chris@529:     An audio file viewer and annotation editor.
Chris@529:     Centre for Digital Music, Queen Mary, University of London.
Chris@529:     This file copyright 2007 QMUL.
Chris@529:     
Chris@529:     This program is free software; you can redistribute it and/or
Chris@529:     modify it under the terms of the GNU General Public License as
Chris@529:     published by the Free Software Foundation; either version 2 of the
Chris@529:     License, or (at your option) any later version.  See the file
Chris@529:     COPYING included with this distribution for more information.
Chris@529: */
Chris@529: 
Chris@529: #ifndef _INTERACTIVE_FILE_FINDER_H_
Chris@529: #define _INTERACTIVE_FILE_FINDER_H_
Chris@529: 
Chris@529: #include "data/fileio/FileFinder.h"
Chris@529: 
Chris@760: #include <QApplication>
Chris@529: #include <QString>
Chris@529: #include <QObject>
Chris@529: 
Chris@529: class InteractiveFileFinder : public QObject,
Chris@529:                               public FileFinder
Chris@529: {
Chris@529:     Q_OBJECT
Chris@529: 
Chris@529: public:
Chris@529:     virtual ~InteractiveFileFinder();
Chris@529: 
Chris@760:     /// Specify the extension for this application's session files
Chris@760:     /// (without the dot)
Chris@760:     void setApplicationSessionExtension(QString extension);
Chris@760: 
Chris@760:     QString getApplicationSessionExtension() const {
Chris@760:         return m_sessionExtension;
Chris@760:     }
Chris@760: 
Chris@529:     QString getOpenFileName(FileType type, QString fallbackLocation = "");
Chris@529:     QString getSaveFileName(FileType type, QString fallbackLocation = "");
Chris@529:     void registerLastOpenedFilePath(FileType type, QString path);
Chris@529: 
Chris@529:     QString find(FileType type, QString location, QString lastKnownLocation = "");
Chris@529: 
Chris@831:     static void setParentWidget(QWidget *);
Chris@831: 
Chris@529:     static InteractiveFileFinder *getInstance() { return &m_instance; }
Chris@529: 
Chris@529: protected:
Chris@529:     InteractiveFileFinder();
Chris@529:     static InteractiveFileFinder m_instance;
Chris@529: 
Chris@529:     QString findRelative(QString location, QString relativeTo);
Chris@529:     QString locateInteractive(FileType type, QString thing);
Chris@529: 
Chris@760:     QString m_sessionExtension;
Chris@529:     QString m_lastLocatedLocation;
Chris@831: 
Chris@831:     QWidget *m_parent;
Chris@529: };
Chris@529: 
Chris@529: #endif
Chris@529: