diff base/Preferences.cpp @ 1313:ff9697592bef 3.0-integration

Add gapless preference to prefs dialog; much work on audio read tests
author Chris Cannam
date Thu, 01 Dec 2016 17:45:40 +0000
parents ba16388b937d
children ea28ee929034
line wrap: on
line diff
--- a/base/Preferences.cpp	Tue Nov 29 17:09:07 2016 +0000
+++ b/base/Preferences.cpp	Thu Dec 01 17:45:40 2016 +0000
@@ -46,6 +46,7 @@
     m_tempDirRoot(""),
     m_fixedSampleRate(0),
     m_resampleOnLoad(false),
+    m_gapless(true),
     m_normaliseAudio(false),
     m_viewFontSize(10),
     m_backgroundMode(BackgroundFromTheme),
@@ -69,6 +70,7 @@
     m_runPluginsInProcess = settings.value("run-vamp-plugins-in-process", true).toBool();
     m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toDouble();
     m_resampleOnLoad = settings.value("resample-on-load", false).toBool();
+    m_gapless = settings.value("gapless", true).toBool();
     m_normaliseAudio = settings.value("normalise-audio", false).toBool();
     m_backgroundMode = BackgroundMode
         (settings.value("background-mode", int(BackgroundFromTheme)).toInt());
@@ -101,6 +103,7 @@
     props.push_back("Resample Quality");
     props.push_back("Omit Temporaries from Recent Files");
     props.push_back("Resample On Load");
+    props.push_back("Use Gapless Mode");
     props.push_back("Normalise Audio");
     props.push_back("Fixed Sample Rate");
     props.push_back("Temporary Directory Root");
@@ -143,6 +146,9 @@
     if (name == "Resample On Load") {
         return tr("Resample mismatching files on import");
     }
+    if (name == "Use Gapless Mode") {
+        return tr("Load mp3 files in gapless mode");
+    }
     if (name == "Fixed Sample Rate") {
         return tr("Single fixed sample rate to resample all files to");
     }
@@ -200,6 +206,9 @@
     if (name == "Resample On Load") {
         return ToggleProperty;
     }
+    if (name == "Use Gapless Mode") {
+        return ToggleProperty;
+    }
     if (name == "Fixed Sample Rate") {
         return ValueProperty;
     }
@@ -582,6 +591,19 @@
 }
 
 void
+Preferences::setUseGaplessMode(bool gapless)
+{
+    if (m_gapless != gapless) {
+        m_gapless = gapless;
+        QSettings settings;
+        settings.beginGroup("Preferences");
+        settings.setValue("gapless", gapless);
+        settings.endGroup();
+        emit propertyChanged("Use Gapless Mode");
+    }
+}
+
+void
 Preferences::setFixedSampleRate(sv_samplerate_t rate)
 {
     if (m_fixedSampleRate != rate) {