Hook up RequirementsChecker with the WelcomeViewStep.

This commit is contained in:
Teo Mrnjavac 2015-05-14 18:02:26 +02:00
parent e19264632d
commit 43992c5251
4 changed files with 76 additions and 47 deletions

View File

@ -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( "<h1>Welcome to the %1 installer.</h1><br/>"
"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(
"<h1>%1</h1><br/>"
"<strong>%2<br/>"
"for %3</strong><br/><br/>"
"Copyright 2014-2015 Teo Mrnjavac &lt;teo@kde.org&gt;<br/>"
"Thanks to: Anke Boersma, Aurélien Gâteau, Kevin Kofler, Philip Müller, "
"Pier Luigi Fiorini and Rohan Garg.<br/><br/>"
"<a href=\"http://calamares.io/\">Calamares</a> "
"development is sponsored by <br/>"
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
"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( "<h1>Welcome to the %1 installer.</h1><br/>"
"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(
"<h1>%1</h1><br/>"
"<strong>%2<br/>"
"for %3</strong><br/><br/>"
"Copyright 2014-2015 Teo Mrnjavac &lt;teo@kde.org&gt;<br/>"
"Thanks to: Anke Boersma, Aurélien Gâteau, Kevin Kofler, Philip Müller, "
"Pier Luigi Fiorini and Rohan Garg.<br/><br/>"
"<a href=\"http://calamares.io/\">Calamares</a> "
"development is sponsored by <br/>"
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
"Liberating Software."
)
.arg( CALAMARES_APPLICATION_NAME )
.arg( CALAMARES_VERSION )
.arg( Calamares::Branding::instance()->string(
Calamares::Branding::VersionedName ) ) );
} );
}

View File

@ -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

View File

@ -19,14 +19,19 @@
#include "WelcomeViewStep.h"
#include "WelcomePage.h"
#include "checker/RequirementsChecker.h"
#include <QVariant>
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() );
}

View File

@ -27,6 +27,7 @@
#include <QVariantMap>
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