Manages workspace state that persists between sessions.
More...
#include <workspace_state.h>
|
|
void | recentCaptureFilesChanged () |
| | Emitted when the recent capture files list changes.
|
| |
| void | recentFileStatusChanged (const QString &filename) |
| | Emitted when a file's status (size/accessibility) is updated.
|
| |
|
void | stateLoaded () |
| | Emitted when state is loaded from disk.
|
| |
|
void | stateSaved () |
| | Emitted when state is saved to disk.
|
| |
|
|
virtual | ~WorkspaceState () |
| | Destroys the singleton and releases all owned resources.
|
| |
|
| WorkspaceState (const WorkspaceState &)=delete |
| | Deleted copy constructor to enforce the singleton pattern.
|
| |
|
WorkspaceState & | operator= (const WorkspaceState &)=delete |
| | Deleted assignment operator to enforce the singleton pattern.
|
| |
| bool | loadCommonState (QString *errorPath=nullptr, int *errorCode=nullptr) |
| | Load state from the recent_common file.
|
| |
| QString | recentCommonFilePath () const |
| | Get the path to the recent_common file.
|
| |
| QString | recentProfileFilePath () const |
| | Get the path to the profile-specific recent file.
|
| |
| const QList< RecentFileInfo > & | recentCaptureFiles () const |
| | Get the list of recently opened capture files.
|
| |
| QStringList | recentCaptureFilenames () const |
| | Get just the filenames of recent capture files.
|
| |
| void | addRecentCaptureFile (const QString &filePath) |
| | Add a capture file to the recent files list.
|
| |
| void | removeRecentCaptureFile (const QString &filePath) |
| | Remove a capture file from the recent files list.
|
| |
|
void | clearRecentCaptureFiles () |
| | Clear all recent capture files.
|
| |
Manages workspace state that persists between sessions.
This class provides Qt-native access to the "recent" settings. It currently runs parallel to ui/recent.c for gradual migration.
Usage: WorkspaceState::instance()->loadCommonState(); QStringList files = WorkspaceState::instance()->recentCaptureFiles();
The singleton pattern avoids adding more dependencies to MainApplication.
◆ WorkspaceState()
| WorkspaceState::WorkspaceState |
( |
QObject * |
parent = nullptr | ) |
|
|
explicitprotected |
◆ addRecentCaptureFile()
| void WorkspaceState::addRecentCaptureFile |
( |
const QString & |
filePath | ) |
|
Add a capture file to the recent files list.
- Parameters
-
| filePath | The path to the capture file. |
◆ instance()
Returns the singleton instance.
Thread-safe in C++11 and later (Meyer's Singleton).
◆ isDevelopmentBuild()
| bool WorkspaceState::isDevelopmentBuild |
( |
| ) |
|
|
static |
Check if this is a development build.
Returns true when VERSION_FLAVOR is non-empty (the default "Development Build" set by CMake). Release builds either leave VERSION_FLAVOR empty or undefine it entirely.
- Returns
true for development builds, false for releases.
◆ isPortableApplication()
| bool WorkspaceState::isPortableApplication |
( |
| ) |
|
|
static |
Check if the application is running in portable mode. (Windows only)
In portable mode, state files are stored in the application directory instead of a user-specific location. For any other OS than Windows, this will return false.
- Returns
true if running in portable mode, false otherwise.
◆ loadCommonState()
| bool WorkspaceState::loadCommonState |
( |
QString * |
errorPath = nullptr, |
|
|
int * |
errorCode = nullptr |
|
) |
| |
Load state from the recent_common file.
Call this during application startup after recent_read_static() has been called.
- Parameters
-
| [out] | errorPath | If loading fails, contains the path that failed. |
| [out] | errorCode | If loading fails, contains the errno. |
- Returns
true on success, false on failure.
◆ recentCaptureFilenames()
| QStringList WorkspaceState::recentCaptureFilenames |
( |
| ) |
const |
Get just the filenames of recent capture files.
Convenience method for code that only needs the paths.
- Returns
- List of file paths, most recent last.
◆ recentCaptureFiles()
| const QList< RecentFileInfo > & WorkspaceState::recentCaptureFiles |
( |
| ) |
const |
Get the list of recently opened capture files.
- Returns
- List of file info structs, most recent last.
◆ recentCommonFilePath()
| QString WorkspaceState::recentCommonFilePath |
( |
| ) |
const |
Get the path to the recent_common file.
- Returns
- Full path to the recent_common file.
◆ recentFileStatusChanged
| void WorkspaceState::recentFileStatusChanged |
( |
const QString & |
filename | ) |
|
|
signal |
Emitted when a file's status (size/accessibility) is updated.
- Parameters
-
| filename | The file whose status was updated. |
◆ recentProfileFilePath()
| QString WorkspaceState::recentProfileFilePath |
( |
| ) |
const |
Get the path to the profile-specific recent file.
- Returns
- Full path to the recent file for the current profile.
◆ removeRecentCaptureFile()
| void WorkspaceState::removeRecentCaptureFile |
( |
const QString & |
filePath | ) |
|
Remove a capture file from the recent files list.
- Parameters
-
| filePath | The path to remove. |
The documentation for this class was generated from the following files:
- /builds/wireshark/wireshark/ui/qt/utils/workspace_state.h
- /builds/wireshark/wireshark/ui/qt/utils/workspace_state.cpp