Skip to content

Commit 7782d65

Browse files
committed
settings: minor code consistency changes
1 parent eb398bd commit 7782d65

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

app/source/gui/settings.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ namespace GUI {
1818

1919
static SETTINGS_STATE settings_state = GENERAL_SETTINGS;
2020
static int selection = 0;
21-
static const int sel_dist = 44;
22-
static char ftp_text[36];
23-
static bool screen_disabled = false;
21+
static const int selectDistance = 44;
22+
static char ftpText[36];
23+
static bool screenDisabled = false;
2424

2525
static void DisplayFTPSettings(void) {
2626
G2D::DrawRect(0, 18, 480, 254, G2D_RGBA(0, 0, 0, cfg.dark_theme? 50 : 80));
@@ -32,27 +32,30 @@ namespace GUI {
3232
G2D::DrawRect((409 - (ok_width)) - 5, (180 - (font->texYSize - 15)) - 5, ok_width + 10, (font->texYSize - 5) + 10, SELECTOR_COLOUR);
3333
G2D::DrawText(409 - (ok_width), (192 - (font->texYSize - 15)) - 3, "OK");
3434

35-
int text_width = intraFontMeasureText(font, ftp_text);
35+
int text_width = intraFontMeasureText(font, ftpText);
3636
G2D::FontSetStyle(1.f, TEXT_COLOUR, INTRAFONT_ALIGN_LEFT);
37-
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, ftp_text);
37+
G2D::DrawText(((480 - (text_width)) / 2), ((272 - (dialog[0]->h)) / 2) + 60, ftpText);
3838
}
3939

4040
static void ControlFTPSettings(void) {
4141
if (Utils::IsButtonPressed(PSP_CTRL_CANCEL)) {
4242
Net::ExitFTP();
4343
settings_state = GENERAL_SETTINGS;
4444

45-
if (screen_disabled)
45+
if (screenDisabled) {
4646
pspDisplayEnable();
47+
}
4748
}
4849

4950
if (Utils::IsButtonPressed(PSP_CTRL_SELECT)) {
50-
screen_disabled = !screen_disabled;
51+
screenDisabled = !screenDisabled;
5152

52-
if (screen_disabled)
53+
if (screenDisabled) {
5354
pspDisplayDisable();
54-
else
55+
}
56+
else {
5557
pspDisplayEnable();
58+
}
5659
}
5760

5861
Utils::SetBounds(selection, 0, 0);
@@ -114,8 +117,9 @@ namespace GUI {
114117
}
115118

116119
static void ControlAboutSettings(void) {
117-
if ((Utils::IsButtonPressed(PSP_CTRL_ENTER)) || (Utils::IsButtonPressed(PSP_CTRL_CANCEL)))
120+
if ((Utils::IsButtonPressed(PSP_CTRL_ENTER)) || (Utils::IsButtonPressed(PSP_CTRL_CANCEL))) {
118121
settings_state = GENERAL_SETTINGS;
122+
}
119123

120124
Utils::SetBounds(selection, 4, 4);
121125
}
@@ -145,10 +149,12 @@ namespace GUI {
145149
G2D::DrawText(60, 248, "About");
146150
G2D::DrawText(60, 262, "Application and device info");
147151

148-
if (cfg.dark_theme)
152+
if (cfg.dark_theme) {
149153
G2D::DrawImage(icon_toggle_on[cfg.dark_theme], 415, 143);
150-
else
154+
}
155+
else {
151156
G2D::DrawImage(icon_toggle_off, 415, 143);
157+
}
152158

153159
G2D::DrawImage(cfg.dev_options? icon_toggle_on[cfg.dark_theme] : icon_toggle_off, 415, 187);
154160
}
@@ -157,7 +163,7 @@ namespace GUI {
157163
if (Utils::IsButtonPressed(PSP_CTRL_ENTER)) {
158164
switch(selection) {
159165
case 0:
160-
Net::InitFTP(ftp_text);
166+
Net::InitFTP(ftpText);
161167
settings_state = FTP_SETTINGS;
162168
break;
163169

@@ -195,7 +201,7 @@ namespace GUI {
195201
G2D::DrawRect(0, 52, 480, 220, BG_COLOUR);
196202
G2D::DrawImage(icon_back, 5, 20);
197203

198-
G2D::DrawRect(0, 52 + (selection * sel_dist), 480, sel_dist, SELECTOR_COLOUR);
204+
G2D::DrawRect(0, 52 + (selection * selectDistance), 480, selectDistance, SELECTOR_COLOUR);
199205
G2D::FontSetStyle(1.f, WHITE, INTRAFONT_ALIGN_LEFT);
200206

201207
switch(settings_state) {
@@ -220,10 +226,12 @@ namespace GUI {
220226
}
221227

222228
void ControlSettings(MenuItem &item, int &ctrl) {
223-
if (ctrl & PSP_CTRL_UP)
229+
if (ctrl & PSP_CTRL_UP) {
224230
selection--;
225-
else if (ctrl & PSP_CTRL_DOWN)
231+
}
232+
else if (ctrl & PSP_CTRL_DOWN) {
226233
selection++;
234+
}
227235

228236
switch(settings_state) {
229237
case GENERAL_SETTINGS:

0 commit comments

Comments
 (0)