From 1926399378cdcc469121584c2c876355ba360669 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 29 Aug 2017 08:00:37 -0400 Subject: [PATCH] Telemetry stub. This is experimental, off-by-default, code for developing a telemetry / tracking configuration module. It is preliminary work for issue #628, but also for KDE Neon configuration. Any telemetry should conform to the KDE Telemetry Policy [1] or similar Free Software telemetry policy (e.g. the Mozilla one). [1] https://community.kde.org/Policies/Telemetry_Policy Initial idea is to distinguish three kinds of tracking: - installs. This tracks that OS has been installed somewhere. It might send some machine information to a remote server. - machines. This enables some kind of machine tracking in the installed system, for instance it could enable popcon on Debian, or periodic phone-home-pings. - users. This enables some kind of telemetry / tracking on the installed user in the system. A simple and transparent setting is to enable install-tracking and set it to opt-in, and disable machine and user tracking. Explain to the user that would like to know when is installed, and that the following information , will be sent to in accordance to the telemetry policy at . Work in this branch is subject to VDG review for the visuals, and privacy oversight by whatever group is responsible for privacy. Note that this module makes it *possible* for telemetry configuration to be visible inside the installer; what distro's do with telemetry already is entirely outside the scope of this configuration module. --- src/modules/tracking/CMakeLists.txt | 13 +++ src/modules/tracking/TrackingPage.cpp | 44 +++++++++ src/modules/tracking/TrackingPage.h | 40 ++++++++ src/modules/tracking/TrackingViewStep.cpp | 109 ++++++++++++++++++++++ src/modules/tracking/TrackingViewStep.h | 63 +++++++++++++ src/modules/tracking/page_trackingstep.ui | 106 +++++++++++++++++++++ src/modules/tracking/tracking.conf | 14 +++ 7 files changed, 389 insertions(+) create mode 100644 src/modules/tracking/CMakeLists.txt create mode 100644 src/modules/tracking/TrackingPage.cpp create mode 100644 src/modules/tracking/TrackingPage.h create mode 100644 src/modules/tracking/TrackingViewStep.cpp create mode 100644 src/modules/tracking/TrackingViewStep.h create mode 100644 src/modules/tracking/page_trackingstep.ui create mode 100644 src/modules/tracking/tracking.conf diff --git a/src/modules/tracking/CMakeLists.txt b/src/modules/tracking/CMakeLists.txt new file mode 100644 index 000000000..d99d09446 --- /dev/null +++ b/src/modules/tracking/CMakeLists.txt @@ -0,0 +1,13 @@ +calamares_add_plugin( tracking + TYPE viewmodule + EXPORT_MACRO PLUGINDLLEXPORT_PRO + SOURCES + TrackingViewStep.cpp + TrackingPage.cpp + UI + page_trackingstep.ui + LINK_PRIVATE_LIBRARIES + calamaresui + SHARED_LIB +) + diff --git a/src/modules/tracking/TrackingPage.cpp b/src/modules/tracking/TrackingPage.cpp new file mode 100644 index 000000000..512b743d4 --- /dev/null +++ b/src/modules/tracking/TrackingPage.cpp @@ -0,0 +1,44 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#include "TrackingPage.h" + +#include "ui_page_trackingstep.h" + +#include "JobQueue.h" +#include "GlobalStorage.h" +#include "utils/Logger.h" +#include "utils/CalamaresUtilsGui.h" +#include "utils/Retranslator.h" +#include "ViewManager.h" + +#include +#include +#include +#include +#include +#include +#include + +TrackingPage::TrackingPage(QWidget *parent) + : QWidget( parent ) + , ui( new Ui::TrackingPage ) +{ + ui->setupUi( this ); +} + diff --git a/src/modules/tracking/TrackingPage.h b/src/modules/tracking/TrackingPage.h new file mode 100644 index 000000000..ccacb6415 --- /dev/null +++ b/src/modules/tracking/TrackingPage.h @@ -0,0 +1,40 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#ifndef TRACKINGPAGE_H +#define TRACKINGPAGE_H + +#include +#include + +namespace Ui +{ +class TrackingPage; +} + +class TrackingPage : public QWidget +{ + Q_OBJECT +public: + explicit TrackingPage( QWidget* parent = nullptr ); + +private: + Ui::TrackingPage* ui; +}; + +#endif //TRACKINGPAGE_H diff --git a/src/modules/tracking/TrackingViewStep.cpp b/src/modules/tracking/TrackingViewStep.cpp new file mode 100644 index 000000000..a78b6c5b8 --- /dev/null +++ b/src/modules/tracking/TrackingViewStep.cpp @@ -0,0 +1,109 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#include "JobQueue.h" +#include "GlobalStorage.h" +#include "utils/Logger.h" + +#include "TrackingViewStep.h" +#include "TrackingPage.h" + +#include + +CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin(); ) + +TrackingViewStep::TrackingViewStep( QObject* parent ) + : Calamares::ViewStep( parent ) + , m_widget( new TrackingPage ) +{ + emit nextStatusChanged( false ); +} + + +TrackingViewStep::~TrackingViewStep() +{ + if ( m_widget && m_widget->parent() == nullptr ) + m_widget->deleteLater(); +} + + +QString +TrackingViewStep::prettyName() const +{ + return tr( "Telemetry and Tracking" ); +} + + +QWidget* +TrackingViewStep::widget() +{ + return m_widget; +} + + +void +TrackingViewStep::next() +{ + emit done(); +} + + +void +TrackingViewStep::back() +{} + + +bool +TrackingViewStep::isNextEnabled() const +{ +// return m_widget->isNextEnabled(); + return false; +} + + +bool +TrackingViewStep::isBackEnabled() const +{ + return true; +} + + +bool +TrackingViewStep::isAtBeginning() const +{ + return true; +} + + +bool +TrackingViewStep::isAtEnd() const +{ + return true; +} + + +QList< Calamares::job_ptr > +TrackingViewStep::jobs() const +{ + return QList< Calamares::job_ptr >(); +} + +void +TrackingViewStep::setConfigurationMap( const QVariantMap& configurationMap ) +{ +} diff --git a/src/modules/tracking/TrackingViewStep.h b/src/modules/tracking/TrackingViewStep.h new file mode 100644 index 000000000..8b9f97db9 --- /dev/null +++ b/src/modules/tracking/TrackingViewStep.h @@ -0,0 +1,63 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +#ifndef TRACKINGVIEWSTEP_H +#define TRACKINGVIEWSTEP_H + +#include +#include +#include + +#include +#include +#include + +class TrackingPage; + +class PLUGINDLLEXPORT TrackingViewStep : public Calamares::ViewStep +{ + Q_OBJECT + +public: + explicit TrackingViewStep( QObject* parent = nullptr ); + virtual ~TrackingViewStep(); + + QString prettyName() const override; + + QWidget* widget() override; + + void next() override; + void back() override; + + bool isNextEnabled() const override; + bool isBackEnabled() const override; + + bool isAtBeginning() const override; + bool isAtEnd() const override; + + QList< Calamares::job_ptr > jobs() const override; + + void setConfigurationMap( const QVariantMap& configurationMap ) override; + +private: + TrackingPage* m_widget; +}; + +CALAMARES_PLUGIN_FACTORY_DECLARATION( TrackingViewStepFactory ) + +#endif // TRACKINGVIEWSTEP_H diff --git a/src/modules/tracking/page_trackingstep.ui b/src/modules/tracking/page_trackingstep.ui new file mode 100644 index 000000000..f42133624 --- /dev/null +++ b/src/modules/tracking/page_trackingstep.ui @@ -0,0 +1,106 @@ + + + TrackingPage + + + + 0 + 0 + 799 + 400 + + + + Form + + + + + + + + Install Tracking + + + + + + + + Explanation of install-tracking. + + + + + + + Enable install-tracking + + + + + + + + + + + + Machine Tracking + + + + + + + + Explanation of machine-tracking. + + + + + + + Enable machine-tracking + + + + + + + + + + + + User Tracking + + + + + + + + Explanation of user-tracking. + + + + + + + Enable user-tracking + + + + + + + + + + + + + + + diff --git a/src/modules/tracking/tracking.conf b/src/modules/tracking/tracking.conf new file mode 100644 index 000000000..ebbbc528d --- /dev/null +++ b/src/modules/tracking/tracking.conf @@ -0,0 +1,14 @@ +--- +machine: + - tracking: false + - style: neon + - path: /etc/machine-file + +user: + - tracking: false + - style: neon + +install: + - tracking: false + - style: neon +