on OSX, "quit nethack" has been selected in the application menu or "Command+Q" has been typed -- user is asking to quit the application; unlike with the window's Close button, user has a chance to back out
| 1051 | // "Command+Q" has been typed -- user is asking to quit the application; |
| 1052 | // unlike with the window's Close button, user has a chance to back out |
| 1053 | void NetHackQtMainWindow::doQuit(bool) |
| 1054 | { |
| 1055 | // there is a separate Quit-without-saving menu entry in the game menu |
| 1056 | // that leads to nethack's "Really quit?" prompt; OSX players can use |
| 1057 | // either one, other implementations only have that other one (plus |
| 1058 | // nethack's #quit command itself) but this routine is unconditional |
| 1059 | // in case someone wants to change that |
| 1060 | #ifdef MACOS |
| 1061 | QString info = nh_qsprintf("This will end your NetHack session.%s", |
| 1062 | !program_state.something_worth_saving ? "" |
| 1063 | : "\n(Cancel quitting and use the Save command" |
| 1064 | "\nto save your current game.)"); |
| 1065 | /* this is similar to closeEvent but the details are different; |
| 1066 | first choice (Cancel) is the default action for most arbitrary keys; |
| 1067 | the second choice (Quit) is the action for <return> or <space>; |
| 1068 | <escape> leaves the popup waiting for some other response; |
| 1069 | the &<char> settings for Alt+<char> shortcuts don't work on OSX */ |
| 1070 | int act = QMessageBox::information(this, "NetHack", info, |
| 1071 | "&Cancel and return to game", |
| 1072 | "&Quit without saving", |
| 1073 | 0, 1); |
| 1074 | switch (act) { |
| 1075 | case 0: |
| 1076 | // cancel |
| 1077 | break; // return to game |
| 1078 | case 1: |
| 1079 | // quit -- bypass the prompting preformed by done2() |
| 1080 | program_state.stopprint++; |
| 1081 | ::done(QUIT); |
| 1082 | /*NOTREACHED*/ |
| 1083 | break; |
| 1084 | } |
| 1085 | #endif |
| 1086 | return; |
| 1087 | } |
| 1088 | |
| 1089 | #if 0 // RLC this isn't used |
| 1090 | void NetHackQtMainWindow::doGuidebook(bool) |
nothing calls this directly
no test coverage detected