Skip to content

Commit

Permalink
Refactor QML instanciation
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehenry committed Jul 15, 2024
1 parent c4eba93 commit 2a03ebf
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 169 deletions.
16 changes: 6 additions & 10 deletions res/controllers/Denon-DN-S3700.qml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import QtQuick
import QtQml

Item {
id: controller
import "Mixxx"

property string controllerId: ""
property bool debugMode: false
MixxxController {
id: controller

function init(controllerId, debugMode) {
controller.controllerId = controllerId;
controller.debugMode = debugMode;
console.error(controllerId, debugMode);
function init() {
console.error(controller.controllerId, controller.debugMode);
}
function shutdown() {
console.error(`Shutting down ${controller.controllerId} with debug mode ${controller.controllerId}`);
console.error(`Shutting down ${controller.controllerId} with debug mode ${controller.debugMode}`);
}
}
2 changes: 2 additions & 0 deletions src/controllers/legacycontrollermapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "controllers/legacycontrollersettingslayout.h"
#include "defs_urls.h"
#include "preferences/usersettings.h"
#include "qml/mixxxcontroller.h"
#include "util/assert.h"

/// This class represents a controller mapping, containing the data elements that
Expand Down Expand Up @@ -374,6 +375,7 @@ class LegacyControllerMapping {
#ifdef MIXXX_USE_QML
QList<QMLModuleInfo> m_modules;
QList<ScreenInfo> m_screens;
QList<mixxx::qml::MixxxController> m_mixxxControllers;
#endif
QList<ScriptFileInfo> m_scripts;
DeviceDirections m_deviceDirection;
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/legacycontrollermappingfilehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ void LegacyControllerMappingFileHandler::addScriptFilesToMapping(
QFileInfo file = findScriptFile(mapping, filename, systemMappingsPath);
if (file.suffix() == "qml") {
#ifdef MIXXX_USE_QML
QString identifier = scriptFile.attribute("identifier", "");
QString identifier = scriptFile.attribute(
"identifier", scriptFile.attribute("functionprefix", ""));
mapping->addScriptFile(LegacyControllerMapping::ScriptFileInfo{
filename,
identifier,
Expand Down
Loading

0 comments on commit 2a03ebf

Please sign in to comment.