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

#include <ShortcutManager.hpp>

Collaboration diagram for ui::qt::ShortcutManager:
Collaboration graph

Classes

struct  Entry
 

Public Member Functions

void Register (const std::string &id, const QString &category, const QString &label, QAction *action)
 Registers action under id, applying any saved override.
 
std::vector< ShortcutInfo > GetAll () const
 All currently registered shortcuts, in registration order.
 
ShortcutResult SetShortcut (const std::string &id, const QKeySequence &sequence)
 Assigns sequence to the shortcut identified by id.
 
void ResetToDefault (const std::string &id)
 Restores the shortcut identified by id to its default.
 
void ResetAllToDefaults ()
 Restores every registered shortcut to its default.
 
void Clear ()
 Clears the registry (not the persisted overrides file).
 

Static Public Member Functions

static ShortcutManager & getInstance ()
 

Private Member Functions

 ShortcutManager ()
 
 ~ShortcutManager ()=default
 
void LoadOverrides ()
 
void SaveOverrides () const
 

Static Private Member Functions

static std::string DefaultFilePath ()
 

Private Attributes

std::vector< Entry > m_entries
 
std::vector< std::pair< std::string, QKeySequence > > m_pendingOverrides
 

Constructor & Destructor Documentation

◆ ShortcutManager()

ui::qt::ShortcutManager::ShortcutManager ( )
private
Here is the call graph for this function:

◆ ~ShortcutManager()

ui::qt::ShortcutManager::~ShortcutManager ( )
privatedefault

Member Function Documentation

◆ Clear()

void ui::qt::ShortcutManager::Clear ( )

Clears the registry (not the persisted overrides file).

Intended for tests: without this, QAction pointers from a previous test's destroyed widgets would dangle in the process-wide singleton.

◆ DefaultFilePath()

std::string ui::qt::ShortcutManager::DefaultFilePath ( )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAll()

std::vector< ShortcutInfo > ui::qt::ShortcutManager::GetAll ( ) const

All currently registered shortcuts, in registration order.

Here is the caller graph for this function:

◆ getInstance()

ShortcutManager & ui::qt::ShortcutManager::getInstance ( )
static
Here is the caller graph for this function:

◆ LoadOverrides()

void ui::qt::ShortcutManager::LoadOverrides ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Register()

void ui::qt::ShortcutManager::Register ( const std::string &  id,
const QString &  category,
const QString &  label,
QAction *  action 
)

Registers action under id, applying any saved override.

action's current shortcut (set by the caller before this call) is treated as the default to reset back to. Calling this again with an id that's already registered updates the entry in place (the action pointer is refreshed and its shortcut is left as-is).

◆ ResetAllToDefaults()

void ui::qt::ShortcutManager::ResetAllToDefaults ( )

Restores every registered shortcut to its default.

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

◆ ResetToDefault()

void ui::qt::ShortcutManager::ResetToDefault ( const std::string &  id)

Restores the shortcut identified by id to its default.

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

◆ SaveOverrides()

void ui::qt::ShortcutManager::SaveOverrides ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetShortcut()

ShortcutResult ui::qt::ShortcutManager::SetShortcut ( const std::string &  id,
const QKeySequence &  sequence 
)

Assigns sequence to the shortcut identified by id.

Rejected (Err) if sequence is already used by a different registered shortcut and sequence is non-empty. An empty sequence clears the shortcut (unbinds the action).

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

Member Data Documentation

◆ m_entries

std::vector<Entry> ui::qt::ShortcutManager::m_entries
private

◆ m_pendingOverrides

std::vector<std::pair<std::string, QKeySequence> > ui::qt::ShortcutManager::m_pendingOverrides
private

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