svcore  1.9
FileFinder.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 2009 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 
21 class FileFinder
22 {
23 public:
24  enum FileType {
35  };
36 
37  virtual QString getOpenFileName(FileType type, QString fallbackLocation = "") = 0;
38  virtual QString getSaveFileName(FileType type, QString fallbackLocation = "") = 0;
39  virtual void registerLastOpenedFilePath(FileType type, QString path) = 0;
40 
41  virtual QString find(FileType type, QString location, QString lastKnownLocation = "") = 0;
42 
43  static FileFinder *getInstance() {
45  return container->getFileFinder();
46  }
47 
48 protected:
49  class FFContainer {
50  public:
52  static FFContainer instance;
53  return &instance;
54  }
55  void setFileFinder(FileFinder *ff) { m_ff = ff; }
56  FileFinder *getFileFinder() const { return m_ff; }
57  private:
59  };
60 
61  static void registerFileFinder(FileFinder *ff) {
63  container->setFileFinder(ff);
64  }
65 };
66 
67 #endif
68 
69 
virtual QString getSaveFileName(FileType type, QString fallbackLocation="")=0
static FileFinder * getInstance()
Definition: FileFinder.h:43
FileFinder * getFileFinder() const
Definition: FileFinder.h:56
void setFileFinder(FileFinder *ff)
Definition: FileFinder.h:55
virtual QString find(FileType type, QString location, QString lastKnownLocation="")=0
virtual QString getOpenFileName(FileType type, QString fallbackLocation="")=0
static FFContainer * getInstance()
Definition: FileFinder.h:51
static void registerFileFinder(FileFinder *ff)
Definition: FileFinder.h:61
virtual void registerLastOpenedFilePath(FileType type, QString path)=0