code-words for options

This commit is contained in:
SophiaHadash 2021-07-07 14:24:15 +02:00
parent 8f1b6296cd
commit ba2ef814de
2 changed files with 9 additions and 13 deletions

View file

@ -1187,20 +1187,16 @@ void GuiMenu::openOtherOptions()
// Exit button configuration.
auto exit_button_config = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "EXIT BUTTON COMBO", false);
std::vector<std::string> exitButtonCombos;
exitButtonCombos.push_back("F4");
exitButtonCombos.push_back("Alt + F4");
std::string selectedExitButtonCombo = Settings::getInstance()->getString("ExitButtonCombo");
exit_button_config->add("F4", "F4", selectedExitButtonCombo == "F4");
exit_button_config->add("Alt + F4", "AltF4", selectedExitButtonCombo == "AltF4");
#if defined(_WIN64) || defined(__unix__)
exitButtonCombos.push_back("Alt + Q");
exit_button_config->add("Alt + Q", "AltQ", selectedExitButtonCombo == "AltQ");
#endif
#if defined(__APPLE__)
exitButtonCombos.push_back("\u2318 + Q");
exit_button_config->add("\u2318 + Q", "CmdQ", selectedExitButtonCombo == "CmdQ");
#endif
for (auto it = exitButtonCombos.cbegin(); it != exitButtonCombos.cend(); it++) {
exit_button_config->add(*it, *it, Settings::getInstance()->
getString("ExitButtonCombo") == *it);
}
s->addWithLabel("CHOOSE EXIT BUTTON COMBO", exit_button_config);
s->addWithLabel("EXIT BUTTON COMBO", exit_button_config);
s->addSaveFunc([exit_button_config, s] {
if (exit_button_config->getSelected() !=
Settings::getInstance()->getString("ExitButtonCombo")) {

View file

@ -455,11 +455,11 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window)
// handle application exit
bool exitState;
std::string exitOption = Settings::getInstance()->getString("ExitButtonCombo");
if (exitOption == "Alt + F4"){
if (exitOption == "AltF4"){
exitState = event.key.keysym.sym == SDLK_F4 && altDown;
}else if (exitOption == "\u2318 + Q"){
}else if (exitOption == "CmdQ"){
exitState = event.key.keysym.sym == SDLK_q && lguiDown;
}else if (exitOption == "Alt + Q"){
}else if (exitOption == "AltQ"){
exitState = event.key.keysym.sym == SDLK_q && altDown;
}else{
exitState = event.key.keysym.sym == SDLK_F4;