Merge branch 'macosx-qtfixes' into NetHack-3.7

This commit is contained in:
nhmall
2020-07-17 23:31:30 -04:00
26 changed files with 137 additions and 52 deletions
+1
View File
@@ -96,6 +96,7 @@
#endif #endif
#ifdef QT_GRAPHICS #ifdef QT_GRAPHICS
#include "../win/Qt/qt_redef.h"
#ifndef DEFAULT_WC_TILED_MAP #ifndef DEFAULT_WC_TILED_MAP
#define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't say \ #define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't say \
wc_ascii_map */ wc_ascii_map */
+2 -1
View File
@@ -114,12 +114,13 @@ endif # WANT_WIN_X11
ifdef WANT_WIN_QT ifdef WANT_WIN_QT
CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS CFLAGS += -DQT_GRAPHICS -DNOUSER_SOUNDS
CFLAGS += -Wno-deprecated-declarations
CFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags) CFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs) WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
LINK=$(CXX) LINK=$(CXX)
WINSRC += $(WINQTSRC) WINSRC += $(WINQTSRC)
WINOBJ0 += $(WINQTOBJ) WINOBJ0 += $(WINQTOBJ)
VARDATND += rip.xpm VARDATND += nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm
MOC = moc MOC = moc
# XXX if /Developer/qt exists and QTDIR not set, use that # XXX if /Developer/qt exists and QTDIR not set, use that
+11 -5
View File
@@ -17,6 +17,7 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@@ -25,6 +26,7 @@ extern "C" {
#else #else
#include <QtGui/QSound> #include <QtGui/QSound>
#endif #endif
#include "qt_redef.h"
#include "qt_bind.h" #include "qt_bind.h"
#include "qt_click.h" #include "qt_click.h"
#ifdef TIMED_DELAY #ifdef TIMED_DELAY
@@ -368,7 +370,7 @@ void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist)
} }
} }
void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior) void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED)
{ {
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->StartMenu(); window->StartMenu();
@@ -425,7 +427,7 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y)
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->ClipAround(x,y); window->ClipAround(x,y);
} }
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,int bkglyph) void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,int bkglyph UNUSED)
{ {
/* TODO: bkglyph */ /* TODO: bkglyph */
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
@@ -679,7 +681,7 @@ bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
bool macro=false; bool macro=false;
for (int i=0; !macro && key_macro[i].key; i++) { for (int i=0; !macro && key_macro[i].key; i++) {
if (key_macro[i].key==k if (key_macro[i].key==k
&& ((key_macro[i].state&key_event->modifiers())==key_macro[i].state)) && ((key_macro[i].state&key_event->modifiers()) == (unsigned int) key_macro[i].state))
{ {
keybuffer.Put(key_macro[i].macro); keybuffer.Put(key_macro[i].macro);
macro=true; macro=true;
@@ -718,9 +720,9 @@ QFrame* NetHackQtBind::splash=0;
QStringList *NetHackQtBind::msgs_strings; QStringList *NetHackQtBind::msgs_strings;
boolean NetHackQtBind::msgs_saved = false; boolean NetHackQtBind::msgs_saved = false;
boolean NetHackQtBind::msgs_initd = false; boolean NetHackQtBind::msgs_initd = false;
#if 0
static void Qt_positionbar(char *) {} static void Qt_positionbar(char *) {}
#endif
} // namespace nethack_qt_ } // namespace nethack_qt_
struct window_procs Qt_procs = { struct window_procs Qt_procs = {
@@ -802,7 +804,11 @@ struct window_procs Qt_procs = {
}; };
#ifndef WIN32 #ifndef WIN32
#if defined(USER_SOUNDS) && !defined(QT_NO_SOUND)
extern "C" void play_usersound(const char* filename, int volume) extern "C" void play_usersound(const char* filename, int volume)
#else
extern "C" void play_usersound(const char* filename UNUSED, int volume UNUSED)
#endif
{ {
#ifdef USER_SOUNDS #ifdef USER_SOUNDS
#ifndef QT_NO_SOUND #ifndef QT_NO_SOUND
+2
View File
@@ -15,7 +15,9 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_click.h" #include "qt_click.h"
namespace nethack_qt_ { namespace nethack_qt_ {
+3 -1
View File
@@ -15,7 +15,9 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_delay.h" #include "qt_delay.h"
namespace nethack_qt_ { namespace nethack_qt_ {
@@ -32,7 +34,7 @@ void NetHackQtDelay::wait()
m_loop.exec(); m_loop.exec();
} }
void NetHackQtDelay::timerEvent(QTimerEvent* timer) void NetHackQtDelay::timerEvent(QTimerEvent* timer UNUSED)
{ {
m_loop.exit(); m_loop.exit();
killTimer(m_timer); killTimer(m_timer);
+2
View File
@@ -18,10 +18,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_glyph.h" #include "qt_glyph.h"
#include "qt_set.h" #include "qt_set.h"
#include "qt_str.h" #include "qt_str.h"
+2
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_icon.h" #include "qt_icon.h"
namespace nethack_qt_ { namespace nethack_qt_ {
+2
View File
@@ -18,10 +18,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_inv.h" #include "qt_inv.h"
#include "qt_glyph.h" #include "qt_glyph.h"
#include "qt_set.h" #include "qt_set.h"
+4 -1
View File
@@ -15,7 +15,9 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_key.h" #include "qt_key.h"
namespace nethack_qt_ { namespace nethack_qt_ {
@@ -28,9 +30,10 @@ NetHackQtKeyBuffer::NetHackQtKeyBuffer() :
bool NetHackQtKeyBuffer::Empty() const { return in==out; } bool NetHackQtKeyBuffer::Empty() const { return in==out; }
bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; }
void NetHackQtKeyBuffer::Put(int k, int a, int state) void NetHackQtKeyBuffer::Put(int k, int a, int kbstate)
{ {
if ( Full() ) return; // Safety if ( Full() ) return; // Safety
nhUse(kbstate);
key[in]=k; key[in]=k;
ascii[in]=a; ascii[in]=a;
in=(in+1)%maxkey; in=(in+1)%maxkey;
+3 -1
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_line.h" #include "qt_line.h"
namespace nethack_qt_ { namespace nethack_qt_ {
@@ -28,7 +30,7 @@ NetHackQtLineEdit::NetHackQtLineEdit() :
{ {
} }
NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) : NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name UNUSED) :
QLineEdit(parent) QLineEdit(parent)
{ {
} }
+5 -3
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_main.h" #include "qt_main.h"
#include "qt_main.moc" #include "qt_main.moc"
#include "qt_bind.h" #include "qt_bind.h"
@@ -377,7 +379,7 @@ static const char * rest_xpm[] = {
" .... ", " .... ",
" "}; " "};
/* XPM */ /* XPM */
static const char * cast_a_xpm[] = { static const char * cast_a_xpm[] UNUSED = {
"12 13 3 1", "12 13 3 1",
" c None", " c None",
". c #FFFF6DB60000", ". c #FFFF6DB60000",
@@ -396,7 +398,7 @@ static const char * cast_a_xpm[] = {
" . X X ", " . X X ",
" . X X "}; " . X X "};
/* XPM */ /* XPM */
static const char * cast_b_xpm[] = { static const char * cast_b_xpm[] UNUSED = {
"12 13 3 1", "12 13 3 1",
" c None", " c None",
". c #FFFF6DB60000", ". c #FFFF6DB60000",
@@ -415,7 +417,7 @@ static const char * cast_b_xpm[] = {
" . X X ", " . X X ",
" . XXX "}; " . XXX "};
/* XPM */ /* XPM */
static const char * cast_c_xpm[] = { static const char * cast_c_xpm[] UNUSED = {
"12 13 3 1", "12 13 3 1",
" c None", " c None",
". c #FFFF6DB60000", ". c #FFFF6DB60000",
+6 -4
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_map.h" #include "qt_map.h"
#include "qt_map.moc" #include "qt_map.moc"
#include "qt_click.h" #include "qt_click.h"
@@ -527,9 +529,9 @@ void NetHackQtMapViewport::CursorTo(int x,int y)
Changed(cursor.x(),cursor.y()); Changed(cursor.x(),cursor.y());
} }
void NetHackQtMapViewport::PrintGlyph(int x,int y,int glyph) void NetHackQtMapViewport::PrintGlyph(int x,int y,int theglyph)
{ {
Glyph(x,y)=glyph; Glyph(x,y)=theglyph;
Changed(x,y); Changed(x,y);
} }
@@ -578,7 +580,7 @@ void NetHackQtMapWindow2::clearMessages()
messages_rect = QRect(); messages_rect = QRect();
} }
void NetHackQtMapWindow2::putMessage(int attr, const QString& text) void NetHackQtMapWindow2::putMessage(int attr UNUSED, const QString& text)
{ {
if ( !messages.isEmpty() ) if ( !messages.isEmpty() )
messages += "\n"; messages += "\n";
@@ -615,7 +617,7 @@ void NetHackQtMapWindow2::CursorTo(int x,int y)
m_viewport->CursorTo(x, y); m_viewport->CursorTo(x, y);
} }
void NetHackQtMapWindow2::PutStr(int attr, const QString& text) void NetHackQtMapWindow2::PutStr(int attr UNUSED, const QString& text UNUSED)
{ {
puts("unexpected PutStr in MapWindow"); puts("unexpected PutStr in MapWindow");
} }
+12 -10
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_menu.h" #include "qt_menu.h"
#include "qt_menu.moc" #include "qt_menu.moc"
#include "qt_glyph.h" #include "qt_glyph.h"
@@ -239,7 +241,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
// Determine column widths // Determine column widths
std::vector<int> col_widths; std::vector<int> col_widths;
for (std::size_t i = 0; i < itemlist.size(); ++i) { for (std::size_t i = 0; i < (size_t) itemlist.size(); ++i) {
QStringList columns = itemlist[i].str.split("\t"); QStringList columns = itemlist[i].str.split("\t");
if (!itemlist[i].Selectable() && columns.size() == 1) if (!itemlist[i].Selectable() && columns.size() == 1)
{ {
@@ -247,7 +249,7 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
// Assume this is a section header // Assume this is a section header
continue; continue;
} }
for (std::size_t j = 0U; j < columns.size(); ++j) { for (std::size_t j = 0U; j < (size_t) columns.size(); ++j) {
int w = fm.width(columns[j] + " \t"); int w = fm.width(columns[j] + " \t");
if (j >= col_widths.size()) { if (j >= col_widths.size()) {
col_widths.push_back(w); col_widths.push_back(w);
@@ -258,12 +260,12 @@ int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
} }
// Pad each column to its column width // Pad each column to its column width
for (std::size_t i = 0U; i < itemlist.size(); ++i) { for (std::size_t i = 0U; i < (size_t) itemlist.size(); ++i) {
QTableWidgetItem *twi = table->item(i, 4); QTableWidgetItem *twi = table->item(i, 4);
if (twi == NULL) { continue; } if (twi == NULL) { continue; }
QString text = twi->text(); QString text = twi->text();
QStringList columns = text.split("\t"); QStringList columns = text.split("\t");
for (std::size_t j = 0U; j+1U < columns.size(); ++j) { for (std::size_t j = 0U; j+1U < (size_t) columns.size(); ++j) {
columns[j] += "\t"; columns[j] += "\t";
int width = col_widths[j]; int width = col_widths[j];
while (fm.width(columns[j]) < width) { while (fm.width(columns[j]) < width) {
@@ -394,7 +396,7 @@ void NetHackQtMenuWindow::AddRow(int row, const MenuItem& mi)
table->item(row, 4)->setFlags(Qt::ItemIsEnabled); table->item(row, 4)->setFlags(Qt::ItemIsEnabled);
WidenColumn(4, fm.width(text)); WidenColumn(4, fm.width(text));
if (mi.color != -1) { if ((int) mi.color != -1) {
twi->setForeground(colors[mi.color]); twi->setForeground(colors[mi.color]);
} }
@@ -495,7 +497,7 @@ void NetHackQtMenuWindow::keyPressEvent(QKeyEvent* event)
InputCount(key); InputCount(key);
else { else {
for (int i=0; i<itemcount; i++) { for (int i=0; i<itemcount; i++) {
if (itemlist[i].ch == key || itemlist[i].gch == key) if ((unsigned int) itemlist[i].ch == key || (unsigned int) itemlist[i].gch == key)
ToggleSelect(i); ToggleSelect(i);
} }
} }
@@ -579,7 +581,7 @@ void NetHackQtMenuWindow::ToggleSelect(int i)
} }
} }
void NetHackQtMenuWindow::cellToggleSelect(int i, int j) void NetHackQtMenuWindow::cellToggleSelect(int i, int j UNUSED)
{ {
ToggleSelect(i); ToggleSelect(i);
} }
@@ -649,7 +651,7 @@ bool NetHackQtTextWindow::Destroy()
return !isVisible(); return !isVisible();
} }
void NetHackQtTextWindow::UseRIP(int how, time_t when) void NetHackQtTextWindow::UseRIP(int how, time_t when UNUSED)
{ {
// Code from X11 windowport // Code from X11 windowport
#define STONE_LINE_LEN 16 /* # chars that fit on one line */ #define STONE_LINE_LEN 16 /* # chars that fit on one line */
@@ -717,7 +719,7 @@ void NetHackQtTextWindow::Clear()
str_fixed=false; str_fixed=false;
} }
void NetHackQtTextWindow::Display(bool block) void NetHackQtTextWindow::Display(bool block UNUSED)
{ {
if (str_fixed) { if (str_fixed) {
lines->setFont(qt_settings->normalFixedFont()); lines->setFont(qt_settings->normalFixedFont());
@@ -750,7 +752,7 @@ void NetHackQtTextWindow::Display(bool block)
exec(); exec();
} }
void NetHackQtTextWindow::PutStr(int attr, const QString& text) void NetHackQtTextWindow::PutStr(int attr UNUSED, const QString& text)
{ {
str_fixed=str_fixed || text.contains(" "); str_fixed=str_fixed || text.contains(" ");
lines->addItem(text); lines->addItem(text);
+5 -3
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_msg.h" #include "qt_msg.h"
#include "qt_msg.moc" #include "qt_msg.moc"
#include "qt_map.h" #include "qt_map.h"
@@ -61,7 +63,7 @@ void NetHackQtMessageWindow::updateFont()
map->setFont(qt_settings->normalFont()); map->setFont(qt_settings->normalFont());
} }
void NetHackQtMessageWindow::Scroll(int dx, int dy) void NetHackQtMessageWindow::Scroll(int dx UNUSED, int dy UNUSED)
{ {
//RLC Is this necessary? //RLC Is this necessary?
//RLC list->Scroll(dx,dy); //RLC list->Scroll(dx,dy);
@@ -79,7 +81,7 @@ void NetHackQtMessageWindow::ClearMessages()
list->clear(); list->clear();
} }
void NetHackQtMessageWindow::Display(bool block) void NetHackQtMessageWindow::Display(bool block UNUSED)
{ {
if (changed) { if (changed) {
list->repaint(); list->repaint();
@@ -137,7 +139,7 @@ void NetHackQtMessageWindow::PutStr(int attr, const QString& text)
#endif #endif
// ATR_BLINK not supported // ATR_BLINK not supported
if (list->count() >= ::iflags.msg_history) if (list->count() >= (int) ::iflags.msg_history)
delete list->item(0); delete list->item(0);
list->addItem(text2); list->addItem(text2);
+7 -5
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_plsel.h" #include "qt_plsel.h"
#include "qt_plsel.moc" #include "qt_plsel.moc"
#include "qt_bind.h" #include "qt_bind.h"
@@ -42,7 +44,7 @@ static const char nh_attribution[] = "<center><big>NetHack %1</big>"
class NhPSListViewItem : public QTableWidgetItem { class NhPSListViewItem : public QTableWidgetItem {
public: public:
NhPSListViewItem( QTableWidget* parent, const QString& name ) : NhPSListViewItem( QTableWidget* parent UNUSED, const QString& name ) :
QTableWidgetItem(name) QTableWidgetItem(name)
{ {
} }
@@ -138,7 +140,7 @@ public:
} }
}; };
NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) : NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED) :
QDialog(NetHackQtBind::mainWidget()), QDialog(NetHackQtBind::mainWidget()),
fully_specified_role(true) fully_specified_role(true)
{ {
@@ -182,8 +184,8 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
QButtonGroup *gendergroup = new QButtonGroup(this); QButtonGroup *gendergroup = new QButtonGroup(this);
QGroupBox* alignbox = new QGroupBox("Alignment",this); QGroupBox* alignbox = new QGroupBox("Alignment",this);
QButtonGroup *aligngroup = new QButtonGroup(this); QButtonGroup *aligngroup = new QButtonGroup(this);
QVBoxLayout* vbgb = new QVBoxLayout(genderbox); QVBoxLayout* vbgb UNUSED = new QVBoxLayout(genderbox);
QVBoxLayout* vbab = new QVBoxLayout(alignbox); QVBoxLayout* vbab UNUSED = new QVBoxLayout(alignbox);
char versionbuf[QBUFSZ]; char versionbuf[QBUFSZ];
QLabel* logo = new QLabel(QString(nh_attribution).arg(version_string(versionbuf)), this); QLabel* logo = new QLabel(QString(nh_attribution).arg(version_string(versionbuf)), this);
@@ -412,7 +414,7 @@ void NetHackQtPlayerSelector::selectRole(int crow, int ccol, int prow, int pcol)
setupOthers(); setupOthers();
} }
void NetHackQtPlayerSelector::selectRace(int crow, int ccol, int prow, int pcol) void NetHackQtPlayerSelector::selectRace(int crow UNUSED, int ccol UNUSED, int prow, int pcol UNUSED)
{ {
int ra = race->currentRow(); int ra = race->currentRow();
int ro = role->currentRow(); int ro = role->currentRow();
+19
View File
@@ -0,0 +1,19 @@
#if defined(QT_GRAPHICS)
#if defined(MACOSX)
/*
* The following conflict with Qt header files so after
* undefing them in qt_undef.h, we redefine them back to
* the non-conflicting names again in here, presumably
* right after the Qt header files with the conflicts have
* been included.
*/
#define u NETHACK_u
#define flags NETHACK_flags
#define g NETHACK_g
#define cg NETHACK_cg
#endif /* MACOSX */
#endif /* QT_GRAPHICS */
+3 -1
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_rip.h" #include "qt_rip.h"
#include "qt_bind.h" #include "qt_bind.h"
#include "qt_str.h" #include "qt_str.h"
@@ -69,7 +71,7 @@ QSize NetHackQtRIP::sizeHint() const
return pixmap->size(); return pixmap->size();
} }
void NetHackQtRIP::paintEvent(QPaintEvent* event) void NetHackQtRIP::paintEvent(QPaintEvent* event UNUSED)
{ {
if ( riplines ) { if ( riplines ) {
int pix_x=(width()-pixmap->width())/2; int pix_x=(width()-pixmap->width())/2;
+4 -2
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_set.h" #include "qt_set.h"
#include "qt_set.moc" #include "qt_set.moc"
#include "qt_glyph.h" #include "qt_glyph.h"
@@ -39,7 +41,7 @@ namespace nethack_qt_ {
#define TILEWMIN 6 #define TILEWMIN 6
#define TILEHMIN 6 #define TILEHMIN 6
NetHackQtSettings::NetHackQtSettings(int w, int h) : NetHackQtSettings::NetHackQtSettings(int w UNUSED, int h UNUSED) :
settings(), settings(),
tilewidth(this), tilewidth(this),
tileheight(this), tileheight(this),
@@ -149,7 +151,7 @@ void NetHackQtSettings::toggleGlyphSize()
whichsize.toggle(); whichsize.toggle();
} }
void NetHackQtSettings::setGlyphSize(bool which) void NetHackQtSettings::setGlyphSize(bool which UNUSED)
{ {
QSize n = QSize(tilewidth.value(),tileheight.value()); QSize n = QSize(tilewidth.value(),tileheight.value());
if ( othersize.isValid() ) { if ( othersize.isValid() ) {
+4 -2
View File
@@ -17,10 +17,12 @@ extern "C" {
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_stat.h" #include "qt_stat.h"
#include "qt_stat.moc" #include "qt_stat.moc"
#include "qt_set.h" #include "qt_set.h"
@@ -209,14 +211,14 @@ QWidget* NetHackQtStatusWindow::Widget() { return this; }
void NetHackQtStatusWindow::Clear() void NetHackQtStatusWindow::Clear()
{ {
} }
void NetHackQtStatusWindow::Display(bool block) void NetHackQtStatusWindow::Display(bool block UNUSED)
{ {
} }
void NetHackQtStatusWindow::CursorTo(int,int y) void NetHackQtStatusWindow::CursorTo(int,int y)
{ {
cursy=y; cursy=y;
} }
void NetHackQtStatusWindow::PutStr(int attr, const QString& text) void NetHackQtStatusWindow::PutStr(int attr UNUSED, const QString& text UNUSED)
{ {
// do a complete update when line 0 is done (as per X11 fancy status) // do a complete update when line 0 is done (as per X11 fancy status)
if (cursy==0) updateStats(); if (cursy==0) updateStats();
+1 -1
View File
@@ -35,7 +35,7 @@ QString str_titlecase(const QString& str)
QString nh_capitalize_words(const QString& str) QString nh_capitalize_words(const QString& str)
{ {
QStringList words = str.split(" "); QStringList words = str.split(" ");
for (size_t i = 0; i < words.size(); ++i) { for (size_t i = 0; i < (size_t) words.size(); ++i) {
words[i] = str_titlecase(words[i]); words[i] = str_titlecase(words[i]);
} }
return words.join(" "); return words.join(" ");
+2
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_streq.h" #include "qt_streq.h"
#include "qt_str.h" #include "qt_str.h"
+3 -1
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_svsel.h" #include "qt_svsel.h"
#include "qt_bind.h" #include "qt_bind.h"
#include "qt_str.h" #include "qt_str.h"
@@ -60,7 +62,7 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
QGroupBox* box = new QGroupBox("Saved Characters",this); QGroupBox* box = new QGroupBox("Saved Characters",this);
QButtonGroup *bg = new QButtonGroup(this); QButtonGroup *bg = new QButtonGroup(this);
vbl->addWidget(box); vbl->addWidget(box);
QVBoxLayout *bgl = new QVBoxLayout(box); QVBoxLayout *bgl UNUSED = new QVBoxLayout(box);
connect(bg, SIGNAL(buttonPressed(int)), this, SLOT(done(int))); connect(bg, SIGNAL(buttonPressed(int)), this, SLOT(done(int)));
for (int i=0; saved[i]; i++) { for (int i=0; saved[i]; i++) {
QPushButton* b = new QPushButton(saved[i],box); QPushButton* b = new QPushButton(saved[i],box);
+17
View File
@@ -0,0 +1,17 @@
#if defined(QT_GRAPHICS)
#if defined(MACOSX)
/*
* The following conflict with Qt header files so we
* undef them in here, then redef them using qt_redef.h
* after the Qt includes.
*/
#undef u
#undef flags
#undef g
#undef cg
#endif /* MACOSX */
#endif /* QT_GRAPHICS */
+12 -10
View File
@@ -57,10 +57,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_win.h" #include "qt_win.h"
#include "qt_bind.h" #include "qt_bind.h"
#include "qt_click.h" #include "qt_click.h"
@@ -119,18 +121,18 @@ NetHackQtWindow::~NetHackQtWindow()
// XXX Use "expected ..." for now, abort or default later. // XXX Use "expected ..." for now, abort or default later.
// //
void NetHackQtWindow::Clear() { puts("unexpected Clear"); } void NetHackQtWindow::Clear() { puts("unexpected Clear"); }
void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } void NetHackQtWindow::Display(bool block UNUSED) { puts("unexpected Display"); }
bool NetHackQtWindow::Destroy() { return true; } bool NetHackQtWindow::Destroy() { return true; }
void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } void NetHackQtWindow::CursorTo(int x UNUSED,int y UNUSED) { puts("unexpected CursorTo"); }
void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } void NetHackQtWindow::PutStr(int attr UNUSED, const QString& text UNUSED) { puts("unexpected PutStr"); }
void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); }
void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, void NetHackQtWindow::AddMenu(int glyph UNUSED, const ANY_P* identifier UNUSED, char ch UNUSED, char gch UNUSED, int attr UNUSED,
const QString& str, unsigned itemflags) { puts("unexpected AddMenu"); } const QString& str UNUSED, unsigned itemflags UNUSED) { puts("unexpected AddMenu"); }
void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } void NetHackQtWindow::EndMenu(const QString& prompt UNUSED) { puts("unexpected EndMenu"); }
int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED) { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } void NetHackQtWindow::ClipAround(int x UNUSED,int y UNUSED) { puts("unexpected ClipAround"); }
void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,int glyph UNUSED) { puts("unexpected PrintGlyph"); }
//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } //void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); }
void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } void NetHackQtWindow::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); }
} // namespace nethack_qt_ } // namespace nethack_qt_
+2
View File
@@ -16,10 +16,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_xcmd.h" #include "qt_xcmd.h"
#include "qt_xcmd.moc" #include "qt_xcmd.moc"
#include "qt_bind.h" #include "qt_bind.h"
+3 -1
View File
@@ -15,10 +15,12 @@
#undef min #undef min
#undef max #undef max
#include "qt_undef.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#endif #endif
#include "qt_redef.h"
#include "qt_yndlg.h" #include "qt_yndlg.h"
#include "qt_yndlg.moc" #include "qt_yndlg.moc"
#include "qt_str.h" #include "qt_str.h"
@@ -182,7 +184,7 @@ char NetHackQtYnDialog::Exec()
show(); show();
char choice=0; char choice=0;
char ch_esc=0; char ch_esc=0;
for (uint i=0; i<ch.length(); i++) { for (uint i=0; i< (uint) ch.length(); i++) {
if (ch[i].unicode()=='q') ch_esc='q'; if (ch[i].unicode()=='q') ch_esc='q';
else if (!ch_esc && ch[i].unicode()=='n') ch_esc='n'; else if (!ch_esc && ch[i].unicode()=='n') ch_esc='n';
} }