From e930c74e851f0e20012adf000643746f674604cf Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 May 2020 14:47:31 +0200 Subject: [PATCH] [welcomeq] Coding style - Apply coding style tool - Remove commented-out cruft - Drop TODO's that don't apply anymore --- src/modules/welcomeq/WelcomeQmlViewStep.cpp | 60 +++++++++------------ src/modules/welcomeq/WelcomeQmlViewStep.h | 3 +- 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.cpp b/src/modules/welcomeq/WelcomeQmlViewStep.cpp index f520a9953..1f173563b 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.cpp +++ b/src/modules/welcomeq/WelcomeQmlViewStep.cpp @@ -22,9 +22,9 @@ #include "checker/GeneralRequirements.h" #include "locale/LabelModel.h" +#include "utils/Dirs.h" #include "utils/Logger.h" #include "utils/Variant.h" -#include "utils/Dirs.h" #include "Branding.h" #include "modulesystem/ModuleManager.h" @@ -33,62 +33,55 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin< WelcomeQmlViewStep >(); ) WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent ) -: Calamares::QmlViewStep(parent ) - , m_config( new Config( this ) ) // the qml singleton takes ownership and deletes it -// , m_nextEnabled( false ) + : Calamares::QmlViewStep( parent ) + , m_config( new Config( this ) ) , m_requirementsChecker( new GeneralRequirements( this ) ) - { -// connect( m_config, -// &Config::isNextEnabledChanged, -// this, -// &WelcomeQmlViewStep::nextStatusChanged ); -// emit nextStatusChanged(true); } QString WelcomeQmlViewStep::prettyName() const { - return tr( "Welcome" ); + return tr( "Welcome" ); } bool WelcomeQmlViewStep::isNextEnabled() const { - // TODO: should return true -// return m_config->property("isNextEnabled").toBool(); + // TODO: should return true + // return m_config->property("isNextEnabled").toBool(); return true; } bool WelcomeQmlViewStep::isBackEnabled() const { - // TODO: should return true (it's weird that you are not allowed to have welcome *after* anything - return false; + // TODO: should return true (it's weird that you are not allowed to have welcome *after* anything + return false; } bool WelcomeQmlViewStep::isAtBeginning() const { - // TODO: adjust to "pages" in the QML - return true; + // TODO: adjust to "pages" in the QML + return true; } bool WelcomeQmlViewStep::isAtEnd() const { - // TODO: adjust to "pages" in the QML - return true; + // TODO: adjust to "pages" in the QML + return true; } Calamares::JobList WelcomeQmlViewStep::jobs() const { - return Calamares::JobList(); + return Calamares::JobList(); } void @@ -96,30 +89,29 @@ WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { m_config->setConfigurationMap( configurationMap ); - // TODO: figure out how the requirements (held by ModuleManager) should be accessible - // to QML as a model. //will be model as a qvariantmap containing a alert level and the message string - if ( configurationMap.contains( "requirements" ) - && configurationMap.value( "requirements" ).type() == QVariant::Map ) - { - m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); - } - else - cWarning() << "no valid requirements map found in welcome " - "module configuration."; + if ( configurationMap.contains( "requirements" ) + && configurationMap.value( "requirements" ).type() == QVariant::Map ) + { + m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); + } + else + { + cWarning() << "no valid requirements map found in welcomeq " + "module configuration."; + } - Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last + Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last setContextProperty( "Welcome", m_config ); } Calamares::RequirementsList WelcomeQmlViewStep::checkRequirements() { - return m_requirementsChecker->checkRequirements(); + return m_requirementsChecker->checkRequirements(); } QObject* WelcomeQmlViewStep::getConfig() { - return m_config; + return m_config; } - diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.h b/src/modules/welcomeq/WelcomeQmlViewStep.h index 8e163083d..7fb31502f 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.h +++ b/src/modules/welcomeq/WelcomeQmlViewStep.h @@ -47,7 +47,6 @@ class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::QmlViewStep Q_OBJECT public: - explicit WelcomeQmlViewStep( QObject* parent = nullptr ); QString prettyName() const override; @@ -75,7 +74,7 @@ public: private: // TODO: a generic QML viewstep should return a config object from a method - Config *m_config; + Config* m_config; GeneralRequirements* m_requirementsChecker; };