In file included from ../win/Qt/qt_bind.cpp:20:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/QtCore:4:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qglobal.h:1302:
/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qflags.h:121:41: warning: declaration shadows a
variable in the global namespace [-Wshadow]
Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
^
[…]
../include/flag.h:390:29: note: previous declaration is here
extern NEARDATA struct flag flags;
^
In file included from ../win/Qt/qt_click.cpp:18:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/QtCore:36:
/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qcache.h:191:15: warning: declaration shadows a
variable in the global namespace [-Wshadow]
Node *u = n;
^
../include/decl.h:219:23: note: previous declaration is here
E NEARDATA struct you u;
^
[…]
In file included from ../win/Qt/qt_click.cpp:18:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:5:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:45:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qtextlayout.h:47:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qcolor.h:44:
/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qrgb.h:66:46: warning: declaration shadows a
variable in the global namespace [-Wshadow]
inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value
^
../include/decl.h:1208:27: note: previous declaration is here
E struct instance_globals g;
^
[…]
In file included from ../win/Qt/qt_glyph.cpp:21:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:5:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:48:
/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qpalette.h:107:49: warning: declaration shadows a
variable in the global namespace [-Wshadow]
inline void setCurrentColorGroup(ColorGroup cg) { data.current_group = cg; }
^
../include/decl.h:1216:30: note: previous declaration is here
E const struct const_globals cg;
^
97 lines
1.9 KiB
C++
97 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_rip.cpp -- tombstone window
|
|
|
|
#include "hack.h"
|
|
#undef Invisible
|
|
#undef Warning
|
|
#undef index
|
|
#undef msleep
|
|
#undef rindex
|
|
#undef wizard
|
|
#undef yn
|
|
#undef min
|
|
#undef max
|
|
|
|
#include "qt_undef.h"
|
|
#include <QtGui/QtGui>
|
|
#if QT_VERSION >= 0x050000
|
|
#include <QtWidgets/QtWidgets>
|
|
#endif
|
|
#include "qt_redef.h"
|
|
#include "qt_rip.h"
|
|
#include "qt_bind.h"
|
|
#include "qt_str.h"
|
|
|
|
namespace nethack_qt_ {
|
|
|
|
QPixmap* NetHackQtRIP::pixmap=0;
|
|
|
|
// Debian uses a separate PIXMAPDIR
|
|
#ifndef PIXMAPDIR
|
|
# ifdef HACKDIR
|
|
# define PIXMAPDIR HACKDIR
|
|
# else
|
|
# define PIXMAPDIR "."
|
|
# endif
|
|
#endif
|
|
|
|
static void
|
|
tryload(QPixmap& pm, const char* fn)
|
|
{
|
|
if (!pm.load(fn)) {
|
|
QString msg;
|
|
msg.sprintf("Cannot load \"%s\"", fn);
|
|
QMessageBox::warning(NetHackQtBind::mainWidget(), "IO Error", msg);
|
|
}
|
|
}
|
|
|
|
NetHackQtRIP::NetHackQtRIP(QWidget* parent) :
|
|
QWidget(parent)
|
|
{
|
|
if (!pixmap) {
|
|
pixmap=new QPixmap;
|
|
tryload(*pixmap, PIXMAPDIR "/rip.xpm");
|
|
}
|
|
riplines=0;
|
|
resize(pixmap->width(),pixmap->height());
|
|
setFont(QFont("times",12)); // XXX may need to be configurable
|
|
}
|
|
|
|
void NetHackQtRIP::setLines(char** l, int n)
|
|
{
|
|
line=l;
|
|
riplines=n;
|
|
}
|
|
|
|
QSize NetHackQtRIP::sizeHint() const
|
|
{
|
|
return pixmap->size();
|
|
}
|
|
|
|
void NetHackQtRIP::paintEvent(QPaintEvent* event)
|
|
{
|
|
if ( riplines ) {
|
|
int pix_x=(width()-pixmap->width())/2;
|
|
int pix_y=(height()-pixmap->height())/2;
|
|
|
|
// XXX positions based on RIP image
|
|
int rip_text_x=pix_x+156;
|
|
int rip_text_y=pix_y+67;
|
|
int rip_text_h=94/riplines;
|
|
|
|
QPainter painter;
|
|
painter.begin(this);
|
|
painter.drawPixmap(pix_x,pix_y,*pixmap);
|
|
for (int i=0; i<riplines; i++) {
|
|
painter.drawText(rip_text_x-i/2,rip_text_y+i*rip_text_h,
|
|
1,1,Qt::TextDontClip|Qt::AlignHCenter,line[i]);
|
|
}
|
|
painter.end();
|
|
}
|
|
}
|
|
|
|
} // namespace nethack_qt_
|