33 * @brief Early settings configuration loader and manager.
44 *
55 * Handles loading and accessing early desktop initialization configuration
6- * from INI files using Qt's QSettings mechanism .
6+ * from JSON files using Qt's JSON parsing .
77 *
88 * @author CFDesktop Team
99 * @date 2026-03-16
10- * @version 0.13.1
10+ * @version 0.14.0
1111 * @since 0.13.0
1212 * @ingroup early_session
1313 */
1414#pragma once
1515
16- #include < QSettings>
1716#include < QString>
1817#include < memory>
1918
19+ class QJsonObject ;
20+
2021namespace cf ::desktop::early_settings {
2122/* *
2223 * @brief Manages early desktop configuration settings.
2324 *
24- * Loads and provides access to early initialization configuration from an
25- * INI -format configuration file. Uses Qt's QSettings for parsing .
25+ * Loads and provides access to early initialization configuration from a
26+ * JSON -format configuration file.
2627 *
2728 * @note Not thread-safe unless externally synchronized.
2829 * @ingroup early_session
2930 *
3031 * @code
31- * EarlySettings settings("settings/early.ini ");
32+ * EarlySettings settings("settings/early.json ");
3233 * if (settings.valid()) {
3334 * QString logPath = settings.get_boot_logger_path();
3435 * }
@@ -39,52 +40,31 @@ class EarlySettings {
3940 /* *
4041 * @brief Constructs EarlySettings and loads from the specified config path.
4142 *
42- * @param[in] early_config_path Path to the early configuration INI file.
43- * @throws None
44- * @note None
45- * @warning None
46- * @since 0.13.0
47- * @ingroup early_session
43+ * @param[in] early_config_path Path to the early configuration JSON file.
4844 */
4945 EarlySettings (const QString& early_config_path);
5046
51- ~EarlySettings () = default ;
47+ ~EarlySettings ();
5248
5349 /* *
5450 * @brief Checks if the settings were loaded successfully.
5551 *
5652 * @return True if settings are valid and loaded without error, false otherwise.
57- * @throws None
58- * @note None
59- * @warning None
60- * @since 0.13.0
61- * @ingroup early_session
6253 */
6354 bool valid () const ;
6455
6556 /* *
6657 * @brief Gets the file path from which settings were loaded.
6758 *
6859 * @return Absolute path to the configuration file.
69- * @throws None
70- * @note None
71- * @warning None
72- * @since 0.13.0
73- * @ingroup early_session
7460 */
7561 QString loadFrom () const ;
7662
7763 /* *
7864 * @brief Gets the boot logger directory path from settings.
7965 *
80- * Reads the logger directory configuration from the early settings file.
81- *
8266 * @return Path to the boot logger directory.
83- * @throws None
8467 * @note The result is cached after the first call.
85- * @warning None
86- * @since 0.13.0
87- * @ingroup early_session
8868 */
8969 QString get_boot_logger_path () const ;
9070
@@ -96,20 +76,27 @@ class EarlySettings {
9676 QString get_desktop_root () const ;
9777
9878 /* *
99- * @brief Unlock the Early Settings, using in release the sessions
79+ * @brief Unlock the Early Settings, used in releasing the sessions.
10080 *
101- * @return std::unique_ptr<QSettings>
81+ * @return std::unique_ptr<QJsonObject> containing the early settings data.
82+ * Returns nullptr if settings are invalid.
10283 */
103- std::unique_ptr<QSettings > unlock_early_settings ();
84+ std::unique_ptr<QJsonObject > unlock_early_settings ();
10485
10586 private:
106- // / @brief Cached path to the log file for the current session. Ownership: owner.
87+ // / @brief Cached path to the log file for the current session.
10788 mutable QString this_session_logfile_path{};
10889
109- // / @brief Cached Desktop Root; only changes when the desktop path is switched
90+ // / @brief Cached Desktop Root; only changes when the desktop path is switched.
11091 mutable QString desktop_root{};
11192
112- // / @brief Qt settings object for reading the INI configuration. Ownership: owner.
113- std::unique_ptr<QSettings> early_settings;
93+ // / @brief Parsed JSON object containing the configuration data. Ownership: owner.
94+ std::unique_ptr<QJsonObject> early_settings_obj_;
95+
96+ // / @brief Whether the JSON file was loaded successfully.
97+ bool valid_ = false ;
98+
99+ // / @brief Path to the configuration file.
100+ QString filepath_{};
114101};
115102} // namespace cf::desktop::early_settings
0 commit comments