Qt "Paper Doll" inventory

Enhance the "Qt Settings" dialog box to provide control over the
paper doll subset of inventory displayed between the message and
status windows (above the map).  A ton of flailing about for a
fairly small but useful change in functionality.

Old dialog (no title):
| [ ] Zoomed            -- check box
| "Width:"  [      ]    -- number entry spinner
| "Height:" [      ]    -- ditto
| "Font:"   [      ]    -- Huge:18pt, Large:14, Medium:12, Small:10, Tiny:8
| [      Dismiss      ] -- button

New dialog:
|     "Qt NetHack Settings"
|
| "Map:"    [ ] "Zoomed"        -- check box
|           "Tile Width"   [  ] -- number entry spinner
|           "Tile Height"  [  ] -- ditto
| "Invent:" [ ] "Shown"         -- check box
|           "Doll Width"   [  ] -- number entry spinner
|           "Doll Height"  [  ] -- ditto
| "Font:"   [      ]    -- Huge:18pt, Large:14, Medium:12, Small:10, Tiny:8
| [          Dismiss          ] -- button

The inventory subset can now be suppressed.  When shown (the default),
its size can be set independently of the map tiles' size.  I've set
the default to be 32x32 tiles instead of 16x16 used for the map.

The settings are saved and restored automatically by Qt, and persist
not just across save/restore cycles but into new games.  (That's not
a change, just a reminder.)
This commit is contained in:
PatR
2020-08-15 19:48:33 -07:00
parent 89fbe2162e
commit 9a866d3601
8 changed files with 299 additions and 57 deletions
+33 -3
View File
@@ -7,15 +7,25 @@
#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:
// Size of window - used to decide default sizes
NetHackQtSettings(int width, int height);
int tileWidth = 16, tileHeight = 16;
#ifdef ENHANCED_PAPERDOLL
int dollWidth = 32, dollHeight = 32;
bool doll_is_shown = true;
#endif
// dialog box for Qt-specific settings
NetHackQtSettings();
NetHackQtGlyphs& glyphs();
const QFont& normalFont();
@@ -31,21 +41,41 @@ signals:
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;
QCheckBox whichsize;
QSize othersize;
#ifdef ENHANCED_PAPERDOLL
QCheckBox dollshown;
QSpinBox dollwidth;
QSpinBox dollheight;
QLabel dollwidthlbl;
QLabel dollheightlbl;
#endif
QComboBox fontsize;
QFont normal, normalfixed, large;
NetHackQtGlyphs* theglyphs;
#if 0
void updateInventory()
{
static_cast <NetHackQtMainWindow *> (NetHackQtBind::mainWidget())
->updateInventory();
}
#endif
private slots:
void resizeTiles();