projectM-visualizer/frontend-qt

QT settings aren't loaded into app on save

Opened this issue · 3 comments

ywwg commented

If I change the presetDuration in the settings in the qt app, the value is not propagated to the app nor saved to the config file. I have to manually edit the config file in order to get the values to change.

Looking at the code, qprojectmconfigdialog.cpp calls projectM::writeConfig, but it never does anything to update the actual values inside the running application. Also, the config it writes has both the new value and the old value, so the new value isn't seen on restart either:

Aspect Correction = 1
Easter Egg Parameter = 1
FPS = 35
Fullscreen = false
Hard Cut Sensitivity = 10
Menu Font = VeraMono.ttf
Mesh X = 220
Mesh Y = 125
Preset Duration = 27
Preset Path = /usr/local/share/projectM/presets
Shuffle Enabled = 1
Smooth Preset Duration = 5
Smooth Transition Duration = 5
Soft Cut Ratings Enabled = 0
Texture Size = 512
Title Font = Vera.ttf
Window Height = 512
Window Width = 512


Smooth Transition Duration = 5  # in seconds
Preset Duration = 30 	     	# in seconds
Easter Egg Parameter = 1

Hard Cut Sensitivity = 10       # Lower to make hard cuts more frequent
Aspect Correction = true	# Custom Shape Aspect Correction

Preset Path = /usr/local/share/projectM/presets # preset location
Title Font = Vera.ttf
Menu Font = VeraMono.ttf

PRs are quite welcome :)

ywwg commented

I started trying to fix it but couldn't. writeConfig is a static function, and readConfig and readSettings are private methods. The other frontends seem to just reinit the entire app with the new settings. I'm happy to make a PR but I don't know this codebase at all so I'd need at least a hint for how to fix it.

Many configuration parameters would require a renderer or full reset of projectM, which could be done automatically, but isn't really worth it. The new C API adds getters and setters for all settings values which can be changed at runtime, including proper resetting.

After changing the settings, the Qt application could either recreate the projectM instance and restart the currently selected preset or set all values one-by-one after checking if they were changed.