From 0902d83d521f459ce3188653527e142fdbb35895 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Aug 2020 16:00:18 -0700 Subject: [PATCH] qt_win.cpp cleanup Started out fixing a comment typo and ended up removing a bunch of unnecessary stuff, plus a little bit of lackluster reformatting. --- win/Qt/qt_win.cpp | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 326acb17c..12d101496 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// Qt Binding for NetHack 3.4 +// Qt Windowing interface for NetHack 3.7 // // Copyright (C) 1996-2001 by Warwick W. Allison (warwick@troll.no) // @@ -22,7 +22,7 @@ // and also because this is my first major application of Qt. // // The problem of NetHack's getkey requirement is solved by intercepting -// key events by overiding QApplicion::notify(...), and putting them in +// key events by overiding QApplication::notify(...), and putting them in // a buffer. Mouse clicks on the map window are treated with a similar // buffer. When the NetHack engine calls for a key, one is taken from // the buffer, or if that is empty, QApplication::exec() is called. @@ -43,7 +43,7 @@ // This includes all the definitions we need from the NetHack main // engine. We pretend MSC is a STDC compiler, because C++ is close // enough, and we undefine NetHack macros which conflict with Qt -// identifiers. +// identifiers (now done in qt_pre.h). #define QT_DEPRECATED_WARNINGS extern "C" { @@ -56,6 +56,9 @@ extern "C" { #include #endif #include "qt_post.h" + +// Many of these headers are not needed here. It's a holdover +// from when most of the Qt code was in one big file. #include "qt_win.h" #include "qt_bind.h" #include "qt_click.h" @@ -68,30 +71,8 @@ extern "C" { #include "qt_msg.h" #include "qt_set.h" -#include - #include "qt_clust.h" -#include - -#ifdef _WS_X11_ -// For userid control -#include -#endif - -#ifdef USER_SOUNDS -#if QT_VERSION >= 0x050000 -# include -# else -# include -# endif -#endif - - -#ifdef USER_SOUNDS -extern void play_sound_for_message(const std::string& str); -#endif - namespace nethack_qt_ { void @@ -119,10 +100,13 @@ bool NetHackQtWindow::Destroy() { return true; } void NetHackQtWindow::CursorTo(int x UNUSED,int y UNUSED) { puts("unexpected CursorTo"); } void NetHackQtWindow::PutStr(int attr UNUSED, const QString& text UNUSED) { puts("unexpected PutStr"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } -void NetHackQtWindow::AddMenu(int glyph UNUSED, const ANY_P* identifier UNUSED, char ch UNUSED, char gch UNUSED, int attr UNUSED, - const QString& str UNUSED, unsigned itemflags UNUSED) { puts("unexpected AddMenu"); } +void NetHackQtWindow::AddMenu(int glyph UNUSED, const ANY_P* identifier UNUSED, + char ch UNUSED, char gch UNUSED, int attr UNUSED, + const QString& str UNUSED, unsigned itemflags UNUSED) + { puts("unexpected AddMenu"); } void NetHackQtWindow::EndMenu(const QString& prompt UNUSED) { puts("unexpected EndMenu"); } -int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED) { 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 UNUSED,int y UNUSED) { puts("unexpected ClipAround"); } 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"); }