Qt "paperdoll" as command button
Clicking on the paper doll inventory subset window will cause the '*' command (#seeall) to execute. They convey the same information (unless multiple leashes or multiple light sources are in use; seeall lists all of them instead of just the first of each) but the doll shows the info with a small grid of map tiles and seeall shows it with an inventory display of worn and wielded items plus tools in active use. Ideally it should show information about a specific item as a "tool tip" when the mouse hovers over one of the doll slots. I don't know whether I'll ever attempt to tackle that or even if that's feasible with Qt. Perhaps use right click instead.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.321 $ $NHDT-Date: 1601940384 2020/10/05 23:26:24 $
|
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.322 $ $NHDT-Date: 1602002574 2020/10/06 16:42:54 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -564,8 +564,11 @@ user_sounds: provide an experimental mechanism for terminal-side sounds similar
|
|||||||
act on it)
|
act on it)
|
||||||
Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings"
|
Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings"
|
||||||
dialog box ("Preferences..." on OSX)
|
dialog box ("Preferences..." on OSX)
|
||||||
Qt: draw a border around each tile in the paper door inventory; when BUC is
|
Qt: draw a border around each tile in the paper doll inventory; when BUC is
|
||||||
known for a doll item, change the border's color and thicken it
|
known for a doll item, change the border's color and thicken it
|
||||||
|
Qt: clicking on the paper doll runs the #seeall command (inventory of wielded
|
||||||
|
and worn items plus tools [lamps, leashes] actively in use; in other
|
||||||
|
words, same set of things whose tiles are used to populate the doll)
|
||||||
|
|
||||||
|
|
||||||
NetHack Community Patches (or Variation) Included
|
NetHack Community Patches (or Variation) Included
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ extern "C" {
|
|||||||
#include "qt_post.h"
|
#include "qt_post.h"
|
||||||
#include "qt_inv.h"
|
#include "qt_inv.h"
|
||||||
#include "qt_glyph.h"
|
#include "qt_glyph.h"
|
||||||
|
#include "qt_main.h"
|
||||||
#include "qt_set.h"
|
#include "qt_set.h"
|
||||||
|
|
||||||
namespace nethack_qt_ {
|
namespace nethack_qt_ {
|
||||||
@@ -52,12 +53,14 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj,
|
|||||||
|
|
||||||
if (nhobj) {
|
if (nhobj) {
|
||||||
border = BORDER_DEFAULT;
|
border = BORDER_DEFAULT;
|
||||||
|
#ifdef ENHANCED_PAPERDOLL
|
||||||
if (Role_if('P') && !Blind)
|
if (Role_if('P') && !Blind)
|
||||||
nhobj->bknown = 1;
|
nhobj->bknown = 1;
|
||||||
if (nhobj->bknown)
|
if (nhobj->bknown)
|
||||||
border = nhobj->cursed ? BORDER_CURSED
|
border = nhobj->cursed ? BORDER_CURSED
|
||||||
: !nhobj->blessed ? BORDER_UNCURSED
|
: !nhobj->blessed ? BORDER_UNCURSED
|
||||||
: BORDER_BLESSED;
|
: BORDER_BLESSED;
|
||||||
|
#endif
|
||||||
glyph = obj_to_glyph(nhobj, rn2_on_display_rng);
|
glyph = obj_to_glyph(nhobj, rn2_on_display_rng);
|
||||||
} else {
|
} else {
|
||||||
border = NO_BORDER;
|
border = NO_BORDER;
|
||||||
@@ -153,7 +156,7 @@ QSize NetHackQtInvUsageWindow::sizeHint(void) const
|
|||||||
h = (1 + qt_settings->dollHeight + 1) * 6;
|
h = (1 + qt_settings->dollHeight + 1) * 6;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (iflags.wc_tiles_map) {
|
if (iflags.wc_tiled_map) {
|
||||||
w = (1 + qt_settings->glyphs().width() + 1) * 3;
|
w = (1 + qt_settings->glyphs().width() + 1) * 3;
|
||||||
h = (1 + qt_settings->glyphs().height() + 1) * 6;
|
h = (1 + qt_settings->glyphs().height() + 1) * 6;
|
||||||
}
|
}
|
||||||
@@ -164,4 +167,18 @@ QSize NetHackQtInvUsageWindow::sizeHint(void) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENHANCED_PAPERDOLL - clicking on the PaperDoll runs #seeall
|
||||||
|
void NetHackQtInvUsageWindow::mousePressEvent(QMouseEvent *event UNUSED)
|
||||||
|
{
|
||||||
|
#ifdef ENHANCED_PAPERDOLL
|
||||||
|
char cmdbuf[32];
|
||||||
|
Strcpy(cmdbuf, "#");
|
||||||
|
(void) cmdname_from_func(doprinuse, &cmdbuf[1], FALSE);
|
||||||
|
// queue up #seeall as if user had typed it; we don't execute doprinuse()
|
||||||
|
// directly because the program might not be ready for the next command
|
||||||
|
QWidget *main = NetHackQtBind::mainWidget();
|
||||||
|
(static_cast <NetHackQtMainWindow *> (main))->DollClickToKeys(cmdbuf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace nethack_qt_
|
} // namespace nethack_qt_
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ public:
|
|||||||
virtual void paintEvent(QPaintEvent*);
|
virtual void paintEvent(QPaintEvent*);
|
||||||
virtual QSize sizeHint(void) const;
|
virtual QSize sizeHint(void) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawWorn(QPainter& painter, obj*, int x, int y, bool canbe=true);
|
void drawWorn(QPainter& painter, obj*, int x, int y, bool canbe=true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -990,6 +990,13 @@ void NetHackQtMainWindow::doKeys(const QString& k)
|
|||||||
qApp->exit();
|
qApp->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENHANCED_PAPERDOLL - player clicked on PaperDoll window
|
||||||
|
void NetHackQtMainWindow::DollClickToKeys(const char *cmds)
|
||||||
|
{
|
||||||
|
keysink.Put(cmds);
|
||||||
|
qApp->exit();
|
||||||
|
}
|
||||||
|
|
||||||
void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window)
|
void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window)
|
||||||
{
|
{
|
||||||
message=window;
|
message=window;
|
||||||
|
|||||||
@@ -49,8 +49,9 @@ public:
|
|||||||
|
|
||||||
void fadeHighlighting(bool before_key);
|
void fadeHighlighting(bool before_key);
|
||||||
|
|
||||||
// this is unconditional in case qt_main.h comes before qt_set.h
|
// these are unconditional in case qt_main.h comes before qt_set.h
|
||||||
void resizePaperDoll(bool); // ENHANCED_PAPERDOLL
|
void resizePaperDoll(bool); // ENHANCED_PAPERDOLL
|
||||||
|
void DollClickToKeys(const char *); // ENHANCED_PAPERDOLL
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void doMenuItem(QAction *);
|
void doMenuItem(QAction *);
|
||||||
|
|||||||
Reference in New Issue
Block a user