annotate widgets/InteractiveFileFinder.h @ 1204:d421df27e184 3.0-integration

Further PropertyBox layout overhaul: avoid crash (/ assertion failure) when property type changes from e.g. colour to colourmap, by replacing the existing widget within the layout rather than trying to repopulate it
author Chris Cannam
date Tue, 20 Dec 2016 10:49:24 +0000
parents 831188672987
children a18e78b9c78b
rev   line source
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@529 16 #ifndef _INTERACTIVE_FILE_FINDER_H_
Chris@529 17 #define _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@529 41 QString getOpenFileName(FileType type, QString fallbackLocation = "");
Chris@529 42 QString getSaveFileName(FileType type, QString fallbackLocation = "");
Chris@529 43 void registerLastOpenedFilePath(FileType type, QString path);
Chris@529 44
Chris@529 45 QString find(FileType type, QString location, QString lastKnownLocation = "");
Chris@529 46
Chris@831 47 static void setParentWidget(QWidget *);
Chris@831 48
Chris@529 49 static InteractiveFileFinder *getInstance() { return &m_instance; }
Chris@529 50
Chris@529 51 protected:
Chris@529 52 InteractiveFileFinder();
Chris@529 53 static InteractiveFileFinder m_instance;
Chris@529 54
Chris@529 55 QString findRelative(QString location, QString relativeTo);
Chris@529 56 QString locateInteractive(FileType type, QString thing);
Chris@529 57
Chris@760 58 QString m_sessionExtension;
Chris@529 59 QString m_lastLocatedLocation;
Chris@831 60
Chris@831 61 QWidget *m_parent;
Chris@529 62 };
Chris@529 63
Chris@529 64 #endif
Chris@529 65