annotate data/fileio/FileFinder.h @ 287:557e00480279

* Fix #1755108 end of file not clearly shown and #1754808 crash when trying to retrieve remote file from absent server
author Chris Cannam
date Mon, 13 Aug 2007 14:51:35 +0000
parents 40db5491bcf8
children 73537d900d4b
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@211 33 SessionOrAudioFile,
Chris@250 34 ImageFile,
Chris@211 35 AnyFile
Chris@211 36 };
Chris@211 37
Chris@211 38 QString getOpenFileName(FileType type, QString fallbackLocation = "");
Chris@211 39 QString getSaveFileName(FileType type, QString fallbackLocation = "");
Chris@211 40 void registerLastOpenedFilePath(FileType type, QString path);
Chris@211 41
Chris@211 42 QString find(FileType type, QString location, QString lastKnownLocation = "");
Chris@211 43
Chris@211 44 static FileFinder *getInstance();
Chris@210 45
Chris@210 46 protected:
Chris@211 47 FileFinder();
Chris@211 48 static FileFinder *m_instance;
Chris@211 49
Chris@211 50 QString findRelative(QString location, QString relativeTo);
Chris@211 51 QString locateInteractive(FileType type, QString thing);
Chris@211 52
Chris@210 53 QString m_lastLocatedLocation;
Chris@210 54 };
Chris@210 55
Chris@210 56 #endif
Chris@210 57