diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 6a8695db0..8d542ecd1 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -21,6 +21,7 @@ #include "ui_WelcomePage.h" #include "CalamaresVersion.h" +#include "checker/RequirementsChecker.h" #include "utils/Logger.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Retranslator.h" @@ -37,11 +38,65 @@ #include "Branding.h" -WelcomePage::WelcomePage( QWidget* parent ) +WelcomePage::WelcomePage( RequirementsChecker* requirementsChecker, QWidget* parent ) : QWidget( parent ) , ui( new Ui::WelcomePage ) + , m_requirementsChecker( requirementsChecker ) { ui->setupUi( this ); + + initLanguages(); + + ui->mainText->setAlignment( Qt::AlignCenter ); + ui->mainText->setWordWrap( true ); + ui->mainText->setOpenExternalLinks( true ); + + CALAMARES_RETRANSLATE( + ui->mainText->setText( tr( "

Welcome to the %1 installer.


" + "This program will ask you some questions and " + "set up %2 on your computer." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::VersionedName ) ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ProductName ) ) ); + ui->retranslateUi( this ); + ) + + ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, + CalamaresUtils::Original, + 2*QSize( CalamaresUtils::defaultFontHeight(), + CalamaresUtils::defaultFontHeight() ) ) ); + connect( ui->aboutButton, &QPushButton::clicked, + this, [ this ] + { + QMessageBox::about( this, + tr( "About %1 installer" ) + .arg( CALAMARES_APPLICATION_NAME ), + tr( + "

%1


" + "%2
" + "for %3


" + "Copyright 2014-2015 Teo Mrnjavac <teo@kde.org>
" + "Thanks to: Anke Boersma, Aurélien Gâteau, Kevin Kofler, Philip Müller, " + "Pier Luigi Fiorini and Rohan Garg.

" + "Calamares " + "development is sponsored by
" + "Blue Systems - " + "Liberating Software." + ) + .arg( CALAMARES_APPLICATION_NAME ) + .arg( CALAMARES_VERSION ) + .arg( Calamares::Branding::instance()->string( + Calamares::Branding::VersionedName ) ) ); + } ); + + ui->verticalLayout->insertWidget( 3, m_requirementsChecker->widget() ); +} + + +void +WelcomePage::initLanguages() +{ ui->languageWidget->setInsertPolicy( QComboBox::InsertAlphabetically ); QLocale defaultLocale = QLocale( QLocale::system().name() ); @@ -118,49 +173,6 @@ WelcomePage::WelcomePage( QWidget* parent ) qApp ); } ); } - - ui->mainText->setAlignment( Qt::AlignCenter ); - ui->mainText->setWordWrap( true ); - ui->mainText->setOpenExternalLinks( true ); - - CALAMARES_RETRANSLATE( - ui->mainText->setText( tr( "

Welcome to the %1 installer.


" - "This program will ask you some questions and " - "set up %2 on your computer." ) - .arg( Calamares::Branding::instance()-> - string( Calamares::Branding::VersionedName ) ) - .arg( Calamares::Branding::instance()-> - string( Calamares::Branding::ProductName ) ) ); - ui->retranslateUi( this ); - ) - - ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, - CalamaresUtils::Original, - 2*QSize( CalamaresUtils::defaultFontHeight(), - CalamaresUtils::defaultFontHeight() ) ) ); - connect( ui->aboutButton, &QPushButton::clicked, - this, [ this ] - { - QMessageBox::about( this, - tr( "About %1 installer" ) - .arg( CALAMARES_APPLICATION_NAME ), - tr( - "

%1


" - "%2
" - "for %3


" - "Copyright 2014-2015 Teo Mrnjavac <teo@kde.org>
" - "Thanks to: Anke Boersma, Aurélien Gâteau, Kevin Kofler, Philip Müller, " - "Pier Luigi Fiorini and Rohan Garg.

" - "Calamares " - "development is sponsored by
" - "Blue Systems - " - "Liberating Software." - ) - .arg( CALAMARES_APPLICATION_NAME ) - .arg( CALAMARES_VERSION ) - .arg( Calamares::Branding::instance()->string( - Calamares::Branding::VersionedName ) ) ); - } ); } diff --git a/src/modules/welcome/WelcomePage.h b/src/modules/welcome/WelcomePage.h index 1992c5cdc..79546802a 100644 --- a/src/modules/welcome/WelcomePage.h +++ b/src/modules/welcome/WelcomePage.h @@ -26,11 +26,14 @@ namespace Ui class WelcomePage; } +class RequirementsChecker; + class WelcomePage : public QWidget { Q_OBJECT public: - explicit WelcomePage( QWidget* parent = nullptr ); + explicit WelcomePage( RequirementsChecker* requirementsChecker, + QWidget* parent = nullptr ); void setUpLinks( bool showSupportUrl, bool showKnownIssuesUrl, @@ -40,7 +43,9 @@ protected: void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus private: + void initLanguages(); Ui::WelcomePage* ui; + RequirementsChecker* m_requirementsChecker; }; #endif // WELCOMEPAGE_H diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index 11c0397a8..182cf0d97 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -19,14 +19,19 @@ #include "WelcomeViewStep.h" #include "WelcomePage.h" +#include "checker/RequirementsChecker.h" + #include WelcomeViewStep::WelcomeViewStep( QObject* parent ) : Calamares::ViewStep( parent ) - , m_widget( new WelcomePage() ) + , m_requirementsChecker( new RequirementsChecker( this ) ) { emit nextStatusChanged( true ); + m_widget = new WelcomePage( m_requirementsChecker ); + connect( m_requirementsChecker, &RequirementsChecker::verdictChanged, + this, &WelcomeViewStep::nextStatusChanged ); } @@ -66,7 +71,7 @@ WelcomeViewStep::back() bool WelcomeViewStep::isNextEnabled() const { - return true; + return m_requirementsChecker->verdict(); } @@ -117,5 +122,9 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_widget->setUpLinks( showSupportUrl, showKnownIssuesUrl, showReleaseNotesUrl ); + + if ( configurationMap.contains( "requirements" ) && + configurationMap.value( "requirements" ).type() == QVariant::Map ) + m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); } diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h index 57b8ede3e..890811347 100644 --- a/src/modules/welcome/WelcomeViewStep.h +++ b/src/modules/welcome/WelcomeViewStep.h @@ -27,6 +27,7 @@ #include class WelcomePage; +class RequirementsChecker; class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep { @@ -58,6 +59,8 @@ public: private: WelcomePage* m_widget; + + RequirementsChecker* m_requirementsChecker; }; #endif // WELCOMEPAGEPLUGIN_H