Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor options screen #1554

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 108 additions & 100 deletions libs/s25main/desktops/dskOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,22 @@
// Allgemein
// {

// "Name"
groupAllgemein->AddText(ID_txtName, DrawPoint(80, 80), _("Name in Game:"), COLOR_YELLOW, FontStyle{}, NormalFont);
DrawPoint curPos = DrawPoint(80, 80);

Check warning on line 151 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L151

Added line #L151 was not covered by tests
using Offset = DrawPoint;
constexpr Offset ctrlOffset(200, -5); // Offset of control to its description text
constexpr Offset ctrlOffset2 = ctrlOffset + Offset(200, 0); // Offset of 2nd control to its description text
constexpr Extent ctrlSize(190, 22);
constexpr Extent ctrlSizeLarge = ctrlSize + Extent(ctrlOffset2 - ctrlOffset);

Check warning on line 156 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L153-L156

Added lines #L153 - L156 were not covered by tests

groupAllgemein->AddText(ID_txtName, curPos, _("Name in Game:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 158 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L158

Added line #L158 was not covered by tests
ctrlEdit* name =
groupAllgemein->AddEdit(ID_edtName, DrawPoint(280, 75), Extent(190, 22), TextureColor::Grey, NormalFont, 15);
groupAllgemein->AddEdit(ID_edtName, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15);

Check warning on line 160 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L160

Added line #L160 was not covered by tests
name->SetText(SETTINGS.lobby.name);
curPos.y += 30;

Check warning on line 162 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L162

Added line #L162 was not covered by tests

// "Sprache"
groupAllgemein->AddText(ID_txtLanguage, DrawPoint(80, 110), _("Language:"), COLOR_YELLOW, FontStyle{}, NormalFont);
combo = groupAllgemein->AddComboBox(ID_cbLanguage, DrawPoint(280, 105), Extent(190, 20), TextureColor::Grey,
NormalFont, 100);
groupAllgemein->AddText(ID_txtLanguage, curPos, _("Language:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 164 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L164

Added line #L164 was not covered by tests
combo =
groupAllgemein->AddComboBox(ID_cbLanguage, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 100);

Check warning on line 166 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L166

Added line #L166 was not covered by tests

bool selected = false;
for(unsigned i = 0; i < LANGUAGES.size(); ++i)
Expand All @@ -173,46 +179,54 @@
}
if(!selected)
combo->SetSelection(0);
curPos.y += 30;

Check warning on line 182 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L182

Added line #L182 was not covered by tests

groupAllgemein->AddText(ID_txtKeyboardLayout, DrawPoint(80, 150), _("Keyboard layout:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupAllgemein->AddTextButton(ID_btKeyboardLayout, DrawPoint(280, 145), Extent(120, 22), TextureColor::Grey,
_("Readme"), NormalFont);
groupAllgemein->AddTextButton(ID_btKeyboardLayout, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey,
_("Keyboard layout"), NormalFont);
curPos.y += 40;

Check warning on line 186 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L184-L186

Added lines #L184 - L186 were not covered by tests

groupAllgemein->AddText(ID_txtPort, DrawPoint(80, 190), _("Local Port:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupAllgemein->AddText(ID_txtPort, curPos, _("Local Port:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 188 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L188

Added line #L188 was not covered by tests
ctrlEdit* edtPort =
groupAllgemein->AddEdit(ID_edtPort, DrawPoint(280, 185), Extent(190, 22), TextureColor::Grey, NormalFont, 15);
groupAllgemein->AddEdit(ID_edtPort, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 15);

Check warning on line 190 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L190

Added line #L190 was not covered by tests
edtPort->SetNumberOnly(true);
edtPort->SetText(SETTINGS.server.localPort);
curPos.y += 30;

Check warning on line 193 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L193

Added line #L193 was not covered by tests

// IPv4/6
groupAllgemein->AddText(ID_txtIpv6, DrawPoint(80, 230), _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupAllgemein->AddText(ID_txtIpv6, curPos, _("Use IPv6:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 196 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L196

Added line #L196 was not covered by tests

ctrlOptionGroup* ipv6 = groupAllgemein->AddOptionGroup(ID_grpIpv6, GroupSelectType::Check);
ipv6->AddTextButton(ID_btOn, DrawPoint(480, 225), Extent(190, 22), TextureColor::Grey, _("IPv6"), NormalFont);
ipv6->AddTextButton(ID_btOff, DrawPoint(280, 225), Extent(190, 22), TextureColor::Grey, _("IPv4"), NormalFont);
ipv6->AddTextButton(ID_btOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("IPv6"), NormalFont);
ipv6->AddTextButton(ID_btOff, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("IPv4"), NormalFont);

Check warning on line 200 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L199-L200

Added lines #L199 - L200 were not covered by tests
ipv6->SetSelection(SETTINGS.server.ipv6);

// ipv6-feld ggf (de-)aktivieren
ipv6->GetCtrl<ctrlButton>(1)->SetEnabled(SETTINGS.proxy.type != ProxyType::Socks5); //-V807
curPos.y += 40;

Check warning on line 204 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L204

Added line #L204 was not covered by tests

// Proxyserver
groupAllgemein->AddText(ID_txtProxy, DrawPoint(80, 280), _("Proxyserver:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupAllgemein->AddText(ID_txtProxy, curPos, _("Proxyserver:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 207 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L207

Added line #L207 was not covered by tests
ctrlEdit* proxy =
groupAllgemein->AddEdit(ID_edtProxy, DrawPoint(280, 275), Extent(190, 22), TextureColor::Grey, NormalFont);
groupAllgemein->AddEdit(ID_edtProxy, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont);

Check warning on line 209 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L209

Added line #L209 was not covered by tests
proxy->SetText(SETTINGS.proxy.hostname);
proxy =
groupAllgemein->AddEdit(ID_edtProxyPort, DrawPoint(480, 275), Extent(50, 22), TextureColor::Grey, NormalFont, 5);
groupAllgemein->AddEdit(ID_edtProxyPort, curPos + ctrlOffset2, Extent(50, 22), TextureColor::Grey, NormalFont, 5);

Check warning on line 212 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L212

Added line #L212 was not covered by tests
proxy->SetNumberOnly(true);
proxy->SetText(SETTINGS.proxy.port);
curPos.y += 30;

Check warning on line 215 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L215

Added line #L215 was not covered by tests

groupAllgemein->AddText(ID_txtUPNP, curPos, _("Use UPnP"), COLOR_YELLOW, FontStyle{}, NormalFont);
ctrlOptionGroup* upnp = groupAllgemein->AddOptionGroup(ID_grpUPNP, GroupSelectType::Check);
upnp->AddTextButton(ID_btOff, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Off"), NormalFont);
upnp->AddTextButton(ID_btOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("On"), NormalFont);
upnp->SetSelection(SETTINGS.global.use_upnp);
curPos.y += 30;

Check warning on line 222 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L217-L222

Added lines #L217 - L222 were not covered by tests

// Proxytyp
groupAllgemein->AddText(ID_txtProxyType, DrawPoint(80, 310), _("Proxytyp:"), COLOR_YELLOW, FontStyle{}, NormalFont);
combo = groupAllgemein->AddComboBox(ID_cbProxyType, DrawPoint(280, 305), Extent(390, 20), TextureColor::Grey,
groupAllgemein->AddText(ID_txtProxyType, curPos, _("Proxytyp:"), COLOR_YELLOW, FontStyle{}, NormalFont);
combo = groupAllgemein->AddComboBox(ID_cbProxyType, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey,

Check warning on line 226 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L225-L226

Added lines #L225 - L226 were not covered by tests
NormalFont, 100);
combo->AddString(_("No Proxy"));
combo->AddString(_("Socks v4"));

// TODO: not implemented
// combo->AddString(_("Socks v5"));

Expand All @@ -222,76 +236,65 @@
case ProxyType::Socks4: combo->SetSelection(1); break;
case ProxyType::Socks5: combo->SetSelection(2); break;
}
curPos.y += 50;

Check warning on line 239 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L239

Added line #L239 was not covered by tests

// }
groupAllgemein->AddText(ID_txtSmartCursor, curPos, _("Smart Cursor"), COLOR_YELLOW, FontStyle{}, NormalFont);
ctrlOptionGroup* smartCursor = groupAllgemein->AddOptionGroup(ID_grpSmartCursor, GroupSelectType::Check);
smartCursor->AddTextButton(
ID_btOff, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Off"), NormalFont,

Check warning on line 244 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L241-L244

Added lines #L241 - L244 were not covered by tests
_("Don't move cursor automatically\nUseful e.g. for split-screen / dual-mice multiplayer (see wiki)"));
smartCursor->AddTextButton(ID_btOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("On"), NormalFont,

Check warning on line 246 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L246

Added line #L246 was not covered by tests
_("Place cursor on default button for new dialogs / action windows (default)"));
smartCursor->SetSelection(SETTINGS.global.smartCursor);
curPos.y += 50;

Check warning on line 249 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L248-L249

Added lines #L248 - L249 were not covered by tests

groupAllgemein->AddText(ID_txtDebugData, DrawPoint(80, 360), _("Submit debug data:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupAllgemein->AddText(ID_txtDebugData, curPos, _("Submit debug data:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 251 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L251

Added line #L251 was not covered by tests
optiongroup = groupAllgemein->AddOptionGroup(ID_grpDebugData, GroupSelectType::Check);
optiongroup->AddTextButton(ID_btSubmitDebugOn, DrawPoint(480, 355), Extent(190, 22), TextureColor::Grey, _("On"),
optiongroup->AddTextButton(ID_btSubmitDebugOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("On"),
NormalFont);
optiongroup->AddTextButton(ID_btSubmitDebugAsk, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Ask always"),

Check warning on line 255 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L253-L255

Added lines #L253 - L255 were not covered by tests
NormalFont);
optiongroup->AddTextButton(ID_btSubmitDebugAsk, DrawPoint(280, 355), Extent(190, 22), TextureColor::Grey,
_("Ask always"), NormalFont);

optiongroup->SetSelection((SETTINGS.global.submit_debug_data == 1) ? ID_btSubmitDebugOn :
ID_btSubmitDebugAsk); //-V807
curPos.y += 30;

Check warning on line 260 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L260

Added line #L260 was not covered by tests

// qx:upnp switch
groupAllgemein->AddText(ID_txtUPNP, DrawPoint(80, 390), _("Use UPnP"), COLOR_YELLOW, FontStyle{}, NormalFont);
ctrlOptionGroup* upnp = groupAllgemein->AddOptionGroup(ID_grpUPNP, GroupSelectType::Check);
upnp->AddTextButton(ID_btOff, DrawPoint(280, 385), Extent(190, 22), TextureColor::Grey, _("Off"), NormalFont);
upnp->AddTextButton(ID_btOn, DrawPoint(480, 385), Extent(190, 22), TextureColor::Grey, _("On"), NormalFont);
upnp->SetSelection(SETTINGS.global.use_upnp);

groupAllgemein->AddText(ID_txtSmartCursor, DrawPoint(80, 420), _("Smart Cursor"), COLOR_YELLOW, FontStyle{},
NormalFont);
ctrlOptionGroup* smartCursor = groupAllgemein->AddOptionGroup(ID_grpSmartCursor, GroupSelectType::Check);
smartCursor->AddTextButton(
ID_btOff, DrawPoint(280, 415), Extent(190, 22), TextureColor::Grey, _("Off"), NormalFont,
_("Don't move cursor automatically\nUseful e.g. for split-screen / dual-mice multiplayer (see wiki)"));
smartCursor->AddTextButton(ID_btOn, DrawPoint(480, 415), Extent(190, 22), TextureColor::Grey, _("On"), NormalFont,
_("Place cursor on default button for new dialogs / action windows (default)"));
smartCursor->SetSelection(SETTINGS.global.smartCursor);

groupAllgemein->AddText(ID_txtGFInfo, DrawPoint(80, 450), _("Show GameFrame Info:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupAllgemein->AddText(ID_txtGFInfo, curPos, _("Show GameFrame Info:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 262 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L262

Added line #L262 was not covered by tests
optiongroup = groupAllgemein->AddOptionGroup(ID_grpGFInfo, GroupSelectType::Check);
optiongroup->AddTextButton(ID_btOn, DrawPoint(480, 445), Extent(190, 22), TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(280, 445), Extent(190, 22), TextureColor::Grey, _("Off"),
NormalFont);
optiongroup->AddTextButton(ID_btOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Off"), NormalFont);

Check warning on line 265 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L264-L265

Added lines #L264 - L265 were not covered by tests

optiongroup->SetSelection(SETTINGS.global.showGFInfo);

// "Auflösung"
groupGrafik->AddText(ID_txtResolution, DrawPoint(80, 80), _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupGrafik->AddComboBox(ID_cbResolution, DrawPoint(280, 75), Extent(190, 22), TextureColor::Grey, NormalFont, 150);
curPos.y = 80;
groupGrafik->AddText(ID_txtResolution, curPos, _("Fullscreen resolution:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupGrafik->AddComboBox(ID_cbResolution, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, NormalFont, 150);
curPos.y += 50;

Check warning on line 273 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L270-L273

Added lines #L270 - L273 were not covered by tests

// "Vollbild"
groupGrafik->AddText(ID_txtFullscreen, DrawPoint(80, 130), _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupGrafik->AddText(ID_txtFullscreen, curPos, _("Mode:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 276 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L276

Added line #L276 was not covered by tests
optiongroup = groupGrafik->AddOptionGroup(ID_grpFullscreen, GroupSelectType::Check);
optiongroup->AddTextButton(ID_btOn, DrawPoint(480, 125), Extent(190, 22), TextureColor::Grey, _("Fullscreen"),
NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(280, 125), Extent(190, 22), TextureColor::Grey, _("Windowed"),
optiongroup->AddTextButton(ID_btOn, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Fullscreen"),

Check warning on line 278 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L278

Added line #L278 was not covered by tests
NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Windowed"), NormalFont);
curPos.y += 50;

Check warning on line 281 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L280-L281

Added lines #L280 - L281 were not covered by tests

groupGrafik->AddText(ID_txtFramerate, DrawPoint(80, 180), _("Limit Framerate:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupGrafik->AddComboBox(ID_cbFramerate, DrawPoint(280, 175), Extent(390, 22), TextureColor::Grey, NormalFont, 150);
// "VSync"
groupGrafik->AddText(ID_txtFramerate, curPos, _("Limit Framerate:"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupGrafik->AddComboBox(ID_cbFramerate, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey, NormalFont, 150);
curPos.y += 50;

Check warning on line 286 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L284-L286

Added lines #L284 - L286 were not covered by tests

// "VBO"
groupGrafik->AddText(ID_txtVBO, DrawPoint(80, 230), _("Vertex Buffer Objects:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupGrafik->AddText(ID_txtVBO, curPos, _("Vertex Buffer Objects:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 289 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L289

Added line #L289 was not covered by tests
optiongroup = groupGrafik->AddOptionGroup(ID_grpVBO, GroupSelectType::Check);

optiongroup->AddTextButton(ID_btOn, DrawPoint(280, 225), Extent(190, 22), TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(480, 225), Extent(190, 22), TextureColor::Grey, _("Off"),
NormalFont);
optiongroup->AddTextButton(ID_btOn, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Off"), NormalFont);
curPos.y += 50;

Check warning on line 293 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L291-L293

Added lines #L291 - L293 were not covered by tests

// "Grafiktreiber"
groupGrafik->AddText(ID_txtVideoDriver, DrawPoint(80, 275), _("Graphics Driver"), COLOR_YELLOW, FontStyle{},
NormalFont);
combo = groupGrafik->AddComboBox(ID_cbVideoDriver, DrawPoint(280, 275), Extent(390, 20), TextureColor::Grey,
groupGrafik->AddText(ID_txtVideoDriver, curPos, _("Graphics Driver"), COLOR_YELLOW, FontStyle{}, NormalFont);
Flamefire marked this conversation as resolved.
Show resolved Hide resolved
combo = groupGrafik->AddComboBox(ID_cbVideoDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey,

Check warning on line 297 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L296-L297

Added lines #L296 - L297 were not covered by tests
NormalFont, 100);

const auto video_drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Video);
Expand All @@ -302,52 +305,57 @@
if(video_driver.GetName() == SETTINGS.driver.video)
combo->SetSelection(combo->GetNumItems() - 1);
}
curPos.y += 40;

Check warning on line 308 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L308

Added line #L308 was not covered by tests

groupGrafik->AddText(ID_txtOptTextures, DrawPoint(80, 320), _("Optimized Textures:"), COLOR_YELLOW, FontStyle{},
NormalFont);
groupGrafik->AddText(ID_txtOptTextures, curPos, _("Optimized Textures:"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 310 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L310

Added line #L310 was not covered by tests
optiongroup = groupGrafik->AddOptionGroup(ID_grpOptTextures, GroupSelectType::Check);

optiongroup->AddTextButton(ID_btOn, DrawPoint(280, 315), Extent(190, 22), TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(480, 315), Extent(190, 22), TextureColor::Grey, _("Off"),
NormalFont);

// "Audiotreiber"
groupSound->AddText(ID_txtAudioDriver, DrawPoint(80, 230), _("Sounddriver"), COLOR_YELLOW, FontStyle{}, NormalFont);
combo = groupSound->AddComboBox(ID_cbAudioDriver, DrawPoint(280, 225), Extent(390, 20), TextureColor::Grey,
NormalFont, 100);

const auto audio_drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Audio);
optiongroup->AddTextButton(ID_btOn, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + ctrlOffset2, ctrlSize, TextureColor::Grey, _("Off"), NormalFont);

Check warning on line 314 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L313-L314

Added lines #L313 - L314 were not covered by tests

for(const auto& audio_driver : audio_drivers)
{
combo->AddString(audio_driver.GetName());
if(audio_driver.GetName() == SETTINGS.driver.audio)
combo->SetSelection(combo->GetNumItems() - 1);
}
curPos.y = 80;
constexpr Offset bt1Offset(200, -5);
constexpr Offset bt2Offset(300, -5);
constexpr Offset volOffset(400, -5);
constexpr Extent ctrlSizeSmall(90, ctrlSize.y);

Check warning on line 320 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L316-L320

Added lines #L316 - L320 were not covered by tests

// Musik
groupSound->AddText(ID_txtMusic, DrawPoint(80, 80), _("Music"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupSound->AddText(ID_txtMusic, curPos, _("Music"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 322 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L322

Added line #L322 was not covered by tests
optiongroup = groupSound->AddOptionGroup(ID_grpMusic, GroupSelectType::Check);
optiongroup->AddTextButton(ID_btOn, DrawPoint(280, 75), Extent(90, 22), TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(380, 75), Extent(90, 22), TextureColor::Grey, _("Off"), NormalFont);
optiongroup->AddTextButton(ID_btOn, curPos + bt1Offset, ctrlSizeSmall, TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + bt2Offset, ctrlSizeSmall, TextureColor::Grey, _("Off"), NormalFont);

Check warning on line 325 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L324-L325

Added lines #L324 - L325 were not covered by tests

ctrlProgress* Mvolume =
groupSound->AddProgress(ID_pgMusicVol, DrawPoint(480, 75), Extent(190, 22), TextureColor::Grey, 139, 138, 100);
groupSound->AddProgress(ID_pgMusicVol, curPos + volOffset, ctrlSize, TextureColor::Grey, 139, 138, 100);

Check warning on line 328 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L328

Added line #L328 was not covered by tests
Mvolume->SetPosition((SETTINGS.sound.musicVolume * 100) / 255); //-V807
curPos.y += 50;

Check warning on line 330 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L330

Added line #L330 was not covered by tests

// Effekte
groupSound->AddText(ID_txtEffects, DrawPoint(80, 130), _("Effects"), COLOR_YELLOW, FontStyle{}, NormalFont);
groupSound->AddText(ID_txtEffects, curPos, _("Effects"), COLOR_YELLOW, FontStyle{}, NormalFont);

Check warning on line 333 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L333

Added line #L333 was not covered by tests
optiongroup = groupSound->AddOptionGroup(ID_grpEffects, GroupSelectType::Check);
optiongroup->AddTextButton(ID_btOn, DrawPoint(280, 125), Extent(90, 22), TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, DrawPoint(380, 125), Extent(90, 22), TextureColor::Grey, _("Off"), NormalFont);
optiongroup->AddTextButton(ID_btOn, curPos + bt1Offset, ctrlSizeSmall, TextureColor::Grey, _("On"), NormalFont);
optiongroup->AddTextButton(ID_btOff, curPos + bt2Offset, ctrlSizeSmall, TextureColor::Grey, _("Off"), NormalFont);

Check warning on line 336 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L335-L336

Added lines #L335 - L336 were not covered by tests

ctrlProgress* FXvolume =
groupSound->AddProgress(ID_pgEffectsVol, DrawPoint(480, 125), Extent(190, 22), TextureColor::Grey, 139, 138, 100);
groupSound->AddProgress(ID_pgEffectsVol, curPos + volOffset, ctrlSize, TextureColor::Grey, 139, 138, 100);

Check warning on line 339 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L339

Added line #L339 was not covered by tests
FXvolume->SetPosition((SETTINGS.sound.effectsVolume * 100) / 255);
curPos.y += 50;

Check warning on line 341 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L341

Added line #L341 was not covered by tests

groupSound->AddTextButton(ID_btMusicPlayer, curPos + ctrlOffset, ctrlSize, TextureColor::Grey, _("Music player"),
NormalFont);
curPos.y += 50;

Check warning on line 345 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L343-L345

Added lines #L343 - L345 were not covered by tests

groupSound->AddText(ID_txtAudioDriver, curPos, _("Sounddriver"), COLOR_YELLOW, FontStyle{}, NormalFont);
combo = groupSound->AddComboBox(ID_cbAudioDriver, curPos + ctrlOffset, ctrlSizeLarge, TextureColor::Grey,
NormalFont, 100);

Check warning on line 349 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L347-L349

Added lines #L347 - L349 were not covered by tests

const auto audio_drivers = drivers::DriverWrapper::LoadDriverList(drivers::DriverType::Audio);

Check warning on line 351 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L351

Added line #L351 was not covered by tests

// Musicplayer-Button
groupSound->AddTextButton(ID_btMusicPlayer, DrawPoint(280, 175), Extent(190, 22), TextureColor::Grey,
_("Music player"), NormalFont);
for(const auto& audio_driver : audio_drivers)

Check warning on line 353 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L353

Added line #L353 was not covered by tests
{
combo->AddString(audio_driver.GetName());
if(audio_driver.GetName() == SETTINGS.driver.audio)
combo->SetSelection(combo->GetNumItems() - 1);

Check warning on line 357 in libs/s25main/desktops/dskOptions.cpp

View check run for this annotation

Codecov / codecov/patch

libs/s25main/desktops/dskOptions.cpp#L355-L357

Added lines #L355 - L357 were not covered by tests
}

// "Allgemein" auswählen
optiongroup = GetCtrl<ctrlOptionGroup>(ID_grpOptions);
Expand Down