From 72857b75d01a4ddca7b3abdbfb0088dcbf638709 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 18 May 2020 11:01:54 +0200 Subject: [PATCH] [partition] Chase moving PrettyRadioButton to libcalamaresui - Update includes - Use exposed API instead of accessing internals of the button --- src/modules/partition/gui/ChoicePage.cpp | 22 +++++++++++----------- src/modules/partition/gui/ChoicePage.h | 18 +++++++++++------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index c69768f70..5c90ea7b0 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -35,20 +35,19 @@ #include "PartitionBarsView.h" #include "PartitionLabelsView.h" #include "PartitionSplitterWidget.h" -#include "PrettyRadioButton.h" #include "ReplaceWidget.h" #include "ScanningDialog.h" +#include "Branding.h" #include "GlobalStorage.h" #include "JobQueue.h" #include "partition/PartitionIterator.h" #include "partition/PartitionQuery.h" +#include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" #include "utils/Retranslator.h" #include "utils/Units.h" - -#include "Branding.h" -#include "utils/CalamaresUtilsGui.h" +#include "widgets/PrettyRadioButton.h" #include #include @@ -69,6 +68,7 @@ using PartitionActions::Choices::SwapChoice; using CalamaresUtils::Partition::PartitionIterator; using CalamaresUtils::Partition::isPartitionFreeSpace; using CalamaresUtils::Partition::findPartitionByPath; +using Calamares::PrettyRadioButton; /** @brief Given a set of swap choices, return a sensible value from it. * @@ -259,14 +259,14 @@ ChoicePage::setupChoices() m_alongsideButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside, CalamaresUtils::Original, iconSize ) ); - m_grp->addButton( m_alongsideButton->buttonWidget(), Alongside ); + m_alongsideButton->addToGroup( m_grp, Alongside ); m_eraseButton = new PrettyRadioButton; m_eraseButton->setIconSize( iconSize ); m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto, CalamaresUtils::Original, iconSize ) ); - m_grp->addButton( m_eraseButton->buttonWidget(), Erase ); + m_eraseButton->addToGroup( m_grp, Erase ); m_replaceButton = new PrettyRadioButton; @@ -274,7 +274,7 @@ ChoicePage::setupChoices() m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs, CalamaresUtils::Original, iconSize ) ); - m_grp->addButton( m_replaceButton->buttonWidget(), Replace ); + m_replaceButton->addToGroup( m_grp, Replace ); // Fill up swap options // .. TODO: only if enabled in the config @@ -294,7 +294,7 @@ ChoicePage::setupChoices() CalamaresUtils::Original, iconSize ) ); m_itemsLayout->addWidget( m_somethingElseButton ); - m_grp->addButton( m_somethingElseButton->buttonWidget(), Manual ); + m_somethingElseButton->addToGroup( m_grp, Manual ); m_itemsLayout->addStretch(); @@ -1193,7 +1193,7 @@ force_uncheck(QButtonGroup* grp, PrettyRadioButton* button) { button->hide(); grp->setExclusive( false ); - button->buttonWidget()->setChecked( false ); + button->setChecked( false ); grp->setExclusive( true ); } @@ -1288,8 +1288,8 @@ ChoicePage::setupActions() m_replaceButton->hide(); m_alongsideButton->hide(); m_grp->setExclusive( false ); - m_replaceButton->buttonWidget()->setChecked( false ); - m_alongsideButton->buttonWidget()->setChecked( false ); + m_replaceButton->setChecked( false ); + m_alongsideButton->setChecked( false ); m_grp->setExclusive( true ); } else if ( osproberEntriesForCurrentDevice.count() == 1 ) diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index baf575d49..1ff8f0d40 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -23,7 +23,6 @@ #include "ui_ChoicePage.h" -#include #include "core/OsproberEntry.h" #include "core/PartitionActions.h" @@ -31,17 +30,22 @@ #include #include #include +#include class QBoxLayout; class QComboBox; class QLabel; class QListView; +namespace Calamares +{ +class PrettyRadioButton; +} + class PartitionBarsView; class PartitionSplitterWidget; class PartitionLabelsView; class PartitionCoreModule; -class PrettyRadioButton; class DeviceInfoWidget; class Device; @@ -153,10 +157,10 @@ private: QComboBox* m_drivesCombo; QButtonGroup* m_grp; - PrettyRadioButton* m_alongsideButton; - PrettyRadioButton* m_eraseButton; - PrettyRadioButton* m_replaceButton; - PrettyRadioButton* m_somethingElseButton; + Calamares::PrettyRadioButton* m_alongsideButton; + Calamares::PrettyRadioButton* m_eraseButton; + Calamares::PrettyRadioButton* m_replaceButton; + Calamares::PrettyRadioButton* m_somethingElseButton; QComboBox* m_eraseSwapChoiceComboBox; // UI, see also m_eraseSwapChoice DeviceInfoWidget* m_deviceInfoWidget; @@ -182,4 +186,4 @@ private: QMutex m_coreMutex; }; -#endif // CHOICEPAGE_H +#endif // CHOICEPAGE_H