|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Manages workspace state that persists between sessions. More...
#include <workspace_state.h>
Signals | |
| 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. | |
Public Member Functions | |
| WorkspaceState (const WorkspaceState &)=delete | |
| WorkspaceState & | operator= (const WorkspaceState &)=delete |
| 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. | |
Static Public Member Functions | |
| static WorkspaceState * | instance () |
| Returns the singleton instance. | |
Protected Member Functions | |
| WorkspaceState (QObject *parent=nullptr) | |
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.
| void WorkspaceState::addRecentCaptureFile | ( | const QString & | filePath | ) |
Add a capture file to the recent files list.
| filePath | The path to the capture file. |
|
static |
Returns the singleton instance.
Thread-safe in C++11 and later (Meyer's Singleton).
| 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.
| [out] | errorPath | If loading fails, contains the path that failed. |
| [out] | errorCode | If loading fails, contains the errno. |
| QStringList WorkspaceState::recentCaptureFilenames | ( | ) | const |
Get just the filenames of recent capture files.
Convenience method for code that only needs the paths.
| const QList< RecentFileInfo > & WorkspaceState::recentCaptureFiles | ( | ) | const |
Get the list of recently opened capture files.
| QString WorkspaceState::recentCommonFilePath | ( | ) | const |
Get the path to the recent_common file.
|
signal |
Emitted when a file's status (size/accessibility) is updated.
| filename | The file whose status was updated. |
| QString WorkspaceState::recentProfileFilePath | ( | ) | const |
Get the path to the profile-specific recent file.
| void WorkspaceState::removeRecentCaptureFile | ( | const QString & | filePath | ) |
Remove a capture file from the recent files list.
| filePath | The path to remove. |