annotate data/fileio/FileFinder.h @ 1823:07a8793a0388

This is distracting in Sonic Annotator
author Chris Cannam
date Tue, 28 Jan 2020 14:32:34 +0000
parents ea1aa24ebf89
children
rev   line source
Chris@582 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@582 2
Chris@582 3 /*
Chris@582 4 Sonic Visualiser
Chris@582 5 An audio file viewer and annotation editor.
Chris@582 6 Centre for Digital Music, Queen Mary, University of London.
Chris@582 7 This file copyright 2009 QMUL.
Chris@582 8
Chris@582 9 This program is free software; you can redistribute it and/or
Chris@582 10 modify it under the terms of the GNU General Public License as
Chris@582 11 published by the Free Software Foundation; either version 2 of the
Chris@582 12 License, or (at your option) any later version. See the file
Chris@582 13 COPYING included with this distribution for more information.
Chris@582 14 */
Chris@582 15
Chris@1332 16 #ifndef SV_FILE_FINDER_H
Chris@1332 17 #define SV_FILE_FINDER_H
Chris@582 18
Chris@582 19 #include <QString>
Chris@582 20
Chris@582 21 class FileFinder
Chris@582 22 {
Chris@582 23 public:
Chris@582 24 enum FileType {
Chris@582 25 SessionFile,
Chris@582 26 AudioFile,
Chris@582 27 LayerFile,
Chris@582 28 LayerFileNoMidi,
Chris@582 29 SessionOrAudioFile,
Chris@582 30 ImageFile,
Chris@1332 31 SVGFile,
Chris@837 32 AnyFile,
Chris@837 33 CSVFile,
Chris@858 34 LayerFileNonSV,
Chris@858 35 LayerFileNoMidiNonSV,
Chris@582 36 };
Chris@582 37
Chris@1690 38 virtual QString getOpenFileName(FileType type,
Chris@1690 39 QString fallbackLocation = "") = 0;
Chris@582 40
Chris@1690 41 virtual QStringList getOpenFileNames(FileType type,
Chris@1690 42 QString fallbackLocation = "") = 0;
Chris@1690 43
Chris@1690 44 virtual QString getSaveFileName(FileType type,
Chris@1690 45 QString fallbackLocation = "") = 0;
Chris@1690 46
Chris@1690 47 virtual void registerLastOpenedFilePath(FileType type,
Chris@1690 48 QString path) = 0;
Chris@1690 49
Chris@1690 50 virtual QString find(FileType type,
Chris@1690 51 QString location,
Chris@1690 52 QString lastKnownLocation = "") = 0;
Chris@582 53
Chris@622 54 static FileFinder *getInstance() {
Chris@622 55 FFContainer *container = FFContainer::getInstance();
Chris@622 56 return container->getFileFinder();
Chris@622 57 }
Chris@582 58
Chris@582 59 protected:
Chris@622 60 class FFContainer {
Chris@622 61 public:
Chris@622 62 static FFContainer *getInstance() {
Chris@622 63 static FFContainer instance;
Chris@622 64 return &instance;
Chris@622 65 }
Chris@622 66 void setFileFinder(FileFinder *ff) { m_ff = ff; }
Chris@622 67 FileFinder *getFileFinder() const { return m_ff; }
Chris@622 68 private:
Chris@622 69 FileFinder *m_ff;
Chris@622 70 };
Chris@622 71
Chris@622 72 static void registerFileFinder(FileFinder *ff) {
Chris@622 73 FFContainer *container = FFContainer::getInstance();
Chris@622 74 container->setFileFinder(ff);
Chris@622 75 }
Chris@582 76 };
Chris@582 77
Chris@582 78 #endif
Chris@582 79
Chris@582 80