@@ -129,7 +129,7 @@ bool ControllerScriptEngineLegacy::callShutdownFunction() {
129129
130130#ifdef MIXXX_USE_QML
131131 for (const auto & controller : m_mixxxController) {
132- controller->shutdown ();
132+ emit controller->shutdown ();
133133 }
134134
135135 if (!m_bQmlMode) {
@@ -207,7 +207,7 @@ bool ControllerScriptEngineLegacy::callInitFunction() {
207207 }
208208
209209 for (const auto & controller : m_mixxxController) {
210- controller->init ();
210+ emit controller->init ();
211211 }
212212
213213 QHashIterator<QString, std::shared_ptr<QQuickItem>> i (m_rootItems);
@@ -261,48 +261,7 @@ bool ControllerScriptEngineLegacy::callInitFunction() {
261261 // ControllerScriptEngineBase::handleQMLErrors
262262 }
263263
264- QListIterator<std::shared_ptr<mixxx::qml::MixxxController>> controllers (m_mixxxController);
265- bool controllersSuccess = true ;
266- while (controllers.hasNext ()) {
267- const QMetaObject* metaObject = controllers.next ()->metaObject ();
268-
269- VERIFY_OR_DEBUG_ASSERT (metaObject) {
270- qCWarning (m_logger) << " Invalid meta object for controller" ;
271- continue ;
272- }
273-
274- QMetaMethod initFunction;
275- bool typed = false ;
276- int methodIdx = metaObject->indexOfMethod (kQmlComponentInitFunctionUntypedSignature );
277-
278- if (methodIdx == -1 || !metaObject->method (methodIdx).isValid ()) {
279- qCDebug (m_logger) << " QML controller has no valid untyped init method." ;
280- methodIdx = metaObject->indexOfMethod (kQmlComponentFunctionTypedSignature );
281- typed = true ;
282- }
283-
284- initFunction = metaObject->method (methodIdx);
285-
286- if (!initFunction.isValid ()) {
287- qCDebug (m_logger) << " QML controller has no valid untyped init method; Skipping." ;
288- continue ;
289- }
290-
291- qCDebug (m_logger) << " Executing init on QML controller" ;
292- if (typed) {
293- success &= initFunction.invoke (i.value ().get (),
294- Qt::DirectConnection,
295- Q_ARG (QString, controllerName),
296- Q_ARG (bool , m_logger ().isDebugEnabled ()));
297- } else {
298- success &= initFunction.invoke (i.value ().get (),
299- Qt::DirectConnection,
300- Q_ARG (QVariant, controllerName),
301- Q_ARG (QVariant, m_logger ().isDebugEnabled ()));
302- }
303- }
304-
305- return success && controllersSuccess;
264+ return success;
306265 }
307266#endif
308267}
0 commit comments