diff widgets/InteractiveFileFinder.cpp @ 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 52e5f6fe31ad
children 6d95d87f1654
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) {