Files
nethack/win/Qt/qt_svsel.cpp
nhmall 84b598e489 get rid of some shadowed variable warnings with Qt under OSX
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;
                             ^
2020-07-16 22:20:23 -04:00

83 lines
2.2 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_svsel.cpp -- saved game selector
#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_svsel.h"
#include "qt_bind.h"
#include "qt_str.h"
namespace nethack_qt_ {
NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
QDialog(NetHackQtBind::mainWidget())
{
QVBoxLayout *vbl = new QVBoxLayout(this);
QHBoxLayout* hb;
QLabel* logo = new QLabel(this); vbl->addWidget(logo);
logo->setAlignment(Qt::AlignCenter);
logo->setPixmap(QPixmap("nhsplash.xpm"));
QLabel* attr = new QLabel("by the NetHack DevTeam",this);
attr->setAlignment(Qt::AlignCenter);
vbl->addWidget(attr);
vbl->addStretch(2);
/*
QLabel* logo = new QLabel(hb);
hb = new QHBox(this);
vbl->addWidget(hb, Qt::AlignCenter);
logo->setPixmap(QPixmap(nh_icon));
logo->setAlignment(AlignRight|Qt::AlignVCenter);
new QLabel(nh_attribution,hb);
*/
hb = new QHBoxLayout(this);
vbl->addLayout(hb, Qt::AlignCenter);
QPushButton* q = new QPushButton("Quit",this);
hb->addWidget(q);
connect(q, SIGNAL(clicked()), this, SLOT(reject()));
QPushButton* c = new QPushButton("New Game",this);
hb->addWidget(c);
connect(c, SIGNAL(clicked()), this, SLOT(accept()));
c->setDefault(true);
QGroupBox* box = new QGroupBox("Saved Characters",this);
QButtonGroup *bg = new QButtonGroup(this);
vbl->addWidget(box);
QVBoxLayout *bgl = new QVBoxLayout(box);
connect(bg, SIGNAL(buttonPressed(int)), this, SLOT(done(int)));
for (int i=0; saved[i]; i++) {
QPushButton* b = new QPushButton(saved[i],box);
bg->addButton(b, i+2);
}
}
int NetHackQtSavedGameSelector::choose()
{
#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog).
if ( qt_compact_mode )
showMaximized();
#endif
return exec()-2;
}
} // namespace nethack_qt_