StateManagement::SessionStore
StateManagement::SessionStore
#include <SessionStore.hpp>
Inherits from QObject
Public Signals
| Name | |
|---|---|
| void | sessionChanged() Emitted when session data changes. |
Public Functions
| Name | |
|---|---|
| SessionStore(QString const & config_dir, QObject * parent =[nullptr]) Construct SessionStore. |
|
| ~SessionStore() override | |
| void | load() Load session data from disk. Called once at startup. |
| void | save() Save session data to disk immediately. Called at shutdown and by debounce timer. |
| QString | filePath() const |
| QString | lastUsedPath(QString const & dialog_id, QString const & fallback ={}) const Get the last-used path for a specific dialog. |
| void | rememberPath(QString const & dialog_id, QString const & path) Remember a path for a specific dialog. |
| QStringList | recentWorkspaces() const |
| void | addRecentWorkspace(QString const & path) Add a workspace to the recent list. |
| void | removeRecentWorkspace(QString const & path) Remove a workspace from the recent list (e.g., file no longer exists). |
| void | captureWindowGeometry(QMainWindow const * window) Capture the current window geometry into session data. |
| void | restoreWindowGeometry(QMainWindow * window) const Restore window geometry from session data. |
| SessionData const & | data() const |
Public Signals Documentation
signal sessionChanged
void sessionChanged()Emitted when session data changes.
Public Functions Documentation
function SessionStore
explicit SessionStore(
QString const & config_dir,
QObject * parent =nullptr
)Construct SessionStore.
Parameters:
- config_dir Directory where session.json will be stored
- parent Parent QObject
function ~SessionStore
~SessionStore() overridefunction load
void load()Load session data from disk. Called once at startup.
function save
void save()Save session data to disk immediately. Called at shutdown and by debounce timer.
function filePath
inline QString filePath() constReturn: Absolute path to the session JSON file
function lastUsedPath
QString lastUsedPath(
QString const & dialog_id,
QString const & fallback ={}
) constGet the last-used path for a specific dialog.
Parameters:
- dialog_id Unique identifier for the dialog (e.g., “import_csv”, “load_video”)
- fallback Path to return if no memory exists for this dialog
Return: The last-used path, or fallback if none recorded
function rememberPath
void rememberPath(
QString const & dialog_id,
QString const & path
)Remember a path for a specific dialog.
Parameters:
- dialog_id Unique identifier for the dialog
- path File or directory path to remember
If the path is a file, the parent directory is stored instead. This auto-saves after a debounce period.
function recentWorkspaces
QStringList recentWorkspaces() constfunction addRecentWorkspace
void addRecentWorkspace(
QString const & path
)Add a workspace to the recent list.
Moves the path to the front if already present. Caps the list at SessionData::max_recent_workspaces.
function removeRecentWorkspace
void removeRecentWorkspace(
QString const & path
)Remove a workspace from the recent list (e.g., file no longer exists).
function captureWindowGeometry
void captureWindowGeometry(
QMainWindow const * window
)Capture the current window geometry into session data.
Parameters:
- window The main window to capture from
function restoreWindowGeometry
void restoreWindowGeometry(
QMainWindow * window
) constRestore window geometry from session data.
Parameters:
- window The main window to restore to
function data
inline SessionData const & data() constUpdated on 2026-11-13 at 20:25:41 +0000