[tracking] Configurations for machine and user tracking
This commit is contained in:
parent
f97a0756a9
commit
528b98c1c4
@ -46,6 +46,21 @@ TrackingStyleConfig::setTracking( TrackingStyleConfig::TrackingState state )
|
||||
emit trackingChanged();
|
||||
}
|
||||
|
||||
void
|
||||
TrackingStyleConfig::validate( QString& s, std::function< bool( const QString& ) >&& pred )
|
||||
{
|
||||
if ( !pred( s ) )
|
||||
{
|
||||
if ( m_state != DisabledByConfig )
|
||||
{
|
||||
cError() << "Configuration string" << s << "is not valid; disabling this tracking type.";
|
||||
m_state = DisabledByConfig;
|
||||
emit trackingChanged();
|
||||
}
|
||||
s = QString();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TrackingStyleConfig::validateUrl( QString& urlString )
|
||||
{
|
||||
@ -86,6 +101,50 @@ InstallTrackingConfig::setConfigurationMap( const QVariantMap& configurationMap
|
||||
validateUrl( m_installTrackingUrl );
|
||||
}
|
||||
|
||||
MachineTrackingConfig::MachineTrackingConfig( QObject* parent )
|
||||
: TrackingStyleConfig( parent )
|
||||
{
|
||||
}
|
||||
|
||||
/** @brief Is @p s a valid machine-tracking style. */
|
||||
static bool
|
||||
isValidMachineTrackingStyle( const QString& s )
|
||||
{
|
||||
static QStringList knownStyles { "neon" };
|
||||
return knownStyles.contains( s );
|
||||
}
|
||||
|
||||
void
|
||||
MachineTrackingConfig::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
TrackingStyleConfig::setConfigurationMap( configurationMap );
|
||||
|
||||
m_machineTrackingStyle = CalamaresUtils::getString( configurationMap, "style" );
|
||||
validate( m_machineTrackingStyle, isValidMachineTrackingStyle );
|
||||
}
|
||||
|
||||
|
||||
UserTrackingConfig::UserTrackingConfig( QObject* parent )
|
||||
: TrackingStyleConfig( parent )
|
||||
{
|
||||
}
|
||||
|
||||
static bool
|
||||
isValidUserTrackingStyle( const QString& s )
|
||||
{
|
||||
static QStringList knownStyles { "kde" };
|
||||
return knownStyles.contains( s );
|
||||
}
|
||||
|
||||
void
|
||||
UserTrackingConfig::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
TrackingStyleConfig::setConfigurationMap( configurationMap );
|
||||
|
||||
m_userTrackingStyle = CalamaresUtils::getString( configurationMap, "style" );
|
||||
validate( m_userTrackingStyle, isValidUserTrackingStyle );
|
||||
}
|
||||
|
||||
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
|
@ -87,12 +87,21 @@ signals:
|
||||
protected:
|
||||
/// @brief Validates the @p urlString, disables tracking if invalid
|
||||
void validateUrl( QString& urlString );
|
||||
/// @brief Validates the @p string, disables tracking if invalid
|
||||
void validate( QString& s, std::function< bool( const QString& s ) >&& pred );
|
||||
|
||||
private:
|
||||
TrackingState m_state = DisabledByConfig;
|
||||
QString m_policy; // URL
|
||||
};
|
||||
|
||||
/** @brief Install tracking pings a URL at the end of installation
|
||||
*
|
||||
* Install tracking will do a single GET on the given URL at
|
||||
* the end of installation. The information included in the GET
|
||||
* request depends on the URL configuration, see also the tracking
|
||||
* jobs.
|
||||
*/
|
||||
class InstallTrackingConfig : public TrackingStyleConfig
|
||||
{
|
||||
public:
|
||||
@ -105,6 +114,46 @@ private:
|
||||
QString m_installTrackingUrl;
|
||||
};
|
||||
|
||||
/** @brief Machine tracking reports from the installed system
|
||||
*
|
||||
* When machine tracking is on, the installed system will report
|
||||
* back ("call home") at some point. This can mean Debian pop-con,
|
||||
* or KDE neon maching tracking, or something else. The kind
|
||||
* of configuration depends on the style of tracking that is enabled.
|
||||
*/
|
||||
class MachineTrackingConfig : public TrackingStyleConfig
|
||||
{
|
||||
public:
|
||||
MachineTrackingConfig( QObject* parent );
|
||||
void setConfigurationMap( const QVariantMap& configurationMap );
|
||||
|
||||
QString machineTrackingStyle() { return m_machineTrackingStyle; }
|
||||
|
||||
private:
|
||||
QString m_machineTrackingStyle;
|
||||
};
|
||||
|
||||
/** @brief User tracking reports user actions
|
||||
*
|
||||
* When user tracking is on, it is enabled for the user configured
|
||||
* in Calamares -- not for users created afterwards in the target
|
||||
* system, unless the target system defaults to tracking them.
|
||||
* The kind of user tracking depends on the target system and
|
||||
* environment; KDE user tracking is one example, which can be
|
||||
* configured in a fine-grained way and defaults to off.
|
||||
*/
|
||||
class UserTrackingConfig : public TrackingStyleConfig
|
||||
{
|
||||
public:
|
||||
UserTrackingConfig( QObject* parent );
|
||||
void setConfigurationMap( const QVariantMap& configurationMap );
|
||||
|
||||
QString userTrackingStyle() { return m_userTrackingStyle; }
|
||||
|
||||
private:
|
||||
QString m_userTrackingStyle;
|
||||
};
|
||||
|
||||
class Config : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Loading…
Reference in New Issue
Block a user