parent
b60ec123a0
commit
03e506a826
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#include "WelcomePage.h"
|
#include "WelcomePage.h"
|
||||||
|
|
||||||
#include "ui_WelcomePage.h"
|
|
||||||
#include "checker/CheckerContainer.h"
|
#include "checker/CheckerContainer.h"
|
||||||
|
#include "ui_WelcomePage.h"
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "CalamaresVersion.h"
|
#include "CalamaresVersion.h"
|
||||||
@ -48,9 +48,18 @@ WelcomePage::WelcomePage( QWidget* parent )
|
|||||||
, m_checkingWidget( new CheckerContainer( this ) )
|
, m_checkingWidget( new CheckerContainer( this ) )
|
||||||
, m_languages( nullptr )
|
, m_languages( nullptr )
|
||||||
{
|
{
|
||||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsResult, m_checkingWidget, &CheckerContainer::requirementsChecked );
|
connect( Calamares::ModuleManager::instance(),
|
||||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsComplete, m_checkingWidget, &CheckerContainer::requirementsComplete );
|
&Calamares::ModuleManager::requirementsResult,
|
||||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsProgress, m_checkingWidget, &CheckerContainer::requirementsProgress );
|
m_checkingWidget,
|
||||||
|
&CheckerContainer::requirementsChecked );
|
||||||
|
connect( Calamares::ModuleManager::instance(),
|
||||||
|
&Calamares::ModuleManager::requirementsComplete,
|
||||||
|
m_checkingWidget,
|
||||||
|
&CheckerContainer::requirementsComplete );
|
||||||
|
connect( Calamares::ModuleManager::instance(),
|
||||||
|
&Calamares::ModuleManager::requirementsProgress,
|
||||||
|
m_checkingWidget,
|
||||||
|
&CheckerContainer::requirementsProgress );
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() * 2 );
|
ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() * 2 );
|
||||||
@ -61,38 +70,31 @@ WelcomePage::WelcomePage( QWidget* parent )
|
|||||||
ui->mainText->setOpenExternalLinks( true );
|
ui->mainText->setOpenExternalLinks( true );
|
||||||
|
|
||||||
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
|
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
|
||||||
<< *Calamares::Branding::VersionedName;
|
<< *Calamares::Branding::VersionedName;
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE( QString message;
|
||||||
QString message;
|
|
||||||
|
|
||||||
if ( Calamares::Settings::instance()->isSetupMode() )
|
if ( Calamares::Settings::instance()->isSetupMode() ) message
|
||||||
message = Calamares::Branding::instance()->welcomeStyleCalamares()
|
= Calamares::Branding::instance()->welcomeStyleCalamares()
|
||||||
? tr( "<h1>Welcome to the Calamares setup program for %1.</h1>" )
|
? tr( "<h1>Welcome to the Calamares setup program for %1.</h1>" )
|
||||||
: tr( "<h1>Welcome to %1 setup.</h1>" );
|
: tr( "<h1>Welcome to %1 setup.</h1>" );
|
||||||
else
|
else message = Calamares::Branding::instance()->welcomeStyleCalamares()
|
||||||
message = Calamares::Branding::instance()->welcomeStyleCalamares()
|
? tr( "<h1>Welcome to the Calamares installer for %1.</h1>" )
|
||||||
? tr( "<h1>Welcome to the Calamares installer for %1.</h1>" )
|
: tr( "<h1>Welcome to the %1 installer.</h1>" );
|
||||||
: tr( "<h1>Welcome to the %1 installer.</h1>" );
|
|
||||||
|
|
||||||
ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) );
|
ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) );
|
||||||
ui->retranslateUi( this );
|
ui->retranslateUi( this ); )
|
||||||
)
|
|
||||||
|
|
||||||
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information,
|
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
CalamaresUtils::Original,
|
CalamaresUtils::Information,
|
||||||
2*QSize( CalamaresUtils::defaultFontHeight(),
|
CalamaresUtils::Original,
|
||||||
CalamaresUtils::defaultFontHeight() ) ) );
|
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
connect( ui->aboutButton, &QPushButton::clicked,
|
connect( ui->aboutButton, &QPushButton::clicked, this, [this] {
|
||||||
this, [ this ]
|
QString title
|
||||||
{
|
= Calamares::Settings::instance()->isSetupMode() ? tr( "About %1 setup" ) : tr( "About %1 installer" );
|
||||||
QString title = Calamares::Settings::instance()->isSetupMode()
|
|
||||||
? tr( "About %1 setup" )
|
|
||||||
: tr( "About %1 installer" );
|
|
||||||
QMessageBox mb( QMessageBox::Information,
|
QMessageBox mb( QMessageBox::Information,
|
||||||
title.arg( CALAMARES_APPLICATION_NAME ),
|
title.arg( CALAMARES_APPLICATION_NAME ),
|
||||||
tr(
|
tr( "<h1>%1</h1><br/>"
|
||||||
"<h1>%1</h1><br/>"
|
|
||||||
"<strong>%2<br/>"
|
"<strong>%2<br/>"
|
||||||
"for %3</strong><br/><br/>"
|
"for %3</strong><br/><br/>"
|
||||||
"Copyright 2014-2017 Teo Mrnjavac <teo@kde.org><br/>"
|
"Copyright 2014-2017 Teo Mrnjavac <teo@kde.org><br/>"
|
||||||
@ -103,24 +105,23 @@ WelcomePage::WelcomePage( QWidget* parent )
|
|||||||
"<a href=\"https://calamares.io/\">Calamares</a> "
|
"<a href=\"https://calamares.io/\">Calamares</a> "
|
||||||
"development is sponsored by <br/>"
|
"development is sponsored by <br/>"
|
||||||
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
||||||
"Liberating Software."
|
"Liberating Software." )
|
||||||
)
|
.arg( CALAMARES_APPLICATION_NAME )
|
||||||
.arg( CALAMARES_APPLICATION_NAME )
|
.arg( CALAMARES_VERSION )
|
||||||
.arg( CALAMARES_VERSION )
|
.arg( *Calamares::Branding::VersionedName ),
|
||||||
.arg( *Calamares::Branding::VersionedName ),
|
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok,
|
||||||
this );
|
this );
|
||||||
mb.setIconPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::Squid,
|
mb.setIconPixmap( CalamaresUtils::defaultPixmap(
|
||||||
CalamaresUtils::Original,
|
CalamaresUtils::Squid,
|
||||||
QSize( CalamaresUtils::defaultFontHeight() * 6,
|
CalamaresUtils::Original,
|
||||||
CalamaresUtils::defaultFontHeight() * 6 ) ) );
|
QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) );
|
||||||
QGridLayout* layout = reinterpret_cast<QGridLayout *>( mb.layout() );
|
QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() );
|
||||||
if ( layout )
|
if ( layout )
|
||||||
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 );
|
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 );
|
||||||
mb.exec();
|
mb.exec();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
ui->verticalLayout->insertWidget( 3, m_checkingWidget);
|
ui->verticalLayout->insertWidget( 3, m_checkingWidget );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,15 +140,16 @@ WelcomePage::initLanguages()
|
|||||||
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
||||||
|
|
||||||
cDebug() << "Matching locale" << defaultLocale;
|
cDebug() << "Matching locale" << defaultLocale;
|
||||||
int matchedLocaleIndex = m_languages->find(
|
int matchedLocaleIndex = m_languages->find( [&]( const QLocale& x ) {
|
||||||
[&](const QLocale& x){ return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); } );
|
return x.language() == defaultLocale.language() && x.country() == defaultLocale.country();
|
||||||
|
} );
|
||||||
|
|
||||||
if ( matchedLocaleIndex < 0 )
|
if ( matchedLocaleIndex < 0 )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
|
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
|
||||||
|
|
||||||
matchedLocaleIndex = m_languages->find(
|
matchedLocaleIndex
|
||||||
[&](const QLocale& x){ return x.language() == defaultLocale.language(); } );
|
= m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( matchedLocaleIndex < 0 )
|
if ( matchedLocaleIndex < 0 )
|
||||||
@ -159,7 +161,9 @@ WelcomePage::initLanguages()
|
|||||||
|
|
||||||
// Now, if it matched, because we didn't match the system locale, switch to the one found
|
// Now, if it matched, because we didn't match the system locale, switch to the one found
|
||||||
if ( matchedLocaleIndex >= 0 )
|
if ( matchedLocaleIndex >= 0 )
|
||||||
|
{
|
||||||
QLocale::setDefault( m_languages->locale( matchedLocaleIndex ).locale() );
|
QLocale::setDefault( m_languages->locale( matchedLocaleIndex ).locale() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( matchedLocaleIndex >= 0 )
|
if ( matchedLocaleIndex >= 0 )
|
||||||
@ -171,44 +175,36 @@ WelcomePage::initLanguages()
|
|||||||
ui->languageWidget->setCurrentIndex( matchedLocaleIndex );
|
ui->languageWidget->setCurrentIndex( matchedLocaleIndex );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cWarning() << "No available translation matched" << defaultLocale;
|
cWarning() << "No available translation matched" << defaultLocale;
|
||||||
|
}
|
||||||
|
|
||||||
connect( ui->languageWidget,
|
connect( ui->languageWidget,
|
||||||
static_cast< void ( QComboBox::* )( int ) >( &QComboBox::currentIndexChanged ),
|
static_cast< void ( QComboBox::* )( int ) >( &QComboBox::currentIndexChanged ),
|
||||||
this,
|
this,
|
||||||
[&]( int newIndex )
|
[&]( int newIndex ) {
|
||||||
{
|
|
||||||
const auto& selectedLocale = m_languages->locale( newIndex ).locale();
|
const auto& selectedLocale = m_languages->locale( newIndex ).locale();
|
||||||
cDebug() << "Selected locale" << selectedLocale;
|
cDebug() << "Selected locale" << selectedLocale;
|
||||||
|
|
||||||
QLocale::setDefault( selectedLocale );
|
QLocale::setDefault( selectedLocale );
|
||||||
CalamaresUtils::installTranslator( selectedLocale,
|
CalamaresUtils::installTranslator(
|
||||||
Calamares::Branding::instance()->translationsDirectory(),
|
selectedLocale, Calamares::Branding::instance()->translationsDirectory(), qApp );
|
||||||
qApp );
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WelcomePage::setUpLinks( bool showSupportUrl,
|
WelcomePage::setUpLinks( bool showSupportUrl, bool showKnownIssuesUrl, bool showReleaseNotesUrl )
|
||||||
bool showKnownIssuesUrl,
|
|
||||||
bool showReleaseNotesUrl )
|
|
||||||
{
|
{
|
||||||
using namespace Calamares;
|
using namespace Calamares;
|
||||||
if ( showSupportUrl && !( *Branding::SupportUrl ).isEmpty() )
|
if ( showSupportUrl && !( *Branding::SupportUrl ).isEmpty() )
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE( ui->supportButton->setText( tr( "%1 support" ).arg( *Branding::ShortProductName ) ); )
|
||||||
ui->supportButton->setText( tr( "%1 support" )
|
ui->supportButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
.arg( *Branding::ShortProductName ) );
|
CalamaresUtils::Help,
|
||||||
)
|
CalamaresUtils::Original,
|
||||||
ui->supportButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Help,
|
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
CalamaresUtils::Original,
|
connect( ui->supportButton, &QPushButton::clicked, [] { QDesktopServices::openUrl( *Branding::SupportUrl ); } );
|
||||||
2*QSize( CalamaresUtils::defaultFontHeight(),
|
|
||||||
CalamaresUtils::defaultFontHeight() ) ) );
|
|
||||||
connect( ui->supportButton, &QPushButton::clicked, []
|
|
||||||
{
|
|
||||||
QDesktopServices::openUrl( *Branding::SupportUrl );
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -217,12 +213,11 @@ WelcomePage::setUpLinks( bool showSupportUrl,
|
|||||||
|
|
||||||
if ( showKnownIssuesUrl && !( *Branding::KnownIssuesUrl ).isEmpty() )
|
if ( showKnownIssuesUrl && !( *Branding::KnownIssuesUrl ).isEmpty() )
|
||||||
{
|
{
|
||||||
ui->knownIssuesButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Bugs,
|
ui->knownIssuesButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
CalamaresUtils::Original,
|
CalamaresUtils::Bugs,
|
||||||
2*QSize( CalamaresUtils::defaultFontHeight(),
|
CalamaresUtils::Original,
|
||||||
CalamaresUtils::defaultFontHeight() ) ) );
|
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
connect( ui->knownIssuesButton, &QPushButton::clicked, []
|
connect( ui->knownIssuesButton, &QPushButton::clicked, [] {
|
||||||
{
|
|
||||||
QDesktopServices::openUrl( *Branding::KnownIssuesUrl );
|
QDesktopServices::openUrl( *Branding::KnownIssuesUrl );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -233,12 +228,11 @@ WelcomePage::setUpLinks( bool showSupportUrl,
|
|||||||
|
|
||||||
if ( showReleaseNotesUrl && !( *Branding::ReleaseNotesUrl ).isEmpty() )
|
if ( showReleaseNotesUrl && !( *Branding::ReleaseNotesUrl ).isEmpty() )
|
||||||
{
|
{
|
||||||
ui->releaseNotesButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Release,
|
ui->releaseNotesButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
CalamaresUtils::Original,
|
CalamaresUtils::Release,
|
||||||
2*QSize( CalamaresUtils::defaultFontHeight(),
|
CalamaresUtils::Original,
|
||||||
CalamaresUtils::defaultFontHeight() ) ) );
|
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
connect( ui->releaseNotesButton, &QPushButton::clicked, []
|
connect( ui->releaseNotesButton, &QPushButton::clicked, [] {
|
||||||
{
|
|
||||||
QDesktopServices::openUrl( *Branding::ReleaseNotesUrl );
|
QDesktopServices::openUrl( *Branding::ReleaseNotesUrl );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -249,11 +243,38 @@ WelcomePage::setUpLinks( bool showSupportUrl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WelcomePage::setupDonateButton( const QString& url )
|
||||||
|
{
|
||||||
|
if ( url.isEmpty() )
|
||||||
|
{
|
||||||
|
ui->donateButton->hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl u( url );
|
||||||
|
if ( u.isValid() )
|
||||||
|
{
|
||||||
|
ui->donateButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
|
CalamaresUtils::Donate,
|
||||||
|
CalamaresUtils::Original,
|
||||||
|
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
|
connect( ui->donateButton, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "Donate URL" << url << "is invalid.";
|
||||||
|
ui->donateButton->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WelcomePage::focusInEvent( QFocusEvent* e )
|
WelcomePage::focusInEvent( QFocusEvent* e )
|
||||||
{
|
{
|
||||||
if ( ui->languageWidget )
|
if ( ui->languageWidget )
|
||||||
|
{
|
||||||
ui->languageWidget->setFocus();
|
ui->languageWidget->setFocus();
|
||||||
|
}
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +288,9 @@ void
|
|||||||
WelcomePage::externallySelectedLanguage( int row )
|
WelcomePage::externallySelectedLanguage( int row )
|
||||||
{
|
{
|
||||||
if ( ( row >= 0 ) && ( row < ui->languageWidget->count() ) )
|
if ( ( row >= 0 ) && ( row < ui->languageWidget->count() ) )
|
||||||
|
{
|
||||||
ui->languageWidget->setCurrentIndex( row );
|
ui->languageWidget->setCurrentIndex( row );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -278,8 +301,14 @@ WelcomePage::setLanguageIcon( QPixmap i )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocaleTwoColumnDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
LocaleTwoColumnDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
QStyledItemDelegate::paint( painter, option, index );
|
QStyledItemDelegate::paint( painter, option, index );
|
||||||
option.widget->style()->drawItemText( painter, option.rect, Qt::AlignRight | Qt::AlignVCenter, option.palette, false, index.data( CalamaresUtils::Locale::LabelModel::EnglishLabelRole ).toString() );
|
option.widget->style()->drawItemText(
|
||||||
|
painter,
|
||||||
|
option.rect,
|
||||||
|
Qt::AlignRight | Qt::AlignVCenter,
|
||||||
|
option.palette,
|
||||||
|
false,
|
||||||
|
index.data( CalamaresUtils::Locale::LabelModel::EnglishLabelRole ).toString() );
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,10 @@ public:
|
|||||||
explicit WelcomePage( QWidget* parent = nullptr );
|
explicit WelcomePage( QWidget* parent = nullptr );
|
||||||
|
|
||||||
/// @brief Configure the buttons for URLs from the branding configuration
|
/// @brief Configure the buttons for URLs from the branding configuration
|
||||||
void setUpLinks( bool showSupportUrl,
|
void setUpLinks( bool showSupportUrl, bool showKnownIssuesUrl, bool showReleaseNotesUrl );
|
||||||
bool showKnownIssuesUrl,
|
/// @brief Configure the "Donate" button
|
||||||
bool showReleaseNotesUrl );
|
void setupDonateButton( const QString& );
|
||||||
|
|
||||||
/// @brief Set international language-selector icon
|
/// @brief Set international language-selector icon
|
||||||
void setLanguageIcon( QPixmap );
|
void setLanguageIcon( QPixmap );
|
||||||
|
|
||||||
@ -50,8 +51,9 @@ public:
|
|||||||
|
|
||||||
/// @brief Change the language from an external source.
|
/// @brief Change the language from an external source.
|
||||||
void externallySelectedLanguage( int row );
|
void externallySelectedLanguage( int row );
|
||||||
|
|
||||||
protected:
|
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:
|
||||||
/// @brief Fill the list of languages with the available translations
|
/// @brief Fill the list of languages with the available translations
|
||||||
@ -59,7 +61,7 @@ private:
|
|||||||
|
|
||||||
Ui::WelcomePage* ui;
|
Ui::WelcomePage* ui;
|
||||||
CheckerContainer* m_checkingWidget;
|
CheckerContainer* m_checkingWidget;
|
||||||
CalamaresUtils::Locale::LabelModel *m_languages;
|
CalamaresUtils::Locale::LabelModel* m_languages;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Delegate to display language information in two columns.
|
/** @brief Delegate to display language information in two columns.
|
||||||
@ -72,6 +74,6 @@ public:
|
|||||||
using QStyledItemDelegate::QStyledItemDelegate;
|
using QStyledItemDelegate::QStyledItemDelegate;
|
||||||
|
|
||||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
|
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
|
||||||
} ;
|
};
|
||||||
|
|
||||||
#endif // WELCOMEPAGE_H
|
#endif // WELCOMEPAGE_H
|
||||||
|
@ -134,6 +134,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="donateButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Donate</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="supportButton">
|
<widget class="QPushButton" name="supportButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -33,13 +33,16 @@
|
|||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin<WelcomeViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin< WelcomeViewStep >(); )
|
||||||
|
|
||||||
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
, m_requirementsChecker( new GeneralRequirements( this ) )
|
||||||
{
|
{
|
||||||
connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsComplete, this, &WelcomeViewStep::nextStatusChanged );
|
connect( Calamares::ModuleManager::instance(),
|
||||||
|
&Calamares::ModuleManager::requirementsComplete,
|
||||||
|
this,
|
||||||
|
&WelcomeViewStep::nextStatusChanged );
|
||||||
m_widget = new WelcomePage();
|
m_widget = new WelcomePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +50,9 @@ WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
|||||||
WelcomeViewStep::~WelcomeViewStep()
|
WelcomeViewStep::~WelcomeViewStep()
|
||||||
{
|
{
|
||||||
if ( m_widget && m_widget->parent() == nullptr )
|
if ( m_widget && m_widget->parent() == nullptr )
|
||||||
|
{
|
||||||
m_widget->deleteLater();
|
m_widget->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,16 +112,17 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
bool showKnownIssuesUrl = CalamaresUtils::getBool( configurationMap, "showKnownIssuesUrl", false );
|
bool showKnownIssuesUrl = CalamaresUtils::getBool( configurationMap, "showKnownIssuesUrl", false );
|
||||||
bool showReleaseNotesUrl = CalamaresUtils::getBool( configurationMap, "showReleaseNotesUrl", false );
|
bool showReleaseNotesUrl = CalamaresUtils::getBool( configurationMap, "showReleaseNotesUrl", false );
|
||||||
|
|
||||||
m_widget->setUpLinks( showSupportUrl,
|
m_widget->setUpLinks( showSupportUrl, showKnownIssuesUrl, showReleaseNotesUrl );
|
||||||
showKnownIssuesUrl,
|
m_widget->setupDonateButton( CalamaresUtils::getString( configurationMap, "donateUrl" ) );
|
||||||
showReleaseNotesUrl );
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "requirements" ) &&
|
if ( configurationMap.contains( "requirements" )
|
||||||
configurationMap.value( "requirements" ).type() == QVariant::Map )
|
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
||||||
|
{
|
||||||
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cWarning() << "no valid requirements map found in welcome "
|
cWarning() << "no valid requirements map found in welcome "
|
||||||
"module configuration.";
|
"module configuration.";
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QVariantMap geoip = CalamaresUtils::getSubMap( configurationMap, "geoip", ok );
|
QVariantMap geoip = CalamaresUtils::getSubMap( configurationMap, "geoip", ok );
|
||||||
@ -124,15 +130,13 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
{
|
{
|
||||||
using FWString = QFutureWatcher< QString >;
|
using FWString = QFutureWatcher< QString >;
|
||||||
|
|
||||||
auto* handler = new CalamaresUtils::GeoIP::Handler(
|
auto* handler = new CalamaresUtils::GeoIP::Handler( CalamaresUtils::getString( geoip, "style" ),
|
||||||
CalamaresUtils::getString( geoip, "style" ),
|
CalamaresUtils::getString( geoip, "url" ),
|
||||||
CalamaresUtils::getString( geoip, "url" ),
|
CalamaresUtils::getString( geoip, "selector" ) );
|
||||||
CalamaresUtils::getString( geoip, "selector" ) );
|
|
||||||
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
|
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
|
||||||
{
|
{
|
||||||
auto* future = new FWString();
|
auto* future = new FWString();
|
||||||
connect( future, &FWString::finished, [view=this, f=future, h=handler]()
|
connect( future, &FWString::finished, [view = this, f = future, h = handler]() {
|
||||||
{
|
|
||||||
QString countryResult = f->future().result();
|
QString countryResult = f->future().result();
|
||||||
cDebug() << "GeoIP result for welcome=" << countryResult;
|
cDebug() << "GeoIP result for welcome=" << countryResult;
|
||||||
view->setCountry( countryResult, h );
|
view->setCountry( countryResult, h );
|
||||||
@ -154,7 +158,9 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
{
|
{
|
||||||
auto icon = Calamares::Branding::instance()->image( language, QSize( 48, 48 ) );
|
auto icon = Calamares::Branding::instance()->image( language, QSize( 48, 48 ) );
|
||||||
if ( !icon.isNull() )
|
if ( !icon.isNull() )
|
||||||
|
{
|
||||||
m_widget->setLanguageIcon( icon );
|
m_widget->setLanguageIcon( icon );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +175,8 @@ logGeoIPHandler( CalamaresUtils::GeoIP::Handler* handler )
|
|||||||
{
|
{
|
||||||
if ( handler )
|
if ( handler )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " (" << static_cast<int>( handler->type() ) << handler->selector() << ')';
|
cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " ("
|
||||||
|
<< static_cast< int >( handler->type() ) << handler->selector() << ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,8 +201,12 @@ WelcomeViewStep::setCountry( const QString& countryCode, CalamaresUtils::GeoIP::
|
|||||||
{
|
{
|
||||||
int r = CalamaresUtils::Locale::availableTranslations()->find( countryCode );
|
int r = CalamaresUtils::Locale::availableTranslations()->find( countryCode );
|
||||||
if ( r < 0 )
|
if ( r < 0 )
|
||||||
|
{
|
||||||
cDebug() << "Unusable country code" << countryCode << "(no suitable translation)";
|
cDebug() << "Unusable country code" << countryCode << "(no suitable translation)";
|
||||||
|
}
|
||||||
if ( ( r >= 0 ) && m_widget )
|
if ( ( r >= 0 ) && m_widget )
|
||||||
|
{
|
||||||
m_widget->externallySelectedLanguage( r );
|
m_widget->externallySelectedLanguage( r );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,13 @@ showSupportUrl: true
|
|||||||
showKnownIssuesUrl: true
|
showKnownIssuesUrl: true
|
||||||
showReleaseNotesUrl: true
|
showReleaseNotesUrl: true
|
||||||
|
|
||||||
|
# If this Url is set to something non-empty, a "donate"
|
||||||
|
# button is added to the welcome page alongside the
|
||||||
|
# others (see settings, above). Clicking the button opens
|
||||||
|
# the corresponding link.
|
||||||
|
#
|
||||||
|
# donateUrl: https://kde.org/community/donations/
|
||||||
|
|
||||||
# Requirements checking. These are general, generic, things
|
# Requirements checking. These are general, generic, things
|
||||||
# that are checked. They may not match with the actual requirements
|
# that are checked. They may not match with the actual requirements
|
||||||
# imposed by other modules in the system.
|
# imposed by other modules in the system.
|
||||||
|
Loading…
Reference in New Issue
Block a user