]> granicus.if.org Git - nethack/commitdiff
qt_win.cpp cleanup
authorPatR <rankin@nethack.org>
Sun, 30 Aug 2020 23:00:18 +0000 (16:00 -0700)
committerPatR <rankin@nethack.org>
Sun, 30 Aug 2020 23:00:18 +0000 (16:00 -0700)
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

index 326acb17c754bf6678c4a22cad0b4d0977b2c921..12d101496b947418e713603bae8a40ad0b2793aa 100644 (file)
@@ -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 <QtWidgets/QtWidgets>
 #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 <ctype.h>
-
 #include "qt_clust.h"
 
-#include <dirent.h>
-
-#ifdef _WS_X11_
-// For userid control
-#include <unistd.h>
-#endif
-
-#ifdef USER_SOUNDS
-#if QT_VERSION >= 0x050000
-#  include <QtMultimedia/QSound>
-# else
-#  include <QtGui/QSound>
-# 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"); }