Files
nethack/win/Qt/qt_set.h
PatR 41a5565403 new 'showvers' option
Add options 'showvers' (boolean) and 'versinfo' (numeric mask) to
show nethack's version on the status lines during play.  It won't be
particularly interesting to ordinary players but should be useful
when making screenshots or video to be streamed, or for someone who
switches between git branches or between nethack and variants.

I worked on this several months back but it was combined with
unfinished changes to 'hitpointbar'.  I've separated it out so that
it can be put into use.  When enabled, one or more components of
"<name> <branch> <version>" will be shown right justified after
status conditions.  At present the default is "<branch>" if that is
available and overall status isn't 'released', or "<version>" if
'released' or if branch isn't available.  That might need some
refinement.

It works as intended for tty and curses, although some abbreviation
mechanism would be useful if/when the program resorts to abbreviating
status conditions to make things narrow enough to fit.

For X11, it works ok for fancy_status:True (the default, controlled
via NetHack.ad settings) but is messed up for tty-style status.  The
text is positioned correctly but there are gaps in it, making it
appear garbled, similar to what I saw when I tried and failed to
implement statuslines:3 for X11.  [It might be due to having empty
condition widgets be 1 pixel wide instead of being totally removed
but I don't think the situation is that simple.]

For Qt, if the text needs to be truncated in order to fit, the center
portion of the string will be shown, discarding parts from the left
and right.  That ought to discard from left and retain rightmost
portion instead.

For win32|mswin|Win GUI, no attempt to support it has been included.
Things should be ok when 'showvers' is left as False (the default)
but I don't know what will happen if that gets toggled to True.  At a
minimum, the version info won't be right justified.  The information,
or at least some of it, is displayed in the game window's title bar
so there isn't any pressing need to add it to status, but toggling
the option will need to behave sensibly if it doesn't already.
2024-02-28 11:47:16 -08:00

96 lines
1.9 KiB
C++

// Copyright (c) Warwick Allison, 1999.
// Qt4 conversion copyright (c) Ray Chason, 2012-2014.
// NetHack may be freely redistributed. See license for details.
// qt_set.h -- the Qt settings
#ifndef QT4SET_H
#define QT4SET_H
#define ENHANCED_PAPERDOLL /* separate size from map tiles, can be hidden */
#include "qt_bind.h" // needed for mainWidget() for updateInventory()
namespace nethack_qt_ {
class NetHackQtGlyphs;
class NetHackQtMainWindow;
class NetHackQtSettings : public QDialog {
Q_OBJECT
public:
int tileWidth = 16, tileHeight = 16;
#ifdef ENHANCED_PAPERDOLL
int dollWidth = 32, dollHeight = 32;
bool doll_is_shown = true;
#endif
bool xcmd_by_row = false;
int xcmd_set = 0; // all_cmds
// dialog box for Qt-specific settings
NetHackQtSettings();
void updateXcmd(bool by_row, int which_set);
NetHackQtGlyphs& glyphs();
const QFont& normalFont();
const QFont& normalFixedFont();
const QFont& largeFont();
const QFont& smallFont();
bool ynInMessages();
signals:
void fontChanged();
void tilesChanged();
public slots:
void toggleGlyphSize();
void setGlyphSize(bool);
#ifdef ENHANCED_PAPERDOLL
void toggleDollShown();
void setDollShown(bool);
void resizeDoll();
#endif
private:
QSettings settings;
QCheckBox whichsize;
QSpinBox tilewidth;
QSpinBox tileheight;
QLabel widthlbl;
QLabel heightlbl;
QSize othersize;
#ifdef ENHANCED_PAPERDOLL
QCheckBox dollshown;
QSpinBox dollwidth;
QSpinBox dollheight;
QLabel dollwidthlbl;
QLabel dollheightlbl;
#endif
QComboBox fontsize;
QFont normal, normalfixed, large, small;
NetHackQtGlyphs* theglyphs;
#if 0
void updateInventory()
{
static_cast <NetHackQtMainWindow *> (NetHackQtBind::mainWidget())
->updateInventory();
}
#endif
private slots:
void resizeTiles();
void changedFont();
};
extern NetHackQtSettings* qt_settings;
} // namespace nethack_qt_
#endif