[welcome] Remove setupLinks() method, use generic

- the generic (enum-based) setupButton() can handle all four
   of the buttons, so setupLinks() can go away. Only the
   (re)translation of the text on the button needs to be
   done, so move that to the main RETRANSLATE.
This commit is contained in:
Adriaan de Groot 2019-08-13 22:57:33 +02:00
parent 64d4b0a46c
commit 119f84d6c1

View File

@ -73,7 +73,8 @@ WelcomePage::WelcomePage( QWidget* parent )
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
<< *Calamares::Branding::VersionedName;
CALAMARES_RETRANSLATE( QString message;
CALAMARES_RETRANSLATE(
QString message;
if ( Calamares::Settings::instance()->isSetupMode() ) message
= Calamares::Branding::instance()->welcomeStyleCalamares()
@ -84,7 +85,8 @@ WelcomePage::WelcomePage( QWidget* parent )
: tr( "<h1>Welcome to the %1 installer.</h1>" );
ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) );
ui->retranslateUi( this ); )
ui->retranslateUi( this );
ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) ); )
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Information,
@ -194,56 +196,6 @@ WelcomePage::initLanguages()
}
void
WelcomePage::setUpLinks( bool showSupportUrl, bool showKnownIssuesUrl, bool showReleaseNotesUrl )
{
using namespace Calamares;
if ( showSupportUrl && !( *Branding::SupportUrl ).isEmpty() )
{
CALAMARES_RETRANSLATE( ui->supportButton->setText( tr( "%1 support" ).arg( *Branding::ShortProductName ) ); )
ui->supportButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Help,
CalamaresUtils::Original,
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
connect( ui->supportButton, &QPushButton::clicked, [] { QDesktopServices::openUrl( *Branding::SupportUrl ); } );
}
else
{
ui->supportButton->hide();
}
if ( showKnownIssuesUrl && !( *Branding::KnownIssuesUrl ).isEmpty() )
{
ui->knownIssuesButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Bugs,
CalamaresUtils::Original,
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
connect( ui->knownIssuesButton, &QPushButton::clicked, [] {
QDesktopServices::openUrl( *Branding::KnownIssuesUrl );
} );
}
else
{
ui->knownIssuesButton->hide();
}
if ( showReleaseNotesUrl && !( *Branding::ReleaseNotesUrl ).isEmpty() )
{
ui->releaseNotesButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Release,
CalamaresUtils::Original,
2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) );
connect( ui->releaseNotesButton, &QPushButton::clicked, [] {
QDesktopServices::openUrl( *Branding::ReleaseNotesUrl );
} );
}
else
{
ui->releaseNotesButton->hide();
}
}
void
WelcomePage::setupButton( Button role, const QString& url )
{
@ -284,15 +236,9 @@ WelcomePage::setupButton( Button role, const QString& url )
QUrl u( url );
if ( u.isValid() )
{
auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) );
button->setIcon( CalamaresUtils::defaultPixmap(
icon,
CalamaresUtils::Original,size
);
connect( button, &QPushButton::clicked, [u]()
{
QDesktopServices::openUrl( u );
} );
auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() );
button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) );
connect( button, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } );
}
else
{