Skip to content

Commit

Permalink
remove "controller engine version" concept
Browse files Browse the repository at this point in the history
This was introduced in PR mixxxdj#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.
  • Loading branch information
Be-ing committed May 22, 2020
1 parent 7c1cab3 commit 333b663
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 64 deletions.
8 changes: 0 additions & 8 deletions src/controllers/controllerpreset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString,QString> match) {
m_productMatches.append(match);
setDirty(true);
Expand Down
3 changes: 0 additions & 3 deletions src/controllers/controllerpresetfilehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
Expand Down Expand Up @@ -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);
Expand Down
34 changes: 1 addition & 33 deletions src/controllers/dlgprefcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 0 additions & 4 deletions src/controllers/dlgprefcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -121,7 +118,6 @@ class DlgPrefController : public DlgPreferencePage {
ControllerOutputMappingTableModel* m_pOutputTableModel;
QSortFilterProxyModel* m_pOutputProxyModel;
bool m_bDirty;
State m_bState;
};

#endif /*DLGPREFCONTROLLER_H*/
9 changes: 0 additions & 9 deletions src/controllers/engine/controllerengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions src/preferences/dlgpreferencepage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 333b663

Please sign in to comment.