# HG changeset patch # User Chris Cannam # Date 1251391769 0 # Node ID f50fa43143ae77f9e23f978baa3cc4263ec66117 # Parent faff9cd8f66326e5b78318ca3abe7d6ade341755 * Fixes to newer-version and survey-offering logic diff -r faff9cd8f663 -r f50fa43143ae main/MainWindow.cpp --- a/main/MainWindow.cpp Thu Aug 27 16:31:45 2009 +0000 +++ b/main/MainWindow.cpp Thu Aug 27 16:49:29 2009 +0000 @@ -79,6 +79,7 @@ #include "rdf/RDFExporter.h" #include "Surveyer.h" +#include "framework/VersionTester.h" // For version information #include @@ -294,6 +295,12 @@ this, SLOT(midiEventsAvailable())); TransformFactory::getInstance()->startPopulationThread(); + + Surveyer *surveyer = new Surveyer(this); + VersionTester *vt = new VersionTester + ("sonicvisualiser.org", "/latest-version.txt", SV_VERSION); + connect(vt, SIGNAL(newerVersionAvailable(QString)), + this, SLOT(newerVersionAvailable(QString))); } MainWindow::~MainWindow() @@ -349,8 +356,6 @@ setupTransformsMenu(); m_mainMenusCreated = true; - - Surveyer *surveyer = new Surveyer(this); } void @@ -4007,9 +4012,16 @@ void MainWindow::newerVersionAvailable(QString version) { - QString title(tr("Newer version available")); - QString text(tr("

Newer version available

You are using version %1 of Sonic Visualiser. Version %3 is now available.

Please consult the Sonic Visualiser website for more information.

").arg(SV_VERSION).arg(version)); - QMessageBox::information(this, title, text); + QSettings settings; + settings.beginGroup("NewerVersionWarning"); + QString tag = QString("version-%1-available-show").arg(version); + if (settings.value(tag, true).toBool()) { + QString title(tr("Newer version available")); + QString text(tr("

Newer version available

You are using version %1 of Sonic Visualiser, but version %3 is now available.

Please see the Sonic Visualiser website for more information.

").arg(SV_VERSION).arg(version)); + QMessageBox::information(this, title, text); + settings.setValue(tag, false); + } + settings.endGroup(); } diff -r faff9cd8f663 -r f50fa43143ae main/Surveyer.cpp --- a/main/Surveyer.cpp Thu Aug 27 16:31:45 2009 +0000 +++ b/main/Surveyer.cpp Thu Aug 27 16:49:29 2009 +0000 @@ -96,17 +96,22 @@ // if (response != "yes") return; QString title = "Sonic Visualiser - User Survey"; - QString text = "

Sonic Visualiser: Take part in our survey!

We at Queen Mary, University of London are running a short survey for users of Sonic Visualiser. We are trying to find out how useful Sonic Visualiser is to people, and what we can do to improve it.

We do not ask for any personal information, and there's absolutely nothing commercial about it, and it should only take five minutes!

Would you like to take part?

"; + QString text = "

Sonic Visualiser: Take part in our survey!

We at Queen Mary, University of London are running a short survey for users of Sonic Visualiser. We are trying to find out how useful Sonic Visualiser is to people, and what we can do to improve it.

We do not ask for any personal information, and it should only take five minutes.

Would you like to take part?

"; QMessageBox mb(dynamic_cast(parent())); mb.setWindowTitle(title); mb.setText(text); QPushButton *yes = mb.addButton(tr("Yes! Take me to the survey"), QMessageBox::ActionRole); - mb.addButton(tr("No thanks"), QMessageBox::RejectRole); + mb.addButton(tr("No, thanks"), QMessageBox::RejectRole); mb.exec(); + QSettings settings; + settings.beginGroup("Survey"); + settings.setValue("countdown", -1); + settings.endGroup(); + if (mb.clickedButton() == yes) { QString svarg = SV_VERSION; QString platformarg = "unknown"; @@ -131,7 +136,7 @@ QString plugid = t.getPluginIdentifier(); QString type, soname, label; PluginIdentifier::parseIdentifier(plugid, type, soname, label); - packages.insert(soname); + if (type == "vamp") packages.insert(soname); } for (std::set::const_iterator i = packages.begin(); i != packages.end(); ++i) {