From 075577d948810cafe17b9a40f40b8cdd70dd31f7 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Wed, 2 Nov 2016 05:58:00 +0100 Subject: [PATCH] [netinstall] Support selecting visible groups by default. In other words, support: hidden: false selected: true groups. This was supposed to work according to README.md, but not actually implemented. Now it should be working. --- src/modules/netinstall/NetInstallPage.cpp | 2 +- src/modules/netinstall/widgets/groupselectionwidget.cpp | 3 ++- src/modules/netinstall/widgets/groupselectionwidget.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 0e3a18c95..89f8e58dd 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -111,7 +111,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) continue; } - GroupSelectionWidget* groupWidget = new GroupSelectionWidget( group.name, group.description, group.packages, this ); + GroupSelectionWidget* groupWidget = new GroupSelectionWidget( group.name, group.description, group.packages, group.selected, this ); m_groupWidgets.insert( groupKey, groupWidget ); ui->groupswidget->layout()->addWidget( groupWidget ); diff --git a/src/modules/netinstall/widgets/groupselectionwidget.cpp b/src/modules/netinstall/widgets/groupselectionwidget.cpp index b477c0453..3048fb01f 100644 --- a/src/modules/netinstall/widgets/groupselectionwidget.cpp +++ b/src/modules/netinstall/widgets/groupselectionwidget.cpp @@ -20,7 +20,7 @@ #include -GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent ) : +GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, QStringList packages, bool selected, QWidget* parent ) : QWidget( parent ), m_isToggled( false ) { @@ -29,6 +29,7 @@ GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, Q connect( ui.group, &QCheckBox::toggled, this, &GroupSelectionWidget::toggleGroup ); ui.group->setText( name ); + ui.group->setChecked( selected ); // also triggers the toggleGroup slot ui.description->setText( description ); const int columns = 4; const int rows = ( packages.size() - 1 ) / columns + 1; diff --git a/src/modules/netinstall/widgets/groupselectionwidget.h b/src/modules/netinstall/widgets/groupselectionwidget.h index a003f4833..1f7a0fc97 100644 --- a/src/modules/netinstall/widgets/groupselectionwidget.h +++ b/src/modules/netinstall/widgets/groupselectionwidget.h @@ -29,7 +29,7 @@ class GroupSelectionWidget : public QWidget { Q_OBJECT public: - explicit GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent = nullptr ); + explicit GroupSelectionWidget( QString name, QString description, QStringList packages, bool selected, QWidget* parent = nullptr ); // Current status of the group: is it selected in the view? bool isToggled() const;