Hook up RequirementsChecker with the WelcomeViewStep.
This commit is contained in:
parent
e19264632d
commit
43992c5251
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "ui_WelcomePage.h"
|
#include "ui_WelcomePage.h"
|
||||||
#include "CalamaresVersion.h"
|
#include "CalamaresVersion.h"
|
||||||
|
#include "checker/RequirementsChecker.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
@ -37,11 +38,65 @@
|
|||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
|
|
||||||
|
|
||||||
WelcomePage::WelcomePage( QWidget* parent )
|
WelcomePage::WelcomePage( RequirementsChecker* requirementsChecker, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::WelcomePage )
|
, ui( new Ui::WelcomePage )
|
||||||
|
, m_requirementsChecker( requirementsChecker )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
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 <teo@kde.org><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 );
|
ui->languageWidget->setInsertPolicy( QComboBox::InsertAlphabetically );
|
||||||
|
|
||||||
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
||||||
@ -118,49 +173,6 @@ WelcomePage::WelcomePage( QWidget* parent )
|
|||||||
qApp );
|
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 <teo@kde.org><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 ) ) );
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,11 +26,14 @@ namespace Ui
|
|||||||
class WelcomePage;
|
class WelcomePage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RequirementsChecker;
|
||||||
|
|
||||||
class WelcomePage : public QWidget
|
class WelcomePage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit WelcomePage( QWidget* parent = nullptr );
|
explicit WelcomePage( RequirementsChecker* requirementsChecker,
|
||||||
|
QWidget* parent = nullptr );
|
||||||
|
|
||||||
void setUpLinks( bool showSupportUrl,
|
void setUpLinks( bool showSupportUrl,
|
||||||
bool showKnownIssuesUrl,
|
bool showKnownIssuesUrl,
|
||||||
@ -40,7 +43,9 @@ protected:
|
|||||||
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initLanguages();
|
||||||
Ui::WelcomePage* ui;
|
Ui::WelcomePage* ui;
|
||||||
|
RequirementsChecker* m_requirementsChecker;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WELCOMEPAGE_H
|
#endif // WELCOMEPAGE_H
|
||||||
|
@ -19,14 +19,19 @@
|
|||||||
#include "WelcomeViewStep.h"
|
#include "WelcomeViewStep.h"
|
||||||
|
|
||||||
#include "WelcomePage.h"
|
#include "WelcomePage.h"
|
||||||
|
#include "checker/RequirementsChecker.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_widget( new WelcomePage() )
|
, m_requirementsChecker( new RequirementsChecker( this ) )
|
||||||
{
|
{
|
||||||
emit nextStatusChanged( true );
|
emit nextStatusChanged( true );
|
||||||
|
m_widget = new WelcomePage( m_requirementsChecker );
|
||||||
|
connect( m_requirementsChecker, &RequirementsChecker::verdictChanged,
|
||||||
|
this, &WelcomeViewStep::nextStatusChanged );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +71,7 @@ WelcomeViewStep::back()
|
|||||||
bool
|
bool
|
||||||
WelcomeViewStep::isNextEnabled() const
|
WelcomeViewStep::isNextEnabled() const
|
||||||
{
|
{
|
||||||
return true;
|
return m_requirementsChecker->verdict();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,5 +122,9 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
m_widget->setUpLinks( showSupportUrl,
|
m_widget->setUpLinks( showSupportUrl,
|
||||||
showKnownIssuesUrl,
|
showKnownIssuesUrl,
|
||||||
showReleaseNotesUrl );
|
showReleaseNotesUrl );
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "requirements" ) &&
|
||||||
|
configurationMap.value( "requirements" ).type() == QVariant::Map )
|
||||||
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
class WelcomePage;
|
class WelcomePage;
|
||||||
|
class RequirementsChecker;
|
||||||
|
|
||||||
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
|
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
|
||||||
{
|
{
|
||||||
@ -58,6 +59,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
WelcomePage* m_widget;
|
WelcomePage* m_widget;
|
||||||
|
|
||||||
|
RequirementsChecker* m_requirementsChecker;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WELCOMEPAGEPLUGIN_H
|
#endif // WELCOMEPAGEPLUGIN_H
|
||||||
|
Loading…
Reference in New Issue
Block a user