Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrevert "Create wmainmenubar controls in coreservices so they are available to controllers on startup" #4661

Merged
merged 4 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,29 @@ void CoreServices::initialize(QApplication* pApp) {

m_pTouchShift = std::make_unique<ControlPushButton>(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<ConfigKey> 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<ControlPushButton>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

persist = true already fetches the last value from the config.
The default value is used as a default if there is not yet anything stored.

UserSettingsPointer pConfig = s_pUserConfig;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah got it. Fixed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, does that mean we need to pick the first-run defaults here? Seems so

key, true, pConfig->getValue(key).toDouble()));
m_uiControls.back()->setButtonMode(ControlPushButton::TOGGLE);
}

// Load tracks in args.qlMusicFiles (command line arguments) into player
// 1 and 2:
const QList<QString>& musicFiles = m_cmdlineArgs.getMusicFiles();
Expand Down Expand Up @@ -597,6 +620,8 @@ void CoreServices::finalize() {

m_pTouchShift.reset();

m_uiControls.clear();

m_pControlIndicatorTimer.reset();

t.elapsed(true);
Expand Down
1 change: 1 addition & 0 deletions src/coreservices.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class CoreServices : public QObject {

std::shared_ptr<mixxx::ScreensaverManager> m_pScreensaverManager;

std::vector<std::unique_ptr<ControlPushButton>> m_uiControls;
std::unique_ptr<ControlPushButton> m_pTouchShift;

Timer m_runtime_timer;
Expand Down