Stellarium 0.12.1
List of all members | Public Slots | Signals | Public Member Functions
StelShortcutMgr Class Reference

Manager of the keyboard shortcuts tied to different features. More...

#include <StelShortcutMgr.hpp>

Public Slots

void setAllActionsEnabled (bool enable)
 Enable/disable all actions of application. More...
 
void restoreDefaultShortcuts ()
 Restore the default combinations by reloading and resaving. More...
 

Signals

void shortcutChanged (StelShortcut *shortcut)
 

Public Member Functions

void init ()
 
bool loadShortcuts (const QString &filePath, bool overload=false)
 Load shortcuts from an existing file. More...
 
void loadShortcuts ()
 Search for file with shortcuts, load shortcuts from it. More...
 
void saveShortcuts ()
 Save current shortcuts to file. More...
 
void saveShortcuts (QIODevice *output) const
 
QAction * addGuiAction (const QString &actionId, bool temporary, const QString &text, const QString &primaryKey, const QString &altKey, const QString &groupId, bool checkable=true, bool autoRepeat=false, bool global=false)
 Add a new action managed by the GUI. More...
 
void changeActionPrimaryKey (const QString &actionId, const QString &groupId, QKeySequence newKey)
 
void changeActionAltKey (const QString &actionId, const QString &groupId, QKeySequence newKey)
 
void setShortcutText (const QString &actionId, const QString &groupId, const QString &description)
 
QAction * getGuiAction (const QString &actionName)
 Get a pointer to an action managed by the GUI. More...
 
QAction * addScriptToAction (const QString &actionId, const QString &script, const QString &scriptAction=QString())
 Bind script evaluation to given action. More...
 
QList< StelShortcutGroup * > getGroupList () const
 Get a list of all shortcut groups. More...
 

Detailed Description

Manager of the keyboard shortcuts tied to different features.

At the moment, the vast majority of QActions used in Stellarium are defined in a JSON file copied to the user data directory on the first run, similar to the configuration file.

Definition at line 34 of file StelShortcutMgr.hpp.

Member Function Documentation

QAction* StelShortcutMgr::addGuiAction ( const QString &  actionId,
bool  temporary,
const QString &  text,
const QString &  primaryKey,
const QString &  altKey,
const QString &  groupId,
bool  checkable = true,
bool  autoRepeat = false,
bool  global = false 
)

Add a new action managed by the GUI.

This method should be used to add new shortcuts to the program.

Parameters
textShort human-readable description in English. Mark the string for translation with the N_() macro and it will be translated when displayed in ShortcutsDialog or HelpDialog.
QAction* StelShortcutMgr::addScriptToAction ( const QString &  actionId,
const QString &  script,
const QString &  scriptAction = QString() 
)

Bind script evaluation to given action.

QList<StelShortcutGroup*> StelShortcutMgr::getGroupList ( ) const

Get a list of all shortcut groups.

QAction* StelShortcutMgr::getGuiAction ( const QString &  actionName)

Get a pointer to an action managed by the GUI.

Directly queryies the StelAppGraphicsWidget instance for a child with the given name.

Parameters
actionNameQt object name for this action
Returns
a pointer to the QAction object or NULL if doesn't exist
bool StelShortcutMgr::loadShortcuts ( const QString &  filePath,
bool  overload = false 
)

Load shortcuts from an existing file.

Parameters
filePathfull path to the file.
overloadif true, if a shortcut in the file already exists, replace its keys with the ones in the file.
void StelShortcutMgr::loadShortcuts ( )

Search for file with shortcuts, load shortcuts from it.

void StelShortcutMgr::restoreDefaultShortcuts ( )
slot

Restore the default combinations by reloading and resaving.

void StelShortcutMgr::saveShortcuts ( )

Save current shortcuts to file.

void StelShortcutMgr::setAllActionsEnabled ( bool  enable)
slot

Enable/disable all actions of application.

need for editing shortcuts without trigging any actions


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