LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
ui::qt::utils::SessionManager Class Reference

Manages session state (open files, filters, scroll position, etc.) More...

#include <SessionManager.hpp>

Collaboration diagram for ui::qt::utils::SessionManager:
Collaboration graph

Classes

struct  SessionState
 

Public Member Functions

void initialize ()
 Initialize session manager.
 
bool hasCrashRecovery () const
 Check if crash recovery is available.
 
SessionState getCrashRecoveryState () const
 Get crash recovery state.
 
void saveSession (const SessionState &state)
 Save current session state.
 
SessionState loadSession ()
 Load last session state.
 
void clearCrashFlag ()
 Clear crash recovery flag (session completed successfully)
 
void setCrashFlag ()
 Set crash recovery flag (session interrupted abnormally)
 
void autoSave (const SessionState &state)
 Auto-save session periodically (call from main event loop)
 
void setAutoSaveEnabled (bool enabled)
 Enable/disable auto-save.
 
bool isAutoSaveEnabled () const
 
std::string getSessionFilePath () const
 Get session file path.
 
std::string getCrashRecoveryFilePath () const
 Get crash recovery file path.
 

Static Public Member Functions

static SessionManager & getInstance ()
 

Private Member Functions

 SessionManager ()=default
 

Private Attributes

std::string m_sessionFilePath
 
std::string m_crashRecoveryFilePath
 
bool m_autoSaveEnabled {true}
 
bool m_hasCrashRecovery {false}
 
std::chrono::steady_clock::time_point m_lastAutoSaveTime
 

Static Private Attributes

static constexpr std::chrono::milliseconds kAutoSaveInterval {30000}
 

Detailed Description

Manages session state (open files, filters, scroll position, etc.)

Automatically saves state periodically and on shutdown. Allows recovery from crashes with user confirmation.

Constructor & Destructor Documentation

◆ SessionManager()

ui::qt::utils::SessionManager::SessionManager ( )
privatedefault

Member Function Documentation

◆ autoSave()

void ui::qt::utils::SessionManager::autoSave ( const SessionState &  state)

Auto-save session periodically (call from main event loop)

Here is the call graph for this function:

◆ clearCrashFlag()

void ui::qt::utils::SessionManager::clearCrashFlag ( )

Clear crash recovery flag (session completed successfully)

Here is the call graph for this function:

◆ getCrashRecoveryFilePath()

std::string ui::qt::utils::SessionManager::getCrashRecoveryFilePath ( ) const
inline

Get crash recovery file path.

◆ getCrashRecoveryState()

SessionManager::SessionState ui::qt::utils::SessionManager::getCrashRecoveryState ( ) const

Get crash recovery state.

Here is the call graph for this function:

◆ getInstance()

SessionManager & ui::qt::utils::SessionManager::getInstance ( )
static

◆ getSessionFilePath()

std::string ui::qt::utils::SessionManager::getSessionFilePath ( ) const
inline

Get session file path.

◆ hasCrashRecovery()

bool ui::qt::utils::SessionManager::hasCrashRecovery ( ) const

Check if crash recovery is available.

◆ initialize()

void ui::qt::utils::SessionManager::initialize ( )

Initialize session manager.

Here is the call graph for this function:

◆ isAutoSaveEnabled()

bool ui::qt::utils::SessionManager::isAutoSaveEnabled ( ) const
inline

◆ loadSession()

SessionManager::SessionState ui::qt::utils::SessionManager::loadSession ( )

Load last session state.

Here is the call graph for this function:

◆ saveSession()

void ui::qt::utils::SessionManager::saveSession ( const SessionState &  state)

Save current session state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAutoSaveEnabled()

void ui::qt::utils::SessionManager::setAutoSaveEnabled ( bool  enabled)
inline

Enable/disable auto-save.

◆ setCrashFlag()

void ui::qt::utils::SessionManager::setCrashFlag ( )

Set crash recovery flag (session interrupted abnormally)

Member Data Documentation

◆ kAutoSaveInterval

constexpr std::chrono::milliseconds ui::qt::utils::SessionManager::kAutoSaveInterval {30000}
staticconstexprprivate

◆ m_autoSaveEnabled

bool ui::qt::utils::SessionManager::m_autoSaveEnabled {true}
private

◆ m_crashRecoveryFilePath

std::string ui::qt::utils::SessionManager::m_crashRecoveryFilePath
private

◆ m_hasCrashRecovery

bool ui::qt::utils::SessionManager::m_hasCrashRecovery {false}
private

◆ m_lastAutoSaveTime

std::chrono::steady_clock::time_point ui::qt::utils::SessionManager::m_lastAutoSaveTime
private

◆ m_sessionFilePath

std::string ui::qt::utils::SessionManager::m_sessionFilePath
private

The documentation for this class was generated from the following files: