Show/hide available links based on greeting.conf and Branding.
This commit is contained in:
parent
23ddfaae67
commit
262ef38c0a
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
@ -121,38 +122,15 @@ GreetingPage::GreetingPage( QWidget* parent )
|
|||||||
ui->mainText->setWordWrap( true );
|
ui->mainText->setWordWrap( true );
|
||||||
ui->mainText->setOpenExternalLinks( true );
|
ui->mainText->setOpenExternalLinks( true );
|
||||||
|
|
||||||
if ( Calamares::Branding::instance()->
|
CALAMARES_RETRANSLATE(
|
||||||
string( Calamares::Branding::ProductUrl ).isEmpty() ||
|
ui->mainText->setText( tr( "<h1>Welcome to the %1 installer.</h1><br/>"
|
||||||
Calamares::Branding::instance()->
|
"This program will ask you some questions and "
|
||||||
string( Calamares::Branding::ProductUrlText ).isEmpty() )
|
"set up %2 on your computer." )
|
||||||
{
|
.arg( Calamares::Branding::instance()->
|
||||||
CALAMARES_RETRANSLATE(
|
string( Calamares::Branding::VersionedName ) )
|
||||||
ui->mainText->setText( tr( "<h1>Welcome to the %1 installer.</h1><br/>"
|
.arg( Calamares::Branding::instance()->
|
||||||
"This program will ask you some questions and "
|
string( Calamares::Branding::ProductName ) ) );
|
||||||
"set up %2 on your computer." )
|
)
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::VersionedName ) )
|
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::ProductName ) ) );
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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.<br/>"
|
|
||||||
"<a href=\"%3\"> %4 </a>" )
|
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::VersionedName ) )
|
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::ProductName ) )
|
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::ProductUrl ) )
|
|
||||||
.arg( Calamares::Branding::instance()->
|
|
||||||
string( Calamares::Branding::ProductUrlText ) ) );
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information,
|
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information,
|
||||||
CalamaresUtils::Original,
|
CalamaresUtils::Original,
|
||||||
@ -184,6 +162,55 @@ GreetingPage::GreetingPage( QWidget* parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
GreetingPage::setUpLinks( bool showSupportUrl,
|
||||||
|
bool showKnownIssuesUrl,
|
||||||
|
bool showReleaseNotesUrl )
|
||||||
|
{
|
||||||
|
using namespace Calamares;
|
||||||
|
Branding* b = Branding::instance();
|
||||||
|
if ( showSupportUrl && !b->string( Branding::SupportUrl ).isEmpty() )
|
||||||
|
{
|
||||||
|
CALAMARES_RETRANSLATE(
|
||||||
|
ui->supportButton->setText( tr( "%1 support" )
|
||||||
|
.arg( b->string( Branding::ShortProductName ) ) );
|
||||||
|
)
|
||||||
|
connect( ui->supportButton, &QPushButton::clicked, []
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl( Branding::instance()->string( Branding::SupportUrl ) );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->supportButton->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( showKnownIssuesUrl && !b->string( Branding::KnownIssuesUrl ).isEmpty() )
|
||||||
|
{
|
||||||
|
connect( ui->knownIssuesButton, &QPushButton::clicked, []
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl( Branding::instance()->string( Branding::KnownIssuesUrl ) );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->knownIssuesButton->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( showReleaseNotesUrl && !b->string( Branding::ReleaseNotesUrl ).isEmpty() )
|
||||||
|
{
|
||||||
|
connect( ui->releaseNotesButton, &QPushButton::clicked, []
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl( Branding::instance()->string( Branding::ReleaseNotesUrl ) );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->releaseNotesButton->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GreetingPage::focusInEvent( QFocusEvent* e )
|
GreetingPage::focusInEvent( QFocusEvent* e )
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,10 @@ class GreetingPage : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit GreetingPage( QWidget* parent = nullptr );
|
explicit GreetingPage( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
void setUpLinks( bool showSupportUrl,
|
||||||
|
bool showKnownIssuesUrl,
|
||||||
|
bool showReleaseNotesUrl );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
||||||
|
|
||||||
|
@ -97,14 +97,48 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="aboutButton">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>&About</string>
|
<widget class="QPushButton" name="releaseNotesButton">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="flat">
|
<string>&Release notes</string>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="flat">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="knownIssuesButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Known issues</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="supportButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Support</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="aboutButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&About</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
|
Loading…
Reference in New Issue
Block a user