-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.330 $ $NHDT-Date: 1602716771 2020/10/14 23:06:11 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.332 $ $NHDT-Date: 1602958104 2020/10/17 18:08:24 $
General Fixes and Modified Features
-----------------------------------
Qt: rest ("Zz") button on the toolbar only worked when 'rest_on_space' was On
(core issue, not Qt's fault)
Qt: rename toolbar button "Get" and action menu choice "Get" to "Pick up"
+Qt: status icons for alignment|hunger|encumbrance which started out centered
+ relative to the label text below them would shift to being left
+ justified when status got updated
Qt+OSX: fix control key
Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's
'O' command to "Game->Run-time options" and entry "Game->Qt settings"
if (!label) {
label=new QLabel(this);
label->setFont(font());
- resizeEvent(0);
}
if (label->text() != t) {
label->setText(t);
- highlight(lower==low_is_good ? hl_good : hl_bad);
+ ForceResize();
+ highlight((lower == low_is_good) ? hl_good : hl_bad);
}
}
-void NetHackQtLabelledIcon::setLabel(const QString& t, long v, long cv, const QString& tail)
+void NetHackQtLabelledIcon::setLabel(const QString& t, long v, long cv,
+ const QString& tail)
{
QString buf;
if (v==NoNum) {
prev_value=cv;
}
-void NetHackQtLabelledIcon::setLabel(const QString& t, long v, const QString& tail)
+void NetHackQtLabelledIcon::setLabel(const QString& t, long v,
+ const QString& tail)
{
setLabel(t,v,v,tail);
}
void NetHackQtLabelledIcon::setIcon(const QPixmap& i)
{
- if (icon) icon->setPixmap(i);
- else { icon=new QLabel(this); icon->setPixmap(i); resizeEvent(0); }
- icon->resize(i.width(),i.height());
+ if (!icon)
+ icon = new QLabel(this);
+ icon->setPixmap(i);
+ ForceResize();
+ icon->resize(i.width(), i.height());
}
void NetHackQtLabelledIcon::setFont(const QFont& f)
}
}
+// used when label (most status fields) or pixmap (alignment, hunger,
+// encumbrance) changes value
+void NetHackQtLabelledIcon::ForceResize()
+{
+ this->resizeEvent((QResizeEvent *) NULL);
+}
+
void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*)
{
setAlignments();
/*
* Set all widget values to a null string. This is used after all spacings
* have been calculated so that when the window is popped up we don't get all
- * kinds of funny values being displayed.
+ * kinds of funny values being displayed. [Actually it isn't used at all.]
*/
void NetHackQtStatusWindow::nullOut()
{
} else {
hunger.setIcon(u.uhs ? p_hungry : p_satiated);
hunger.setLabel(hung);
+ hunger.ForceResize();
hunger.show();
}
const char *enc = enc_stat[near_capacity()];
} else {
encumber.setIcon(p_encumber[near_capacity() - 1]);
encumber.setLabel(enc);
+ encumber.ForceResize();
encumber.show();
}
if (Stoned) stoned.show(); else stoned.hide();
if (Stunned) stunned.show(); else stunned.hide();
if (Confusion) confused.show(); else confused.hide();
if (Hallucination) hallu.show(); else hallu.hide();
+ // [pr - Why is blind handled differently from other on/off conditions?]
if (Blind) {
blind.setLabel("Blind");
blind.show();
name.setLabel(buf2, NetHackQtLabelledIcon::NoNum, u.ulevel);
char buf3[BUFSZ];
- if (describe_level(buf3)) {
- dlevel.setLabel(buf3,true);
- } else {
- buf.sprintf("%s, level ", g.dungeons[u.uz.dnum].dname);
- dlevel.setLabel(buf,(long)::depth(&u.uz));
+ if (!describe_level(buf3)) {
+ Sprintf(buf3, "%s, level %d",
+ g.dungeons[u.uz.dnum].dname, ::depth(&u.uz));
}
+ // false: always highlight as 'change for the better' regardless of
+ // new depth compared to old
+ dlevel.setLabel(buf3, false);
gold.setLabel("Au:", money_cnt(g.invent));
}
buf.sprintf("/%d", u.uenmax);
power.setLabel("Pow:", u.uen, buf);
- ac.setLabel("AC:",(long)u.uac);
+ ac.setLabel("AC:", (long) u.uac);
//if (::flags.showexp) {
// exp.setLabel("Exp:", (long) u.uexp);
//} else {
- // 'exp' now only used to pad the line that Xp/Exp is displayed on
+ // 'exp' is now only used to pad the line that Xp/Exp is displayed on
exp.setLabel("");
//}
+ text = NULL;
if (u.ualign.type==A_CHAOTIC) {
align.setIcon(p_chaotic);
text = "Chaotic";
align.setIcon(p_lawful);
text = "Lawful";
}
- align.setLabel(text);
+ if (text) {
+ // false: don't highlight as 'became lower' even if the internal
+ // numeric value is becoming lower (N -> C, L -> N || C)
+ align.setLabel(text, false);
+ // without this, the ankh pixmap shifts from centered to left
+ // justified relative to the label text for some unknown reason...
+ align.ForceResize();
+ }
if (::flags.time)
time.setLabel("Time:", (long) g.moves);