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@1639: #include "base/Debug.h" Chris@1639: 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@1639: permish = settings.value(tag, false).toBool(); Chris@1639: SVDEBUG << "NetworkPermissionTester: Asked already, result was " << permish << endl; Chris@663: } else { Chris@1639: SVDEBUG << "NetworkPermissionTester: Asking for permission" << endl; Chris@663: Chris@1639: QDialog d; Chris@1770: d.setWindowTitle(QCoreApplication::translate("NetworkPermissionTester", "Welcome to Sonic Visualiser")); Chris@663: Chris@1770: QGridLayout *layout = new QGridLayout; Chris@1770: d.setLayout(layout); Chris@663: Chris@1613: QString preamble; Chris@1613: preamble = QCoreApplication::translate Chris@1613: ("NetworkPermissionTester", Chris@1613: "

Welcome to Sonic Visualiser!

" Chris@1613: "

Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.

" Chris@1613: "

Developed in the Centre for Digital Music at Queen Mary University of London, Sonic Visualiser is open source software under the GNU General Public License.

" Chris@1613: "


" Chris@1613: "

Before we go on...

" Chris@1613: "

Sonic Visualiser would like permission to use the network.

"); Chris@1613: Chris@1613: QString bullets; Chris@1613: if (m_withOSC) { Chris@1613: bullets = QCoreApplication::translate Chris@1613: ("NetworkPermissionTester", Chris@1613: "

This is to:

" Chris@1613: "
  • Find information about available and installed plugins;
  • " Chris@1613: "
  • Support the use of Open Sound Control; and
  • " Chris@1613: "
  • Tell you when updates are available.
  • " Chris@1613: "
"); Chris@1613: } else { Chris@1613: bullets = QCoreApplication::translate Chris@1613: ("NetworkPermissionTester", Chris@1613: "

This is to:

" Chris@1613: "
  • Find information about available and installed plugins; and
  • " Chris@1613: "
  • Tell you when updates are available.
  • " Chris@1613: "
"); Chris@1613: } Chris@1613: Chris@1613: QString postamble; Chris@1613: postamble = QCoreApplication::translate Chris@1613: ("NetworkPermissionTester", Chris@1613: "

No personal information will be sent, no tracking is carried out, and no individual information will be shared with anyone else. We will however make aggregate counts of distinct requests for usage reporting.

" Chris@1613: "

We recommend that you allow this, because it makes Sonic Visualiser more useful to you and supports the public funding of this work. But if you do not wish to allow it, please un-check the box below.

"); Chris@1613: Chris@1770: QLabel *label = new QLabel; Chris@1770: label->setWordWrap(true); Chris@1770: label->setText(preamble + bullets + postamble); Chris@1770: layout->addWidget(label, 0, 0); Chris@663: Chris@1770: QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this")); Chris@1770: cb->setChecked(true); Chris@1770: layout->addWidget(cb, 1, 0); Chris@1770: Chris@1770: QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); Chris@1770: QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept())); Chris@1770: layout->addWidget(bb, 2, 0); Chris@1770: Chris@1770: d.exec(); Chris@663: Chris@681: permish = cb->isChecked(); Chris@1770: settings.setValue(tag, permish); Chris@1639: Chris@1639: SVDEBUG << "NetworkPermissionTester: asked, answer was " << permish << endl; Chris@663: } Chris@663: Chris@663: settings.endGroup(); Chris@663: Chris@663: return permish; Chris@663: } Chris@663: Chris@663: Chris@663: