diff options
author | Be <be@mixxx.org> | 2021-09-28 17:04:28 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2021-09-29 18:50:07 -0500 |
commit | 9218ea976147bef1bd9c2905f7e7476a2946c7fb (patch) | |
tree | 3139444bbe4d46a5e99331e9d190ef263be4b9dd /src/qml/qmlapplication.cpp | |
parent | 9215fc62e3496c84ccebddbe9c438cf0c4e919a0 (diff) |
add QML button to show DlgPreferences
Diffstat (limited to 'src/qml/qmlapplication.cpp')
-rw-r--r-- | src/qml/qmlapplication.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/qml/qmlapplication.cpp b/src/qml/qmlapplication.cpp index dc3d03e488..9cdf2f34ab 100644 --- a/src/qml/qmlapplication.cpp +++ b/src/qml/qmlapplication.cpp @@ -4,6 +4,7 @@ #include "qml/asyncimageprovider.h" #include "qml/qmlconfigproxy.h" #include "qml/qmlcontrolproxy.h" +#include "qml/qmldlgpreferencesproxy.h" #include "qml/qmleffectmanifestparametersmodel.h" #include "qml/qmleffectslotproxy.h" #include "qml/qmleffectsmanagerproxy.h" @@ -46,8 +47,23 @@ QmlApplication::QmlApplication( exit(result); } - qmlRegisterType<QmlControlProxy>("Mixxx", 0, 1, "ControlProxy"); - qmlRegisterType<QmlWaveformOverview>("Mixxx", 0, 1, "WaveformOverview"); + // FIXME: DlgPreferences has some initialization logic that must be executed + // before the GUI is shown, at least for the effects system. + m_pDlgPreferences = std::make_shared<DlgPreferences>( + m_pCoreServices->getScreensaverManager(), + nullptr, + m_pCoreServices->getSoundManager(), + m_pCoreServices->getPlayerManager(), + m_pCoreServices->getControllerManager(), + m_pCoreServices->getVinylControlManager(), + m_pCoreServices->getLV2Backend(), + m_pCoreServices->getEffectsManager(), + m_pCoreServices->getSettingsManager(), + m_pCoreServices->getLibrary()); + // Without this, QApplication will quit when the last QWidget QWindow is + // closed because it does not take into account the window created by + // the QQmlApplicationEngine. + m_pDlgPreferences->setAttribute(Qt::WA_QuitOnClose, false); // Any uncreateable non-singleton types registered here require arguments // that we don't want to expose to QML directly. Instead, they can be @@ -66,6 +82,21 @@ QmlApplication::QmlApplication( // convert them to shared_ptrs when the QQmlApplicationEngine instantiates // the QML proxy objects. + qmlRegisterSingletonType<QmlDlgPreferencesProxy>("Mixxx", + 0, + 1, + "PreferencesDialog", + lambda_to_singleton_type_factory_ptr( + [pDlgPreferences = std::weak_ptr<DlgPreferences>( + m_pDlgPreferences)](QQmlEngine* pEngine, + QJSEngine* pScriptEngine) -> QObject* { + Q_UNUSED(pScriptEngine); + return new QmlDlgPreferencesProxy(pDlgPreferences.lock(), pEngine); + })); + + qmlRegisterType<QmlControlProxy>("Mixxx", 0, 1, "ControlProxy"); + qmlRegisterType<QmlWaveformOverview>("Mixxx", 0, 1, "WaveformOverview"); + qmlRegisterSingletonType<QmlEffectsManagerProxy>("Mixxx", 0, 1, |