To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / main / NetworkPermissionTester.cpp @ 474:f15476ef3475
History | View | Annotate | Download (2.84 KB)
| 1 |
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
|---|---|
| 2 |
|
| 3 |
/*
|
| 4 |
Sonic Lineup
|
| 5 |
Comparative visualisation and alignment of related audio recordings
|
| 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(VECT_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 |
| 45 |
("NetworkPermissionTester",
|
| 46 |
"Sonic Lineup"));
|
| 47 |
|
| 48 |
QGridLayout *layout = new QGridLayout;
|
| 49 |
d.setLayout(layout); |
| 50 |
|
| 51 |
QLabel *label = new QLabel;
|
| 52 |
label->setWordWrap(true);
|
| 53 |
label->setText |
| 54 |
(QCoreApplication::translate |
| 55 |
("NetworkPermissionTester",
|
| 56 |
"<img src=\":icons/qm-logo-smaller-white.png\" style=\"float:right; margin-left: 4em\"><h2>Welcome to Sonic Lineup!</h2>"
|
| 57 |
"<p>Sonic Lineup is a program for comparative visualisation and alignment of groups of related audio recordings.</p>"
|
| 58 |
"<p>Developed in the Centre for Digital Music at Queen Mary, University of London, Sonic Lineup is open source software under the GNU General Public License.</p>"
|
| 59 |
"<p><hr></p>"
|
| 60 |
"<p><b>Before we go on...</b></p>"
|
| 61 |
"<p>Sonic Lineup would like to make occasional network requests, to check for updates.</li></ul>"
|
| 62 |
"<p>No personal information will be sent, no tracking is carried out, and no information will be shared with anyone else.</p>"
|
| 63 |
"<p>We recommend that you allow this, because it makes Sonic Lineup more useful to you. But if you do not wish to do so, please un-check the box below.<br></p>"));
|
| 64 |
layout->addWidget(label, 0, 0); |
| 65 |
|
| 66 |
QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this")); |
| 67 |
cb->setChecked(true);
|
| 68 |
layout->addWidget(cb, 1, 0); |
| 69 |
|
| 70 |
QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
|
| 71 |
QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept())); |
| 72 |
layout->addWidget(bb, 2, 0); |
| 73 |
|
| 74 |
d.exec(); |
| 75 |
|
| 76 |
permish = cb->isChecked(); |
| 77 |
settings.setValue(tag, permish); |
| 78 |
} |
| 79 |
|
| 80 |
settings.endGroup(); |
| 81 |
|
| 82 |
return permish;
|
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|