[welcome] Shuffle code

- things that can be done in the designer file should be there,
  not weirdly repeated in code elsewhere
- drop the insertion of an extra spacer (why not include it in the
  designer file?)
- shuffle all the connect() calls down to the end of the constructor
This commit is contained in:
Adriaan de Groot 2020-04-22 11:01:50 +02:00
parent be86561913
commit c3941b6e65
2 changed files with 26 additions and 26 deletions

View file

@ -51,34 +51,12 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
, m_languages( nullptr ) , m_languages( nullptr )
, m_conf( conf ) , m_conf( conf )
{ {
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 );
const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
ui->verticalLayout->insertSpacing( 1, defaultFontHeight * 2 ); ui->setupUi( this );
initLanguages();
ui->mainText->setAlignment( Qt::AlignCenter );
ui->mainText->setWordWrap( true );
ui->mainText->setOpenExternalLinks( true );
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
<< *Calamares::Branding::VersionedName;
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate )
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Information, CalamaresUtils::Information,
CalamaresUtils::Original, CalamaresUtils::Original,
2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
// insert system-check widget below welcome text // insert system-check widget below welcome text
const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText );
@ -100,6 +78,22 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel );
} }
} }
initLanguages();
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
<< *Calamares::Branding::VersionedName;
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate )
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
connect( Calamares::ModuleManager::instance(),
&Calamares::ModuleManager::requirementsComplete,
m_checkingWidget,
&CheckerContainer::requirementsComplete );
connect( Calamares::ModuleManager::instance(),
&Calamares::ModuleManager::requirementsProgress,
m_checkingWidget,
&CheckerContainer::requirementsProgress );
} }
void void

View file

@ -43,6 +43,12 @@
<property name="text"> <property name="text">
<string notr="true">&lt;Calamares welcome text&gt;</string> <string notr="true">&lt;Calamares welcome text&gt;</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -78,15 +84,15 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="languageWidget"> <widget class="QComboBox" name="languageWidget">
<property name="toolTip">
<string>Select application and system language</string>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>2</horstretch> <horstretch>2</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Select application and system language</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>