[tracking] Apply current coding style
This commit is contained in:
parent
e3ecb083a0
commit
5183200515
@ -38,22 +38,26 @@ TrackingInstallJob::~TrackingInstallJob()
|
|||||||
delete m_networkManager;
|
delete m_networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingInstallJob::prettyName() const
|
QString
|
||||||
|
TrackingInstallJob::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Installation feedback" );
|
return tr( "Installation feedback" );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingInstallJob::prettyDescription() const
|
QString
|
||||||
|
TrackingInstallJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
return prettyName();
|
return prettyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingInstallJob::prettyStatusMessage() const
|
QString
|
||||||
|
TrackingInstallJob::prettyStatusMessage() const
|
||||||
{
|
{
|
||||||
return tr( "Sending installation feedback." );
|
return tr( "Sending installation feedback." );
|
||||||
}
|
}
|
||||||
|
|
||||||
Calamares::JobResult TrackingInstallJob::exec()
|
Calamares::JobResult
|
||||||
|
TrackingInstallJob::exec()
|
||||||
{
|
{
|
||||||
m_networkManager = new QNetworkAccessManager();
|
m_networkManager = new QNetworkAccessManager();
|
||||||
|
|
||||||
@ -66,16 +70,13 @@ Calamares::JobResult TrackingInstallJob::exec()
|
|||||||
request.setRawHeader( "User-Agent", "Mozilla/5.0 (compatible; Calamares)" );
|
request.setRawHeader( "User-Agent", "Mozilla/5.0 (compatible; Calamares)" );
|
||||||
|
|
||||||
QTimer timeout;
|
QTimer timeout;
|
||||||
timeout.setSingleShot(true);
|
timeout.setSingleShot( true );
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
|
|
||||||
connect( m_networkManager, &QNetworkAccessManager::finished,
|
connect( m_networkManager, &QNetworkAccessManager::finished, this, &TrackingInstallJob::dataIsHere );
|
||||||
this, &TrackingInstallJob::dataIsHere );
|
connect( m_networkManager, &QNetworkAccessManager::finished, &loop, &QEventLoop::quit );
|
||||||
connect( m_networkManager, &QNetworkAccessManager::finished,
|
connect( &timeout, &QTimer::timeout, &loop, &QEventLoop::quit );
|
||||||
&loop, &QEventLoop::quit );
|
|
||||||
connect( &timeout, &QTimer::timeout,
|
|
||||||
&loop, &QEventLoop::quit );
|
|
||||||
|
|
||||||
m_networkManager->get( request ); // The semaphore is released when data is received
|
m_networkManager->get( request ); // The semaphore is released when data is received
|
||||||
timeout.start( 5000 /* ms */ );
|
timeout.start( 5000 /* ms */ );
|
||||||
@ -93,46 +94,52 @@ Calamares::JobResult TrackingInstallJob::exec()
|
|||||||
return Calamares::JobResult::ok();
|
return Calamares::JobResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackingInstallJob::dataIsHere( QNetworkReply* reply )
|
void
|
||||||
|
TrackingInstallJob::dataIsHere( QNetworkReply* reply )
|
||||||
{
|
{
|
||||||
cDebug() << "Installation feedback request OK";
|
cDebug() << "Installation feedback request OK";
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingMachineNeonJob::prettyName() const
|
QString
|
||||||
|
TrackingMachineNeonJob::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Machine feedback" );
|
return tr( "Machine feedback" );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingMachineNeonJob::prettyDescription() const
|
QString
|
||||||
|
TrackingMachineNeonJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
return prettyName();
|
return prettyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrackingMachineNeonJob::prettyStatusMessage() const
|
QString
|
||||||
|
TrackingMachineNeonJob::prettyStatusMessage() const
|
||||||
{
|
{
|
||||||
return tr( "Configuring machine feedback." );
|
return tr( "Configuring machine feedback." );
|
||||||
}
|
}
|
||||||
|
|
||||||
Calamares::JobResult TrackingMachineNeonJob::exec()
|
Calamares::JobResult
|
||||||
|
TrackingMachineNeonJob::exec()
|
||||||
{
|
{
|
||||||
int r = CalamaresUtils::System::instance()->targetEnvCall(
|
int r = CalamaresUtils::System::instance()->targetEnvCall( "/bin/sh",
|
||||||
"/bin/sh",
|
QString(), // Working dir
|
||||||
QString(), // Working dir
|
QString(
|
||||||
QString(
|
R"x(MACHINE_ID=`cat /etc/machine-id`
|
||||||
R"x(MACHINE_ID=`cat /etc/machine-id`
|
|
||||||
sed -i "s,URI =.*,URI = http://releases.neon.kde.org/meta-release/${MACHINE_ID}," /etc/update-manager/meta-release
|
sed -i "s,URI =.*,URI = http://releases.neon.kde.org/meta-release/${MACHINE_ID}," /etc/update-manager/meta-release
|
||||||
sed -i "s,URI_LTS =.*,URI_LTS = http://releases.neon.kde.org/meta-release-lts/${MACHINE_ID}," /etc/update-manager/meta-release
|
sed -i "s,URI_LTS =.*,URI_LTS = http://releases.neon.kde.org/meta-release-lts/${MACHINE_ID}," /etc/update-manager/meta-release
|
||||||
true
|
true
|
||||||
)x"),
|
)x" ),
|
||||||
std::chrono::seconds( 1 ) );
|
std::chrono::seconds( 1 ) );
|
||||||
|
|
||||||
if ( r == 0 )
|
if ( r == 0 )
|
||||||
return Calamares::JobResult::ok();
|
return Calamares::JobResult::ok();
|
||||||
else if ( r > 0 )
|
else if ( r > 0 )
|
||||||
return Calamares::JobResult::error( tr( "Error in machine feedback configuration." ),
|
return Calamares::JobResult::error(
|
||||||
tr( "Could not configure machine feedback correctly, script error %1." ).arg( r ) );
|
tr( "Error in machine feedback configuration." ),
|
||||||
|
tr( "Could not configure machine feedback correctly, script error %1." ).arg( r ) );
|
||||||
else
|
else
|
||||||
return Calamares::JobResult::error( tr( "Error in machine feedback configuration." ),
|
return Calamares::JobResult::error(
|
||||||
tr( "Could not configure machine feedback correctly, Calamares error %1." ).arg( r ) );
|
tr( "Error in machine feedback configuration." ),
|
||||||
|
tr( "Could not configure machine feedback correctly, Calamares error %1." ).arg( r ) );
|
||||||
}
|
}
|
||||||
|
@ -21,18 +21,18 @@
|
|||||||
#include "ui_page_trackingstep.h"
|
#include "ui_page_trackingstep.h"
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "JobQueue.h"
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "utils/Logger.h"
|
#include "JobQueue.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
|
||||||
#include "utils/Retranslator.h"
|
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/Retranslator.h"
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
TrackingPage::TrackingPage(QWidget *parent)
|
TrackingPage::TrackingPage( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::TrackingPage )
|
, ui( new Ui::TrackingPage )
|
||||||
{
|
{
|
||||||
@ -40,14 +40,22 @@ TrackingPage::TrackingPage(QWidget *parent)
|
|||||||
|
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
ui->retranslateUi( this );
|
ui->retranslateUi( this ); ui->generalExplanation->setText(
|
||||||
ui->generalExplanation->setText( tr( "Install tracking helps %1 to see how many users they have, what hardware they install %1 to and (with the last two options below), get continuous information about preferred applications. To see what will be sent, please click the help icon next to each area." ).arg( *StringEntry::ShortProductName ) );
|
tr( "Install tracking helps %1 to see how many users they have, what hardware they install %1 to and (with "
|
||||||
ui->installExplanation->setText( tr( "By selecting this you will send information about your installation and hardware. This information will <b>only be sent once</b> after the installation finishes." ) );
|
"the last two options below), get continuous information about preferred applications. To see what "
|
||||||
ui->machineExplanation->setText( tr( "By selecting this you will <b>periodically</b> send information about your installation, hardware and applications, to %1." ).arg( *StringEntry::ShortProductName ) );
|
"will be sent, please click the help icon next to each area." )
|
||||||
ui->userExplanation->setText( tr( "By selecting this you will <b>regularly</b> send information about your installation, hardware, applications and usage patterns, to %1." ).arg( *StringEntry::ShortProductName ) );
|
.arg( *StringEntry::ShortProductName ) );
|
||||||
)
|
ui->installExplanation->setText(
|
||||||
|
tr( "By selecting this you will send information about your installation and hardware. This information "
|
||||||
|
"will <b>only be sent once</b> after the installation finishes." ) );
|
||||||
|
ui->machineExplanation->setText( tr( "By selecting this you will <b>periodically</b> send information about "
|
||||||
|
"your installation, hardware and applications, to %1." )
|
||||||
|
.arg( *StringEntry::ShortProductName ) );
|
||||||
|
ui->userExplanation->setText( tr( "By selecting this you will <b>regularly</b> send information about your "
|
||||||
|
"installation, hardware, applications and usage patterns, to %1." )
|
||||||
|
.arg( *StringEntry::ShortProductName ) ); )
|
||||||
|
|
||||||
QButtonGroup *group = new QButtonGroup( this );
|
QButtonGroup* group = new QButtonGroup( this );
|
||||||
group->setExclusive( true );
|
group->setExclusive( true );
|
||||||
group->addButton( ui->noneRadio );
|
group->addButton( ui->noneRadio );
|
||||||
group->addButton( ui->installRadio );
|
group->addButton( ui->installRadio );
|
||||||
@ -56,114 +64,143 @@ TrackingPage::TrackingPage(QWidget *parent)
|
|||||||
ui->noneRadio->setChecked( true );
|
ui->noneRadio->setChecked( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackingPage::enableTrackingOption(TrackingType t, bool enabled)
|
void
|
||||||
|
TrackingPage::enableTrackingOption( TrackingType t, bool enabled )
|
||||||
{
|
{
|
||||||
QWidget* group = nullptr;
|
QWidget* group = nullptr;
|
||||||
|
|
||||||
switch ( t )
|
switch ( t )
|
||||||
{
|
{
|
||||||
case TrackingType::InstallTracking:
|
case TrackingType::InstallTracking:
|
||||||
group = ui->installGroup;
|
group = ui->installGroup;
|
||||||
break;
|
break;
|
||||||
case TrackingType::MachineTracking:
|
case TrackingType::MachineTracking:
|
||||||
group = ui->machineGroup;
|
group = ui->machineGroup;
|
||||||
break;
|
break;
|
||||||
case TrackingType::UserTracking:
|
case TrackingType::UserTracking:
|
||||||
group = ui->userGroup;
|
group = ui->userGroup;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( group != nullptr )
|
if ( group != nullptr )
|
||||||
{
|
{
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
|
{
|
||||||
group->show();
|
group->show();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
group->hide();
|
group->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cWarning() << "unknown tracking option" << int(t);
|
{
|
||||||
|
cWarning() << "unknown tracking option" << int( t );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TrackingPage::getTrackingOption(TrackingType t)
|
bool
|
||||||
|
TrackingPage::getTrackingOption( TrackingType t )
|
||||||
{
|
{
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
// A tracking type is enabled if it is checked, or
|
// A tracking type is enabled if it is checked, or
|
||||||
// any higher level is checked.
|
// any higher level is checked.
|
||||||
#define ch(x) ui->x->isChecked()
|
#define ch( x ) ui->x->isChecked()
|
||||||
switch ( t )
|
switch ( t )
|
||||||
{
|
{
|
||||||
case TrackingType::InstallTracking:
|
case TrackingType::InstallTracking:
|
||||||
enabled = ch(installRadio) || ch(machineRadio) || ch(userRadio);
|
enabled = ch( installRadio ) || ch( machineRadio ) || ch( userRadio );
|
||||||
break;
|
break;
|
||||||
case TrackingType::MachineTracking:
|
case TrackingType::MachineTracking:
|
||||||
enabled = ch(machineRadio) || ch(userRadio);
|
enabled = ch( machineRadio ) || ch( userRadio );
|
||||||
break;
|
break;
|
||||||
case TrackingType::UserTracking:
|
case TrackingType::UserTracking:
|
||||||
enabled = ch(userRadio);
|
enabled = ch( userRadio );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef ch
|
#undef ch
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackingPage::setTrackingPolicy(TrackingType t, QString url)
|
void
|
||||||
|
TrackingPage::setTrackingPolicy( TrackingType t, QString url )
|
||||||
{
|
{
|
||||||
QToolButton *button = nullptr;
|
QToolButton* button = nullptr;
|
||||||
switch( t )
|
switch ( t )
|
||||||
{
|
{
|
||||||
case TrackingType::InstallTracking:
|
case TrackingType::InstallTracking:
|
||||||
button = ui->installPolicyButton;
|
button = ui->installPolicyButton;
|
||||||
break;
|
break;
|
||||||
case TrackingType::MachineTracking:
|
case TrackingType::MachineTracking:
|
||||||
button = ui->machinePolicyButton;
|
button = ui->machinePolicyButton;
|
||||||
break;
|
break;
|
||||||
case TrackingType::UserTracking:
|
case TrackingType::UserTracking:
|
||||||
button = ui->userPolicyButton;
|
button = ui->userPolicyButton;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( button != nullptr )
|
if ( button != nullptr )
|
||||||
if ( url.isEmpty() )
|
if ( url.isEmpty() )
|
||||||
|
{
|
||||||
button->hide();
|
button->hide();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connect( button, &QToolButton::clicked, [url]{ QDesktopServices::openUrl( url ); } );
|
connect( button, &QToolButton::clicked, [url] { QDesktopServices::openUrl( url ); } );
|
||||||
cDebug() << "Tracking policy" << int(t) << "set to" << url;
|
cDebug() << "Tracking policy" << int( t ) << "set to" << url;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cWarning() << "unknown tracking option" << int(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackingPage::setGeneralPolicy( QString url )
|
|
||||||
{
|
|
||||||
if ( url.isEmpty() )
|
|
||||||
ui->generalPolicyLabel->hide();
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->generalPolicyLabel->show();
|
cWarning() << "unknown tracking option" << int( t );
|
||||||
ui->generalPolicyLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
||||||
ui->generalPolicyLabel->show();
|
|
||||||
connect( ui->generalPolicyLabel, &QLabel::linkActivated, [url]{ QDesktopServices::openUrl( url ); } );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackingPage::setTrackingLevel(const QString& l)
|
void
|
||||||
|
TrackingPage::setGeneralPolicy( QString url )
|
||||||
|
{
|
||||||
|
if ( url.isEmpty() )
|
||||||
|
{
|
||||||
|
ui->generalPolicyLabel->hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->generalPolicyLabel->show();
|
||||||
|
ui->generalPolicyLabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
|
||||||
|
ui->generalPolicyLabel->show();
|
||||||
|
connect( ui->generalPolicyLabel, &QLabel::linkActivated, [url] { QDesktopServices::openUrl( url ); } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackingPage::setTrackingLevel( const QString& l )
|
||||||
{
|
{
|
||||||
QString level = l.toLower();
|
QString level = l.toLower();
|
||||||
QRadioButton* button = nullptr;
|
QRadioButton* button = nullptr;
|
||||||
|
|
||||||
if (level.isEmpty() || level == "none")
|
if ( level.isEmpty() || level == "none" )
|
||||||
|
{
|
||||||
button = ui->noneRadio;
|
button = ui->noneRadio;
|
||||||
else if (level == "install")
|
}
|
||||||
|
else if ( level == "install" )
|
||||||
|
{
|
||||||
button = ui->installRadio;
|
button = ui->installRadio;
|
||||||
else if (level == "machine")
|
}
|
||||||
|
else if ( level == "machine" )
|
||||||
|
{
|
||||||
button = ui->machineRadio;
|
button = ui->machineRadio;
|
||||||
else if (level == "user")
|
}
|
||||||
|
else if ( level == "user" )
|
||||||
|
{
|
||||||
button = ui->userRadio;
|
button = ui->userRadio;
|
||||||
|
}
|
||||||
|
|
||||||
if ( button != nullptr )
|
if ( button != nullptr )
|
||||||
|
{
|
||||||
button->setChecked( true );
|
button->setChecked( true );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cWarning() << "unknown default tracking level" << l;
|
cWarning() << "unknown default tracking level" << l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#include "TrackingType.h"
|
#include "TrackingType.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -61,4 +61,4 @@ private:
|
|||||||
Ui::TrackingPage* ui;
|
Ui::TrackingPage* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //TRACKINGPAGE_H
|
#endif //TRACKINGPAGE_H
|
||||||
|
@ -24,6 +24,6 @@ enum class TrackingType
|
|||||||
InstallTracking,
|
InstallTracking,
|
||||||
MachineTracking,
|
MachineTracking,
|
||||||
UserTracking
|
UserTracking
|
||||||
} ;
|
};
|
||||||
|
|
||||||
#endif //TRACKINGTYPE_H
|
#endif //TRACKINGTYPE_H
|
||||||
|
@ -21,20 +21,21 @@
|
|||||||
#include "TrackingJobs.h"
|
#include "TrackingJobs.h"
|
||||||
#include "TrackingPage.h"
|
#include "TrackingPage.h"
|
||||||
|
|
||||||
#include "JobQueue.h"
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
#include "utils/Variant.h"
|
#include "utils/Variant.h"
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin<TrackingViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin< TrackingViewStep >(); )
|
||||||
|
|
||||||
/** @brief Is @p s a valid machine-tracking style. */
|
/** @brief Is @p s a valid machine-tracking style. */
|
||||||
static bool isValidStyle( const QString& s )
|
static bool
|
||||||
|
isValidStyle( const QString& s )
|
||||||
{
|
{
|
||||||
static QStringList knownStyles { "neon" };
|
static QStringList knownStyles { "neon" };
|
||||||
return knownStyles.contains( s );
|
return knownStyles.contains( s );
|
||||||
@ -51,7 +52,9 @@ TrackingViewStep::TrackingViewStep( QObject* parent )
|
|||||||
TrackingViewStep::~TrackingViewStep()
|
TrackingViewStep::~TrackingViewStep()
|
||||||
{
|
{
|
||||||
if ( m_widget && m_widget->parent() == nullptr )
|
if ( m_widget && m_widget->parent() == nullptr )
|
||||||
|
{
|
||||||
m_widget->deleteLater();
|
m_widget->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,11 +100,12 @@ TrackingViewStep::isAtEnd() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrackingViewStep::onLeave()
|
void
|
||||||
|
TrackingViewStep::onLeave()
|
||||||
{
|
{
|
||||||
m_installTracking.userEnabled = m_widget->getTrackingOption( TrackingType::InstallTracking );
|
m_installTracking.userEnabled = m_widget->getTrackingOption( TrackingType::InstallTracking );
|
||||||
m_machineTracking.userEnabled = m_widget->getTrackingOption( TrackingType::MachineTracking );
|
m_machineTracking.userEnabled = m_widget->getTrackingOption( TrackingType::MachineTracking );
|
||||||
m_userTracking.userEnabled = m_widget->getTrackingOption( TrackingType::UserTracking );
|
m_userTracking.userEnabled = m_widget->getTrackingOption( TrackingType::UserTracking );
|
||||||
cDebug() << "Install tracking:" << m_installTracking.enabled();
|
cDebug() << "Install tracking:" << m_installTracking.enabled();
|
||||||
cDebug() << "Machine tracking:" << m_machineTracking.enabled();
|
cDebug() << "Machine tracking:" << m_machineTracking.enabled();
|
||||||
cDebug() << " User tracking:" << m_userTracking.enabled();
|
cDebug() << " User tracking:" << m_userTracking.enabled();
|
||||||
@ -123,10 +127,7 @@ TrackingViewStep::jobs() const
|
|||||||
memory.setNum( s->getTotalMemoryB().first );
|
memory.setNum( s->getTotalMemoryB().first );
|
||||||
disk.setNum( s->getTotalDiskB() );
|
disk.setNum( s->getTotalDiskB() );
|
||||||
|
|
||||||
installUrl
|
installUrl.replace( "$CPU", s->getCpuDescription() ).replace( "$MEMORY", memory ).replace( "$DISK", disk );
|
||||||
.replace( "$CPU", s->getCpuDescription() )
|
|
||||||
.replace( "$MEMORY", memory )
|
|
||||||
.replace( "$DISK", disk );
|
|
||||||
|
|
||||||
cDebug() << Logger::SubEntry << "install-tracking URL" << installUrl;
|
cDebug() << Logger::SubEntry << "install-tracking URL" << installUrl;
|
||||||
|
|
||||||
@ -137,13 +138,16 @@ TrackingViewStep::jobs() const
|
|||||||
{
|
{
|
||||||
Q_ASSERT( isValidStyle( m_machineTrackingStyle ) );
|
Q_ASSERT( isValidStyle( m_machineTrackingStyle ) );
|
||||||
if ( m_machineTrackingStyle == "neon" )
|
if ( m_machineTrackingStyle == "neon" )
|
||||||
|
{
|
||||||
l.append( Calamares::job_ptr( new TrackingMachineNeonJob() ) );
|
l.append( Calamares::job_ptr( new TrackingMachineNeonJob() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariantMap TrackingViewStep::setTrackingOption(const QVariantMap& configurationMap, const QString& key, TrackingType t)
|
QVariantMap
|
||||||
|
TrackingViewStep::setTrackingOption( const QVariantMap& configurationMap, const QString& key, TrackingType t )
|
||||||
{
|
{
|
||||||
bool settingEnabled = false;
|
bool settingEnabled = false;
|
||||||
|
|
||||||
@ -159,8 +163,8 @@ QVariantMap TrackingViewStep::setTrackingOption(const QVariantMap& configuration
|
|||||||
trackingConfiguration.settingEnabled = settingEnabled;
|
trackingConfiguration.settingEnabled = settingEnabled;
|
||||||
trackingConfiguration.userEnabled = false;
|
trackingConfiguration.userEnabled = false;
|
||||||
|
|
||||||
m_widget->enableTrackingOption(t, settingEnabled);
|
m_widget->enableTrackingOption( t, settingEnabled );
|
||||||
m_widget->setTrackingPolicy(t, CalamaresUtils::getString( config, "policy" ) );
|
m_widget->setTrackingPolicy( t, CalamaresUtils::getString( config, "policy" ) );
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -176,7 +180,9 @@ TrackingViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
config = setTrackingOption( configurationMap, "machine", TrackingType::MachineTracking );
|
config = setTrackingOption( configurationMap, "machine", TrackingType::MachineTracking );
|
||||||
auto s = CalamaresUtils::getString( config, "style" );
|
auto s = CalamaresUtils::getString( config, "style" );
|
||||||
if ( isValidStyle( s ) )
|
if ( isValidStyle( s ) )
|
||||||
|
{
|
||||||
m_machineTrackingStyle = s;
|
m_machineTrackingStyle = s;
|
||||||
|
}
|
||||||
|
|
||||||
setTrackingOption( configurationMap, "user", TrackingType::UserTracking );
|
setTrackingOption( configurationMap, "user", TrackingType::UserTracking );
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
#include "TrackingType.h"
|
#include "TrackingType.h"
|
||||||
|
|
||||||
|
#include <PluginDllMacro.h>
|
||||||
#include <utils/PluginFactory.h>
|
#include <utils/PluginFactory.h>
|
||||||
#include <viewpages/ViewStep.h>
|
#include <viewpages/ViewStep.h>
|
||||||
#include <PluginDllMacro.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -65,12 +65,13 @@ private:
|
|||||||
struct TrackingEnabled
|
struct TrackingEnabled
|
||||||
{
|
{
|
||||||
bool settingEnabled; // Enabled in config file
|
bool settingEnabled; // Enabled in config file
|
||||||
bool userEnabled; // User checked "yes"
|
bool userEnabled; // User checked "yes"
|
||||||
|
|
||||||
TrackingEnabled()
|
TrackingEnabled()
|
||||||
: settingEnabled( false )
|
: settingEnabled( false )
|
||||||
, userEnabled( false )
|
, userEnabled( false )
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool enabled() const { return settingEnabled && userEnabled; }
|
bool enabled() const { return settingEnabled && userEnabled; }
|
||||||
};
|
};
|
||||||
@ -78,15 +79,21 @@ private:
|
|||||||
|
|
||||||
inline TrackingEnabled& tracking( TrackingType t )
|
inline TrackingEnabled& tracking( TrackingType t )
|
||||||
{
|
{
|
||||||
if (t == TrackingType::UserTracking)
|
if ( t == TrackingType::UserTracking )
|
||||||
|
{
|
||||||
return m_userTracking;
|
return m_userTracking;
|
||||||
else if (t == TrackingType::MachineTracking)
|
}
|
||||||
|
else if ( t == TrackingType::MachineTracking )
|
||||||
|
{
|
||||||
return m_machineTracking;
|
return m_machineTracking;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return m_installTracking;
|
return m_installTracking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( TrackingViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( TrackingViewStepFactory )
|
||||||
|
|
||||||
#endif // TRACKINGVIEWSTEP_H
|
#endif // TRACKINGVIEWSTEP_H
|
||||||
|
Loading…
Reference in New Issue
Block a user