[users] Prep-work for configurable actions

- tidy include style
 - add setting to UsersViewStep for hostname action
This commit is contained in:
Adriaan de Groot 2020-02-17 16:27:53 +01:00
parent 33b3321698
commit 61d096c9ec
2 changed files with 27 additions and 6 deletions

View File

@ -25,6 +25,7 @@
#include "UsersPage.h" #include "UsersPage.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
@ -32,9 +33,28 @@
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin< UsersViewStep >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin< UsersViewStep >(); )
static const NamedEnumTable< SetHostNameJob::Action >&
hostnameActions()
{
using Action = SetHostNameJob::Action;
// *INDENT-OFF*
// clang-format off
static const NamedEnumTable< Action > names {
{ QStringLiteral( "none" ), Action::None },
{ QStringLiteral( "etcfile" ), Action::EtcHostname },
{ QStringLiteral( "hostnamed" ), Action::SystemdHostname }
};
// clang-format on
// *INDENT-ON*
return names;
}
UsersViewStep::UsersViewStep( QObject* parent ) UsersViewStep::UsersViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( new UsersPage() ) , m_widget( new UsersPage() )
, m_actions( SetHostNameJob::Action::None )
{ {
emit nextStatusChanged( true ); emit nextStatusChanged( true );
connect( m_widget, &UsersPage::checkReady, this, &UsersViewStep::nextStatusChanged ); connect( m_widget, &UsersPage::checkReady, this, &UsersViewStep::nextStatusChanged );

View File

@ -20,13 +20,13 @@
#ifndef USERSPAGEPLUGIN_H #ifndef USERSPAGEPLUGIN_H
#define USERSPAGEPLUGIN_H #define USERSPAGEPLUGIN_H
#include "SetHostNameJob.h"
#include "PluginDllMacro.h"
#include "utils/PluginFactory.h"
#include "viewpages/ViewStep.h"
#include <QObject> #include <QObject>
#include <utils/PluginFactory.h>
#include <viewpages/ViewStep.h>
#include <PluginDllMacro.h>
#include <QVariant> #include <QVariant>
class UsersPage; class UsersPage;
@ -61,6 +61,7 @@ private:
QList< Calamares::job_ptr > m_jobs; QList< Calamares::job_ptr > m_jobs;
QStringList m_defaultGroups; QStringList m_defaultGroups;
SetHostNameJob::Actions m_actions;
}; };
CALAMARES_PLUGIN_FACTORY_DECLARATION( UsersViewStepFactory ) CALAMARES_PLUGIN_FACTORY_DECLARATION( UsersViewStepFactory )