[partition] Chase moving PrettyRadioButton to libcalamaresui

- Update includes
- Use exposed API instead of accessing internals of the button
This commit is contained in:
Adriaan de Groot 2020-05-18 11:01:54 +02:00
parent 17231ae41f
commit 72857b75d0
2 changed files with 22 additions and 18 deletions

View file

@ -35,20 +35,19 @@
#include "PartitionBarsView.h" #include "PartitionBarsView.h"
#include "PartitionLabelsView.h" #include "PartitionLabelsView.h"
#include "PartitionSplitterWidget.h" #include "PartitionSplitterWidget.h"
#include "PrettyRadioButton.h"
#include "ReplaceWidget.h" #include "ReplaceWidget.h"
#include "ScanningDialog.h" #include "ScanningDialog.h"
#include "Branding.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "partition/PartitionIterator.h" #include "partition/PartitionIterator.h"
#include "partition/PartitionQuery.h" #include "partition/PartitionQuery.h"
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "utils/Units.h" #include "utils/Units.h"
#include "widgets/PrettyRadioButton.h"
#include "Branding.h"
#include "utils/CalamaresUtilsGui.h"
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
@ -69,6 +68,7 @@ using PartitionActions::Choices::SwapChoice;
using CalamaresUtils::Partition::PartitionIterator; using CalamaresUtils::Partition::PartitionIterator;
using CalamaresUtils::Partition::isPartitionFreeSpace; using CalamaresUtils::Partition::isPartitionFreeSpace;
using CalamaresUtils::Partition::findPartitionByPath; using CalamaresUtils::Partition::findPartitionByPath;
using Calamares::PrettyRadioButton;
/** @brief Given a set of swap choices, return a sensible value from it. /** @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, m_alongsideButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside,
CalamaresUtils::Original, CalamaresUtils::Original,
iconSize ) ); iconSize ) );
m_grp->addButton( m_alongsideButton->buttonWidget(), Alongside ); m_alongsideButton->addToGroup( m_grp, Alongside );
m_eraseButton = new PrettyRadioButton; m_eraseButton = new PrettyRadioButton;
m_eraseButton->setIconSize( iconSize ); m_eraseButton->setIconSize( iconSize );
m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto, m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto,
CalamaresUtils::Original, CalamaresUtils::Original,
iconSize ) ); iconSize ) );
m_grp->addButton( m_eraseButton->buttonWidget(), Erase ); m_eraseButton->addToGroup( m_grp, Erase );
m_replaceButton = new PrettyRadioButton; m_replaceButton = new PrettyRadioButton;
@ -274,7 +274,7 @@ ChoicePage::setupChoices()
m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs, m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs,
CalamaresUtils::Original, CalamaresUtils::Original,
iconSize ) ); iconSize ) );
m_grp->addButton( m_replaceButton->buttonWidget(), Replace ); m_replaceButton->addToGroup( m_grp, Replace );
// Fill up swap options // Fill up swap options
// .. TODO: only if enabled in the config // .. TODO: only if enabled in the config
@ -294,7 +294,7 @@ ChoicePage::setupChoices()
CalamaresUtils::Original, CalamaresUtils::Original,
iconSize ) ); iconSize ) );
m_itemsLayout->addWidget( m_somethingElseButton ); m_itemsLayout->addWidget( m_somethingElseButton );
m_grp->addButton( m_somethingElseButton->buttonWidget(), Manual ); m_somethingElseButton->addToGroup( m_grp, Manual );
m_itemsLayout->addStretch(); m_itemsLayout->addStretch();
@ -1193,7 +1193,7 @@ force_uncheck(QButtonGroup* grp, PrettyRadioButton* button)
{ {
button->hide(); button->hide();
grp->setExclusive( false ); grp->setExclusive( false );
button->buttonWidget()->setChecked( false ); button->setChecked( false );
grp->setExclusive( true ); grp->setExclusive( true );
} }
@ -1288,8 +1288,8 @@ ChoicePage::setupActions()
m_replaceButton->hide(); m_replaceButton->hide();
m_alongsideButton->hide(); m_alongsideButton->hide();
m_grp->setExclusive( false ); m_grp->setExclusive( false );
m_replaceButton->buttonWidget()->setChecked( false ); m_replaceButton->setChecked( false );
m_alongsideButton->buttonWidget()->setChecked( false ); m_alongsideButton->setChecked( false );
m_grp->setExclusive( true ); m_grp->setExclusive( true );
} }
else if ( osproberEntriesForCurrentDevice.count() == 1 ) else if ( osproberEntriesForCurrentDevice.count() == 1 )

View file

@ -23,7 +23,6 @@
#include "ui_ChoicePage.h" #include "ui_ChoicePage.h"
#include <QWidget>
#include "core/OsproberEntry.h" #include "core/OsproberEntry.h"
#include "core/PartitionActions.h" #include "core/PartitionActions.h"
@ -31,17 +30,22 @@
#include <QMutex> #include <QMutex>
#include <QPointer> #include <QPointer>
#include <QSet> #include <QSet>
#include <QWidget>
class QBoxLayout; class QBoxLayout;
class QComboBox; class QComboBox;
class QLabel; class QLabel;
class QListView; class QListView;
namespace Calamares
{
class PrettyRadioButton;
}
class PartitionBarsView; class PartitionBarsView;
class PartitionSplitterWidget; class PartitionSplitterWidget;
class PartitionLabelsView; class PartitionLabelsView;
class PartitionCoreModule; class PartitionCoreModule;
class PrettyRadioButton;
class DeviceInfoWidget; class DeviceInfoWidget;
class Device; class Device;
@ -153,10 +157,10 @@ private:
QComboBox* m_drivesCombo; QComboBox* m_drivesCombo;
QButtonGroup* m_grp; QButtonGroup* m_grp;
PrettyRadioButton* m_alongsideButton; Calamares::PrettyRadioButton* m_alongsideButton;
PrettyRadioButton* m_eraseButton; Calamares::PrettyRadioButton* m_eraseButton;
PrettyRadioButton* m_replaceButton; Calamares::PrettyRadioButton* m_replaceButton;
PrettyRadioButton* m_somethingElseButton; Calamares::PrettyRadioButton* m_somethingElseButton;
QComboBox* m_eraseSwapChoiceComboBox; // UI, see also m_eraseSwapChoice QComboBox* m_eraseSwapChoiceComboBox; // UI, see also m_eraseSwapChoice
DeviceInfoWidget* m_deviceInfoWidget; DeviceInfoWidget* m_deviceInfoWidget;
@ -182,4 +186,4 @@ private:
QMutex m_coreMutex; QMutex m_coreMutex;
}; };
#endif // CHOICEPAGE_H #endif // CHOICEPAGE_H