|
mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
|
Runtime configuration types, defaults, and JSON loading entrypoints. More...
#include <QByteArray>#include <QJsonObject>#include <QString>#include <QStringList>Go to the source code of this file.
Classes | |
| struct | ShortcutConfig |
| Global shortcut registration settings. More... | |
| struct | AudioConfig |
| Audio capture configuration passed to the recorder. More... | |
| struct | TranscriberConfig |
| Transcription runtime configuration. More... | |
| struct | AppConfig |
| Top-level runtime configuration snapshot. More... | |
Functions | |
| QString | defaultConfigPath () |
| Returns the default runtime config path. | |
| QString | defaultModelPath () |
| Returns the default model artifact path used for fallback config values. | |
| AppConfig | defaultAppConfig () |
| Returns the built-in runtime defaults. | |
| AppConfig | loadConfig (const QString &path, QString *errorMessage=nullptr) |
| Loads a config file and applies repo-defined fallback defaults. | |
| AppConfig | loadConfigObject (const QJsonObject &root, const QString &sourceName=QStringLiteral("<in-memory config>")) |
| Loads a config object and applies the same fallback rules as file loading. | |
| QByteArray | serializeConfig (const AppConfig &config) |
| Serializes a config snapshot to indented JSON. | |
| QJsonObject | configToJsonObject (const AppConfig &config) |
| Converts a config snapshot to the saved JSON object shape. | |
| bool | saveConfig (const QString &path, const AppConfig &config, QString *errorMessage=nullptr) |
| Saves a config snapshot to disk, creating parent directories as needed. | |
| QStringList | supportedConfigKeys () |
| Returns the supported dotted keys for config mutation. | |
| bool | applyConfigValue (AppConfig *config, QStringView key, const QString &value, QString *errorMessage=nullptr) |
| Applies a single dotted-key config value with validation. | |
Runtime configuration types, defaults, and JSON loading entrypoints.
Definition in file config.h.
| bool applyConfigValue | ( | AppConfig * | config, |
| QStringView | key, | ||
| const QString & | value, | ||
| QString * | errorMessage = nullptr |
||
| ) |
Applies a single dotted-key config value with validation.
| config | Config snapshot to mutate. |
| key | Canonical dotted config key. |
| value | Text value to parse and validate. |
| errorMessage | Optional output for validation failures. |
true when the key is supported and the value is valid. | QJsonObject configToJsonObject | ( | const AppConfig & | config | ) |
Converts a config snapshot to the saved JSON object shape.
| config | Config snapshot to convert. |
| AppConfig defaultAppConfig | ( | ) |
Returns the built-in runtime defaults.
| QString defaultConfigPath | ( | ) |
Returns the default runtime config path.
Runtime defaults are intentionally centralized here so the loader, tests, and any future CLI or config UI work from the same baseline values.
config.json. | QString defaultModelPath | ( | ) |
Returns the default model artifact path used for fallback config values.
| AppConfig loadConfig | ( | const QString & | path, |
| QString * | errorMessage = nullptr |
||
| ) |
Loads a config file and applies repo-defined fallback defaults.
Invalid or missing values are handled permissively where possible so runtime startup can continue with safe defaults and warnings.
| path | Path to the JSON config file. |
| errorMessage | Optional output for fatal load or parse failures. |
| AppConfig loadConfigObject | ( | const QJsonObject & | root, |
| const QString & | sourceName = QStringLiteral("<in-memory config>") |
||
| ) |
Loads a config object and applies the same fallback rules as file loading.
This is primarily used by in-memory control-plane payloads so the tray and daemon share one config contract instead of maintaining parallel JSON readers.
| root | JSON object shaped like the saved config file. |
| sourceName | Human-readable source label used in warning messages. |
| bool saveConfig | ( | const QString & | path, |
| const AppConfig & | config, | ||
| QString * | errorMessage = nullptr |
||
| ) |
Saves a config snapshot to disk, creating parent directories as needed.
| path | Destination config path. |
| config | Config snapshot to save. |
| errorMessage | Optional output for write failures. |
true on success. | QByteArray serializeConfig | ( | const AppConfig & | config | ) |
Serializes a config snapshot to indented JSON.
| config | Config snapshot to serialize. |
| QStringList supportedConfigKeys | ( | ) |
Returns the supported dotted keys for config mutation.