changeset 686:7f7fba33b7de

Add network permission to prefs; make OSC support one of the things that depends on it
author Chris Cannam
date Thu, 12 Dec 2013 15:20:42 +0000
parents e84a1c6fb35a
children eda211f246e4
files .hgsubstate main/MainWindow.cpp main/NetworkPermissionTester.cpp main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 5 files changed, 39 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Dec 11 22:00:09 2013 +0000
+++ b/.hgsubstate	Thu Dec 12 15:20:42 2013 +0000
@@ -1,5 +1,5 @@
 236814e07bd07473958c1ff89103124536a0c3c8 dataquay
 3c5adc4a864fa75e5b1e67c260b77541aaa4f1f6 sv-dependency-builds
-47964f188bd9cb2a75ad5c3783a86db76950a392 svapp
+c837368b1faf2cd3727242099eefec0a18deb91f svapp
 786ee8d1f30e4920f361419a75eafa079ec0160d svcore
 b81f21f2c4c3d1cb115e278a098ac4869fb7377f svgui
--- a/main/MainWindow.cpp	Wed Dec 11 22:00:09 2013 +0000
+++ b/main/MainWindow.cpp	Thu Dec 12 15:20:42 2013 +0000
@@ -128,7 +128,7 @@
 
 
 MainWindow::MainWindow(bool withAudioOutput, bool withOSCSupport) :
-    MainWindowBase(withAudioOutput, withOSCSupport, true),
+    MainWindowBase(withAudioOutput, true),
     m_overview(0),
     m_mainMenusCreated(false),
     m_paneMenu(0),
@@ -302,6 +302,9 @@
     NetworkPermissionTester tester;
     bool networkPermission = tester.havePermission();
     if (networkPermission) {
+        if (withOSCSupport) {
+            startOSCQueue();
+        }
         TransformFactory::getInstance()->startPopulationThread();
         m_surveyer = new Surveyer
             ("sonicvisualiser.org", "survey23-present.txt", "survey23.php");
--- a/main/NetworkPermissionTester.cpp	Wed Dec 11 22:00:09 2013 +0000
+++ b/main/NetworkPermissionTester.cpp	Thu Dec 12 15:20:42 2013 +0000
@@ -56,10 +56,12 @@
 	      "<p>Developed in the Centre for Digital Music at Queen Mary, University of London, Sonic Visualiser is provided free as open source software under the GNU General Public License.</p>"
               "<p><hr></p>"
 	      "<p><b>Before we go on...</b></p>"
-	      "<p>Sonic Visualiser needs to make occasional network requests to our servers.</p>"
+	      "<p>Sonic Visualiser would like to make networking connections and open a network port.</p>"
 	      "<p>This is to:</p>"
-	      "<ul><li> look up information about available and installed plugins; and</li>"
-	      "<li> tell you when updates are available.</li></ul>"
+	      "<ul><li> Find information about available and installed plugins;</li>"
+	      "<li> Support the use of Open Sound Control, where configured; and</li>"
+	      "<li> Tell you when updates are available.</li>"
+              "</ul>"
 	      "<p>No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.</p>"
 	      "<p>We recommend that you allow this, because it makes Sonic Visualiser more useful. But if you do not wish to do so, please un-check the box below.<br></p>"));
 	layout->addWidget(label, 0, 0);
--- a/main/PreferencesDialog.cpp	Wed Dec 11 22:00:09 2013 +0000
+++ b/main/PreferencesDialog.cpp	Thu Dec 12 15:20:42 2013 +0000
@@ -42,6 +42,8 @@
 #include "audioio/AudioTargetFactory.h"
 #include "base/ResourceFinder.h"
 
+#include "version.h"
+
 PreferencesDialog::PreferencesDialog(QWidget *parent) :
     QDialog(parent),
     m_audioDevice(0),
@@ -206,8 +208,13 @@
 #endif
 
     settings.beginGroup("Preferences");
+
     QString userLocale = settings.value("locale", "").toString();
     m_currentLocale = userLocale;
+    
+    QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
+    m_networkPermission = settings.value(permishTag, false).toBool();
+
     settings.endGroup();
 
     QComboBox *locale = new QComboBox;
@@ -240,6 +247,11 @@
     connect(locale, SIGNAL(currentIndexChanged(int)),
             this, SLOT(localeChanged(int)));
 
+    QCheckBox *networkPermish = new QCheckBox;
+    networkPermish->setCheckState(m_networkPermission ? Qt::Checked : Qt::Unchecked);
+    connect(networkPermish, SIGNAL(stateChanged(int)),
+            this, SLOT(networkPermissionChanged(int)));
+
     QSpinBox *fontSize = new QSpinBox;
     int fs = prefs->getPropertyRangeAndValue("View Font Size", &min, &max,
                                              &deflt);
@@ -278,6 +290,10 @@
                        row, 0);
     subgrid->addWidget(locale, row++, 1, 1, 1);
 
+    subgrid->addWidget(new QLabel(tr("%1:").arg(tr("Allow network usage"))),
+                       row, 0);
+    subgrid->addWidget(networkPermish, row++, 1, 1, 1);
+
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Temporary Directory Root"))),
                        row, 0);
@@ -508,6 +524,14 @@
 }
 
 void
+PreferencesDialog::networkPermissionChanged(int state)
+{
+    m_networkPermission = (state == Qt::Checked);
+    m_applyButton->setEnabled(true);
+    m_changesOnRestart = true;
+}
+
+void
 PreferencesDialog::showSplashChanged(int state)
 {
     m_showSplash = (state == Qt::Checked);
@@ -602,19 +626,17 @@
         AudioTargetFactory::getInstance()->getCallbackTargetNames();
 
     QSettings settings;
-
     settings.beginGroup("Preferences");
+    QString permishTag = QString("network-permission-%1").arg(SV_VERSION);
+    settings.setValue(permishTag, m_networkPermission);
     settings.setValue("audio-target", devices[m_audioDevice]);
+    settings.setValue("locale", m_currentLocale);
     settings.endGroup();
 
     settings.beginGroup("MainWindow");
     settings.setValue("sessiontemplate", m_currentTemplate);
     settings.endGroup();
 
-    settings.beginGroup("Preferences");
-    settings.setValue("locale", m_currentLocale);
-    settings.endGroup();
-
     m_applyButton->setEnabled(false);
 
     if (m_changesOnRestart) {
--- a/main/PreferencesDialog.h	Wed Dec 11 22:00:09 2013 +0000
+++ b/main/PreferencesDialog.h	Thu Dec 12 15:20:42 2013 +0000
@@ -61,6 +61,7 @@
     void showSplashChanged(int state);
     void defaultTemplateChanged(int);
     void localeChanged(int);
+    void networkPermissionChanged(int state);
 
     void tempDirButtonClicked();
 
@@ -91,6 +92,7 @@
     int m_audioDevice;
     int m_resampleQuality;
     bool m_resampleOnLoad;
+    bool m_networkPermission;
     QString m_tempDirRoot;
     int m_backgroundMode;
     int m_timeToTextMode;