Chris@95
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@95
|
2
|
Chris@95
|
3 /*
|
Chris@95
|
4 Tony
|
Chris@95
|
5 An intonation analysis and annotation tool
|
Chris@95
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@95
|
7
|
Chris@95
|
8 This program is free software; you can redistribute it and/or
|
Chris@95
|
9 modify it under the terms of the GNU General Public License as
|
Chris@95
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@95
|
11 License, or (at your option) any later version. See the file
|
Chris@95
|
12 COPYING included with this distribution for more information.
|
Chris@95
|
13 */
|
Chris@95
|
14
|
Chris@95
|
15 #include "NetworkPermissionTester.h"
|
Chris@95
|
16
|
Chris@95
|
17 #include "../version.h"
|
Chris@95
|
18
|
Chris@95
|
19 #include <QWidget>
|
Chris@95
|
20 #include <QString>
|
Chris@95
|
21 #include <QSettings>
|
Chris@95
|
22 #include <QCoreApplication>
|
Chris@95
|
23 #include <QDialog>
|
Chris@95
|
24 #include <QGridLayout>
|
Chris@95
|
25 #include <QLabel>
|
Chris@95
|
26 #include <QDialogButtonBox>
|
Chris@95
|
27 #include <QCheckBox>
|
Chris@95
|
28
|
Chris@95
|
29 bool
|
Chris@95
|
30 NetworkPermissionTester::havePermission()
|
Chris@95
|
31 {
|
Chris@95
|
32 QSettings settings;
|
Chris@95
|
33 settings.beginGroup("Preferences");
|
Chris@95
|
34
|
Chris@95
|
35 QString tag = QString("network-permission-%1").arg(TONY_VERSION);
|
Chris@95
|
36
|
Chris@95
|
37 bool permish = false;
|
Chris@95
|
38
|
Chris@95
|
39 if (settings.contains(tag)) {
|
Chris@95
|
40 permish = settings.value(tag, false).toBool();
|
Chris@95
|
41 } else {
|
Chris@95
|
42
|
Chris@95
|
43 QDialog d;
|
Chris@95
|
44 d.setWindowTitle(QCoreApplication::translate
|
Chris@95
|
45 ("NetworkPermissionTester",
|
Chris@95
|
46 "Tony: a tool for melody annotation"));
|
Chris@95
|
47
|
Chris@95
|
48 QGridLayout *layout = new QGridLayout;
|
Chris@95
|
49 d.setLayout(layout);
|
Chris@95
|
50
|
Chris@95
|
51 QLabel *label = new QLabel;
|
Chris@95
|
52 label->setWordWrap(true);
|
Chris@95
|
53 label->setText
|
Chris@95
|
54 (QCoreApplication::translate
|
Chris@95
|
55 ("NetworkPermissionTester",
|
Chris@95
|
56 "<h2>Tony: a tool for melody annotation</h2>"
|
Chris@436
|
57 "<p><img src=\":icons/qm-logo-smaller.png\" style=\"float:right\">Tony is a program for computer-assisted pitch and note annotation of unaccompanied melody.</p>"
|
Chris@95
|
58 "<p>Developed in the Centre for Digital Music at Queen Mary, University of London, Tony is provided free as open source software under the GNU General Public License.</p>"
|
Chris@95
|
59 "<p><hr></p>"
|
Chris@95
|
60 "<p><b>Before we go on...</b></p>"
|
Chris@95
|
61 "<p>Tony needs to make occasional network requests to our servers.</p>"
|
Chris@95
|
62 "<p>This is to:</p>"
|
Chris@95
|
63 "<ul><li> tell you when updates are available.</li></ul>"
|
Chris@95
|
64 "<p>No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.</p>"
|
Chris@95
|
65 "<p>We recommend that you allow this. But if you do not wish to do so, please un-check the box below.<br></p>"));
|
Chris@95
|
66 layout->addWidget(label, 0, 0);
|
Chris@95
|
67
|
Chris@95
|
68 QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this"));
|
Chris@95
|
69 cb->setChecked(true);
|
Chris@95
|
70 layout->addWidget(cb, 1, 0);
|
Chris@95
|
71
|
Chris@95
|
72 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
|
Chris@95
|
73 QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
|
Chris@95
|
74 layout->addWidget(bb, 2, 0);
|
Chris@95
|
75
|
Chris@95
|
76 d.exec();
|
Chris@95
|
77
|
Chris@95
|
78 bool permish = cb->isChecked();
|
Chris@95
|
79 settings.setValue(tag, permish);
|
Chris@95
|
80 }
|
Chris@95
|
81
|
Chris@95
|
82 settings.endGroup();
|
Chris@95
|
83
|
Chris@95
|
84 return permish;
|
Chris@95
|
85 }
|
Chris@95
|
86
|
Chris@95
|
87
|
Chris@95
|
88
|