Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt 6.8 deprecated declaration fixes #13845

Merged
merged 6 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/controllers/legacycontrollersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ QWidget* LegacyControllerBooleanSetting::buildInputWidget(QWidget* pParent) {
pCheckBox->setCheckState(m_editedValue ? Qt::Checked : Qt::Unchecked);
});

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(pCheckBox, &QCheckBox::checkStateChanged, this, [this](Qt::CheckState state) {
#else
connect(pCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
#endif
m_editedValue = state == Qt::Checked;
emit changed();
});
Expand Down
8 changes: 8 additions & 0 deletions src/dialog/dlgreplacecuecolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,19 @@ DlgReplaceCueColor::DlgReplaceCueColor(

// Update dialog widgets when conditions checkboxes are (un)checked
connect(checkBoxCurrentColorCondition,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
Holzhaus marked this conversation as resolved.
Show resolved Hide resolved
this,
&DlgReplaceCueColor::slotUpdateWidgets);
connect(checkBoxHotcueIndexCondition,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgReplaceCueColor::slotUpdateWidgets);

Expand Down
4 changes: 4 additions & 0 deletions src/library/dao/trackdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,11 @@ void setTrackSourceSynchronizedAt(const QSqlRecord& record, const int column, Tr
if (!value.isNull() && value.canConvert<quint64>()) {
DEBUG_ASSERT(value.isValid());
const quint64 msecsSinceEpoch = qvariant_cast<quint64>(value);
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
sourceSynchronizedAt.setTimeZone(QTimeZone::UTC);
#else
sourceSynchronizedAt.setTimeSpec(Qt::UTC);
#endif
sourceSynchronizedAt.setMSecsSinceEpoch(msecsSinceEpoch);
}
pTrack->setSourceSynchronizedAt(sourceSynchronizedAt);
Expand Down
8 changes: 8 additions & 0 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ void DlgTrackInfo::init() {
&DlgTrackInfo::slotBpmClear);

connect(bpmConst,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgTrackInfo::slotBpmConstChanged);

Expand Down Expand Up @@ -662,7 +666,11 @@ void DlgTrackInfo::slotBpmClear() {
bpmTap->setEnabled(true);
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgTrackInfo::slotBpmConstChanged(Qt::CheckState state) {
#else
void DlgTrackInfo::slotBpmConstChanged(int state) {
#endif
if (state == Qt::Unchecked) {
// try to reload BeatMap from the Track
reloadTrackBeats(*m_pLoadedTrack);
Expand Down
4 changes: 4 additions & 0 deletions src/library/dlgtrackinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {

void slotBpmScale(mixxx::Beats::BpmScale bpmScale);
void slotBpmClear();
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void slotBpmConstChanged(Qt::CheckState state);
#else
void slotBpmConstChanged(int state);
#endif
void slotBpmTap(double averageLength, int numSamples);
void slotSpinBpmValueChanged(double value);

Expand Down
32 changes: 31 additions & 1 deletion src/preferences/dialog/dlgprefautodj.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "preferences/dialog/dlgprefautodj.h"

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
#include <QTimeZone>
#endif

#include "moc_dlgprefautodj.cpp"

DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent,
Expand All @@ -21,9 +25,20 @@ DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent,
RequeueIgnoreCheckBox->setChecked(m_pConfig->getValue(
ConfigKey("[Auto DJ]", "UseIgnoreTime"), false));
connect(RequeueIgnoreCheckBox,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefAutoDJ::slotToggleRequeueIgnore);
/// TODO: Once we require at least Qt 6.7, remove this `setTimeZone` call
/// and uncomment the corresponding declarations in the UI file instead.
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
RequeueIgnoreTimeEdit->setTimeZone(QTimeZone::LocalTime);
#else
RequeueIgnoreTimeEdit->setTimeSpec(Qt::LocalTime);
#endif
RequeueIgnoreTimeEdit->setTime(
QTime::fromString(
m_pConfig->getValue(
Expand Down Expand Up @@ -54,7 +69,11 @@ DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent,
: Qt::Unchecked);
// Be ready to enable and modify the minimum number and un/check the checkbox
connect(RandomQueueCheckBox,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefAutoDJ::slotToggleRandomQueue);
connect(RandomQueueMinimumSpinBox,
Expand Down Expand Up @@ -124,7 +143,10 @@ void DlgPrefAutoDJ::slotCancel() {
? Qt::Checked
: Qt::Unchecked);
slotToggleRandomQueue(
m_pConfig->getValue<bool>(ConfigKey("[Auto DJ]", "Requeue")));
m_pConfig->getValue(
ConfigKey("[Auto DJ]", "Requeue"), false)
? Qt::Checked
: Qt::Unchecked);
}

void DlgPrefAutoDJ::slotResetToDefaults() {
Expand All @@ -148,7 +170,11 @@ void DlgPrefAutoDJ::slotSetMinimumAvailable(int a_iValue) {
m_pConfig->setValue(ConfigKey("[Auto DJ]", "MinimumAvailableBuff"), a_iValue);
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefAutoDJ::slotToggleRequeueIgnore(Qt::CheckState buttonState) {
#else
void DlgPrefAutoDJ::slotToggleRequeueIgnore(int buttonState) {
#endif
bool checked = buttonState == Qt::Checked;
m_pConfig->setValue(ConfigKey("[Auto DJ]", "UseIgnoreTimeBuff"), checked);
RequeueIgnoreTimeEdit->setEnabled(checked);
Expand Down Expand Up @@ -179,7 +205,11 @@ void DlgPrefAutoDJ::slotConsiderRepeatPlaylistState(bool enable) {
}
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefAutoDJ::slotToggleRandomQueue(Qt::CheckState buttonState) {
#else
void DlgPrefAutoDJ::slotToggleRandomQueue(int buttonState) {
#endif
bool enable = buttonState == Qt::Checked;
// Toggle the option to select minimum tracks
RandomQueueMinimumSpinBox->setEnabled(enable);
Expand Down
8 changes: 8 additions & 0 deletions src/preferences/dialog/dlgprefautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ class DlgPrefAutoDJ : public DlgPreferencePage, public Ui::DlgPrefAutoDJDlg {

private slots:
void slotSetMinimumAvailable(int);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void slotToggleRequeueIgnore(Qt::CheckState state);
#else
void slotToggleRequeueIgnore(int buttonState);
#endif
void slotSetRequeueIgnoreTime(const QTime& a_rTime);
void slotSetRandomQueueMin(int);
void slotConsiderRepeatPlaylistState(bool);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void slotToggleRandomQueue(Qt::CheckState state);
#else
void slotToggleRandomQueue(int buttonState);
#endif

private:
UserSettingsPointer m_pConfig;
Expand Down
10 changes: 7 additions & 3 deletions src/preferences/dialog/dlgprefautodjdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@
<property name="displayFormat">
<string>hh:mm</string>
</property>
<property name="timeSpec">
<enum>Qt::LocalTime</enum>
</property>
<!--
TODO: Enable this once we require at least Qt 6.7 and remove the
corresponding code from the C++ file.
-->
<!--<property name="timeZone">
<enum>QTimeZone::LocalTime</enum>
</property>-->
<property name="minimumSize">
<size>
<width>60</width>
Expand Down
45 changes: 45 additions & 0 deletions src/preferences/dialog/dlgprefbeats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,43 @@ DlgPrefBeats::DlgPrefBeats(QWidget* parent, UserSettingsPointer pConfig)
this,
&DlgPrefBeats::pluginSelected);
connect(checkBoxAnalyzerEnabled,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBeats::analyzerEnabled);
connect(checkBoxFixedTempo,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBeats::fixedtempoEnabled);
connect(checkBoxFastAnalysis,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBeats::fastAnalysisEnabled);
connect(checkBoxReanalyze,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBeats::slotReanalyzeChanged);
connect(checkBoxReanalyzeImported,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBeats::slotReanalyzeImportedChanged);

Expand Down Expand Up @@ -89,13 +109,23 @@ void DlgPrefBeats::pluginSelected(int i) {
slotUpdate();
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBeats::analyzerEnabled(Qt::CheckState state) {
m_bAnalyzerEnabled = (state == Qt::Checked);
#else
void DlgPrefBeats::analyzerEnabled(int i) {
m_bAnalyzerEnabled = static_cast<bool>(i);
#endif
slotUpdate();
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBeats::fixedtempoEnabled(Qt::CheckState state) {
m_bFixedTempoEnabled = (state == Qt::Checked);
#else
void DlgPrefBeats::fixedtempoEnabled(int i) {
m_bFixedTempoEnabled = static_cast<bool>(i);
#endif
slotUpdate();
}

Expand Down Expand Up @@ -139,18 +169,33 @@ void DlgPrefBeats::slotUpdate() {
checkBoxReanalyzeImported->setChecked(m_bReanalyzeImported);
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBeats::slotReanalyzeChanged(Qt::CheckState state) {
m_bReanalyze = (state == Qt::Checked);
#else
void DlgPrefBeats::slotReanalyzeChanged(int value) {
m_bReanalyze = static_cast<bool>(value);
#endif
slotUpdate();
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBeats::slotReanalyzeImportedChanged(Qt::CheckState state) {
m_bReanalyzeImported = (state == Qt::Checked);
#else
void DlgPrefBeats::slotReanalyzeImportedChanged(int value) {
m_bReanalyzeImported = static_cast<bool>(value);
#endif
slotUpdate();
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBeats::fastAnalysisEnabled(Qt::CheckState state) {
m_bFastAnalysisEnabled = (state == Qt::Checked);
#else
void DlgPrefBeats::fastAnalysisEnabled(int i) {
m_bFastAnalysisEnabled = static_cast<bool>(i);
#endif
slotUpdate();
}

Expand Down
8 changes: 8 additions & 0 deletions src/preferences/dialog/dlgprefbeats.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ class DlgPrefBeats : public DlgPreferencePage, public Ui::DlgBeatsDlg {

private slots:
void pluginSelected(int i);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void analyzerEnabled(Qt::CheckState state);
void fixedtempoEnabled(Qt::CheckState state);
void fastAnalysisEnabled(Qt::CheckState state);
void slotReanalyzeChanged(Qt::CheckState state);
void slotReanalyzeImportedChanged(Qt::CheckState state);
#else
void analyzerEnabled(int i);
void fixedtempoEnabled(int i);
void fastAnalysisEnabled(int i);
void slotReanalyzeChanged(int value);
void slotReanalyzeImportedChanged(int value);
#endif

private:
void loadSettings();
Expand Down
27 changes: 27 additions & 0 deletions src/preferences/dialog/dlgprefbroadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,27 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent,
static_cast<int>(EncoderSettings::ChannelMode::STEREO));

connect(checkBoxEnableReconnect,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBroadcast::checkBoxEnableReconnectChanged);
connect(checkBoxLimitReconnects,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBroadcast::checkBoxLimitReconnectsChanged);
connect(enableCustomMetadata,
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
&QCheckBox::checkStateChanged,
#else
&QCheckBox::stateChanged,
#endif
this,
&DlgPrefBroadcast::enableCustomMetadataChanged);

Expand Down Expand Up @@ -280,15 +292,30 @@ void DlgPrefBroadcast::broadcastEnabledChanged(double value) {
btnDisconnectAll->setEnabled(enabled);
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBroadcast::checkBoxEnableReconnectChanged(Qt::CheckState state) {
widgetReconnectControls->setEnabled(state == Qt::Checked);
#else
void DlgPrefBroadcast::checkBoxEnableReconnectChanged(int value) {
widgetReconnectControls->setEnabled(value);
#endif
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBroadcast::checkBoxLimitReconnectsChanged(Qt::CheckState state) {
spinBoxMaximumRetries->setEnabled(state == Qt::Checked);
#else
void DlgPrefBroadcast::checkBoxLimitReconnectsChanged(int value) {
spinBoxMaximumRetries->setEnabled(value);
#endif
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void DlgPrefBroadcast::enableCustomMetadataChanged(Qt::CheckState state) {
const bool value = (state == Qt::Checked);
#else
void DlgPrefBroadcast::enableCustomMetadataChanged(int value) {
#endif
custom_artist->setEnabled(value);
custom_title->setEnabled(value);
}
Expand Down
6 changes: 6 additions & 0 deletions src/preferences/dialog/dlgprefbroadcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ class DlgPrefBroadcast : public DlgPreferencePage, public Ui::DlgPrefBroadcastDl
void slotUpdate() override;
void slotResetToDefaults() override;
void broadcastEnabledChanged(double value);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void checkBoxEnableReconnectChanged(Qt::CheckState state);
void checkBoxLimitReconnectsChanged(Qt::CheckState state);
void enableCustomMetadataChanged(Qt::CheckState state);
#else
void checkBoxEnableReconnectChanged(int value);
void checkBoxLimitReconnectsChanged(int value);
void enableCustomMetadataChanged(int value);
#endif
void connectionListItemSelected(const QModelIndex& selected);

signals:
Expand Down
Loading
Loading