projectM-visualizer / frontend-qt

:bangbang: CURRENTLY BROKEN :bangbang: - Will be fixed some time after the libprojectM 4.0 release! Help is highly appreciated. Qt-based standalone frontend to projectM. Currently supports Linux with PulseAudio or JACK audio backends.
GNU Lesser General Public License v2.1
12 stars 5 forks source link

QT settings aren't loaded into app on save #6

Open ywwg opened 4 years ago

ywwg commented 4 years ago

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
revmischa commented 4 years ago

PRs are quite welcome :)

ywwg commented 4 years ago

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.

kblaschke commented 3 years ago

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.