ApplicationConfigManager
ApplicationConfigManager is the application-wide runtime configuration
singleton. It persists application-level settings via QSettings and exposes
them through a thread-safe API backed by a QMutex. A declarative option
registry (getOptions()) describes every available option with its metadata,
enabling automatic UI generation and generic get/set access via
getOptionValue() and setOptionValue().
The manager owns an ApplicationConfig value struct that holds the
in-memory state for the LIF module toggle, the CUDA module toggle, and the
debug-logging toggle. Signals notify connected components whenever any of these
values change.
Runtime toggles
LIF module — isLifEnabled() / setLifEnabled() control whether the
LIF hardware and UI components are active. The corresponding signal
lifEnabledChanged(bool) is emitted on each change. The LIF-enabled state is
persisted under BC::Key::AppConfig::lifEnabled.
Debug logging — isDebugLoggingEnabled() / setDebugLogging() control
whether Debug-severity messages are written to the debug log file. Calling
setDebugLogging() persists the setting and emits debugLoggingChanged(bool).
At application startup, MainWindow reads the persisted value, applies it to
LogHandler via LogHandler::instance().setDebugLogging(), and wires
the debugLoggingChanged signal to LogHandler::setDebugLogging so
subsequent changes propagate automatically.
CUDA module — isCudaEnabled() reflects whether the CUDA acceleration
path is active. The cudaEnabled field is present in the ApplicationConfig
struct; its UI toggle is conditional on build-time CUDA availability.
Option registry
getOptions() returns the full list of AppOption entries, each carrying a
settingsKey, a display label, a description, a type-aware
defaultValue, and a requiresRestart flag. The registry drives the
Application Configuration dialog described in
Application Configuration. Keys are declared as constexpr
QLatin1StringView constants in the BC::Key::AppConfig namespace:
appConfig (the QSettings group name), lifEnabled, cudaEnabled,
debugLogging, and appFont.
API Reference
-
struct AppOption
Declarative application option descriptor.
Describes a single configurable application option, including its settings key, display name, description, type-aware default value, and whether changing it requires an application restart.
-
class ApplicationConfigManager : public QObject
Centralized runtime application configuration manager.
ApplicationConfigManager provides centralized, thread-safe runtime configuration management. It replaces compile-time flags (BC_LIF, etc.) with runtime configuration decisions persisted via QSettings.
The manager maintains a declarative option registry (getOptions()) that describes all available options with their metadata, enabling automatic UI generation and generic get/set access.
Design principles:
Singleton pattern with global access
Thread-safe with QMutex
Qt integration with signals for configuration changes
Declarative option registry for UI generation
Public Functions
-
bool isLifEnabled() const
Check if LIF module is enabled.
Thread-safe query for LIF module availability.
- Returns:
True if LIF functionality is enabled
-
bool isCudaEnabled() const
Check if CUDA module is enabled.
Thread-safe query for CUDA module availability.
- Returns:
True if CUDA functionality is enabled
-
bool isDebugLoggingEnabled() const
Check if debug logging is enabled.
- Returns:
True if Debug-level log messages are written to the debug log file
-
void setDebugLogging(bool enabled)
Enable or disable debug logging and persist the setting.
- Parameters:
enabled – True to write Debug messages to debug_YYYYMM.csv
-
bool isUpdateCheckEnabled() const
Check if startup update checking is enabled.
- Returns:
True if the application checks GitHub for new releases on startup
-
void setUpdateCheckEnabled(bool enabled)
Enable or disable startup update checks and persist the setting.
- Parameters:
enabled – True to enable the daily-throttled startup check
-
void setLifEnabled(bool enabled)
Enable or disable LIF module and persist the setting.
- Parameters:
enabled – True to enable LIF hardware and UI components
-
const QVector<AppOption> &getOptions() const
Get the declarative option registry.
- Returns:
Read-only reference to the list of registered AppOption entries
-
QVariant getOptionValue(const QString &key) const
Get the current persisted value for an option key.
- Parameters:
key – The settingsKey of the option (within AppConfig group)
- Returns:
The stored value, or the option’s defaultValue if not yet set
-
void setOptionValue(const QString &key, const QVariant &value)
Set and persist a value for an option key.
Persists the value to QSettings and updates in-memory state. Emits the appropriate specific signal (lifEnabledChanged, fontChanged, etc.) as well as configurationChanged when relevant.
- Parameters:
key – The settingsKey of the option
value – The new value to store
Signals
-
void configurationChanged(const ApplicationConfig &newConfig)
Emitted when application configuration changes.
- Parameters:
newConfig – The updated application configuration
-
void debugLoggingChanged(bool enabled)
-
void fontChanged(QFont font)
-
void lifEnabledChanged(bool enabled)
-
void updateCheckEnabledChanged(bool enabled)
Public Static Functions
-
static ApplicationConfigManager &instance()
Get singleton instance for application configuration access.
Provides thread-safe access to the application configuration manager. The instance is created on first access and persists for the application lifetime.
- Returns:
Reference to the singleton instance
Private Functions
-
explicit ApplicationConfigManager(QObject *parent = nullptr)
-
~ApplicationConfigManager() = default
-
ApplicationConfigManager(const ApplicationConfigManager&) = delete
-
ApplicationConfigManager &operator=(const ApplicationConfigManager&) = delete
Private Members
-
mutable QMutex d_configMutex
Thread-safe access control
-
ApplicationConfig d_currentConfig
Current configuration state
Private Static Attributes
-
static ApplicationConfigManager *s_instance = nullptr
Singleton instance
-
struct ApplicationConfig
Application configuration structure.