[libcalamares] Deal with deprecations in QComboBox
This commit is contained in:
parent
a067e4fc4f
commit
20e6d1d66c
30
src/libcalamares/compat/CheckBox.h
Normal file
30
src/libcalamares/compat/CheckBox.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2024 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef CALAMARES_COMPAT_XML_H
|
||||
#define CALAMARES_COMPAT_XML_H
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
|
||||
using checkBoxStateType = int;
|
||||
const auto checkBoxStateChangedSignal = &QCheckBox::stateChanged;
|
||||
constexpr checkBoxStateType checkBoxUncheckedValue = 0;
|
||||
#else
|
||||
using checkBoxStateType = Qt::CheckState;
|
||||
const auto checkBoxStateChangedSignal = &QCheckBox::checkStateChanged;
|
||||
constexpr checkBoxStateType checkBoxUncheckedValue = Qt::Unchecked;
|
||||
#endif
|
||||
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "Branding.h"
|
||||
#include "Settings.h"
|
||||
#include "compat/CheckBox.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
#include <QFocusEvent>
|
||||
@ -41,15 +42,10 @@ FinishedPage::FinishedPage( Config* config, QWidget* parent )
|
||||
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
||||
} );
|
||||
connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked );
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
|
||||
connect( ui->restartCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
[ config ]( int state ) { config->setRestartNowWanted( state != 0 ); } );
|
||||
#else
|
||||
connect( ui->restartCheckBox,
|
||||
&QCheckBox::checkStateChanged,
|
||||
[ config ]( Qt::CheckState state ) { config->setRestartNowWanted( state != Qt::Unchecked ); } );
|
||||
#endif
|
||||
Calamares::checkBoxStateChangedSignal,
|
||||
[ config ]( Calamares::checkBoxStateType state )
|
||||
{ config->setRestartNowWanted( state != Calamares::checkBoxUncheckedValue ); } );
|
||||
|
||||
CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate );
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "Branding.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/CheckBox.h"
|
||||
#include "partition/PartitionIterator.h"
|
||||
#include "partition/PartitionQuery.h"
|
||||
#include "utils/Gui.h"
|
||||
@ -187,7 +188,7 @@ ChoicePage::init( PartitionCoreModule* core )
|
||||
|
||||
connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice );
|
||||
connect( m_encryptWidget, &EncryptWidget::stateChanged, this, &ChoicePage::onEncryptWidgetStateChanged );
|
||||
connect( m_reuseHomeCheckBox, &QCheckBox::stateChanged, this, &ChoicePage::onHomeCheckBoxStateChanged );
|
||||
connect( m_reuseHomeCheckBox, Calamares::checkBoxStateChangedSignal, this, &ChoicePage::onHomeCheckBoxStateChanged );
|
||||
|
||||
ChoicePage::applyDeviceChoice();
|
||||
}
|
||||
@ -361,7 +362,8 @@ ChoicePage::setupChoices()
|
||||
Device*
|
||||
ChoicePage::selectedDevice()
|
||||
{
|
||||
Device* const currentDevice = m_core->deviceModel()->deviceForIndex( m_core->deviceModel()->index( m_drivesCombo->currentIndex() ) );
|
||||
Device* const currentDevice
|
||||
= m_core->deviceModel()->deviceForIndex( m_core->deviceModel()->index( m_drivesCombo->currentIndex() ) );
|
||||
return currentDevice;
|
||||
}
|
||||
|
||||
@ -1031,7 +1033,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
||||
if ( m_enableEncryptionWidget )
|
||||
{
|
||||
m_encryptWidget->show();
|
||||
if ( m_config->preCheckEncryption() && ! m_preCheckActivated )
|
||||
if ( m_config->preCheckEncryption() && !m_preCheckActivated )
|
||||
{
|
||||
m_encryptWidget->setEncryptionCheckbox( true );
|
||||
m_preCheckActivated = true;
|
||||
@ -1091,7 +1093,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
||||
if ( shouldShowEncryptWidget( choice ) )
|
||||
{
|
||||
m_encryptWidget->show();
|
||||
if ( m_config->preCheckEncryption() && ! m_preCheckActivated )
|
||||
if ( m_config->preCheckEncryption() && !m_preCheckActivated )
|
||||
{
|
||||
m_encryptWidget->setEncryptionCheckbox( true );
|
||||
m_preCheckActivated = true;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "ViewManager.h"
|
||||
#include "compat/CheckBox.h"
|
||||
#include "utils/Gui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
@ -32,7 +33,7 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent )
|
||||
|
||||
ui->noneCheckBox->setChecked( true );
|
||||
ui->noneCheckBox->setEnabled( false );
|
||||
connect( ui->noneCheckBox, &QCheckBox::stateChanged, this, &TrackingPage::buttonNoneChecked );
|
||||
connect( ui->noneCheckBox, Calamares::checkBoxStateChangedSignal, this, &TrackingPage::buttonNoneChecked );
|
||||
|
||||
// Each "panel" of configuration has the same kind of setup,
|
||||
// where the xButton and xCheckBox is connected to the xTracking
|
||||
@ -40,9 +41,9 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent )
|
||||
#define trackingSetup( x ) \
|
||||
do \
|
||||
{ \
|
||||
connect( ui->x##CheckBox, &QCheckBox::stateChanged, this, &TrackingPage::buttonChecked ); \
|
||||
connect( ui->x##CheckBox, Calamares::checkBoxStateChangedSignal, this, &TrackingPage::buttonChecked ); \
|
||||
connect( ui->x##CheckBox, \
|
||||
&QCheckBox::stateChanged, \
|
||||
Calamares::checkBoxStateChangedSignal, \
|
||||
config->x##Tracking(), \
|
||||
QOverload< bool >::of( &TrackingStyleConfig::setTracking ) ); \
|
||||
connect( config->x##Tracking(), \
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "Settings.h"
|
||||
#include "compat/CheckBox.h"
|
||||
#include "utils/Gui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
@ -137,9 +138,10 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
||||
|
||||
ui->checkBoxDoAutoLogin->setChecked( m_config->doAutoLogin() );
|
||||
connect( ui->checkBoxDoAutoLogin,
|
||||
&QCheckBox::stateChanged,
|
||||
Calamares::checkBoxStateChangedSignal,
|
||||
this,
|
||||
[ this ]( int checked ) { m_config->setAutoLogin( checked != Qt::Unchecked ); } );
|
||||
[ this ]( Calamares::checkBoxStateType checked )
|
||||
{ m_config->setAutoLogin( checked != Calamares::checkBoxUncheckedValue ); } );
|
||||
connect( config, &Config::autoLoginChanged, ui->checkBoxDoAutoLogin, &QCheckBox::setChecked );
|
||||
|
||||
ui->checkBoxReusePassword->setVisible( m_config->writeRootPassword() );
|
||||
@ -147,7 +149,7 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
||||
if ( m_config->writeRootPassword() )
|
||||
{
|
||||
connect( config, &Config::reuseUserPasswordForRootChanged, ui->checkBoxReusePassword, &QCheckBox::setChecked );
|
||||
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged, this, &UsersPage::onReuseUserPasswordChanged );
|
||||
connect( ui->checkBoxReusePassword, Calamares::checkBoxStateChangedSignal, this, &UsersPage::onReuseUserPasswordChanged );
|
||||
}
|
||||
|
||||
ui->checkBoxRequireStrongPassword->setVisible( m_config->permitWeakPasswords() );
|
||||
@ -155,7 +157,7 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
||||
if ( m_config->permitWeakPasswords() )
|
||||
{
|
||||
connect( ui->checkBoxRequireStrongPassword,
|
||||
&QCheckBox::stateChanged,
|
||||
Calamares::checkBoxStateChangedSignal,
|
||||
this,
|
||||
[ this ]( int checked ) { m_config->setRequireStrongPasswords( checked != Qt::Unchecked ); } );
|
||||
connect(
|
||||
|
Loading…
Reference in New Issue
Block a user