Request: Use custom path for Settings class #130

Open
opened 2016-05-04 00:57:55 +00:00 by jbltx · 0 comments
jbltx commented 2016-05-04 00:57:55 +00:00 (Migrated from github.com)

It could be useful to add a path property to Settings item, like this:

Window {
    id: mainWindow
    width: mainSettings.window_width
    height: mainSettings.window_height

    Settings {
         id: mainSettings
         path: "path/to/settings.ini"
         format: "ini"
         category: "mainSettings"
    }
    Settings {
        id: gameplaySettings
        path: "path/to/settings.ini"
        format: "ini"
        category: "gameplaySettings"
    }
   Settings {
        id: otherSettings
        category: "otherSettings"
       // no path defined, use default QSettings properties...
    }
}
# path/to/settings.ini
[mainSettings]
window_width=800
window_height=600
[gameplaySettings]
hud_color=red
...

We can use this constructor to do that in the Settings class

QSettings(const QString & fileName, Format format, QObject * parent = 0);

As you can see, there's no defined properties in the Settings item, but settings are already defined in the INI file, so the Settings could be able to define all properties using defined settings (like window_width, window_height and hud_color in my example).

It could be useful to add a _path_ property to Settings item, like this: ``` qml Window { id: mainWindow width: mainSettings.window_width height: mainSettings.window_height Settings { id: mainSettings path: "path/to/settings.ini" format: "ini" category: "mainSettings" } Settings { id: gameplaySettings path: "path/to/settings.ini" format: "ini" category: "gameplaySettings" } Settings { id: otherSettings category: "otherSettings" // no path defined, use default QSettings properties... } } ``` ``` ini # path/to/settings.ini [mainSettings] window_width=800 window_height=600 [gameplaySettings] hud_color=red ... ``` We can use this constructor to do that in the Settings class ``` cpp QSettings(const QString & fileName, Format format, QObject * parent = 0); ``` As you can see, there's no defined properties in the Settings item, but settings are already defined in the INI file, so the Settings could be able to define all properties using defined settings (like window_width, window_height and hud_color in my example).
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mdkcore/Bacon2D#130
No description provided.