InteractiveFileFinder.h
Go to the documentation of this file.
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 SV_INTERACTIVE_FILE_FINDER_H
17 #define SV_INTERACTIVE_FILE_FINDER_H
18 
19 #include "data/fileio/FileFinder.h"
20 
21 #include <QApplication>
22 #include <QString>
23 #include <QObject>
24 
25 class InteractiveFileFinder : public QObject,
26  public FileFinder
27 {
28  Q_OBJECT
29 
30 public:
31  virtual ~InteractiveFileFinder();
32 
35  void setApplicationSessionExtension(QString extension);
36 
38  return m_sessionExtension;
39  }
40 
41  QString getOpenFileName(FileType type,
42  QString fallbackLocation = "") override;
43 
44  QStringList getOpenFileNames(FileType type,
45  QString fallbackLocation = "") override;
46 
47  QString getSaveFileName(FileType type,
48  QString fallbackLocation = "") override;
49 
50  void registerLastOpenedFilePath(FileType type,
51  QString path) override;
52 
53  QString find(FileType type,
54  QString location,
55  QString lastKnownLocation = "") override;
56 
57  static void setParentWidget(QWidget *);
58 
60 
61 protected:
64 
65  QString findRelative(QString location, QString relativeTo);
66  QString locateInteractive(FileType type, QString thing);
67 
68  QStringList getOpenFileNames(FileType type,
69  QString fallbackLocation,
70  bool multiple);
71 
74 
75  QWidget *m_parent;
76 };
77 
78 #endif
79 
static void setParentWidget(QWidget *)
void registerLastOpenedFilePath(FileType type, QString path) override
QString locateInteractive(FileType type, QString thing)
QString getSaveFileName(FileType type, QString fallbackLocation="") override
void setApplicationSessionExtension(QString extension)
Specify the extension for this application&#39;s session files (without the dot)
QString getOpenFileName(FileType type, QString fallbackLocation="") override
QString find(FileType type, QString location, QString lastKnownLocation="") override
QStringList getOpenFileNames(FileType type, QString fallbackLocation="") override
QString findRelative(QString location, QString relativeTo)
QString getApplicationSessionExtension() const
static InteractiveFileFinder m_instance
static InteractiveFileFinder * getInstance()