Mercurial > hg > svgui
changeset 760:d0fd7630d32f tonioni
Make session file extension parameterisable, use .ton for Tony
author | Chris Cannam |
---|---|
date | Wed, 02 Apr 2014 18:22:41 +0100 |
parents | 30bc7b2155dc |
children | 6a8d922f991d |
files | widgets/InteractiveFileFinder.cpp widgets/InteractiveFileFinder.h |
diffstat | 2 files changed, 32 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/InteractiveFileFinder.cpp Wed Apr 02 10:26:27 2014 +0100 +++ b/widgets/InteractiveFileFinder.cpp Wed Apr 02 18:22:41 2014 +0100 @@ -33,6 +33,7 @@ InteractiveFileFinder::m_instance; InteractiveFileFinder::InteractiveFileFinder() : + m_sessionExtension("sv"), m_lastLocatedLocation("") { SVDEBUG << "Registering interactive file finder" << endl; @@ -43,6 +44,12 @@ { } +void +InteractiveFileFinder::setApplicationSessionExtension(QString extension) +{ + m_sessionExtension = extension; +} + QString InteractiveFileFinder::getOpenFileName(FileType type, QString fallbackLocation) { @@ -57,7 +64,10 @@ case SessionFile: settingsKey = "sessionpath"; title = tr("Select a session file"); - filter = tr("Sonic Visualiser session files (*.sv)\nRDF files (%1)\nAll files (*.*)").arg(RDFImporter::getKnownExtensions()); + filter = tr("%1 session files (*.%1)\nRDF files (%3)\nAll files (*.*)") + .arg(QApplication::applicationName()) + .arg(m_sessionExtension) + .arg(RDFImporter::getKnownExtensions()); break; case AudioFile: @@ -97,9 +107,11 @@ case SessionOrAudioFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2)\nSonic Visualiser session files (*.sv)\nAudio files (%2)\nRDF files (%1)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2)\n%3 session files (*.%4)\nAudio files (%2)\nRDF files (%1)\nAll files (*.*)") .arg(RDFImporter::getKnownExtensions()) - .arg(AudioFileReaderFactory::getKnownExtensions()); + .arg(AudioFileReaderFactory::getKnownExtensions()) + .arg(QApplication::applicationName()) + .arg(m_sessionExtension); break; case ImageFile: @@ -123,10 +135,12 @@ case AnyFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2 %3)\n%4 session files (*.%5)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") .arg(AudioFileReaderFactory::getKnownExtensions()) .arg(DataFileReaderFactory::getKnownExtensions()) - .arg(RDFImporter::getKnownExtensions()); + .arg(RDFImporter::getKnownExtensions()) + .arg(QApplication::applicationName()) + .arg(m_sessionExtension); break; }; @@ -216,7 +230,8 @@ case SessionFile: settingsKey = "savesessionpath"; title = tr("Select a session file"); - filter = tr("Sonic Visualiser session files (*.sv)\nAll files (*.*)"); + filter = tr("%1 session files (*.%2)\nAll files (*.*)") + .arg(QApplication::applicationName()).arg(m_sessionExtension); break; case AudioFile: @@ -300,7 +315,7 @@ dialog.setConfirmOverwrite(false); // we'll do that if (type == SessionFile) { - dialog.setDefaultSuffix("sv"); + dialog.setDefaultSuffix(m_sessionExtension); } else if (type == AudioFile) { dialog.setDefaultSuffix("wav"); } else if (type == ImageFile) {
--- a/widgets/InteractiveFileFinder.h Wed Apr 02 10:26:27 2014 +0100 +++ b/widgets/InteractiveFileFinder.h Wed Apr 02 18:22:41 2014 +0100 @@ -18,6 +18,7 @@ #include "data/fileio/FileFinder.h" +#include <QApplication> #include <QString> #include <QObject> @@ -29,6 +30,14 @@ public: virtual ~InteractiveFileFinder(); + /// Specify the extension for this application's session files + /// (without the dot) + void setApplicationSessionExtension(QString extension); + + QString getApplicationSessionExtension() const { + return m_sessionExtension; + } + QString getOpenFileName(FileType type, QString fallbackLocation = ""); QString getSaveFileName(FileType type, QString fallbackLocation = ""); void registerLastOpenedFilePath(FileType type, QString path); @@ -44,6 +53,7 @@ QString findRelative(QString location, QString relativeTo); QString locateInteractive(FileType type, QString thing); + QString m_sessionExtension; QString m_lastLocatedLocation; };