[tracking] Polish UI a bit
- add icons for graphical display of actions - extend description of tracking options - add debug logging - enable next button - show/hide tracking options based on configuration
This commit is contained in:
parent
806799ece4
commit
20a2465cc7
@ -6,6 +6,8 @@ calamares_add_plugin( tracking
|
||||
TrackingPage.cpp
|
||||
UI
|
||||
page_trackingstep.ui
|
||||
RESOURCES
|
||||
page_trackingstep.qrc
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
calamaresui
|
||||
SHARED_LIB
|
||||
|
@ -42,3 +42,29 @@ TrackingPage::TrackingPage(QWidget *parent)
|
||||
ui->setupUi( this );
|
||||
}
|
||||
|
||||
void TrackingPage::showTrackingOption(TrackingType t, bool show)
|
||||
{
|
||||
QGroupBox *group = nullptr;
|
||||
|
||||
cDebug() << "Showing tracking option" << int(t) << show;
|
||||
switch ( t )
|
||||
{
|
||||
case TrackingType::InstallTracking:
|
||||
group = ui->installTrackingBox;
|
||||
break;
|
||||
case TrackingType::MachineTracking:
|
||||
group = ui->machineTrackingBox;
|
||||
break;
|
||||
case TrackingType::UserTracking:
|
||||
group = ui->UserTrackingBox;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( group != nullptr )
|
||||
if ( show )
|
||||
group->show();
|
||||
else
|
||||
group->hide();
|
||||
else
|
||||
cDebug() << " .. unknown option" << int(t);
|
||||
}
|
||||
|
@ -33,6 +33,15 @@ class TrackingPage : public QWidget
|
||||
public:
|
||||
explicit TrackingPage( QWidget* parent = nullptr );
|
||||
|
||||
enum class TrackingType
|
||||
{
|
||||
InstallTracking,
|
||||
MachineTracking,
|
||||
UserTracking
|
||||
} ;
|
||||
|
||||
void showTrackingOption( TrackingType t, bool show );
|
||||
|
||||
private:
|
||||
Ui::TrackingPage* ui;
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "JobQueue.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/CalamaresUtils.h"
|
||||
|
||||
#include "TrackingViewStep.h"
|
||||
#include "TrackingPage.h"
|
||||
@ -45,7 +46,7 @@ TrackingViewStep::~TrackingViewStep()
|
||||
QString
|
||||
TrackingViewStep::prettyName() const
|
||||
{
|
||||
return tr( "Telemetry and Tracking" );
|
||||
return tr( "Telemetry" );
|
||||
}
|
||||
|
||||
|
||||
@ -71,8 +72,7 @@ TrackingViewStep::back()
|
||||
bool
|
||||
TrackingViewStep::isNextEnabled() const
|
||||
{
|
||||
// return m_widget->isNextEnabled();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -100,10 +100,38 @@ TrackingViewStep::isAtEnd() const
|
||||
QList< Calamares::job_ptr >
|
||||
TrackingViewStep::jobs() const
|
||||
{
|
||||
cDebug() << "Tracking jobs ..";
|
||||
return QList< Calamares::job_ptr >();
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
bool getTrackingEnabled( const QVariantMap& configurationMap, const QString& key, TrackingEnabled& track )
|
||||
{
|
||||
cDebug() << "Tracking configuration" << key;
|
||||
|
||||
// Switch it off by default
|
||||
track.settingEnabled = false;
|
||||
track.userEnabled = false;
|
||||
|
||||
bool success = false;
|
||||
auto config = CalamaresUtils::getSubMap( configurationMap, key, success );
|
||||
|
||||
if ( success )
|
||||
{
|
||||
track.settingEnabled = CalamaresUtils::getBool( config, "enabled", false );
|
||||
track.userEnabled = track.settingEnabled && CalamaresUtils::getBool( config, "default", false );
|
||||
}
|
||||
cDebug() << " .. Install tracking: enabled=" <<track.settingEnabled << "default=" << track.userEnabled;
|
||||
|
||||
return track.settingEnabled;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackingViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
getTrackingEnabled( configurationMap, "install", m_installTracking );
|
||||
getTrackingEnabled( configurationMap, "machine", m_machineTracking );
|
||||
getTrackingEnabled( configurationMap, "user", m_userTracking );
|
||||
}
|
||||
|
@ -29,6 +29,12 @@
|
||||
|
||||
class TrackingPage;
|
||||
|
||||
struct TrackingEnabled
|
||||
{
|
||||
bool settingEnabled; // Enabled in config file
|
||||
bool userEnabled; // User checked "yes"
|
||||
};
|
||||
|
||||
class PLUGINDLLEXPORT TrackingViewStep : public Calamares::ViewStep
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -56,6 +62,8 @@ public:
|
||||
|
||||
private:
|
||||
TrackingPage* m_widget;
|
||||
|
||||
TrackingEnabled m_installTracking, m_machineTracking, m_userTracking;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( TrackingViewStepFactory )
|
||||
|
BIN
src/modules/tracking/binoculars.png
Normal file
BIN
src/modules/tracking/binoculars.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 430 B |
BIN
src/modules/tracking/machine.png
Normal file
BIN
src/modules/tracking/machine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 B |
8
src/modules/tracking/page_trackingstep.qrc
Normal file
8
src/modules/tracking/page_trackingstep.qrc
Normal file
@ -0,0 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="tracking">
|
||||
<file>machine.png</file>
|
||||
<file>../../../data/images/information.svgz</file>
|
||||
<file>binoculars.png</file>
|
||||
<file>phone.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -25,11 +25,57 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Explanation of install-tracking.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="installActionIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="page_trackingstep.qrc">:/tracking/phone.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="installExplanation">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Installation tracking helps %1 count how many people use it. If you enable install-tracking, at the end of the installation, information about your hardware will be sent <span style=" font-weight:600;">one time only</span> to our servers. To see what will be sent, click on the help-icon.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="page_trackingstep.qrc">
|
||||
<normaloff>:/tracking/data/images/information.svgz</normaloff>:/tracking/data/images/information.svgz</iconset>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::NoArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
@ -52,11 +98,51 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Explanation of machine-tracking.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="machineActionIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="page_trackingstep.qrc">:/tracking/machine.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="machineExplanation">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Machine tracking helps %1 count how many people use it on an ongoing basis. If you enable machine-tracking, the system will send limited information about your hardware and installed software <span style=" font-weight:600;">periodically</span> to our servers. For information about the kind of information being sent, click on the help icon.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="page_trackingstep.qrc">
|
||||
<normaloff>:/tracking/data/images/information.svgz</normaloff>:/tracking/data/images/information.svgz</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
@ -79,11 +165,51 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Explanation of user-tracking.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="userActionIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="page_trackingstep.qrc">:/tracking/binoculars.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="userExplanation">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>User tracking helps %1 understand how people use the system and the applications. If you enable user-tracking, the system will send information about your use of the installed software <span style=" font-weight:600;">regularly</span> to our servers. For information about the kind of information being sent and the policies that apply, click on the help icon.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_3">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="page_trackingstep.qrc">
|
||||
<normaloff>:/tracking/data/images/information.svgz</normaloff>:/tracking/data/images/information.svgz</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
@ -101,6 +227,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="page_trackingstep.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
BIN
src/modules/tracking/phone.png
Normal file
BIN
src/modules/tracking/phone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 459 B |
Loading…
Reference in New Issue
Block a user