Freeciv-3.3
Loading...
Searching...
No Matches
shortcuts.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2003 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifndef FC__SHORTCUTSDLG_H
15#define FC__SHORTCUTSDLG_H
16
17// Qt
18#include <QDialog>
19#include <QLineEdit>
20#include <QPushButton>
21
23class QVBoxLayout;
24struct fc_shortcut;
25
28void write_shortcuts();
29bool read_shortcuts();
30void shortcutreset();
31
32// Assign numbers for casting
97
98#define SC_NUM_SHORTCUTS 61
99
100
101/**************************************************************************
102 Base shortcut struct
103**************************************************************************/
105{
107 int key;
108 Qt::MouseButton mouse;
109 Qt::KeyboardModifiers mod;
111 bool operator==(const fc_shortcut& a) const {
112 return ((key == a.key) && (mouse == a.mouse) && (mod == a.mod));
113 }
114};
115
116/**************************************************************************
117 Class with static members holding all shortcuts
118**************************************************************************/
120{
122 fc_shortcuts();
124
125public:
127 static fc_shortcuts *sc();
128 static bool is_instantiated();
129 static void drop();
131public:
132 static void init_default(bool read);
137};
138
139/**************************************************************************
140 Widget for picking shortcuts
141**************************************************************************/
142class line_edit : public QLineEdit
143{
145public:
146 line_edit();
148 protected:
151};
152
153/**************************************************************************
154 Popup for picking shortcuts
155**************************************************************************/
156class fc_shortcut_popup : public QDialog
157{
159public:
160 fc_shortcut_popup(QWidget *parent);
161 void run(fc_shortcut *s);
163protected:
164 void closeEvent(QCloseEvent*);
165private:
166 bool check_if_exist();
168};
169
170/**************************************************************************
171 QPushButton holding shortcut
172**************************************************************************/
173class fc_sc_button : public QPushButton
174{
177public:
178 fc_sc_button();
182 void show_info(QString str);
183private slots:
184 void popup_error();
185};
186
187/**************************************************************************
188 Shortcut dialog
189**************************************************************************/
190class fc_shortcuts_dialog : public QDialog
191{
197 void add_option(fc_shortcut *sc);
198 void init();
199 void refresh();
200public:
201 fc_shortcuts_dialog(QWidget *parent = 0);
202virtual ~fc_shortcuts_dialog();
203private slots:
204 void apply_option(int response);
205 void edit_shortcut();
206};
207
208#endif // FC__SHORTCUSDLG_H
#define str
Definition astring.c:76
fc_shortcut * sc_orig
Definition shortcuts.h:181
void show_info(QString str)
void popup_error()
fc_shortcut * sc
Definition shortcuts.h:180
QString err_message
Definition shortcuts.h:176
void closeEvent(QCloseEvent *)
fc_shortcut * sc
Definition shortcuts.h:162
void run(fc_shortcut *s)
virtual ~fc_shortcuts_dialog()
void add_option(fc_shortcut *sc)
void apply_option(int response)
QDialogButtonBox * button_box
Definition shortcuts.h:195
QVBoxLayout * scroll_layout
Definition shortcuts.h:194
QMap< shortcut_id, fc_shortcut * > * hashcopy
Definition shortcuts.h:196
QVBoxLayout * main_layout
Definition shortcuts.h:193
static fc_shortcuts * m_instance
Definition shortcuts.h:123
static QMap< shortcut_id, fc_shortcut * > hash
Definition shortcuts.h:130
static fc_shortcuts * sc()
static void init_default(bool read)
static void drop()
QString get_desc(shortcut_id id)
fc_shortcut * get_shortcut(shortcut_id id)
static bool is_instantiated()
Q_DISABLE_COPY(fc_shortcuts)
void set_shortcut(fc_shortcut *sc)
shortcut_id get_id(fc_shortcut *sc)
void mousePressEvent(QMouseEvent *event)
fc_shortcut shc
Definition shortcuts.h:147
void keyReleaseEvent(QKeyEvent *event)
char * incite_cost
Definition comments.c:76
enum event_type event
Definition events.c:81
struct player_slot * slots
Definition player.c:51
shortcut_id
Definition shortcuts.h:33
@ SC_PARADROP
Definition shortcuts.h:95
@ SC_UPGRADE_UNIT
Definition shortcuts.h:63
@ SC_BUILDIRRIGATION
Definition shortcuts.h:67
@ SC_BUILDCITY
Definition shortcuts.h:70
@ SC_DONE_MOVING
Definition shortcuts.h:57
@ SC_BUILDROAD
Definition shortcuts.h:69
@ SC_UNSENTRY_TILE
Definition shortcuts.h:61
@ SC_NONE
Definition shortcuts.h:34
@ SC_CULTIVATE
Definition shortcuts.h:68
@ SC_DO
Definition shortcuts.h:62
@ SC_CENTER_VIEW
Definition shortcuts.h:36
@ SC_POPUP_COMB_INF
Definition shortcuts.h:83
@ SC_SENTRY
Definition shortcuts.h:71
@ SC_GOBUILDCITY
Definition shortcuts.h:92
@ SC_NUKE
Definition shortcuts.h:76
@ SC_HIDE_WORKERS
Definition shortcuts.h:52
@ SC_AUTOEXPLORE
Definition shortcuts.h:59
@ SC_POPUP_INFO
Definition shortcuts.h:47
@ SC_SETHOME
Definition shortcuts.h:64
@ SC_RELOAD_LUA
Definition shortcuts.h:90
@ SC_PLANT
Definition shortcuts.h:66
@ SC_BUILDMINE
Definition shortcuts.h:65
@ SC_FULLSCREEN
Definition shortcuts.h:37
@ SC_TRADE_ROUTES
Definition shortcuts.h:54
@ SC_CITY_OUTPUT
Definition shortcuts.h:39
@ SC_TRANSFORM
Definition shortcuts.h:75
@ SC_STACK_SIZE
Definition shortcuts.h:94
@ SC_SHOW_UNITS
Definition shortcuts.h:53
@ SC_PASTE_PROD
Definition shortcuts.h:50
@ SC_WAKEUP_SENTRIES
Definition shortcuts.h:48
@ SC_MAKE_LINK
Definition shortcuts.h:49
@ SC_FORTIFY
Definition shortcuts.h:72
@ SC_APPEND_FOCUS
Definition shortcuts.h:46
@ SC_ZOOM_IN
Definition shortcuts.h:87
@ SC_GOJOINCITY
Definition shortcuts.h:93
@ SC_MAP_GRID
Definition shortcuts.h:40
@ SC_MINIMAP
Definition shortcuts.h:38
@ SC_QUICK_BUY
Definition shortcuts.h:42
@ SC_CITY_PROD
Definition shortcuts.h:55
@ SC_RELOAD_THEME
Definition shortcuts.h:84
@ SC_PATROL
Definition shortcuts.h:60
@ SC_GOTO
Definition shortcuts.h:73
@ SC_RELOAD_TILESET
Definition shortcuts.h:85
@ SC_BUY_MAP
Definition shortcuts.h:79
@ SC_SCROLL_MAP
Definition shortcuts.h:35
@ SC_GOTOAIRLIFT
Definition shortcuts.h:58
@ SC_WAIT
Definition shortcuts.h:74
@ SC_QUICK_SELECT
Definition shortcuts.h:43
@ SC_IFACE_LOCK
Definition shortcuts.h:80
@ SC_DEBOARD
Definition shortcuts.h:78
@ SC_ZOOM_RESET
Definition shortcuts.h:91
@ SC_ZOOM_OUT
Definition shortcuts.h:88
@ SC_ADJUST_WORKERS
Definition shortcuts.h:45
@ SC_SELECT_BUTTON
Definition shortcuts.h:44
@ SC_AUTOMATE
Definition shortcuts.h:81
@ SC_CITY_NAMES
Definition shortcuts.h:56
@ SC_COPY_PROD
Definition shortcuts.h:51
@ SC_LOAD_LUA
Definition shortcuts.h:89
@ SC_BOARD
Definition shortcuts.h:77
@ SC_CLEAN
Definition shortcuts.h:82
@ SC_NAT_BORDERS
Definition shortcuts.h:41
@ SC_SHOW_FULLBAR
Definition shortcuts.h:86
void popup_shortcuts_dialog()
bool read_shortcuts()
void shortcutreset()
QString shortcut_to_string(fc_shortcut *sc)
void write_shortcuts()
QString str
Definition shortcuts.h:110
Qt::KeyboardModifiers mod
Definition shortcuts.h:109
Qt::MouseButton mouse
Definition shortcuts.h:108
bool operator==(const fc_shortcut &a) const
Definition shortcuts.h:111
shortcut_id id
Definition shortcuts.h:106