Skip to content

Commit 262e9e5

Browse files
Connect status bar checkbox with actual status bar
1 parent 6ad91e3 commit 262e9e5

7 files changed

Lines changed: 42 additions & 43 deletions

File tree

src/GUI/EditorWindow.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ EditorWindow::EditorWindow(QWidget* parent)
167167
ltContent->addLayout(ltGameObject, 7);
168168

169169
pStatusBar->setSizeGripEnabled(false);
170+
pStatusBar->setHidden(!PROGRAM_CONSTANTS->pSettingsFile->IsStatusBarEnabled());
170171

171172
QVBoxLayout* ltMain = new QVBoxLayout();
172173
ltMain->addLayout(ltFactions);
@@ -534,6 +535,7 @@ void EditorWindow::ActSettings_Triggered()
534535

535536
connect(sw, &SettingsWindow::languageChanged, this, [this](){ this->pSettingsWindow->close(); emit languageChanged(); });
536537
connect(sw, &SettingsWindow::btnBackClicked, pSettingsWindow, &QWidget::close);
538+
connect(sw, &SettingsWindow::enableStatusBar, this, &EditorWindow::SettingsWindow_EnableStatusBar);
537539
}
538540

539541
pSettingsWindow->show();
@@ -586,5 +588,7 @@ void EditorWindow::ActOpen_NewHotkeyFileSelected(const QString& filepath)
586588
emit newHotkeyFileSelected(filepath);
587589
}
588590

591+
void EditorWindow::SettingsWindow_EnableStatusBar(const bool status) { pStatusBar->setHidden(!status); }
592+
589593
#pragma endregion
590594

src/GUI/EditorWindow.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ private slots:
6464
void ActOpen_Triggered();
6565
void ActOpen_NewHotkeyFileSelected(const QString& filepath);
6666
void ActSaveAs_SaveToSelectedFile(const QString& filepath);
67+
void SettingsWindow_EnableStatusBar(const bool status);
6768

6869
signals:
6970
void languageChanged();

src/GUI/SettingsWindow.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ void SettingsWindow::BtnSave_Clicked()
108108
DiscordRPCStateUpdate(chkEnableDiscordRPC->checkState());
109109

110110
PROGRAM_CONSTANTS->pSettingsFile->SetForceSystemLanguageOnStartUp(chkForceSystemLanguageOnStartUp->checkState());
111+
112+
PROGRAM_CONSTANTS->pSettingsFile->SetStatusBarStatus(chkEnableStatusBar->checkState());
113+
emit enableStatusBar(Settings::FromQtCheckState(chkEnableStatusBar->checkState()));
111114

112115
bool isNewLanguageAssigned = cmbLanguage->currentIndex() != PROGRAM_CONSTANTS->pSettingsFile->GetLanguage();
113116

@@ -116,7 +119,7 @@ void SettingsWindow::BtnSave_Clicked()
116119

117120
PROGRAM_CONSTANTS->pSettingsFile->Save();
118121

119-
// Might be useful in future, but right now -- dead code
122+
// TODO: Might be useful in future, but right now it is a dead code
120123
if (isRestartRequired)
121124
{
122125
QMessageBox msgBox(nullptr);
@@ -188,16 +191,3 @@ void SettingsWindow::ConsoleWindowStateUpdate(const Qt::CheckState& state)
188191
void SettingsWindow::DiscordRPCStateUpdate(const Qt::CheckState& state)
189192
{
190193
}
191-
192-
void SettingsWindow::StatusBarStateUpdate(const Qt::CheckState& state)
193-
{
194-
switch (state)
195-
{
196-
case Qt::CheckState::Checked:
197-
WINDOW_MANAGER->pHotkeysEditor->pEditorWindow->pStatusBar->setHidden(false);
198-
break;
199-
case Qt::CheckState::Unchecked:
200-
WINDOW_MANAGER->pHotkeysEditor->pEditorWindow->pStatusBar->setHidden(true);
201-
break;
202-
}
203-
}

src/GUI/SettingsWindow.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ class SettingsWindow final : public QWidget
3636
void DiscordRPCStateUpdate(const Qt::CheckState& state);
3737
/// @brief Enable/disable status bar.
3838
void StatusBarStateUpdate(const Qt::CheckState& state);
39+
public:
40+
SettingsWindow(QWidget* parent = nullptr);
3941
private slots:
4042
void BtnSave_Clicked();
4143
void BtnResetAll_Clicked();
42-
public:
43-
SettingsWindow(QWidget* parent = nullptr);
4444
signals:
45+
void enableStatusBar(const bool status);
4546
void btnBackClicked();
4647
void languageChanged();
4748
};

src/GUI/Translations/ru.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,94 +22,94 @@
2222
<context>
2323
<name>EditorWindow</name>
2424
<message>
25-
<location filename="../EditorWindow.cpp" line="188"/>
25+
<location filename="../EditorWindow.cpp" line="189"/>
2626
<source>File</source>
2727
<translation>Файл</translation>
2828
</message>
2929
<message>
30-
<location filename="../EditorWindow.cpp" line="189"/>
30+
<location filename="../EditorWindow.cpp" line="190"/>
3131
<source>Open</source>
3232
<translation>Открыть</translation>
3333
</message>
3434
<message>
35-
<location filename="../EditorWindow.cpp" line="190"/>
35+
<location filename="../EditorWindow.cpp" line="191"/>
3636
<source>Save</source>
3737
<translation>Сохранить</translation>
3838
</message>
3939
<message>
40-
<location filename="../EditorWindow.cpp" line="191"/>
40+
<location filename="../EditorWindow.cpp" line="192"/>
4141
<source>Save As...</source>
4242
<translation>Сохранить как...</translation>
4343
</message>
4444
<message>
45-
<location filename="../EditorWindow.cpp" line="192"/>
45+
<location filename="../EditorWindow.cpp" line="193"/>
4646
<source>Special</source>
4747
<translation>Дополнительно</translation>
4848
</message>
4949
<message>
50-
<location filename="../EditorWindow.cpp" line="208"/>
50+
<location filename="../EditorWindow.cpp" line="209"/>
5151
<source>View</source>
5252
<translation>Вид</translation>
5353
</message>
5454
<message>
55-
<location filename="../EditorWindow.cpp" line="209"/>
55+
<location filename="../EditorWindow.cpp" line="210"/>
5656
<source>Status Bar</source>
5757
<translation>Строка состояния</translation>
5858
</message>
5959
<message>
60-
<location filename="../EditorWindow.cpp" line="210"/>
60+
<location filename="../EditorWindow.cpp" line="211"/>
6161
<source>Enable</source>
6262
<translation>Включить</translation>
6363
</message>
6464
<message>
65-
<location filename="../EditorWindow.cpp" line="211"/>
65+
<location filename="../EditorWindow.cpp" line="212"/>
6666
<source>Disable</source>
6767
<translation>Отключить</translation>
6868
</message>
6969
<message>
70-
<location filename="../EditorWindow.cpp" line="215"/>
71-
<location filename="../EditorWindow.cpp" line="527"/>
70+
<location filename="../EditorWindow.cpp" line="216"/>
71+
<location filename="../EditorWindow.cpp" line="528"/>
7272
<source>Settings</source>
7373
<translation>Настройки</translation>
7474
</message>
7575
<message>
76-
<location filename="../EditorWindow.cpp" line="219"/>
77-
<location filename="../EditorWindow.cpp" line="492"/>
76+
<location filename="../EditorWindow.cpp" line="220"/>
77+
<location filename="../EditorWindow.cpp" line="493"/>
7878
<source>About</source>
7979
<translation>О программе</translation>
8080
</message>
8181
<message>
82-
<location filename="../EditorWindow.cpp" line="353"/>
82+
<location filename="../EditorWindow.cpp" line="354"/>
8383
<source>Layout %1</source>
8484
<translation>Раскладка %1</translation>
8585
</message>
8686
<message>
87-
<location filename="../EditorWindow.cpp" line="472"/>
87+
<location filename="../EditorWindow.cpp" line="473"/>
8888
<source>Authors: </source>
8989
<translation>Авторы: </translation>
9090
</message>
9191
<message>
92-
<location filename="../EditorWindow.cpp" line="473"/>
92+
<location filename="../EditorWindow.cpp" line="474"/>
9393
<source>Version: </source>
9494
<translation>Версия: </translation>
9595
</message>
9696
<message>
97-
<location filename="../EditorWindow.cpp" line="474"/>
97+
<location filename="../EditorWindow.cpp" line="475"/>
9898
<source>Program licensed with </source>
9999
<translation>Программа лицензирована под </translation>
100100
</message>
101101
<message>
102-
<location filename="../EditorWindow.cpp" line="475"/>
102+
<location filename="../EditorWindow.cpp" line="476"/>
103103
<source>GitHub repository:</source>
104104
<translation>Репозиторий на GitHub:</translation>
105105
</message>
106106
<message>
107-
<location filename="../EditorWindow.cpp" line="477"/>
107+
<location filename="../EditorWindow.cpp" line="478"/>
108108
<source>Support development:</source>
109109
<translation>Поддержать разработку:</translation>
110110
</message>
111111
<message>
112-
<location filename="../EditorWindow.cpp" line="557"/>
112+
<location filename="../EditorWindow.cpp" line="559"/>
113113
<source>Changes has been saved to the file:</source>
114114
<translation>Изменения были сохранены в файл:</translation>
115115
</message>
@@ -118,12 +118,12 @@
118118
<translation type="obsolete">Изменения были сохранены в файл:</translation>
119119
</message>
120120
<message>
121-
<location filename="../EditorWindow.cpp" line="578"/>
121+
<location filename="../EditorWindow.cpp" line="580"/>
122122
<source>Binary files</source>
123123
<translation>Двоичные файлы</translation>
124124
</message>
125125
<message>
126-
<location filename="../EditorWindow.cpp" line="579"/>
126+
<location filename="../EditorWindow.cpp" line="581"/>
127127
<source>Any files</source>
128128
<translation>Все файлы</translation>
129129
</message>
@@ -418,22 +418,22 @@
418418
<translation>НАЗАД</translation>
419419
</message>
420420
<message>
421-
<location filename="../SettingsWindow.cpp" line="125"/>
421+
<location filename="../SettingsWindow.cpp" line="128"/>
422422
<source>Setting Apply Confirmation</source>
423423
<translation>Подтверждение применения настроек</translation>
424424
</message>
425425
<message>
426-
<location filename="../SettingsWindow.cpp" line="126"/>
426+
<location filename="../SettingsWindow.cpp" line="129"/>
427427
<source>You have selected settings that require a complete restart of the editor. Do you want to apply new settings and restart editor?</source>
428428
<translation>Вы выбрали настройки, которые требуют полного перезапуска редактора. Вы желаете применить новые настройки и перезапустить редактор?</translation>
429429
</message>
430430
<message>
431-
<location filename="../SettingsWindow.cpp" line="128"/>
431+
<location filename="../SettingsWindow.cpp" line="131"/>
432432
<source>YES</source>
433433
<translation>ДА</translation>
434434
</message>
435435
<message>
436-
<location filename="../SettingsWindow.cpp" line="129"/>
436+
<location filename="../SettingsWindow.cpp" line="132"/>
437437
<source>CANCEL</source>
438438
<translation>ОТМЕНА</translation>
439439
</message>

src/Settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void Settings::SetToDefault()
2626
DebugConsole = false;
2727
DiscordRPC = true;
2828
ForceSystemLanguage = true;
29+
StatusBar = true;
2930
Language = 0; // English
3031
}
3132

src/Settings.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ class Settings final
1616
bool StatusBar;
1717

1818
private: // Methods
19-
bool FromQtCheckState(const Qt::CheckState& state);
2019
public:
2120
explicit Settings();
2221
~Settings();
2322

23+
/// @brief Converts Qt::ChechState to the bool.
24+
static bool FromQtCheckState(const Qt::CheckState& state);
25+
2426
/// @brief Set all `Settings` class variables to default values.
2527
void SetToDefault();
2628
/// @brief Parse `Resources\Settings.json`.

0 commit comments

Comments
 (0)