[welcomeq] Port to newer QmlViewStep

This commit is contained in:
Adriaan de Groot 2020-02-12 14:25:30 +01:00
parent adb312bdd2
commit 7bf0fded1b
2 changed files with 5 additions and 75 deletions

View File

@ -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" ) );

View File

@ -21,11 +21,10 @@
#include "Config.h"
#include "PluginDllMacro.h"
#include "modulesystem/Requirement.h"
#include "utils/PluginFactory.h"
#include "viewpages/ViewStep.h"
#include <PluginDllMacro.h>
#include "viewpages/QmlViewStep.h"
#include <QObject>
#include <QVariantMap>
@ -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 )