15 #include <QKeySequence>
16 #include <QKeySequenceEdit>
19 #include <QPushButton>
22 class QDialogButtonBox;
void init()
Inits shortcut dialog layout.
bool shortcut_exists(const fc_shortcut &shortcut, QString &where) const
Checks if a shortcut already exists.
void add_option(const fc_shortcut &sc)
Adds shortcut option for dialog.
void apply_option(int response)
Slot for buttons on bottom of shortcut dialog.
fc_shortcuts_dialog(QWidget *parent=0)
Contructor for shortcut dialog.
void edit_shortcut()
Slot for editing shortcut.
QDialogButtonBox * button_box
QVBoxLayout * scroll_layout
~fc_shortcuts_dialog() override
Destructor for shortcut dialog.
QVBoxLayout * main_layout
void refresh()
Reinitializes layout.
fc_shortcut get_shortcut(shortcut_id id) const
Returns shortcut for given id.
std::map< shortcut_id, QPointer< QAction > > m_actions
static fc_shortcuts * m_instance
static fc_shortcuts * sc()
Returns given instance.
void init_default(bool read)
Inits defaults shortcuts or reads from settings.
static void drop()
Deletes current instance.
void write() const
Writes shortcuts to file.
void create_no_action_shortcuts(map_view *parent)
Enable key bindings for all shortcuts that have no action associated with them.
Q_DISABLE_COPY(fc_shortcuts)
std::map< shortcut_id, fc_shortcut > m_shortcuts_by_id
void set_shortcut(const fc_shortcut &sc)
Sets given shortcut.
void setup_action(const fc_shortcut &sc, QAction *action)
Sets up key bindings for the action.
std::map< shortcut_id, QPointer< QShortcut > > m_shortcuts
virtual ~fc_shortcuts()
fc_shortcuts destructor
bool read()
Reads shortcuts from file.
void link_action(shortcut_id id, QAction *action)
Links an action to a shortcut.
void invoke(shortcut_id id, map_view *mapview)
Invokes the action for a shortcut.
void maybe_route_mouse_shortcut(QMouseEvent *event, map_view *mapview)
If the mouse event corresponds to a registered shortcut, fire the corresponding action.
fc_shortcuts()
fc_shortcuts contructor
QString get_desc(shortcut_id id) const
Returns description for given shortcut.
auto shortcuts() const
Returns all existing shortcuts.
bool eventFilter(QObject *watched, QEvent *event) override
Mouse press event for shortcut edit widget.
fc_shortcut shortcut() const
Retrieves the shortcut entered by the user.
shortcut_edit(const fc_shortcut &sc)
Constructs a shortcut edit widget.
bool event(QEvent *event) override
Reimplemented from QObject.
bool m_ignore_next_mouse_event
void set_shortcut(const fc_shortcut &shortcut)
Changes the shortcut displayed by the widget.
void popup_shortcuts_dialog()
Popups shortcut dialog.
Qt::KeyboardModifiers modifiers
bool is_valid() const
Checks if the shortcut can be used.
QString to_string() const
Returns shortcut as string (eg.
bool conflicts(const fc_shortcut &other) const