diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 390364630..52d629f10 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.352 $ $NHDT-Date: 1605315160 2020/11/14 00:52:40 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.353 $ $NHDT-Date: 1605316497 2020/11/14 01:14:57 $ General Fixes and Modified Features ----------------------------------- @@ -385,6 +385,8 @@ tins of spinach and 'dead' eggs could cause out of array bounds access curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support +Qt: at Xp levels above 20 with 'showexp' On, the combined status field + "Level:NN/nnnnnnnn" was too big and truncated by a char at each end tty: redraw unexplored locations as S_unexplored rather than after map has been partially overwritten by popup menu or text display tty: previous change resulted in remnants of previous level being shown on diff --git a/win/Qt/Qt-issues.txt b/win/Qt/Qt-issues.txt index b25adff97..c38fca661 100644 --- a/win/Qt/Qt-issues.txt +++ b/win/Qt/Qt-issues.txt @@ -59,4 +59,15 @@ code into its own routine and calling that for both types of windows. From the text window code, it sees the initial shift but not the ':' that should follow. +Clicking on window close button pops up a confirmation dialog with + [ Save and exit ] [__Quit_without_saving__] +with the second one highlighted. Internally they're specified as +"&Save" and "&Quit". Typing or picks Quit, but +typing 'Q' or 'q' picks Save-and-exit because Alt+Q is expected for +the keyboard shortcut. + +The status window can't be resized while hitpointbar is active. +Toggling it off, resizing as desired, then toggling it back on is a +viable workaround. + ----- diff --git a/win/Qt/qt_main.cpp b/win/Qt/qt_main.cpp index 00765d8a9..69a2729dc 100644 --- a/win/Qt/qt_main.cpp +++ b/win/Qt/qt_main.cpp @@ -1138,6 +1138,16 @@ void NetHackQtMainWindow::layout() // call resizePaperDoll() indirectly... qt_settings->resizeDoll(); #endif + // reset widths + int w = width(); /* of main window */ + // 10: approximate size of resizing hotspots + int d = qt_settings->doll_is_shown ? 10 + invusage->width() + 10 : 10; + if (d % 4) + d += 4 - d % 4; + splittersizes[2] = w / 2 - (d * 1 / 4); // status + splittersizes[1] = d - 10; // invusage + splittersizes[0] = w / 2 - (d * 3 / 4); // messages + hsplitter->setSizes(splittersizes); } } @@ -1162,8 +1172,8 @@ void NetHackQtMainWindow::resizePaperDoll(bool showdoll) hsplitter->setSizes(hsplittersizes); } - // Height limit is 48 pixels per doll cell; - // values greater than 44 need taller window which pushes the map down. + // Height limit is 48+2 pixels per doll cell plus 1 pixel margin at top; + // values greater than 42+2 need taller window which pushes the map down. // FIXME: this doesn't shrink the window back if size is reduced from 45+ int oldheight = vsplittersizes[0], newheight = w->height(); diff --git a/win/Qt/qt_stat.cpp b/win/Qt/qt_stat.cpp index 7b918e070..deadd798f 100644 --- a/win/Qt/qt_stat.cpp +++ b/win/Qt/qt_stat.cpp @@ -3,6 +3,43 @@ // NetHack may be freely redistributed. See license for details. // qt_stat.cpp -- status window, upper right portion of the overall window +// +// The Qt status window consists of many lines: +// +// hitpoint bar (when enabled) +// Title (plname the Rank or plname the MonsterSpecies) +// Dungeon location (branch and level) +// separator line +// six icons (special 40x40 tiles, paired with...) +// six characteristic texts ("Str:18/03", "Dex:15", &c) +// separator line +// five status fields without icons (some containing two values: +// Gold, HP/HPmax, Energy/Enmax, AC, XpLevel/ExpPoints or HD) +// optional line with two text fields (Time:1234, Score:89) +// separator line +// varying number of icons (one or more, each paired with...) +// corresponding text (Alignment plus zero or more status conditions +// including Hunger if not "normal" and encumbrance if not "normal") +// +// The hitpoint bar spans the width of the status window when enabled. +// Title and location are centered. +// The icons and text for the size characteristics are evenly spaced. +// The five main stats are padded with an empty sixth and spaced to +// match the characteristics. +// Time and Score are spaced as if each were three fields wide. +// Icons and texts for alignment and conditions are left justified. +// The separator lines are thin and don't take up much vertical space. +// The hitpoint bar line and the Time+Score line are omitted when the +// corresponding items are disabled. +// +// FIXME: +// When hitpoint bar is shown, attempting to resize horizontally won't +// do anything. Toggling it off, then resizing, and back On works. +// +// TODO: +// If/when status conditions become too wide for the status window, scale +// down their icons and switch their text to a smaller font to match. +// extern "C" { #include "hack.h" @@ -23,6 +60,8 @@ extern "C" { extern const char *enc_stat[]; /* from botl.c */ extern const char *hu_stat[]; /* from eat.c */ +extern int qt_compact_mode; + namespace nethack_qt_ { NetHackQtStatusWindow::NetHackQtStatusWindow() : @@ -67,6 +106,11 @@ NetHackQtStatusWindow::NetHackQtStatusWindow() : first_set(true), alreadyfullhp(false) { + if (!qt_compact_mode) { + int w = NetHackQtBind::mainWidget()->width(); + setMaximumWidth(w / 2); + } + p_str = QPixmap(str_xpm); p_str = QPixmap(str_xpm); p_dex = QPixmap(dex_xpm); @@ -648,7 +692,11 @@ void NetHackQtStatusWindow::updateStats() // up/down highlighting becomes tricky--don't try very hard if (::flags.showexp) { buf.sprintf("%ld/%ld", (long) u.ulevel, (long) u.uexp); - level.setLabel("Level:" + buf, + // at levels above 20, "Level:NN/nnnnnnnn" doesn't fit so + // shorten "Level" to "Lvl" at that stage; + // at level 30, a few pixels are truncated from the start + // and end of "Lvl:30/nnnnnnnnn" but the result is ledgible + level.setLabel(((u.ulevel <= 20) ? "Level:" : "Lvl:") + buf, NetHackQtLabelledIcon::NoNum, (long) u.uexp); } else { level.setLabel("Level:", (long) u.ulevel);