[welcome] [welcomeq] Move requirements to Config
The Config object can hold all of the configuration information, including also the requirements-checking parts. Move requirements- checking configuration there, so it is shared and consistent across welcome and welcomeq, regardless. This repairs the test that expects the Config object to handle **all** of the configuration, too.
This commit is contained in:
parent
67d2b5568d
commit
ad76a2cbe8
@ -8,26 +8,22 @@ find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network )
|
|||||||
find_package( LIBPARTED )
|
find_package( LIBPARTED )
|
||||||
if ( LIBPARTED_FOUND )
|
if ( LIBPARTED_FOUND )
|
||||||
set( PARTMAN_SRC checker/partman_devices.c )
|
set( PARTMAN_SRC checker/partman_devices.c )
|
||||||
set( CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY} )
|
set( PARTMAN_LIB ${LIBPARTED_LIBRARY} )
|
||||||
else()
|
else()
|
||||||
set( PARTMAN_SRC )
|
set( PARTMAN_SRC )
|
||||||
set( CHECKER_LINK_LIBRARIES )
|
set( PARTMAN_LIB )
|
||||||
add_definitions( -DWITHOUT_LIBPARTED )
|
add_definitions( -DWITHOUT_LIBPARTED )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set( CHECKER_SOURCES
|
|
||||||
checker/CheckerContainer.cpp
|
|
||||||
checker/GeneralRequirements.cpp
|
|
||||||
checker/ResultWidget.cpp
|
|
||||||
checker/ResultsListWidget.cpp
|
|
||||||
${PARTMAN_SRC}
|
|
||||||
)
|
|
||||||
|
|
||||||
calamares_add_plugin( welcome
|
calamares_add_plugin( welcome
|
||||||
TYPE viewmodule
|
TYPE viewmodule
|
||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
${CHECKER_SOURCES}
|
checker/CheckerContainer.cpp
|
||||||
|
checker/GeneralRequirements.cpp
|
||||||
|
checker/ResultWidget.cpp
|
||||||
|
checker/ResultsListWidget.cpp
|
||||||
|
${PARTMAN_SRC}
|
||||||
WelcomeViewStep.cpp
|
WelcomeViewStep.cpp
|
||||||
Config.cpp
|
Config.cpp
|
||||||
Config.h
|
Config.h
|
||||||
@ -37,7 +33,7 @@ calamares_add_plugin( welcome
|
|||||||
RESOURCES
|
RESOURCES
|
||||||
welcome.qrc
|
welcome.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${CHECKER_LINK_LIBRARIES}
|
${PARTMAN_LIB}
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
Qt5::Network
|
Qt5::Network
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
@ -46,9 +42,14 @@ calamares_add_plugin( welcome
|
|||||||
calamares_add_test(
|
calamares_add_test(
|
||||||
welcometest
|
welcometest
|
||||||
SOURCES
|
SOURCES
|
||||||
|
checker/GeneralRequirements.cpp
|
||||||
|
${PARTMAN_SRC}
|
||||||
Config.cpp
|
Config.cpp
|
||||||
Tests.cpp
|
Tests.cpp
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
|
${PARTMAN_LIB}
|
||||||
|
Qt5::DBus
|
||||||
|
Qt5::Network
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
Calamares::calamaresui
|
Calamares::calamaresui
|
||||||
)
|
)
|
||||||
|
@ -27,6 +27,7 @@ Config::Config( QObject* parent )
|
|||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
||||||
, m_filtermodel( std::make_unique< QSortFilterProxyModel >() )
|
, m_filtermodel( std::make_unique< QSortFilterProxyModel >() )
|
||||||
|
, m_requirementsChecker( std::make_unique< GeneralRequirements >( this ) )
|
||||||
{
|
{
|
||||||
initLanguages();
|
initLanguages();
|
||||||
|
|
||||||
@ -399,4 +400,15 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
|
|
||||||
::setLanguageIcon( this, configurationMap );
|
::setLanguageIcon( this, configurationMap );
|
||||||
::setGeoIP( this, configurationMap );
|
::setGeoIP( this, configurationMap );
|
||||||
|
|
||||||
|
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.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#ifndef WELCOME_CONFIG_H
|
#ifndef WELCOME_CONFIG_H
|
||||||
#define WELCOME_CONFIG_H
|
#define WELCOME_CONFIG_H
|
||||||
|
|
||||||
|
#include "checker/GeneralRequirements.h"
|
||||||
|
|
||||||
#include "locale/LabelModel.h"
|
#include "locale/LabelModel.h"
|
||||||
#include "modulesystem/RequirementsModel.h"
|
#include "modulesystem/RequirementsModel.h"
|
||||||
|
|
||||||
@ -100,6 +102,9 @@ public slots:
|
|||||||
|
|
||||||
QAbstractItemModel* unsatisfiedRequirements() const;
|
QAbstractItemModel* unsatisfiedRequirements() const;
|
||||||
|
|
||||||
|
/// @brief Check the general requirements
|
||||||
|
Calamares::RequirementsList checkRequirements() const { return m_requirementsChecker->checkRequirements(); }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countryCodeChanged( QString countryCode );
|
void countryCodeChanged( QString countryCode );
|
||||||
void localeIndexChanged( int localeIndex );
|
void localeIndexChanged( int localeIndex );
|
||||||
@ -118,6 +123,7 @@ private:
|
|||||||
|
|
||||||
CalamaresUtils::Locale::LabelModel* m_languages = nullptr;
|
CalamaresUtils::Locale::LabelModel* m_languages = nullptr;
|
||||||
std::unique_ptr< QSortFilterProxyModel > m_filtermodel;
|
std::unique_ptr< QSortFilterProxyModel > m_filtermodel;
|
||||||
|
std::unique_ptr< GeneralRequirements > m_requirementsChecker;
|
||||||
|
|
||||||
QString m_languageIcon;
|
QString m_languageIcon;
|
||||||
QString m_countryCode;
|
QString m_countryCode;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "WelcomePage.h"
|
#include "WelcomePage.h"
|
||||||
#include "checker/GeneralRequirements.h"
|
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "modulesystem/ModuleManager.h"
|
#include "modulesystem/ModuleManager.h"
|
||||||
@ -25,7 +24,6 @@ WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
|||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_conf( new Config( this ) )
|
, m_conf( new Config( this ) )
|
||||||
, m_widget( new WelcomePage( m_conf ) )
|
, m_widget( new WelcomePage( m_conf ) )
|
||||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
|
||||||
{
|
{
|
||||||
connect( Calamares::ModuleManager::instance(),
|
connect( Calamares::ModuleManager::instance(),
|
||||||
&Calamares::ModuleManager::requirementsComplete,
|
&Calamares::ModuleManager::requirementsComplete,
|
||||||
@ -96,17 +94,6 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
{
|
{
|
||||||
m_conf->setConfigurationMap( configurationMap );
|
m_conf->setConfigurationMap( configurationMap );
|
||||||
|
|
||||||
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.";
|
|
||||||
}
|
|
||||||
|
|
||||||
//here init the qml or qwidgets needed bits
|
//here init the qml or qwidgets needed bits
|
||||||
m_widget->init();
|
m_widget->init();
|
||||||
}
|
}
|
||||||
@ -114,5 +101,5 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
Calamares::RequirementsList
|
Calamares::RequirementsList
|
||||||
WelcomeViewStep::checkRequirements()
|
WelcomeViewStep::checkRequirements()
|
||||||
{
|
{
|
||||||
return m_requirementsChecker->checkRequirements();
|
return m_conf->checkRequirements();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
Config* m_conf;
|
Config* m_conf;
|
||||||
WelcomePage* m_widget;
|
WelcomePage* m_widget;
|
||||||
GeneralRequirements* m_requirementsChecker;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory )
|
||||||
|
@ -26,7 +26,6 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin<
|
|||||||
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
||||||
: Calamares::QmlViewStep( parent )
|
: Calamares::QmlViewStep( parent )
|
||||||
, m_config( new Config( this ) )
|
, m_config( new Config( this ) )
|
||||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
|
||||||
{
|
{
|
||||||
connect( Calamares::ModuleManager::instance(),
|
connect( Calamares::ModuleManager::instance(),
|
||||||
&Calamares::ModuleManager::requirementsComplete,
|
&Calamares::ModuleManager::requirementsComplete,
|
||||||
@ -58,7 +57,6 @@ WelcomeQmlViewStep::isBackEnabled() const
|
|||||||
bool
|
bool
|
||||||
WelcomeQmlViewStep::isAtBeginning() const
|
WelcomeQmlViewStep::isAtBeginning() const
|
||||||
{
|
{
|
||||||
// TODO: adjust to "pages" in the QML
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +64,6 @@ WelcomeQmlViewStep::isAtBeginning() const
|
|||||||
bool
|
bool
|
||||||
WelcomeQmlViewStep::isAtEnd() const
|
WelcomeQmlViewStep::isAtEnd() const
|
||||||
{
|
{
|
||||||
// TODO: adjust to "pages" in the QML
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,26 +78,13 @@ void
|
|||||||
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
m_config->setConfigurationMap( configurationMap );
|
m_config->setConfigurationMap( configurationMap );
|
||||||
|
|
||||||
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
|
Calamares::RequirementsList
|
||||||
WelcomeQmlViewStep::checkRequirements()
|
WelcomeQmlViewStep::checkRequirements()
|
||||||
{
|
{
|
||||||
return m_requirementsChecker->checkRequirements();
|
return m_config->checkRequirements();
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject*
|
QObject*
|
||||||
|
@ -29,9 +29,7 @@ class Handler;
|
|||||||
}
|
}
|
||||||
} // namespace CalamaresUtils
|
} // namespace CalamaresUtils
|
||||||
|
|
||||||
class GeneralRequirements;
|
|
||||||
|
|
||||||
// TODO: Needs a generic Calamares::QmlViewStep as base class
|
|
||||||
// TODO: refactor and move what makes sense to base class
|
// TODO: refactor and move what makes sense to base class
|
||||||
class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::QmlViewStep
|
class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::QmlViewStep
|
||||||
{
|
{
|
||||||
@ -65,7 +63,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Config* m_config;
|
Config* m_config;
|
||||||
GeneralRequirements* m_requirementsChecker;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeQmlViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeQmlViewStepFactory )
|
||||||
|
Loading…
Reference in New Issue
Block a user