comparison main/NetworkPermissionTester.cpp @ 677:bfd68cc71a25 imaf_enc

Merge from default branch, fix build
author Chris Cannam
date Thu, 05 Dec 2013 10:57:51 +0000
parents 7e0d135e6758
children 60d3575f8016
comparison
equal deleted inserted replaced
676:dabe6e994a9c 677:bfd68cc71a25
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #include "NetworkPermissionTester.h"
16
17 #include "../version.h"
18
19 #include <QWidget>
20 #include <QString>
21 #include <QSettings>
22 #include <QCoreApplication>
23 #include <QDialog>
24 #include <QGridLayout>
25 #include <QLabel>
26 #include <QDialogButtonBox>
27 #include <QCheckBox>
28
29 bool
30 NetworkPermissionTester::havePermission()
31 {
32 QSettings settings;
33 settings.beginGroup("Preferences");
34
35 QString tag = QString("network-permission-%1").arg(SV_VERSION);
36
37 bool permish = false;
38
39 if (settings.contains(tag)) {
40 permish = settings.value(tag, false).toBool();
41 } else {
42
43 QDialog d;
44 d.setWindowTitle(QCoreApplication::translate("NetworkPermissionTester", "Welcome to Sonic Visualiser"));
45
46 QGridLayout *layout = new QGridLayout;
47 d.setLayout(layout);
48
49 QLabel *label = new QLabel;
50 label->setWordWrap(true);
51 label->setText
52 (QCoreApplication::translate
53 ("NetworkPermissionTester",
54 "<h2>Welcome to Sonic Visualiser!</h2>"
55 "<p><img src=\":icons/qm-logo-smaller.png\" style=\"float:right\">Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.</p>"
56 "<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>"
57 "<p><b>This is an experimental release of Sonic Visualiser with support for import and export of IM-AF encoded multitrack files.</b><br>It is not a standard Sonic Visualiser release.</p>"
58 "<p><hr></p>"
59 "<p><b>Before we go on...</b></p>"
60 "<p>Sonic Visualiser needs to make occasional network requests to our servers.</p>"
61 "<p>This is to:</p>"
62 "<ul><li> look up information about available and installed plugins.</li></ul>"
63 "<p>No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.</p>"
64 "<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>"));
65 layout->addWidget(label, 0, 0);
66
67 QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this"));
68 cb->setChecked(true);
69 layout->addWidget(cb, 1, 0);
70
71 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
72 QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
73 layout->addWidget(bb, 2, 0);
74
75 d.exec();
76
77 bool permish = cb->isChecked();
78 settings.setValue(tag, permish);
79 }
80
81 settings.endGroup();
82
83 return permish;
84 }
85
86
87