[tracking] Use enum-conveniences

main
Adriaan de Groot 5 years ago
parent ab6c6a6748
commit 6d744374db

@ -19,11 +19,17 @@
#ifndef TRACKINGTYPE_H
#define TRACKINGTYPE_H
#include "utils/NamedEnum.h"
enum class TrackingType
{
InstallTracking,
MachineTracking,
UserTracking
NoTracking, // Do not enable tracking at all
InstallTracking, // Track that *this* install has happened
MachineTracking, // Track the machine, ongoing
UserTracking // Track the user, ongoing
};
// Implemented in TrackingViewStep.cpp
const NamedEnumTable< TrackingType >& trackingNames();
#endif //TRACKINGTYPE_H

@ -189,3 +189,20 @@ TrackingViewStep::setConfigurationMap( const QVariantMap& configurationMap )
m_widget->setGeneralPolicy( CalamaresUtils::getString( configurationMap, "policy" ) );
m_widget->setTrackingLevel( CalamaresUtils::getString( configurationMap, "default" ) );
}
const NamedEnumTable< TrackingType >&
trackingNames()
{
// *INDENT-OFF*
// clang-format off
static const NamedEnumTable< TrackingType > names {
{ QStringLiteral( "none" ), TrackingType::NoTracking },
{ QStringLiteral( "install" ), TrackingType::InstallTracking },
{ QStringLiteral( "machine" ), TrackingType::MachineTracking },
{ QStringLiteral( "user" ), TrackingType::UserTracking }
};
// clang-format on
// *INDENT-ON*
return names;
}

Loading…
Cancel
Save