Fix #6: apply config dialog changes to running projectM instance - #17
Draft
struktured wants to merge 2 commits into
Draft
Fix #6: apply config dialog changes to running projectM instance#17struktured wants to merge 2 commits into
struktured wants to merge 2 commits into
Conversation
Previously, saving the settings dialog only wrote values to the config file — the running projectM instance kept using the old values until the next launch. The reset signal was gated on PROJECTM_RESET_IS_THREAD_SAFE which is never defined. Add applyLiveSettings() that pushes the new values via the projectM 4.x runtime API after writing the config file. Applies: - FPS, aspect correction, beat sensitivity - Soft cut and preset durations - Easter egg parameter - Window and mesh size Texture size, preset path, shuffle, and font paths still require restart since they need GL context recreation or playlist reload. Closes #6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR wires the Qt Settings dialog to immediately apply supported configuration changes to the running projectM 4.x instance, rather than only writing them to config.inp and requiring an app restart.
Changes:
- Add
applyLiveSettings()and invoke it aftersaveConfig()on Save. - Apply runtime-tunable settings via projectM 4.x public C API setters (FPS, aspect correction, beat sensitivity, durations, easter egg, window/mesh size).
- Remove the previously dead
#ifdef PROJECTM_RESET_IS_THREAD_SAFEreset gate in the Save handler.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/common/qprojectmconfigdialog.hpp |
Declares new applyLiveSettings() helper. |
src/common/qprojectmconfigdialog.cpp |
Implements applyLiveSettings() and calls it after saving settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+173
to
+181
| projectm_set_fps(pm, _ui.maxFPSSpinBox->value()); | ||
| projectm_set_aspect_correction(pm, _ui.useAspectCorrectionCheckBox->checkState() == Qt::Checked); | ||
| projectm_set_beat_sensitivity(pm, static_cast<float>(_ui.beatSensitivitySpinBox->value())); | ||
| projectm_set_soft_cut_duration(pm, _ui.smoothPresetDurationSpinBox->value()); | ||
| projectm_set_preset_duration(pm, _ui.presetDurationSpinBox->value()); | ||
| projectm_set_easter_egg(pm, static_cast<float>(_ui.easterEggParameterSpinBox->value())); | ||
| projectm_set_window_size(pm, | ||
| static_cast<size_t>(_ui.windowWidthSpinBox->value()), | ||
| static_cast<size_t>(_ui.windowHeightSpinBox->value())); |
Comment on lines
+165
to
+178
| if (!_qprojectMWidget || !_qprojectMWidget->qprojectM()) { | ||
| return; | ||
| } | ||
| auto *pm = _qprojectMWidget->qprojectM()->instance(); | ||
| if (!pm) { | ||
| return; | ||
| } | ||
|
|
||
| projectm_set_fps(pm, _ui.maxFPSSpinBox->value()); | ||
| projectm_set_aspect_correction(pm, _ui.useAspectCorrectionCheckBox->checkState() == Qt::Checked); | ||
| projectm_set_beat_sensitivity(pm, static_cast<float>(_ui.beatSensitivitySpinBox->value())); | ||
| projectm_set_soft_cut_duration(pm, _ui.smoothPresetDurationSpinBox->value()); | ||
| projectm_set_preset_duration(pm, _ui.presetDurationSpinBox->value()); | ||
| projectm_set_easter_egg(pm, static_cast<float>(_ui.easterEggParameterSpinBox->value())); |
Comment on lines
+179
to
+181
| projectm_set_window_size(pm, | ||
| static_cast<size_t>(_ui.windowWidthSpinBox->value()), | ||
| static_cast<size_t>(_ui.windowHeightSpinBox->value())); |
- Hold the projectMMutex when calling projectM C API setters to avoid races with the render thread's paintGL. - Resize the top-level Qt window instead of calling projectm_set_window_size directly. Qt's resize event flows through QProjectMWidget::resizeGL, which already handles devicePixelRatio scaling and queues the projectM update on the render thread. The direct call would skip DPR and desync projectM's internal size from the actual GL framebuffer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@copilot review |
|
verified against the libprojectM 4.x headers, sharing results:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6
Summary
Previously, the settings dialog wrote new values to
config.inpbut never pushed them to the running projectM instance. The user had to restart to see changes take effect. The reset signal was gated behind#ifdef PROJECTM_RESET_IS_THREAD_SAFEwhich is never defined, so it was effectively dead code.Fix
Add
applyLiveSettings()that calls projectM 4.x runtime setters aftersaveConfig():projectm_set_fpsprojectm_set_aspect_correctionprojectm_set_beat_sensitivityprojectm_set_soft_cut_durationprojectm_set_preset_durationprojectm_set_easter_eggprojectm_set_window_sizeprojectm_set_mesh_sizeRestart still required for
projectm_playlistThese could be wired up later but each has trickier semantics. This PR addresses the common case (timing/sensitivity tuning) which is what the original issue describes.
Test plan