svgui
1.9
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2007 QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _INTERACTIVE_FILE_FINDER_H_ 00017 #define _INTERACTIVE_FILE_FINDER_H_ 00018 00019 #include "data/fileio/FileFinder.h" 00020 00021 #include <QApplication> 00022 #include <QString> 00023 #include <QObject> 00024 00025 class InteractiveFileFinder : public QObject, 00026 public FileFinder 00027 { 00028 Q_OBJECT 00029 00030 public: 00031 virtual ~InteractiveFileFinder(); 00032 00035 void setApplicationSessionExtension(QString extension); 00036 00037 QString getApplicationSessionExtension() const { 00038 return m_sessionExtension; 00039 } 00040 00041 QString getOpenFileName(FileType type, QString fallbackLocation = ""); 00042 QString getSaveFileName(FileType type, QString fallbackLocation = ""); 00043 void registerLastOpenedFilePath(FileType type, QString path); 00044 00045 QString find(FileType type, QString location, QString lastKnownLocation = ""); 00046 00047 static void setParentWidget(QWidget *); 00048 00049 static InteractiveFileFinder *getInstance() { return &m_instance; } 00050 00051 protected: 00052 InteractiveFileFinder(); 00053 static InteractiveFileFinder m_instance; 00054 00055 QString findRelative(QString location, QString relativeTo); 00056 QString locateInteractive(FileType type, QString thing); 00057 00058 QString m_sessionExtension; 00059 QString m_lastLocatedLocation; 00060 00061 QWidget *m_parent; 00062 }; 00063 00064 #endif 00065