comparison widgets/FileFinder.h @ 378:22b72f0f6a4e

* More work to abstract out interactive components used in the data library, so that it does not need to depend on QtGui.
author Chris Cannam
date Fri, 14 Mar 2008 17:14:21 +0000
parents
children
comparison
equal deleted inserted replaced
377:0bcb449d15f4 378:22b72f0f6a4e
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2007 QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _FILE_FINDER_H_
17 #define _FILE_FINDER_H_
18
19 #include <QString>
20 #include <QObject>
21
22 class FileFinder : public QObject
23 {
24 Q_OBJECT
25
26 public:
27 virtual ~FileFinder();
28
29 enum FileType {
30 SessionFile,
31 AudioFile,
32 LayerFile,
33 LayerFileNoMidi,
34 SessionOrAudioFile,
35 ImageFile,
36 AnyFile
37 };
38
39 QString getOpenFileName(FileType type, QString fallbackLocation = "");
40 QString getSaveFileName(FileType type, QString fallbackLocation = "");
41 void registerLastOpenedFilePath(FileType type, QString path);
42
43 QString find(FileType type, QString location, QString lastKnownLocation = "");
44
45 static FileFinder *getInstance();
46
47 protected:
48 FileFinder();
49 static FileFinder *m_instance;
50
51 QString findRelative(QString location, QString relativeTo);
52 QString locateInteractive(FileType type, QString thing);
53
54 QString m_lastLocatedLocation;
55 };
56
57 #endif
58