Skip to content

Commit 0c59acd

Browse files
Add shortcuts to the topbar menu options
1 parent 43749d9 commit 0c59acd

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

src/GUI/EditorWindow.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ void EditorWindow::ConfigureMenu()
170170
QAction* actSave = new QAction(tr("Save"));
171171
QAction* actSaveAs = new QAction(tr("Save As..."));
172172
QAction* actSpecial = new QAction(tr("Special"));
173+
174+
actOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
175+
actSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
176+
actSaveAs->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
177+
173178
mnFileOptions->addAction(actOpen);
174179
mnFileOptions->addAction(actSave);
175180
mnFileOptions->addAction(actSaveAs);
@@ -379,6 +384,13 @@ QHBoxLayout* EditorWindow::CreateKeysOnKeyboard(const QString& str)
379384
return pKeys;
380385
}
381386

387+
388+
void EditorWindow::SetActionHotkey(const QString& fctShortName, const QString& goName, const QString& actName, const QString& hk)
389+
{
390+
Faction& fct = const_cast<Faction&>(FACTIONS_MANAGER->FindByShortName(fctShortName));
391+
fct.SetHotkey(goName, actName, hk);
392+
}
393+
382394
void EditorWindow::KeyboardWindow_Nullify()
383395
{
384396
for (QChar& qc : QString("QWERTYUIOPASDFGHJKLZXCVBNM"))
@@ -419,12 +431,6 @@ void EditorWindow::KeyboardWindow_Update(int id)
419431
}
420432
}
421433

422-
void EditorWindow::SetActionHotkey(const QString& fctShortName, const QString& goName, const QString& actName, const QString& hk)
423-
{
424-
Faction& fct = const_cast<Faction&>(FACTIONS_MANAGER->FindByShortName(fctShortName));
425-
fct.SetHotkey(goName, actName, hk);
426-
}
427-
428434
void EditorWindow::ActAbout_Triggered()
429435
{
430436
// If dialog already exists, we reuse created window
@@ -519,6 +525,7 @@ void EditorWindow::ActSave_Triggered()
519525

520526
void EditorWindow::ActSaveAs_Triggered()
521527
{
528+
LOGMSG("ActSaveAs_Triggered");
522529
}
523530

524531
void EditorWindow::ActOpen_Triggered()

src/GUI/Translations/ru.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,74 +63,74 @@
6363
<translation>Дополнительно</translation>
6464
</message>
6565
<message>
66-
<location filename="../EditorWindow.cpp" line="183"/>
66+
<location filename="../EditorWindow.cpp" line="188"/>
6767
<source>View</source>
6868
<translation>Вид</translation>
6969
</message>
7070
<message>
71-
<location filename="../EditorWindow.cpp" line="184"/>
71+
<location filename="../EditorWindow.cpp" line="189"/>
7272
<source>Status Bar</source>
7373
<translation>Строка состояния</translation>
7474
</message>
7575
<message>
76-
<location filename="../EditorWindow.cpp" line="185"/>
76+
<location filename="../EditorWindow.cpp" line="190"/>
7777
<source>Enable</source>
7878
<translation>Включить</translation>
7979
</message>
8080
<message>
81-
<location filename="../EditorWindow.cpp" line="186"/>
81+
<location filename="../EditorWindow.cpp" line="191"/>
8282
<source>Disable</source>
8383
<translation>Отключить</translation>
8484
</message>
8585
<message>
86-
<location filename="../EditorWindow.cpp" line="190"/>
87-
<location filename="../EditorWindow.cpp" line="498"/>
86+
<location filename="../EditorWindow.cpp" line="195"/>
87+
<location filename="../EditorWindow.cpp" line="504"/>
8888
<source>Settings</source>
8989
<translation>Настройки</translation>
9090
</message>
9191
<message>
92-
<location filename="../EditorWindow.cpp" line="194"/>
93-
<location filename="../EditorWindow.cpp" line="463"/>
92+
<location filename="../EditorWindow.cpp" line="199"/>
93+
<location filename="../EditorWindow.cpp" line="469"/>
9494
<source>About</source>
9595
<translation>О программе</translation>
9696
</message>
9797
<message>
98-
<location filename="../EditorWindow.cpp" line="328"/>
98+
<location filename="../EditorWindow.cpp" line="333"/>
9999
<source>Layout %1</source>
100100
<translation>Раскладка %1</translation>
101101
</message>
102102
<message>
103-
<location filename="../EditorWindow.cpp" line="443"/>
103+
<location filename="../EditorWindow.cpp" line="449"/>
104104
<source>Authors: </source>
105105
<translation>Авторы: </translation>
106106
</message>
107107
<message>
108-
<location filename="../EditorWindow.cpp" line="444"/>
108+
<location filename="../EditorWindow.cpp" line="450"/>
109109
<source>Version: </source>
110110
<translation>Версия: </translation>
111111
</message>
112112
<message>
113-
<location filename="../EditorWindow.cpp" line="445"/>
113+
<location filename="../EditorWindow.cpp" line="451"/>
114114
<source>Program licensed with </source>
115115
<translation>Программа лицензирована под </translation>
116116
</message>
117117
<message>
118-
<location filename="../EditorWindow.cpp" line="446"/>
118+
<location filename="../EditorWindow.cpp" line="452"/>
119119
<source>GitHub repository:</source>
120120
<translation>Репозиторий на GitHub:</translation>
121121
</message>
122122
<message>
123-
<location filename="../EditorWindow.cpp" line="448"/>
123+
<location filename="../EditorWindow.cpp" line="454"/>
124124
<source>Support development:</source>
125125
<translation>Поддержать разработку:</translation>
126126
</message>
127127
<message>
128-
<location filename="../EditorWindow.cpp" line="530"/>
128+
<location filename="../EditorWindow.cpp" line="537"/>
129129
<source>Binary files</source>
130130
<translation type="unfinished">Двоичные файлы</translation>
131131
</message>
132132
<message>
133-
<location filename="../EditorWindow.cpp" line="531"/>
133+
<location filename="../EditorWindow.cpp" line="538"/>
134134
<source>Any files</source>
135135
<translation type="unfinished">Все файлы</translation>
136136
</message>

0 commit comments

Comments
 (0)