Chris@663: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@663:
Chris@663: /*
Chris@663: Sonic Visualiser
Chris@663: An audio file viewer and annotation editor.
Chris@663: Centre for Digital Music, Queen Mary, University of London.
Chris@663:
Chris@663: This program is free software; you can redistribute it and/or
Chris@663: modify it under the terms of the GNU General Public License as
Chris@663: published by the Free Software Foundation; either version 2 of the
Chris@663: License, or (at your option) any later version. See the file
Chris@663: COPYING included with this distribution for more information.
Chris@663: */
Chris@663:
Chris@663: #include "NetworkPermissionTester.h"
Chris@663:
Chris@663: #include "../version.h"
Chris@663:
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663: #include
Chris@663:
Chris@663: bool
Chris@663: NetworkPermissionTester::havePermission()
Chris@663: {
Chris@663: QSettings settings;
Chris@663: settings.beginGroup("Preferences");
Chris@663:
Chris@663: QString tag = QString("network-permission-%1").arg(SV_VERSION);
Chris@663:
Chris@663: bool permish = false;
Chris@663:
Chris@663: if (settings.contains(tag)) {
Chris@663: permish = settings.value(tag, false).toBool();
Chris@663: } else {
Chris@663:
Chris@663: QDialog d;
Chris@663: d.setWindowTitle(QCoreApplication::translate("NetworkPermissionTester", "Welcome to Sonic Visualiser"));
Chris@663:
Chris@663: QGridLayout *layout = new QGridLayout;
Chris@663: d.setLayout(layout);
Chris@663:
Chris@663: QLabel *label = new QLabel;
Chris@663: label->setWordWrap(true);
Chris@664: label->setText
Chris@664: (QCoreApplication::translate
Chris@664: ("NetworkPermissionTester",
Chris@667: "Welcome to Sonic Visualiser!
"
Chris@667: "Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.
"
Chris@664: "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.
"
Chris@667: "
"
Chris@667: "Before we go on...
"
Chris@664: "Sonic Visualiser needs to make occasional network requests to our servers.
"
Chris@667: "This is to:
"
Chris@667: "- look up information about available and installed plugins; and
"
Chris@667: "- tell you when updates are available.
"
Chris@667: "No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.
"
Chris@667: "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.
"));
Chris@663: layout->addWidget(label, 0, 0);
Chris@663:
Chris@667: QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this"));
Chris@663: cb->setChecked(true);
Chris@663: layout->addWidget(cb, 1, 0);
Chris@663:
Chris@663: QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
Chris@663: QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
Chris@663: layout->addWidget(bb, 2, 0);
Chris@663:
Chris@663: d.exec();
Chris@663:
Chris@663: bool permish = cb->isChecked();
Chris@663: settings.setValue(tag, permish);
Chris@663: }
Chris@663:
Chris@663: settings.endGroup();
Chris@663:
Chris@663: return permish;
Chris@663: }
Chris@663:
Chris@663:
Chris@663: