Chris@529
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@529
|
2
|
Chris@529
|
3 /*
|
Chris@529
|
4 Sonic Visualiser
|
Chris@529
|
5 An audio file viewer and annotation editor.
|
Chris@529
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@529
|
7 This file copyright 2007 QMUL.
|
Chris@529
|
8
|
Chris@529
|
9 This program is free software; you can redistribute it and/or
|
Chris@529
|
10 modify it under the terms of the GNU General Public License as
|
Chris@529
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@529
|
12 License, or (at your option) any later version. See the file
|
Chris@529
|
13 COPYING included with this distribution for more information.
|
Chris@529
|
14 */
|
Chris@529
|
15
|
Chris@1407
|
16 #ifndef SV_INTERACTIVE_FILE_FINDER_H
|
Chris@1407
|
17 #define SV_INTERACTIVE_FILE_FINDER_H
|
Chris@529
|
18
|
Chris@529
|
19 #include "data/fileio/FileFinder.h"
|
Chris@529
|
20
|
Chris@760
|
21 #include <QApplication>
|
Chris@529
|
22 #include <QString>
|
Chris@529
|
23 #include <QObject>
|
Chris@529
|
24
|
Chris@529
|
25 class InteractiveFileFinder : public QObject,
|
Chris@529
|
26 public FileFinder
|
Chris@529
|
27 {
|
Chris@529
|
28 Q_OBJECT
|
Chris@529
|
29
|
Chris@529
|
30 public:
|
Chris@529
|
31 virtual ~InteractiveFileFinder();
|
Chris@529
|
32
|
Chris@760
|
33 /// Specify the extension for this application's session files
|
Chris@760
|
34 /// (without the dot)
|
Chris@760
|
35 void setApplicationSessionExtension(QString extension);
|
Chris@760
|
36
|
Chris@760
|
37 QString getApplicationSessionExtension() const {
|
Chris@760
|
38 return m_sessionExtension;
|
Chris@760
|
39 }
|
Chris@760
|
40
|
Chris@1440
|
41 QString getOpenFileName(FileType type,
|
Chris@1440
|
42 QString fallbackLocation = "") override;
|
Chris@1440
|
43
|
Chris@1440
|
44 QStringList getOpenFileNames(FileType type,
|
Chris@1440
|
45 QString fallbackLocation = "") override;
|
Chris@1440
|
46
|
Chris@1440
|
47 QString getSaveFileName(FileType type,
|
Chris@1440
|
48 QString fallbackLocation = "") override;
|
Chris@1440
|
49
|
Chris@1440
|
50 void registerLastOpenedFilePath(FileType type,
|
Chris@1440
|
51 QString path) override;
|
Chris@529
|
52
|
Chris@1440
|
53 QString find(FileType type,
|
Chris@1440
|
54 QString location,
|
Chris@1440
|
55 QString lastKnownLocation = "") override;
|
Chris@529
|
56
|
Chris@831
|
57 static void setParentWidget(QWidget *);
|
Chris@831
|
58
|
Chris@529
|
59 static InteractiveFileFinder *getInstance() { return &m_instance; }
|
Chris@529
|
60
|
Chris@529
|
61 protected:
|
Chris@529
|
62 InteractiveFileFinder();
|
Chris@529
|
63 static InteractiveFileFinder m_instance;
|
Chris@529
|
64
|
Chris@529
|
65 QString findRelative(QString location, QString relativeTo);
|
Chris@529
|
66 QString locateInteractive(FileType type, QString thing);
|
Chris@529
|
67
|
Chris@1440
|
68 QStringList getOpenFileNames(FileType type,
|
Chris@1440
|
69 QString fallbackLocation,
|
Chris@1440
|
70 bool multiple);
|
Chris@1440
|
71
|
Chris@760
|
72 QString m_sessionExtension;
|
Chris@529
|
73 QString m_lastLocatedLocation;
|
Chris@831
|
74
|
Chris@831
|
75 QWidget *m_parent;
|
Chris@529
|
76 };
|
Chris@529
|
77
|
Chris@529
|
78 #endif
|
Chris@529
|
79
|