From: PatR Date: Thu, 6 Jan 2022 20:25:17 +0000 (-0800) Subject: Qt: force 'toptenwin' option On X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86343af200bf34dd1460766d8f60ad11cbd6f183;p=nethack Qt: force 'toptenwin' option On 'toptenwin' defaults to false, so the high scores list at end of game gets written to stdout by default. stdout might be a bit bucket if the game is started from a menu somewhere or from Explorer or Finder or something comparable. Even when started from a terminal, writing to stdout is bad if running asynchronously ('nethack &'). Have Qt init force the 'toptenwin' option to true to show the high scores in a pop-up text window. The "since you were in wizard mode your score is ignored" line also goes to a pop-up text window now too. An extra is needed to dismiss that when quitting if you go through the full disclosure sequence. 'nethack -s' writes scores to stdout before interface initialization takes place, so isn't affected by this change. That's intentional so that 'nethack -s > ~/myscores' can be used to capture the output. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index e6efc4477..9e10c24ec 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1117,6 +1117,9 @@ Qt: while a text window was shown (such as the "things that are here" popup Qt: if player's run-time options specified a tiles file and it couldn't be loaded, Qt was falling back to x11tiles just like when the default can't be loaded; fallback to player's file plus explicit path instead +Qt: force the 'toptenwin' option On so that high scores display at end of game + is shown in a text window instead of being written to stdout where it + might not be seen (note: doesn't apply to 'nethack -s') Qt: {maybe just Qt+OSX:} when viewing a text window ('V' to look at 'history' for instance), clicking on [Search], entering a search target in the resulting popup and clicking on [Okay] or typing , the text diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 5f6a193fe..ac1d91ade 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -154,9 +154,17 @@ NetHackQtBind::qt_Splash() } } -void NetHackQtBind::qt_init_nhwindows(int* argc, char** argv) +void NetHackQtBind::qt_init_nhwindows(int *argc, char **argv) { - iflags.menu_tab_sep = true; + // menu entries use embedded to align fields; + // it could be toggled off via 'O', but only when in wizard mode + ::iflags.menu_tab_sep = true; + + // force high scores display to be shown in a window, and don't allow + // that to be toggled off via 'O' (note: 'nethack -s' won't reach here; + // its output goes to stdout so can potentially be redirected into a file) + ::iflags.toptenwin = true; + ::set_option_mod_status("toptenwin", ::set_in_config); #ifdef UNIX // Userid control @@ -495,20 +503,29 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) NetHackQtWindow* window=id_to_window[(int)wid]; window->ClipAround(x,y); } -void NetHackQtBind::qt_print_glyph(winid wid,xchar x,xchar y, - const glyph_info *glyphinfo, - const glyph_info *bkglyphinfo UNUSED) + +void NetHackQtBind::qt_print_glyph( + winid wid, xchar x, xchar y, + const glyph_info *glyphinfo, + const glyph_info *bkglyphinfo UNUSED) { /* TODO: bkglyph */ - NetHackQtWindow* window=id_to_window[(int)wid]; - window->PrintGlyph(x,y,glyphinfo); + NetHackQtWindow *window = id_to_window[(int) wid]; + window->PrintGlyph(x, y, glyphinfo); +} + +#if 0 +void NetHackQtBind::qt_print_glyph_compose( + winid wid, xchar x, xchar y, int glyph1, int glyph2) +{ + NetHackQtWindow *window = id_to_window[(int) wid]; + window->PrintGlyphCompose(x, y, glyph1, glyph2); } -//void NetHackQtBind::qt_print_glyph_compose(winid wid,xchar x,xchar y,int glyph1, int glyph2) -//{ - //NetHackQtWindow* window=id_to_window[(int)wid]; - //window->PrintGlyphCompose(x,y,glyph1,glyph2); -//} +#endif /*0*/ +// +// FIXME: sending output to stdout can mean that the player never sees it. +// void NetHackQtBind::qt_raw_print(const char *str) { puts(str); @@ -516,7 +533,7 @@ void NetHackQtBind::qt_raw_print(const char *str) void NetHackQtBind::qt_raw_print_bold(const char *str) { - puts(str); + qt_raw_print(str); } int NetHackQtBind::qt_nhgetch()