diff --git a/src/coreservices.cpp b/src/coreservices.cpp index 0415ec27307..371d6d7cad7 100644 --- a/src/coreservices.cpp +++ b/src/coreservices.cpp @@ -423,6 +423,28 @@ void CoreServices::initialize(QApplication* pApp) { m_pTouchShift = std::make_unique(ConfigKey("[Controls]", "touch_shift")); + // The following UI controls must be created here so that controllers can bind to them + // on startup. + m_uiControls.clear(); + const std::vector uiKeys = { + ConfigKey("[Master]", "skin_settings"), + ConfigKey("[Microphone]", "show_microphone"), + ConfigKey(VINYL_PREF_KEY, "show_vinylcontrol"), + ConfigKey("[PreviewDeck]", "show_previewdeck"), + ConfigKey("[Library]", "show_coverart"), + ConfigKey("[Master]", "maximize_library"), + ConfigKey("[Samplers]", "show_samplers"), + ConfigKey("[EffectRack1]", "show"), + ConfigKey("[Skin]", "show_4effectunits"), + ConfigKey("[Master]", "show_mixer"), + }; + + m_uiControls.reserve(uiKeys.size()); + for (const auto& key : uiKeys) { + m_uiControls.emplace_back(std::make_unique(key)); + m_uiControls.back()->setButtonMode(ControlPushButton::TOGGLE); + } + // Load tracks in args.qlMusicFiles (command line arguments) into player // 1 and 2: const QList& musicFiles = m_cmdlineArgs.getMusicFiles(); @@ -597,6 +619,8 @@ void CoreServices::finalize() { m_pTouchShift.reset(); + m_uiControls.clear(); + m_pControlIndicatorTimer.reset(); t.elapsed(true); diff --git a/src/coreservices.h b/src/coreservices.h index b45a80cf6e0..01c4ba4e512 100644 --- a/src/coreservices.h +++ b/src/coreservices.h @@ -151,6 +151,7 @@ class CoreServices : public QObject { std::shared_ptr m_pScreensaverManager; + std::vector> m_uiControls; std::unique_ptr m_pTouchShift; Timer m_runtime_timer;