![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <shortcuts.h>
Inheritance diagram for fc_shortcuts:
Collaboration diagram for fc_shortcuts:Public Member Functions | |
| virtual | ~fc_shortcuts () |
| fc_shortcuts destructor More... | |
| void | init_default (bool read) |
| Inits defaults shortcuts or reads from settings. More... | |
| auto | shortcuts () const |
| Returns all existing shortcuts. More... | |
| fc_shortcut | get_shortcut (shortcut_id id) const |
| Returns shortcut for given id. More... | |
| void | set_shortcut (const fc_shortcut &sc) |
| Sets given shortcut. More... | |
| QString | get_desc (shortcut_id id) const |
| Returns description for given shortcut. More... | |
| void | link_action (shortcut_id id, QAction *action) |
| Links an action to a shortcut. More... | |
| void | create_no_action_shortcuts (map_view *parent) |
| Enable key bindings for all shortcuts that have no action associated with them. More... | |
| void | invoke (shortcut_id id, map_view *mapview) |
| Invokes the action for a shortcut. More... | |
| void | maybe_route_mouse_shortcut (QMouseEvent *event, map_view *mapview) |
| If the mouse event corresponds to a registered shortcut, fire the corresponding action. More... | |
| bool | read () |
| Reads shortcuts from file. More... | |
| void | write () const |
| Writes shortcuts to file. More... | |
Static Public Member Functions | |
| static fc_shortcuts * | sc () |
| Returns given instance. More... | |
| static void | drop () |
| Deletes current instance. More... | |
Private Member Functions | |
| Q_DISABLE_COPY (fc_shortcuts) | |
| fc_shortcuts () | |
| fc_shortcuts contructor More... | |
| void | setup_action (const fc_shortcut &sc, QAction *action) |
| Sets up key bindings for the action. More... | |
Private Attributes | |
| std::map< shortcut_id, QPointer< QAction > > | m_actions |
| std::map< shortcut_id, QPointer< QShortcut > > | m_shortcuts |
| std::map< shortcut_id, fc_shortcut > | m_shortcuts_by_id |
Static Private Attributes | |
| static fc_shortcuts * | m_instance = nullptr |
Definition at line 126 of file shortcuts.h.
|
private |
|
virtual |
fc_shortcuts destructor
Definition at line 234 of file shortcuts.cpp.
| void fc_shortcuts::create_no_action_shortcuts | ( | map_view * | parent | ) |
Enable key bindings for all shortcuts that have no action associated with them.
Definition at line 285 of file shortcuts.cpp.
|
static |
Deletes current instance.
Definition at line 345 of file shortcuts.cpp.
| QString fc_shortcuts::get_desc | ( | shortcut_id | id | ) | const |
Returns description for given shortcut.
Definition at line 239 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::shortcut_exists().
| fc_shortcut fc_shortcuts::get_shortcut | ( | shortcut_id | id | ) | const |
Returns shortcut for given id.
Definition at line 247 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::edit_shortcut(), map_view::shortcut_released(), and unit_actions::update_actions().
| void fc_shortcuts::init_default | ( | bool | read | ) |
Inits defaults shortcuts or reads from settings.
Definition at line 365 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::apply_option(), and fc_shortcuts().
| void fc_shortcuts::invoke | ( | shortcut_id | id, |
| map_view * | mapview | ||
| ) |
Invokes the action for a shortcut.
Definition at line 313 of file shortcuts.cpp.
Referenced by maybe_route_mouse_shortcut(), and hud_action::mouse_clicked().
| void fc_shortcuts::link_action | ( | shortcut_id | id, |
| QAction * | action | ||
| ) |
Links an action to a shortcut.
This will synchronize the action with the shortcut, and it will be triggered whenever the shortcut is entered.
Definition at line 275 of file shortcuts.cpp.
| void fc_shortcuts::maybe_route_mouse_shortcut | ( | QMouseEvent * | event, |
| map_view * | mapview | ||
| ) |
If the mouse event corresponds to a registered shortcut, fire the corresponding action.
Definition at line 328 of file shortcuts.cpp.
Referenced by map_view::mousePressEvent().
|
private |
| bool fc_shortcuts::read | ( | ) |
Reads shortcuts from file.
Returns false if failed.
Definition at line 765 of file shortcuts.cpp.
Referenced by init_default().
|
static |
Returns given instance.
Definition at line 354 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::apply_option(), fc_shortcuts_dialog::edit_shortcut(), fc_shortcuts_dialog::init(), hud_action::mouse_clicked(), map_view::mousePressEvent(), read(), setup_action(), mr_menu::setup_menus(), fc_shortcuts_dialog::shortcut_exists(), map_view::shortcut_released(), unit_actions::update_actions(), write(), fc_client::write_settings(), and fc_client::~fc_client().
| void fc_shortcuts::set_shortcut | ( | const fc_shortcut & | sc | ) |
Sets given shortcut.
Definition at line 255 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::edit_shortcut(), and read().
|
private |
Sets up key bindings for the action.
Definition at line 384 of file shortcuts.cpp.
Referenced by link_action(), and set_shortcut().
|
inline |
Returns all existing shortcuts.
Definition at line 138 of file shortcuts.h.
Referenced by create_no_action_shortcuts(), link_action(), maybe_route_mouse_shortcut(), and write().
| void fc_shortcuts::write | ( | ) | const |
Writes shortcuts to file.
Definition at line 746 of file shortcuts.cpp.
Referenced by fc_shortcuts_dialog::apply_option(), and fc_client::write_settings().
|
private |
Definition at line 161 of file shortcuts.h.
Referenced by create_no_action_shortcuts(), invoke(), link_action(), and set_shortcut().
|
staticprivate |
Definition at line 159 of file shortcuts.h.
|
private |
Definition at line 162 of file shortcuts.h.
Referenced by create_no_action_shortcuts().
|
private |
Definition at line 163 of file shortcuts.h.
Referenced by get_desc(), get_shortcut(), init_default(), set_shortcut(), shortcuts(), and ~fc_shortcuts().