From 333b66368cfa691dfdb55f0d1ba7910174a5254f Mon Sep 17 00:00:00 2001 From: Be Date: Thu, 21 May 2020 22:34:35 -0500 Subject: [PATCH] remove "controller engine version" concept This was introduced in PR #1795 when the migration to QJSEngine was planned for a release when the latest Ubuntu version shipped Qt 5.9, which did not support ES7. The purpose was to show users an error when they loaded a script using ES7 if they were using a Qt version before 5.12. Since Mixxx 2.3 took so long, the QJSEngine migration will be released when the latest Ubuntu LTS (20.04) ships Qt 5.12, so we do not need to introduce this "controller engine version" concept anymore. Mixxx will still build and run with Qt < 5.12 at the small cost of keeping only one #if in ControllerEngine::throwJSError, but mappings using ES7, which now includes any mapping using the Components library, will not work. --- src/controllers/controllerpreset.h | 8 ----- .../controllerpresetfilehandler.cpp | 3 -- src/controllers/dlgprefcontroller.cpp | 34 +------------------ src/controllers/dlgprefcontroller.h | 4 --- src/controllers/engine/controllerengine.h | 9 ----- src/preferences/dlgpreferencepage.h | 7 ---- 6 files changed, 1 insertion(+), 64 deletions(-) diff --git a/src/controllers/controllerpreset.h b/src/controllers/controllerpreset.h index d397d896c03c..f30f6d9c9f0c 100644 --- a/src/controllers/controllerpreset.h +++ b/src/controllers/controllerpreset.h @@ -151,14 +151,6 @@ class ControllerPreset { return m_mixxxVersion; } - inline void setControllerEngineVersion(int iControllerEngineVersion) { - m_iControllerEngineVersion = iControllerEngineVersion; - } - - inline int controllerEngineVersion() const { - return m_iControllerEngineVersion; - } - inline void addProductMatch(QHash match) { m_productMatches.append(match); setDirty(true); diff --git a/src/controllers/controllerpresetfilehandler.cpp b/src/controllers/controllerpresetfilehandler.cpp index 108a7f9d114a..6d147a6e8858 100644 --- a/src/controllers/controllerpresetfilehandler.cpp +++ b/src/controllers/controllerpresetfilehandler.cpp @@ -87,8 +87,6 @@ void ControllerPresetFileHandler::parsePresetInfo( return; } - int iControllerEngineVersion = root.attribute("controllerEngineVersion", 0).toInt(); - preset->setControllerEngineVersion(iControllerEngineVersion); QString mixxxVersion = root.attribute("mixxxVersion", ""); preset->setMixxxVersion(mixxxVersion); QString schemaVersion = root.attribute("schemaVersion", ""); @@ -194,7 +192,6 @@ QDomDocument ControllerPresetFileHandler::buildRootWithScripts( QDomElement rootNode = doc.documentElement(); rootNode.setAttribute("schemaVersion", XML_SCHEMA_VERSION); rootNode.setAttribute("mixxxVersion", preset.mixxxVersion()); - rootNode.setAttribute("controllerEngineVersion", preset.controllerEngineVersion()); QDomElement info = doc.createElement("info"); rootNode.appendChild(info); diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index 4989a51ed798..1f1999078489 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -33,8 +33,7 @@ DlgPrefController::DlgPrefController(QWidget* parent, Controller* controller, Co m_pInputProxyModel(NULL), m_pOutputTableModel(NULL), m_pOutputProxyModel(NULL), - m_bDirty(false), - m_bState(State::valid) { + m_bDirty(false) { m_ui.setupUi(this); initTableView(m_ui.m_pInputMappingTableView); @@ -545,7 +544,6 @@ void DlgPrefController::slotShowPreset(ControllerPresetPointer preset) { m_ui.labelLoadedPreset->setText(presetName(preset)); m_ui.labelLoadedPresetDescription->setText(presetDescription(preset)); m_ui.labelLoadedPresetAuthor->setText(presetAuthor(preset)); - checkPresetCompatibility(preset); QStringList supportLinks; QString forumLink = presetForumLink(preset); @@ -625,36 +623,6 @@ void DlgPrefController::slotShowPreset(ControllerPresetPointer preset) { m_pOutputTableModel = pOutputModel; } -void DlgPrefController::checkPresetCompatibility(ControllerPresetPointer preset) { - if (m_ui.chkEnabledDevice->isChecked() && !presetIsSupported(preset)) { - m_bState = State::invalid; - m_ui.groupBoxWarning->show(); - m_ui.btnLearningWizard->setEnabled(false); - m_ui.btnAddInputMapping->setEnabled(false); - m_ui.btnRemoveInputMappings->setEnabled(false); - m_ui.btnClearAllInputMappings->setEnabled(false); - m_ui.btnAddOutputMapping->setEnabled(false); - m_ui.btnRemoveOutputMappings->setEnabled(false); - m_ui.btnClearAllOutputMappings->setEnabled(false); - } else { - m_bState = State::valid; - m_ui.groupBoxWarning->hide(); - bool isMappable = m_pController->isMappable(); - m_ui.btnLearningWizard->setEnabled(isMappable); - m_ui.btnAddInputMapping->setEnabled(true); - m_ui.btnRemoveInputMappings->setEnabled(true); - m_ui.btnClearAllInputMappings->setEnabled(true); - m_ui.btnAddOutputMapping->setEnabled(true); - m_ui.btnRemoveOutputMappings->setEnabled(true); - m_ui.btnClearAllOutputMappings->setEnabled(true); - } -} - - -bool DlgPrefController::presetIsSupported(ControllerPresetPointer preset) { - return ControllerEngine::version >= preset->controllerEngineVersion(); -} - void DlgPrefController::addInputMapping() { if (m_pInputTableModel) { m_pInputTableModel->addEmptyMapping(); diff --git a/src/controllers/dlgprefcontroller.h b/src/controllers/dlgprefcontroller.h index 3d25e6d7662d..c50bffe6a38a 100644 --- a/src/controllers/dlgprefcontroller.h +++ b/src/controllers/dlgprefcontroller.h @@ -73,7 +73,6 @@ class DlgPrefController : public DlgPreferencePage { QString presetDescription(const ControllerPresetPointer pPreset) const; QString presetForumLink(const ControllerPresetPointer pPreset) const; QString presetWikiLink(const ControllerPresetPointer pPreset) const; - void checkPresetCompatibility(ControllerPresetPointer preset); QString presetScriptFileLinks(const ControllerPresetPointer pPreset) const; void applyPresetChanges(); void savePreset(); @@ -108,8 +107,6 @@ class DlgPrefController : public DlgPreferencePage { void enableDevice(); void disableDevice(); - inline bool presetIsSupported(ControllerPresetPointer preset); - Ui::DlgPrefControllerDlg m_ui; UserSettingsPointer m_pConfig; ControllerManager* m_pControllerManager; @@ -121,7 +118,6 @@ class DlgPrefController : public DlgPreferencePage { ControllerOutputMappingTableModel* m_pOutputTableModel; QSortFilterProxyModel* m_pOutputProxyModel; bool m_bDirty; - State m_bState; }; #endif /*DLGPREFCONTROLLER_H*/ diff --git a/src/controllers/engine/controllerengine.h b/src/controllers/engine/controllerengine.h index adea6310a628..d9f05224e23e 100644 --- a/src/controllers/engine/controllerengine.h +++ b/src/controllers/engine/controllerengine.h @@ -82,15 +82,6 @@ class ControllerEngine : public QObject { ControllerEngine(Controller* controller); virtual ~ControllerEngine(); - // The controller engine version is used to check compatibility of presets. -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - // Qt >= 5.12.0 supports ECMAScript 7 (2016) - static const int version = 2; -#else - // Qt < 5.12.0 supports ECMAScript 5 (2009) - static const int version = 1; -#endif - // Execute a JS function in the engine bool executeFunction(QJSValue functionObject, QJSValueList arguments); bool executeFunction(QJSValue functionObject, const QByteArray& data); diff --git a/src/preferences/dlgpreferencepage.h b/src/preferences/dlgpreferencepage.h index 3ed62ead3099..114cb043e4dc 100644 --- a/src/preferences/dlgpreferencepage.h +++ b/src/preferences/dlgpreferencepage.h @@ -8,13 +8,6 @@ class DlgPreferencePage : public QWidget { Q_OBJECT public: - enum class State { - // The preferences are valid and can be applied. - valid, - // There's something wrong with the preferences and they cannot be applied. - invalid - }; - DlgPreferencePage(QWidget* pParent); virtual ~DlgPreferencePage();