diff --git a/src/modules/tracking/TrackingPage.cpp b/src/modules/tracking/TrackingPage.cpp index 02bc94195..e42ae2312 100644 --- a/src/modules/tracking/TrackingPage.cpp +++ b/src/modules/tracking/TrackingPage.cpp @@ -40,13 +40,15 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent ) ui->setupUi( this ); CALAMARES_RETRANSLATE_SLOT( &TrackingPage::retranslate ); - QButtonGroup* group = new QButtonGroup( this ); - group->setExclusive( true ); - group->addButton( ui->noneRadio ); - group->addButton( ui->installRadio ); - group->addButton( ui->machineRadio ); - group->addButton( ui->userRadio ); - ui->noneRadio->setChecked( true ); + ui->noneCheckBox->setChecked( true ); + connect( ui->noneCheckBox, &QCheckBox::stateChanged, this, &TrackingPage::noneChecked ); + connect( ui->installCheckBox, &QCheckBox::stateChanged, this, &TrackingPage::otherChecked ); + connect( ui->machineCheckBox, &QCheckBox::stateChanged, this, &TrackingPage::otherChecked ); + connect( ui->userCheckBox, &QCheckBox::stateChanged, this, &TrackingPage::otherChecked ); + + connect( ui->installCheckBox, &QCheckBox::stateChanged, [ this ]( int s ) { cDebug() << "Checkbox install changed" << s; } ); + connect( config->installTracking(), &TrackingStyleConfig::trackingChanged, [ config ]() { cDebug() << + "Install tracking changed" << config->installTracking()->isEnabled(); } ) ; connect( config, &Config::generalPolicyChanged, [ this ]( const QString& url ) { this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); @@ -85,30 +87,35 @@ TrackingPage::retranslate() .arg( product ) ); } - -void -TrackingPage::setTrackingLevel( TrackingType t ) +void TrackingPage::noneChecked(int state) { - QRadioButton* button = nullptr; - - switch ( t ) + if ( state ) { - case TrackingType::NoTracking: - button = ui->noneRadio; - break; - case TrackingType::InstallTracking: - button = ui->installRadio; - break; - case TrackingType::MachineTracking: - button = ui->machineRadio; - break; - case TrackingType::UserTracking: - button = ui->userRadio; - break; - } - - if ( button != nullptr ) - { - button->setChecked( true ); + cDebug() << "Unchecking all due to none box"; + ui->installCheckBox->setChecked( false ); + ui->machineCheckBox->setChecked( false ); + ui->userCheckBox->setChecked( false ); + } +} + +void TrackingPage::otherChecked(int state) +{ + cDebug() << "Other checked" << state; + if ( state ) + { + // Can't have none checked, if another one is + ui->noneCheckBox->setChecked( false ); + } + else + { + if ( ui->installCheckBox->isChecked() || ui->machineCheckBox->isChecked() || ui->userCheckBox->isChecked() ) + { + // One of them is still checked, leave *none* alone + ; + } + else + { + ui->noneCheckBox->setChecked( true ); + } } } diff --git a/src/modules/tracking/TrackingPage.h b/src/modules/tracking/TrackingPage.h index f63f7375c..e4c465fbc 100644 --- a/src/modules/tracking/TrackingPage.h +++ b/src/modules/tracking/TrackingPage.h @@ -37,12 +37,23 @@ class TrackingPage : public QWidget public: explicit TrackingPage( Config* config, QWidget* parent = nullptr ); - ///@brief Select one of the four levels by name - void setTrackingLevel( TrackingType t ); - public Q_SLOTS: void retranslate(); + /** @brief When the *no tracking* checkbox is changed + * + * @p state will be non-zero when the box is checked; this + * **unchecks** all the other boxes. + */ + void noneChecked( int state ); + + /** @brief Some other checkbox changed + * + * This may check the *none* button if all the others are + * now unchecked. + */ + void otherChecked( int state ); + private: Ui::TrackingPage* ui; }; diff --git a/src/modules/tracking/page_trackingstep.ui b/src/modules/tracking/page_trackingstep.ui index 9612ef2b4..4383d312d 100644 --- a/src/modules/tracking/page_trackingstep.ui +++ b/src/modules/tracking/page_trackingstep.ui @@ -32,7 +32,7 @@ margin-left: 2em; - + @@ -83,7 +83,7 @@ margin-left: 2em; - + @@ -145,7 +145,7 @@ margin-left: 2em; - + @@ -207,7 +207,7 @@ margin-left: 2em; - +