mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1777 Adding disclaimer dialog and setting to hide it.
This commit is contained in:
parent
3653457b28
commit
4d780b0ffd
@ -50,6 +50,7 @@ GeneralSettings::GeneralSettings() :
|
||||
m_useUDPMirror(false),
|
||||
m_useExpertMode(false),
|
||||
m_collectUsageData(true),
|
||||
m_showUsageDataDisclaimer(true),
|
||||
m_dialog(0)
|
||||
{}
|
||||
|
||||
@ -147,7 +148,7 @@ void GeneralSettings::apply()
|
||||
m_useExpertMode = m_page->cbExpertMode->isChecked();
|
||||
m_autoConnect = m_page->checkAutoConnect->isChecked();
|
||||
m_autoSelect = m_page->checkAutoSelect->isChecked();
|
||||
m_collectUsageData = m_page->cbUsageData->isChecked();
|
||||
setCollectUsageData(m_page->cbUsageData->isChecked());
|
||||
}
|
||||
|
||||
void GeneralSettings::finish()
|
||||
@ -165,6 +166,7 @@ void GeneralSettings::readSettings(QSettings *qs)
|
||||
m_useUDPMirror = qs->value(QLatin1String("UDPMirror"), m_useUDPMirror).toBool();
|
||||
m_useExpertMode = qs->value(QLatin1String("ExpertMode"), m_useExpertMode).toBool();
|
||||
m_collectUsageData = qs->value(QLatin1String("CollectUsageData"), m_collectUsageData).toBool();
|
||||
m_showUsageDataDisclaimer = qs->value(QLatin1String("ShowUsageDataDisclaimer"), m_showUsageDataDisclaimer).toBool();
|
||||
qs->endGroup();
|
||||
}
|
||||
|
||||
@ -184,6 +186,7 @@ void GeneralSettings::saveSettings(QSettings *qs)
|
||||
qs->setValue(QLatin1String("UDPMirror"), m_useUDPMirror);
|
||||
qs->setValue(QLatin1String("ExpertMode"), m_useExpertMode);
|
||||
qs->setValue(QLatin1String("CollectUsageData"), m_collectUsageData);
|
||||
qs->setValue(QLatin1String("ShowUsageDataDisclaimer"), m_showUsageDataDisclaimer);
|
||||
qs->endGroup();
|
||||
}
|
||||
|
||||
@ -259,11 +262,29 @@ bool GeneralSettings::collectUsageData() const
|
||||
return m_collectUsageData;
|
||||
}
|
||||
|
||||
bool GeneralSettings::showUsageDataDisclaimer() const
|
||||
{
|
||||
return m_showUsageDataDisclaimer;
|
||||
}
|
||||
|
||||
bool GeneralSettings::useExpertMode() const
|
||||
{
|
||||
return m_useExpertMode;
|
||||
}
|
||||
|
||||
bool GeneralSettings::setCollectUsageData(bool collect)
|
||||
{
|
||||
if (collect && collect != m_collectUsageData) {
|
||||
setShowUsageDataDisclaimer(true);
|
||||
}
|
||||
m_collectUsageData = collect;
|
||||
}
|
||||
|
||||
bool GeneralSettings::setShowUsageDataDisclaimer(bool show)
|
||||
{
|
||||
m_showUsageDataDisclaimer = show;
|
||||
}
|
||||
|
||||
void GeneralSettings::slotAutoConnect(int value)
|
||||
{
|
||||
if (value == Qt::Checked) {
|
||||
|
@ -58,10 +58,12 @@ public:
|
||||
bool autoSelect() const;
|
||||
bool useUDPMirror() const;
|
||||
bool collectUsageData() const;
|
||||
bool showUsageDataDisclaimer() const;
|
||||
void readSettings(QSettings *qs);
|
||||
void saveSettings(QSettings *qs);
|
||||
bool useExpertMode() const;
|
||||
signals:
|
||||
bool setCollectUsageData(bool collect);
|
||||
bool setShowUsageDataDisclaimer(bool show);
|
||||
|
||||
private slots:
|
||||
void resetInterfaceColor();
|
||||
@ -81,6 +83,7 @@ private:
|
||||
bool m_useUDPMirror;
|
||||
bool m_useExpertMode;
|
||||
bool m_collectUsageData;
|
||||
bool m_showUsageDataDisclaimer;
|
||||
QPointer<QWidget> m_dialog;
|
||||
QList<QTextCodec *> m_codecs;
|
||||
};
|
||||
|
@ -30,11 +30,15 @@
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkRequest>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <uavobjectutil/devicedescriptorstruct.h>
|
||||
#include <uavobjectutil/uavobjectutilmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
#include "version_info/version_info.h"
|
||||
#include "coreplugin/icore.h"
|
||||
#include "qmainwindow.h"
|
||||
|
||||
UsageTrackerPlugin::UsageTrackerPlugin() :
|
||||
m_telemetryManager(NULL)
|
||||
@ -72,6 +76,43 @@ void UsageTrackerPlugin::onAutopilotConnect()
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
|
||||
if (settings->collectUsageData()) {
|
||||
if (settings->showUsageDataDisclaimer()) {
|
||||
QMessageBox message;
|
||||
message.setWindowTitle(tr("Usage data collection"));
|
||||
message.setIcon(QMessageBox::Information);
|
||||
message.addButton(tr("Yes allow collecting information"), QMessageBox::AcceptRole);
|
||||
message.addButton(tr("No do not allow collecting information"), QMessageBox::RejectRole);
|
||||
message.setText(tr("Openpilot GCS has a function to collect limited anonymous information about "
|
||||
"the usage of the application itself and the OpenPilot hardware connected to it.\n\n"
|
||||
"The intention is to not include anything that can be considered sensitive "
|
||||
"or a threat to the users integrity. The collected information will be sent "
|
||||
"using a secure protocol to an OpenPilot web service and stored in a database "
|
||||
"for later analysis and statistical purposes.\n"
|
||||
"No information will be sold or given to any third party. The sole purpose is "
|
||||
"to collect statistics about the usage of our software and hardware to enable us "
|
||||
"to make things better for you users.\n\n"
|
||||
"The following things are collected:\n"
|
||||
"- Bootloader version\n"
|
||||
"- Firmware version, tag and git hash\n"
|
||||
"- OP Hardware type, revision and mcu serial number\n"
|
||||
"- GCS version\n"
|
||||
"- Operating system version and architecture\n"
|
||||
"- Current local time\n\n"
|
||||
"It is possible to enable or disable this functionality in the general "
|
||||
"settings part of the options for the GCS application at any time.\n\n"
|
||||
"Thank You for helping us making things better and for supporting OpenPilot!"));
|
||||
QCheckBox* disclaimerCb = new QCheckBox(tr("&Don't show this message again."));
|
||||
disclaimerCb->setChecked(true);
|
||||
message.setCheckBox(disclaimerCb);
|
||||
if (message.exec() != QMessageBox::AcceptRole) {
|
||||
settings->setCollectUsageData(false);
|
||||
settings->setShowUsageDataDisclaimer(!message.checkBox()->isChecked());
|
||||
return;
|
||||
} else {
|
||||
settings->setCollectUsageData(true);
|
||||
settings->setShowUsageDataDisclaimer(!message.checkBox()->isChecked());
|
||||
}
|
||||
}
|
||||
QTimer::singleShot(1000, this, SLOT(trackUsage()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user