sailfishos-applications / flowplayer

Music Player for SailfishOS
https://openrepos.net/content/olf/flowplayer
Other
6 stars 7 forks source link

[utils.cpp] Avoid creating QSettings too early #65

Closed llewelld closed 9 months ago

llewelld commented 9 months ago

If the QSettings are initialised statically they may fail to pick up the organization and application names set in main. The result is that the settings are written to and read from both ~/.config/Unknown\Organization.conf and ~/.config/sailfishos-applications/flowplayer.conf.

This can prevent the configured Music directories being read from successfully.

Fixes #64.

llewelld commented 9 months ago

This PR is primarily to demonstrate the problem and test a fix; I can appreciate you may prefer a better solution that doesn't create the QSettings object every time. According to the docs this is okay ("Constructing and destroying a QSettings object is very fast"), but perhaps isn't the most elegant approach.

dcaliste commented 9 months ago

Thanks for the patch. We can still move to a singleton object later if needed.

Olf0 commented 9 months ago

Also fixes issue #63.