Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorConfig::QSettingsBackend Class Reference

Reader for legacy KConfig-style INI configuration files. More...

#include <phosphor-config/include/PhosphorConfig/QSettingsBackend.h>

Static Public Member Functions

static QMap< QString, QVariant > readConfigFromDisk (const QString &filePath)
 Read an INI config from an arbitrary file path.
 

Detailed Description

Reader for legacy KConfig-style INI configuration files.

Read-only and one-way: it exists so a consumer migrating an old INI file onto JsonBackend can get at the old values. There is deliberately no live INI IBackend to pair with it — QSettings flushes unsaved changes when it is destroyed and offers no way to drop them, so it cannot satisfy IBackend::reparseConfiguration's contract to discard pending in-memory changes. An implementation over it would persist exactly the writes callers asked it to throw away.

Member Function Documentation

◆ readConfigFromDisk()

static QMap< QString, QVariant > PhosphorConfig::QSettingsBackend::readConfigFromDisk ( const QString &  filePath)
static

Read an INI config from an arbitrary file path.

Returns a flat QMap keyed by "Group/Key"; ungrouped keys appear unprefixed.

Values spelling "true"/"false" (case-insensitively) come back as bools, everything else as a QString — callers coerce from there. A missing or unreadable file yields an empty map rather than an error: to a migration chain, "no legacy config" and "empty legacy config" mean the same thing.

Parses the file directly rather than through QSettings, so no QConfFile cache entry is installed for filePath and a caller that renames or deletes the file afterwards sees no stale cached copy.


The documentation for this class was generated from the following file: