comparison main/MainWindow.cpp @ 663:55efa5a18814

Add network permission question box on first startup
author Chris Cannam
date Tue, 26 Nov 2013 13:10:28 +0000
parents 6f06094daba0
children 17fe7e0c23a1
comparison
equal deleted inserted replaced
662:6f06094daba0 663:55efa5a18814
81 #include "widgets/ModelDataTableDialog.h" 81 #include "widgets/ModelDataTableDialog.h"
82 #include "rdf/PluginRDFIndexer.h" 82 #include "rdf/PluginRDFIndexer.h"
83 #include "rdf/RDFExporter.h" 83 #include "rdf/RDFExporter.h"
84 84
85 #include "Surveyer.h" 85 #include "Surveyer.h"
86 #include "NetworkPermissionTester.h"
86 #include "framework/VersionTester.h" 87 #include "framework/VersionTester.h"
87 88
88 // For version information 89 // For version information
89 #include <vamp/vamp.h> 90 #include <vamp/vamp.h>
90 #include <vamp-hostsdk/PluginBase.h> 91 #include <vamp-hostsdk/PluginBase.h>
249 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); 250 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
250 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); 251 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
251 252
252 IconLoader il; 253 IconLoader il;
253 254
254 QSettings settings;
255 settings.beginGroup("MainWindow");
256 settings.endGroup();
257
258 m_playControlsSpacer = new QFrame; 255 m_playControlsSpacer = new QFrame;
259 256
260 layout->setSpacing(4); 257 layout->setSpacing(4);
261 layout->addWidget(m_mainScroll, 0, 0, 1, 5); 258 layout->addWidget(m_mainScroll, 0, 0, 1, 5);
262 layout->addWidget(m_overview, 1, 1); 259 layout->addWidget(m_overview, 1, 1);
302 299
303 newSession(); 300 newSession();
304 301
305 connect(m_midiInput, SIGNAL(eventsAvailable()), 302 connect(m_midiInput, SIGNAL(eventsAvailable()),
306 this, SLOT(midiEventsAvailable())); 303 this, SLOT(midiEventsAvailable()));
307 304
308 TransformFactory::getInstance()->startPopulationThread(); 305 NetworkPermissionTester tester(this);
309 306 bool networkPermission = tester.havePermission();
310 m_surveyer = new Surveyer 307 if (networkPermission) {
311 ("sonicvisualiser.org", "survey23-present.txt", "survey23.php"); 308 TransformFactory::getInstance()->startPopulationThread();
312 309 m_surveyer = new Surveyer
313 m_versionTester = new VersionTester 310 ("sonicvisualiser.org", "survey23-present.txt", "survey23.php");
314 ("sonicvisualiser.org", "latest-version.txt", SV_VERSION); 311 m_versionTester = new VersionTester
315 connect(m_versionTester, SIGNAL(newerVersionAvailable(QString)), 312 ("sonicvisualiser.org", "latest-version.txt", SV_VERSION);
316 this, SLOT(newerVersionAvailable(QString))); 313 connect(m_versionTester, SIGNAL(newerVersionAvailable(QString)),
314 this, SLOT(newerVersionAvailable(QString)));
315 } else {
316 m_surveyer = 0;
317 m_versionTester = 0;
318 }
317 } 319 }
318 320
319 MainWindow::~MainWindow() 321 MainWindow::~MainWindow()
320 { 322 {
321 // SVDEBUG << "MainWindow::~MainWindow" << endl; 323 // SVDEBUG << "MainWindow::~MainWindow" << endl;
4440 QSettings settings; 4442 QSettings settings;
4441 settings.beginGroup("NewerVersionWarning"); 4443 settings.beginGroup("NewerVersionWarning");
4442 QString tag = QString("version-%1-available-show").arg(version); 4444 QString tag = QString("version-%1-available-show").arg(version);
4443 if (settings.value(tag, true).toBool()) { 4445 if (settings.value(tag, true).toBool()) {
4444 QString title(tr("Newer version available")); 4446 QString title(tr("Newer version available"));
4445 QString text(tr("<h3>Newer version available</h3><p>You are using version %1 of Sonic Visualiser, but version %3 is now available.</p><p>Please see the <a href=\"http://sonicvisualiser.org/\">Sonic Visualiser website</a> for more information.</p>").arg(SV_VERSION).arg(version)); 4447 QString text(tr("<h3>Newer version available</h3><p>You are using version %1 of Sonic Visualiser, but version %2 is now available.</p><p>Please see the <a href=\"http://sonicvisualiser.org/\">Sonic Visualiser website</a> for more information.</p>").arg(SV_VERSION).arg(version));
4446 QMessageBox::information(this, title, text); 4448 QMessageBox::information(this, title, text);
4447 settings.setValue(tag, false); 4449 settings.setValue(tag, false);
4448 } 4450 }
4449 settings.endGroup(); 4451 settings.endGroup();
4450 } 4452 }