From 883b7bdc5231a12e1fc7032ff5fc5c096e93748e Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 6 Nov 2024 23:31:46 +0100 Subject: [PATCH 1/7] fix(build): Fix `-Wdeprecated-declarations` warnings for `QCheckBox` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes warnings such as: mixxx/src/controllers/legacycontrollersettings.cpp: In member function ‘virtual QWidget* LegacyControllerBooleaetting::buildInputWidget(QWidget*)’: mixxx/src/controllers/legacycontrollersettings.cpp:144:36: error: ‘void QCheckBox::stateChanged(int)’ is depreced: Use checkStateChanged() instead [-Werror=deprecated-declarations] 144 | connect(pCheckBox, &QCheckBox::stateChanged, this, [this](int state) { | ^~~~~~~~~~~~ In file included from /usr/include/qt6/QtWidgets/QCheckBox:1, from mixxx/src/controllers/legacycontrollersettings.cpp:5:/usr/include/qt6/QtWidgets/qcheckbox.h:41:10: note: declared here 41 | void stateChanged(int); | ^~~~~~~~~~~~ cc1plus: all warnings being treated as errors --- src/controllers/legacycontrollersettings.cpp | 4 ++++ src/dialog/dlgreplacecuecolor.cpp | 8 ++++++++ src/library/dlgtrackinfo.cpp | 4 ++++ src/preferences/dialog/dlgprefautodj.cpp | 8 ++++++++ src/preferences/dialog/dlgprefbeats.cpp | 20 +++++++++++++++++++ src/preferences/dialog/dlgprefbroadcast.cpp | 12 +++++++++++ src/preferences/dialog/dlgprefkey.cpp | 21 +++++++++++++++++--- src/preferences/dialog/dlgprefreplaygain.cpp | 8 ++++++++ src/widget/weffectchainpresetbutton.cpp | 8 ++++++++ src/widget/wtrackmenu.cpp | 10 ++++++++++ 10 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/controllers/legacycontrollersettings.cpp b/src/controllers/legacycontrollersettings.cpp index f97d2b9d628..91e8f9005a6 100644 --- a/src/controllers/legacycontrollersettings.cpp +++ b/src/controllers/legacycontrollersettings.cpp @@ -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(); }); diff --git a/src/dialog/dlgreplacecuecolor.cpp b/src/dialog/dlgreplacecuecolor.cpp index 4b98d2a34e6..8c053eb7df4 100644 --- a/src/dialog/dlgreplacecuecolor.cpp +++ b/src/dialog/dlgreplacecuecolor.cpp @@ -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 this, &DlgReplaceCueColor::slotUpdateWidgets); connect(checkBoxHotcueIndexCondition, +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + &QCheckBox::checkStateChanged, +#else &QCheckBox::stateChanged, +#endif this, &DlgReplaceCueColor::slotUpdateWidgets); diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 47b32bcc021..30a7fa159f6 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -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); diff --git a/src/preferences/dialog/dlgprefautodj.cpp b/src/preferences/dialog/dlgprefautodj.cpp index 7842318bf60..1ef5153e572 100644 --- a/src/preferences/dialog/dlgprefautodj.cpp +++ b/src/preferences/dialog/dlgprefautodj.cpp @@ -21,7 +21,11 @@ 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); RequeueIgnoreTimeEdit->setTime( @@ -54,7 +58,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, diff --git a/src/preferences/dialog/dlgprefbeats.cpp b/src/preferences/dialog/dlgprefbeats.cpp index e2910464262..fc6ec59e30a 100644 --- a/src/preferences/dialog/dlgprefbeats.cpp +++ b/src/preferences/dialog/dlgprefbeats.cpp @@ -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); diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index b8e3bfc1d8b..8eaba663c7d 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -146,15 +146,27 @@ DlgPrefBroadcast::DlgPrefBroadcast(QWidget *parent, static_cast(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); diff --git a/src/preferences/dialog/dlgprefkey.cpp b/src/preferences/dialog/dlgprefkey.cpp index ed45a66e30e..1730ce21488 100644 --- a/src/preferences/dialog/dlgprefkey.cpp +++ b/src/preferences/dialog/dlgprefkey.cpp @@ -54,12 +54,27 @@ DlgPrefKey::DlgPrefKey(QWidget* parent, UserSettingsPointer pConfig) this, &DlgPrefKey::pluginSelected); setScrollSafeGuard(plugincombo); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(banalyzerenabled, &QCheckBox::checkStateChanged, +#else connect(banalyzerenabled, &QCheckBox::stateChanged, - this, &DlgPrefKey::analyzerEnabled); +#endif + this, + &DlgPrefKey::analyzerEnabled); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(bfastAnalysisEnabled, &QCheckBox::checkStateChanged, +#else connect(bfastAnalysisEnabled, &QCheckBox::stateChanged, - this, &DlgPrefKey::fastAnalysisEnabled); +#endif + this, + &DlgPrefKey::fastAnalysisEnabled); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(breanalyzeEnabled, &QCheckBox::checkStateChanged, +#else connect(breanalyzeEnabled, &QCheckBox::stateChanged, - this, &DlgPrefKey::reanalyzeEnabled); +#endif + this, + &DlgPrefKey::reanalyzeEnabled); connect(radioNotationOpenKey, &QRadioButton::toggled, this, &DlgPrefKey::setNotationOpenKey); diff --git a/src/preferences/dialog/dlgprefreplaygain.cpp b/src/preferences/dialog/dlgprefreplaygain.cpp index 34103dce589..17280a60562 100644 --- a/src/preferences/dialog/dlgprefreplaygain.cpp +++ b/src/preferences/dialog/dlgprefreplaygain.cpp @@ -19,7 +19,11 @@ DlgPrefReplayGain::DlgPrefReplayGain(QWidget* parent, UserSettingsPointer pConfi m_enabled(kConfigKey, kReplayGainEnabled) { setupUi(this); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(EnableGain, &QCheckBox::checkStateChanged, this, &DlgPrefReplayGain::slotSetRGEnabled); +#else connect(EnableGain, &QCheckBox::stateChanged, this, &DlgPrefReplayGain::slotSetRGEnabled); +#endif connect(buttonGroupAnalyzer, #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) &QButtonGroup::idClicked, @@ -49,7 +53,11 @@ DlgPrefReplayGain::DlgPrefReplayGain(QWidget* parent, UserSettingsPointer pConfi setScrollSafeGuard(SliderDefaultBoost); connect(checkBoxReanalyze, +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + &QCheckBox::checkStateChanged, +#else &QCheckBox::stateChanged, +#endif this, &DlgPrefReplayGain::slotSetReanalyze); diff --git a/src/widget/weffectchainpresetbutton.cpp b/src/widget/weffectchainpresetbutton.cpp index 56e4f40d462..9d6e129eda5 100644 --- a/src/widget/weffectchainpresetbutton.cpp +++ b/src/widget/weffectchainpresetbutton.cpp @@ -146,7 +146,11 @@ void WEffectChainPresetButton::populateMenu() { pEffectSlot->hideParameter(pParameter); } }; +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(pCheckbox.get(), &QCheckBox::checkStateChanged, this, handler); +#else connect(pCheckbox.get(), &QCheckBox::stateChanged, this, handler); +#endif auto pAction = make_parented(pEffectMenu); pAction->setDefaultWidget(pCheckbox.get()); @@ -166,7 +170,11 @@ void WEffectChainPresetButton::populateMenu() { pEffectSlot->hideParameter(pParameter); } }; +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(pCheckbox.get(), &QCheckBox::checkStateChanged, this, handler); +#else connect(pCheckbox.get(), &QCheckBox::stateChanged, this, handler); +#endif auto pAction = make_parented(pEffectMenu); pAction->setDefaultWidget(pCheckbox.get()); diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index ef1b52b35fc..697cccc263b 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -1550,7 +1550,17 @@ void WTrackMenu::slotPopulateCrateMenu() { m_pCrateMenu->addAction(pAction.get()); connect(pAction.get(), &QAction::triggered, this, [this, pCheckBox{pCheckBox.get()}] { updateSelectionCrates(pCheckBox); }); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + connect(pCheckBox.get(), + &QCheckBox::checkStateChanged, + this, + [this, pCheckBox{pCheckBox.get()}] { + updateSelectionCrates(pCheckBox); + }); +#else connect(pCheckBox.get(), &QCheckBox::stateChanged, this, [this, pCheckBox{pCheckBox.get()}] { updateSelectionCrates(pCheckBox); }); +#endif } m_pCrateMenu->addSeparator(); QAction* newCrateAction = new QAction(tr("Add to New Crate"), m_pCrateMenu); From 89f5f4df1fbbf50c2d6a06be16238694271f2243 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 6 Nov 2024 23:39:42 +0100 Subject: [PATCH 2/7] fix(build): Fix `-Wdeprecated-declarations` warnings for `QDateTime` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes warnings such as: In file included from mixxx/src/library/browse/browsethread.cpp:10: mixxx/src/util/datetime.h: In function ‘QDateTime mixxx::localDateTimeFromUtc(const QDateTime&)’: mixxx/src/util/datetime.h:16:51: error: ‘QDateTime::QDateTime(QDate, QTime, Qt::TimeSpec, int)’ is deprecated: Pass QTimeZone instead [-Werror=deprecated-declarations] 16 | return QDateTime(dt.date(), dt.time(), Qt::UTC).toLocalTime(); | ^ In file included from /usr/include/qt6/QtCore/QDateTime:1, from mixxx/src/util/fileinfo.h:5, from mixxx/src/util/fileaccess.h:3, from mixxx/src/library/browse/browsethread.h:14, from mixxx/src/library/browse/browsethread.cpp:1: /usr/include/qt6/QtCore/qdatetime.h:359:5: note: declared here 359 | QDateTime(QDate date, QTime time, Qt::TimeSpec spec, int offsetSeconds = 0); | ^~~~~~~~~ cc1plus: all warnings being treated as errors --- src/library/dao/trackdao.cpp | 4 ++++ src/preferences/dialog/dlgprefautodj.cpp | 11 +++++++++++ src/preferences/dialog/dlgprefautodjdlg.ui | 10 +++++++--- src/util/datetime.h | 5 +++++ src/util/db/sqlite.cpp | 6 ++++++ 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp index 0e8d72686ca..1a8c4570296 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -1197,7 +1197,11 @@ void setTrackSourceSynchronizedAt(const QSqlRecord& record, const int column, Tr if (!value.isNull() && value.canConvert()) { DEBUG_ASSERT(value.isValid()); const quint64 msecsSinceEpoch = qvariant_cast(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); diff --git a/src/preferences/dialog/dlgprefautodj.cpp b/src/preferences/dialog/dlgprefautodj.cpp index 1ef5153e572..d54ea0b2e02 100644 --- a/src/preferences/dialog/dlgprefautodj.cpp +++ b/src/preferences/dialog/dlgprefautodj.cpp @@ -1,5 +1,9 @@ #include "preferences/dialog/dlgprefautodj.h" +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +#include +#endif + #include "moc_dlgprefautodj.cpp" DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent, @@ -28,6 +32,13 @@ DlgPrefAutoDJ::DlgPrefAutoDJ(QWidget* pParent, #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( diff --git a/src/preferences/dialog/dlgprefautodjdlg.ui b/src/preferences/dialog/dlgprefautodjdlg.ui index c84dab445dd..05542aaf126 100644 --- a/src/preferences/dialog/dlgprefautodjdlg.ui +++ b/src/preferences/dialog/dlgprefautodjdlg.ui @@ -121,9 +121,13 @@ hh:mm - - Qt::LocalTime - + + 60 diff --git a/src/util/datetime.h b/src/util/datetime.h index 6cc238b1aa3..f921ddd7f29 100644 --- a/src/util/datetime.h +++ b/src/util/datetime.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include "util/assert.h" @@ -13,7 +14,11 @@ namespace mixxx { /// Obtain the local date time from an UTC date time. inline QDateTime localDateTimeFromUtc( const QDateTime& dt) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + return QDateTime(dt.date(), dt.time(), QTimeZone::UTC).toLocalTime(); +#else return QDateTime(dt.date(), dt.time(), Qt::UTC).toLocalTime(); +#endif } /// Extract a QDateTime from a QVariant. diff --git a/src/util/db/sqlite.cpp b/src/util/db/sqlite.cpp index fae53bde223..3610f10f517 100644 --- a/src/util/db/sqlite.cpp +++ b/src/util/db/sqlite.cpp @@ -1,5 +1,7 @@ #include "util/db/sqlite.h" +#include + #include "util/assert.h" namespace { @@ -40,7 +42,11 @@ QDateTime readGeneratedTimestamp(const QVariant& value) { VERIFY_OR_DEBUG_ASSERT(time.isValid()) { return QDateTime(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + return QDateTime(date, time, QTimeZone::UTC); +#else return QDateTime(date, time, Qt::UTC); +#endif } QVariant writeGeneratedTimestamp(const QDateTime& value) { From ed09269df7bcd94ab977a0e98a7ec9e21b73be96 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2024 00:19:27 +0100 Subject: [PATCH 3/7] fix(build): Fix `-Wdeprecated-declarations` warnings for `QDomDocument` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes warnings such as: mixxx/src/skin/legacy/legacyskinparser.cpp: In static member function ‘static QDomE lement LegacySkinParser::openSkin(const QString&)’: mixxx/src/skin/legacy/legacyskinparser.cpp:237:25: error: ‘bool QDomDocument::setCo ntent(QIODevice*, QString*, int*, int*)’ is deprecated: Use the overload returning ParseResult instead . [-Werror=deprecated-declarations] 237 | if (!skin.setContent(&skinXmlFile,&errorMessage,&errorLine,&errorColumn)) { | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/qt6/QtXml/QDomElement:1, from mixxx/src/skin/legacy/legacyskinparser.h:3, from mixxx/src/skin/legacy/legacyskinparser.cpp:1: /usr/include/qt6/QtXml/qdom.h:330:10: note: declared here 330 | bool setContent(QIODevice *dev, QString *errorMsg, int *errorLine = nullptr, int *errorCol umn = nullptr); | ^~~~~~~~~~ --- src/skin/legacy/legacyskinparser.cpp | 18 ++++++++++++++++++ src/util/xml.cpp | 19 +++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index 480928a3b66..e6dbdfb6640 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -227,6 +227,13 @@ QDomElement LegacySkinParser::openSkin(const QString& skinPath) { QDomDocument skin("skin"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + const auto parseResult = skin.setContent(&skinXmlFile); + if (!parseResult) { + qDebug() << "LegacySkinParser::openSkin - setContent failed see" + << "line:" << parseResult.errorLine << "column:" << parseResult.errorColumn; + qDebug() << "LegacySkinParser::openSkin - message:" << parseResult.errorMessage; +#else QString errorMessage; int errorLine; int errorColumn; @@ -235,6 +242,7 @@ QDomElement LegacySkinParser::openSkin(const QString& skinPath) { qDebug() << "LegacySkinParser::openSkin - setContent failed see" << "line:" << errorLine << "column:" << errorColumn; qDebug() << "LegacySkinParser::openSkin - message:" << errorMessage; +#endif return QDomElement(); } @@ -1732,6 +1740,15 @@ QDomElement LegacySkinParser::loadTemplate(const QString& path) { } QDomDocument tmpl("template"); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + const auto parseResult = tmpl.setContent(&templateFile); + if (!parseResult) { + qWarning() << "LegacySkinParser::loadTemplate - setContent failed see" + << absolutePath << "line:" << parseResult.errorLine + << "column:" << parseResult.errorColumn; + qWarning() << "LegacySkinParser::loadTemplate - message:" << parseResult.errorMessage; +#else QString errorMessage; int errorLine; int errorColumn; @@ -1741,6 +1758,7 @@ QDomElement LegacySkinParser::loadTemplate(const QString& path) { qWarning() << "LegacySkinParser::loadTemplate - setContent failed see" << absolutePath << "line:" << errorLine << "column:" << errorColumn; qWarning() << "LegacySkinParser::loadTemplate - message:" << errorMessage; +#endif return QDomElement(); } diff --git a/src/util/xml.cpp b/src/util/xml.cpp index ccfee0fb986..02c5b08957c 100644 --- a/src/util/xml.cpp +++ b/src/util/xml.cpp @@ -69,15 +69,22 @@ QDomElement XmlParse::openXMLFile(const QString& path, const QString& name) { qDebug() << "Could not open xml file:" << file.fileName(); return QDomElement(); } + +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + const auto parseResult = doc.setContent(&file); + if (!parseResult) { + QString errorString = QString("%1 at line %2, column %3") + .arg(parseResult.errorMessage) + .arg(parseResult.errorLine) + .arg(parseResult.errorColumn); + +#else QString error; int line, col; if (!doc.setContent(&file, &error, &line, &col)) { - QString errorString = QString("%1 at line %2, column %3") - .arg(error).arg(line).arg(col); - - QString errorLog = QString("Error parsing XML file %1: %2") - .arg(file.fileName(), errorString); - qWarning() << errorLog; + QString errorString = QString("%1 at line %2, column %3").arg(error).arg(line).arg(col); +#endif + qWarning().nospace() << "Error parsing XML file " << file.fileName() << ": " << errorString; // Set up error dialog ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties(); From 5d3f6f68398049ce9ff00d2cbeed2ad1550ccde0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2024 21:35:36 +0100 Subject: [PATCH 4/7] refactor: Use correct parameter value for `checkStateChanged` slots --- src/library/dlgtrackinfo.cpp | 4 ++++ src/library/dlgtrackinfo.h | 4 ++++ src/preferences/dialog/dlgprefautodj.cpp | 13 +++++++++- src/preferences/dialog/dlgprefautodj.h | 8 +++++++ src/preferences/dialog/dlgprefbeats.cpp | 25 ++++++++++++++++++++ src/preferences/dialog/dlgprefbeats.h | 8 +++++++ src/preferences/dialog/dlgprefbroadcast.cpp | 15 ++++++++++++ src/preferences/dialog/dlgprefbroadcast.h | 6 +++++ src/preferences/dialog/dlgprefkey.cpp | 15 ++++++++++++ src/preferences/dialog/dlgprefkey.h | 6 +++++ src/preferences/dialog/dlgprefreplaygain.cpp | 19 +++++++++++---- src/preferences/dialog/dlgprefreplaygain.h | 12 ++++++++-- src/widget/weffectchainpresetbutton.cpp | 18 ++++++++++---- 13 files changed, 141 insertions(+), 12 deletions(-) diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 30a7fa159f6..fbeb8edc256 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -666,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); diff --git a/src/library/dlgtrackinfo.h b/src/library/dlgtrackinfo.h index a05a7bfcb5f..c6404acd843 100644 --- a/src/library/dlgtrackinfo.h +++ b/src/library/dlgtrackinfo.h @@ -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); diff --git a/src/preferences/dialog/dlgprefautodj.cpp b/src/preferences/dialog/dlgprefautodj.cpp index d54ea0b2e02..9c23ae92d14 100644 --- a/src/preferences/dialog/dlgprefautodj.cpp +++ b/src/preferences/dialog/dlgprefautodj.cpp @@ -143,7 +143,10 @@ void DlgPrefAutoDJ::slotCancel() { ? Qt::Checked : Qt::Unchecked); slotToggleRandomQueue( - m_pConfig->getValue(ConfigKey("[Auto DJ]", "Requeue"))); + m_pConfig->getValue( + ConfigKey("[Auto DJ]", "Requeue"), false) + ? Qt::Checked + : Qt::Unchecked); } void DlgPrefAutoDJ::slotResetToDefaults() { @@ -167,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); @@ -198,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); diff --git a/src/preferences/dialog/dlgprefautodj.h b/src/preferences/dialog/dlgprefautodj.h index cc5e28fde06..50185889cb7 100644 --- a/src/preferences/dialog/dlgprefautodj.h +++ b/src/preferences/dialog/dlgprefautodj.h @@ -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; diff --git a/src/preferences/dialog/dlgprefbeats.cpp b/src/preferences/dialog/dlgprefbeats.cpp index fc6ec59e30a..3849ab0e3ec 100644 --- a/src/preferences/dialog/dlgprefbeats.cpp +++ b/src/preferences/dialog/dlgprefbeats.cpp @@ -109,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(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(i); +#endif slotUpdate(); } @@ -159,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(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(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(i); +#endif slotUpdate(); } diff --git a/src/preferences/dialog/dlgprefbeats.h b/src/preferences/dialog/dlgprefbeats.h index b63f56c5b90..69317d33a39 100644 --- a/src/preferences/dialog/dlgprefbeats.h +++ b/src/preferences/dialog/dlgprefbeats.h @@ -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(); diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index 8eaba663c7d..e259a043f52 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -292,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); } diff --git a/src/preferences/dialog/dlgprefbroadcast.h b/src/preferences/dialog/dlgprefbroadcast.h index fa52f4ed7e8..589ecb8a1c9 100644 --- a/src/preferences/dialog/dlgprefbroadcast.h +++ b/src/preferences/dialog/dlgprefbroadcast.h @@ -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: diff --git a/src/preferences/dialog/dlgprefkey.cpp b/src/preferences/dialog/dlgprefkey.cpp index 1730ce21488..23b38a33962 100644 --- a/src/preferences/dialog/dlgprefkey.cpp +++ b/src/preferences/dialog/dlgprefkey.cpp @@ -188,18 +188,33 @@ void DlgPrefKey::pluginSelected(int i) { slotUpdate(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +void DlgPrefKey::analyzerEnabled(Qt::CheckState state) { + m_bAnalyzerEnabled = (state == Qt::Checked); +#else void DlgPrefKey::analyzerEnabled(int i) { m_bAnalyzerEnabled = static_cast(i); +#endif slotUpdate(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +void DlgPrefKey::fastAnalysisEnabled(Qt::CheckState state) { + m_bFastAnalysisEnabled = (state == Qt::Checked); +#else void DlgPrefKey::fastAnalysisEnabled(int i) { m_bFastAnalysisEnabled = static_cast(i); +#endif slotUpdate(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +void DlgPrefKey::reanalyzeEnabled(Qt::CheckState state) { + m_bReanalyzeEnabled = (state == Qt::Checked); +#else void DlgPrefKey::reanalyzeEnabled(int i) { m_bReanalyzeEnabled = static_cast(i); +#endif slotUpdate(); } diff --git a/src/preferences/dialog/dlgprefkey.h b/src/preferences/dialog/dlgprefkey.h index 42edc479e2b..9af2b6045bb 100644 --- a/src/preferences/dialog/dlgprefkey.h +++ b/src/preferences/dialog/dlgprefkey.h @@ -28,9 +28,15 @@ class DlgPrefKey : public DlgPreferencePage, Ui::DlgPrefKeyDlg { private slots: void pluginSelected(int i); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + void analyzerEnabled(Qt::CheckState state); + void fastAnalysisEnabled(Qt::CheckState state); + void reanalyzeEnabled(Qt::CheckState state); +#else void analyzerEnabled(int i); void fastAnalysisEnabled(int i); void reanalyzeEnabled(int i); +#endif void setNotation(KeyUtils::KeyNotation notation); void setNotationOpenKey(bool); diff --git a/src/preferences/dialog/dlgprefreplaygain.cpp b/src/preferences/dialog/dlgprefreplaygain.cpp index 17280a60562..7324ff5bf43 100644 --- a/src/preferences/dialog/dlgprefreplaygain.cpp +++ b/src/preferences/dialog/dlgprefreplaygain.cpp @@ -121,8 +121,13 @@ void DlgPrefReplayGain::slotResetToDefaults() { slotApply(); } -void DlgPrefReplayGain::slotSetRGEnabled() { - m_rgSettings.setReplayGainEnabled(EnableGain->isChecked()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +void DlgPrefReplayGain::slotSetRGEnabled(Qt::CheckState state) { + m_rgSettings.setReplayGainEnabled(state == Qt::Checked); +#else +void DlgPrefReplayGain::slotSetRGEnabled(int isChecked) { + m_rgSettings.setReplayGainEnabled(static_cast(isChecked)); +#endif slotUpdate(); slotApply(); } @@ -186,8 +191,12 @@ void DlgPrefReplayGain::slotApply() { m_enabled.set(EnableGain->isChecked() ? 1.0 : 0.0); } -void DlgPrefReplayGain::slotSetReanalyze() { - bool checked = checkBoxReanalyze->isChecked(); - m_rgSettings.setReplayGainReanalyze(checked); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +void DlgPrefReplayGain::slotSetReanalyze(Qt::CheckState state) { + m_rgSettings.setReplayGainReanalyze(state == Qt::Checked); +#else +void DlgPrefReplayGain::slotSetReanalyze(int state) { + m_rgSettings.setReplayGainReanalyze(static_cast(state)); +#endif slotApply(); } diff --git a/src/preferences/dialog/dlgprefreplaygain.h b/src/preferences/dialog/dlgprefreplaygain.h index 98372fe63e4..88b69743579 100644 --- a/src/preferences/dialog/dlgprefreplaygain.h +++ b/src/preferences/dialog/dlgprefreplaygain.h @@ -20,9 +20,17 @@ class DlgPrefReplayGain: public DlgPreferencePage, // Update initial gain increment void slotUpdateReplayGainBoost(); void slotUpdateDefaultBoost(); - void slotSetRGEnabled(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + void slotSetRGEnabled(Qt::CheckState); +#else + void slotSetRGEnabled(int); +#endif void slotSetRGAnalyzerChanged(); - void slotSetReanalyze(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + void slotSetReanalyze(Qt::CheckState); +#else + void slotSetReanalyze(int); +#endif void slotApply() override; void slotUpdate() override; diff --git a/src/widget/weffectchainpresetbutton.cpp b/src/widget/weffectchainpresetbutton.cpp index 9d6e129eda5..067113f6d7e 100644 --- a/src/widget/weffectchainpresetbutton.cpp +++ b/src/widget/weffectchainpresetbutton.cpp @@ -139,8 +139,13 @@ void WEffectChainPresetButton::populateMenu() { auto pCheckbox = make_parented(pEffectMenu); pCheckbox->setChecked(true); pCheckbox->setText(pParameter->manifest()->name()); - auto handler = [pCheckbox{pCheckbox.get()}, pEffectSlot, pParameter] { - if (pCheckbox->isChecked()) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + auto handler = [pEffectSlot, pParameter](Qt::CheckState state) { + if (state == Qt::Checked) { +#else + auto handler = [pEffectSlot, pParameter](int state) { + if (static_cast(state)) { +#endif pEffectSlot->showParameter(pParameter); } else { pEffectSlot->hideParameter(pParameter); @@ -163,8 +168,13 @@ void WEffectChainPresetButton::populateMenu() { auto pCheckbox = make_parented(pEffectMenu); pCheckbox->setChecked(false); pCheckbox->setText(pParameter->manifest()->name()); - auto handler = [pCheckbox{pCheckbox.get()}, pEffectSlot, pParameter] { - if (pCheckbox->isChecked()) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + auto handler = [pEffectSlot, pParameter](Qt::CheckState state) { + if (state == Qt::Checked) { +#else + auto handler = [pEffectSlot, pParameter](int state) { + if (static_cast(state)) { +#endif pEffectSlot->showParameter(pParameter); } else { pEffectSlot->hideParameter(pParameter); From 12dd4c7541749454ef8e6b7d94e850a7d3807149 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2024 21:40:57 +0100 Subject: [PATCH 5/7] refactor(weffectchainpresetbutton): Deduplicate some code --- src/widget/weffectchainpresetbutton.cpp | 66 ++++++++----------------- 1 file changed, 20 insertions(+), 46 deletions(-) diff --git a/src/widget/weffectchainpresetbutton.cpp b/src/widget/weffectchainpresetbutton.cpp index 067113f6d7e..3b7e7d694b8 100644 --- a/src/widget/weffectchainpresetbutton.cpp +++ b/src/widget/weffectchainpresetbutton.cpp @@ -135,61 +135,35 @@ void WEffectChainPresetButton::populateMenu() { static_cast(parameterTypeId); const auto& loadedParameters = pEffectSlot->getLoadedParameters().value(parameterType); - for (const auto& pParameter : loadedParameters) { - auto pCheckbox = make_parented(pEffectMenu); - pCheckbox->setChecked(true); - pCheckbox->setText(pParameter->manifest()->name()); -#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - auto handler = [pEffectSlot, pParameter](Qt::CheckState state) { - if (state == Qt::Checked) { -#else - auto handler = [pEffectSlot, pParameter](int state) { - if (static_cast(state)) { -#endif - pEffectSlot->showParameter(pParameter); - } else { - pEffectSlot->hideParameter(pParameter); - } - }; -#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - connect(pCheckbox.get(), &QCheckBox::checkStateChanged, this, handler); -#else - connect(pCheckbox.get(), &QCheckBox::stateChanged, this, handler); -#endif - - auto pAction = make_parented(pEffectMenu); - pAction->setDefaultWidget(pCheckbox.get()); - - pEffectMenu->addAction(pAction.get()); - } - const auto& hiddenParameters = pEffectSlot->getHiddenParameters().value(parameterType); - for (const auto& pParameter : hiddenParameters) { - auto pCheckbox = make_parented(pEffectMenu); - pCheckbox->setChecked(false); - pCheckbox->setText(pParameter->manifest()->name()); + for (const auto& parameters : {loadedParameters, hiddenParameters}) { + for (const auto& pParameter : parameters) { + auto pCheckbox = make_parented(pEffectMenu); + pCheckbox->setChecked(true); + pCheckbox->setText(pParameter->manifest()->name()); #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - auto handler = [pEffectSlot, pParameter](Qt::CheckState state) { - if (state == Qt::Checked) { + auto handler = [pEffectSlot, pParameter](Qt::CheckState state) { + if (state == Qt::Checked) { #else - auto handler = [pEffectSlot, pParameter](int state) { - if (static_cast(state)) { + auto handler = [pEffectSlot, pParameter](int state) { + if (static_cast(state)) { #endif - pEffectSlot->showParameter(pParameter); - } else { - pEffectSlot->hideParameter(pParameter); - } - }; + pEffectSlot->showParameter(pParameter); + } else { + pEffectSlot->hideParameter(pParameter); + } + }; #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - connect(pCheckbox.get(), &QCheckBox::checkStateChanged, this, handler); + connect(pCheckbox.get(), &QCheckBox::checkStateChanged, this, handler); #else - connect(pCheckbox.get(), &QCheckBox::stateChanged, this, handler); + connect(pCheckbox.get(), &QCheckBox::stateChanged, this, handler); #endif - auto pAction = make_parented(pEffectMenu); - pAction->setDefaultWidget(pCheckbox.get()); + auto pAction = make_parented(pEffectMenu); + pAction->setDefaultWidget(pCheckbox.get()); - pEffectMenu->addAction(pAction.get()); + pEffectMenu->addAction(pAction.get()); + } } } pEffectMenu->addSeparator(); From 768c02241d3a7a26b78ed3987c827a141157f708 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 7 Nov 2024 22:05:51 +0100 Subject: [PATCH 6/7] refactor(xml): Use `QString::number` to avoid multi-`arg` --- src/util/xml.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/util/xml.cpp b/src/util/xml.cpp index 02c5b08957c..06726be1649 100644 --- a/src/util/xml.cpp +++ b/src/util/xml.cpp @@ -73,10 +73,11 @@ QDomElement XmlParse::openXMLFile(const QString& path, const QString& name) { #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) const auto parseResult = doc.setContent(&file); if (!parseResult) { - QString errorString = QString("%1 at line %2, column %3") - .arg(parseResult.errorMessage) - .arg(parseResult.errorLine) - .arg(parseResult.errorColumn); + QString errorString = + QStringLiteral("%1 at line %2, column %3") + .arg(parseResult.errorMessage, + QString::number(parseResult.errorLine), + QString::number(parseResult.errorColumn)); #else QString error; From 6eb87608670821f8a7070acfa4352c8186b6e405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 8 Nov 2024 22:48:35 +0100 Subject: [PATCH 7/7] Make iterator const --- src/library/tabledelegates/coverartdelegate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/library/tabledelegates/coverartdelegate.cpp b/src/library/tabledelegates/coverartdelegate.cpp index df7417a522e..f48713018b6 100644 --- a/src/library/tabledelegates/coverartdelegate.cpp +++ b/src/library/tabledelegates/coverartdelegate.cpp @@ -178,14 +178,14 @@ void CoverArtDelegate::paintItem( } void CoverArtDelegate::cleanCacheMissRows() const { - auto it = m_cacheMissRows.begin(); - while (it != m_cacheMissRows.end()) { + auto it = m_cacheMissRows.cbegin(); + while (it != m_cacheMissRows.cend()) { const QModelIndex index = m_pTableView->model()->index(*it, m_column); const QRect rect = m_pTableView->visualRect(index); if (!rect.intersects(m_pTableView->rect())) { // Cover image row is no longer shown. We keep the set // small which likely reuses the allocatd memory later - it = m_cacheMissRows.erase(it); + it = constErase(&m_cacheMissRows, it); } else { ++it; }