From 7bf0fded1b7b917ca8e1555f7654d91f2dd89891 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Feb 2020 14:25:30 +0100 Subject: [PATCH] [welcomeq] Port to newer QmlViewStep --- src/modules/welcomeq/WelcomeQmlViewStep.cpp | 51 +-------------------- src/modules/welcomeq/WelcomeQmlViewStep.h | 29 ++---------- 2 files changed, 5 insertions(+), 75 deletions(-) diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.cpp b/src/modules/welcomeq/WelcomeQmlViewStep.cpp index 2a5b0f661..e43bddc54 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.cpp +++ b/src/modules/welcomeq/WelcomeQmlViewStep.cpp @@ -37,7 +37,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin< WelcomeQmlViewStep >(); ) WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent ) - : Calamares::ViewStep( parent ) + : Calamares::QmlViewStep( QStringLiteral( "welcomeq" ), parent ) , m_requirementsChecker( new GeneralRequirements( this ) ) { connect( Calamares::ModuleManager::instance(), @@ -51,60 +51,12 @@ WelcomeQmlViewStep::~WelcomeQmlViewStep() { } - QString WelcomeQmlViewStep::prettyName() const { return tr( "Welcome" ); } - -QWidget* -WelcomeQmlViewStep::widget() -{ - return nullptr; -} - - -bool -WelcomeQmlViewStep::isNextEnabled() const -{ - // TODO: should return true - return false; -} - - -bool -WelcomeQmlViewStep::isBackEnabled() const -{ - // 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; -} - - -bool -WelcomeQmlViewStep::isAtEnd() const -{ - // TODO: adjust to "pages" in the QML - return true; -} - - -Calamares::JobList -WelcomeQmlViewStep::jobs() const -{ - return Calamares::JobList(); -} - - /** @brief Look up a URL for a button * * Looks up @p key in @p map; if it is a *boolean* value, then @@ -140,6 +92,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map void WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { + QmlViewStep::setConfigurationMap( configurationMap ); using Calamares::Branding; m_config.setHelpUrl( jobOrBrandingSetting( Branding::SupportUrl, configurationMap, "showSupportUrl" ) ); diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.h b/src/modules/welcomeq/WelcomeQmlViewStep.h index 5486d8d31..2bfe448a3 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.h +++ b/src/modules/welcomeq/WelcomeQmlViewStep.h @@ -21,11 +21,10 @@ #include "Config.h" +#include "PluginDllMacro.h" #include "modulesystem/Requirement.h" #include "utils/PluginFactory.h" -#include "viewpages/ViewStep.h" - -#include +#include "viewpages/QmlViewStep.h" #include #include @@ -40,13 +39,7 @@ class Handler; class GeneralRequirements; -class QQmlComponent; -class QQuickItem; -class QQuickWidget; - -// TODO: Needs a generic Calamares::QmlViewStep as base class -// TODO: refactor and move what makes sense to base class -class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::ViewStep +class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::QmlViewStep { Q_OBJECT @@ -56,16 +49,6 @@ public: QString prettyName() const override; - QWidget* widget() override; - - bool isNextEnabled() const override; - bool isBackEnabled() const override; - - bool isAtBeginning() const override; - bool isAtEnd() const override; - - Calamares::JobList jobs() const override; - void setConfigurationMap( const QVariantMap& configurationMap ) override; /** @brief Sets the country that Calamares is running in. @@ -82,12 +65,6 @@ private: // TODO: a generic QML viewstep should return a config object from a method Config m_config; GeneralRequirements* m_requirementsChecker; - - // TODO: these need to be in the base class (also a base class of ExecutionViewStep) - QQuickWidget* m_qmlWidget; - QQmlComponent* m_qmlComponent; - QQuickItem* m_qmlItem; - }; CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeQmlViewStepFactory )