From 8e8525a941ecf660f038c582138c0bdf509f35d0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Mar 2021 13:10:09 +0100 Subject: [PATCH] [netinstall] Simplify slots in the UI page --- src/modules/netinstall/NetInstallPage.cpp | 28 +++++------------------ src/modules/netinstall/NetInstallPage.h | 4 ---- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 0dfb810b5..31c9d15ac 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -33,8 +33,12 @@ NetInstallPage::NetInstallPage( Config* c, QWidget* parent ) ui->setupUi( this ); ui->groupswidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents ); ui->groupswidget->setModel( c->model() ); - connect( c, &Config::statusChanged, this, &NetInstallPage::setStatus ); - connect( c, &Config::titleLabelChanged, this, &NetInstallPage::setTitle ); + connect( c, &Config::statusChanged, ui->netinst_status, &QLabel::setText ); + connect( c, &Config::titleLabelChanged, [ui = this->ui]( const QString title ) { + ui->label->setVisible( !title.isEmpty() ); + ui->label->setText( title ); + } ); + connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups ); } @@ -55,26 +59,6 @@ NetInstallPage::expandGroups() } } -void -NetInstallPage::setStatus( QString s ) -{ - ui->netinst_status->setText( s ); -} - -void -NetInstallPage::setTitle( QString title ) -{ - if ( title.isEmpty() ) - { - ui->label->hide(); - } - else - { - ui->label->setText( title ); // That's get() on the TranslatedString - ui->label->show(); - } -} - void NetInstallPage::onActivate() { diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index e58a7dd8c..72375d0f0 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -39,10 +39,6 @@ public: void onActivate(); -public slots: - void setStatus( QString s ); - void setTitle( QString title ); - /** @brief Expand entries that should be pre-expanded. * * Follows the *expanded* key / the startExpanded field in the