Files
nethack/win/Qt/qt_main.h
PatR a87a83fc83 Qt menu fixes: mainly Quit
Changes affecting everybody (using Qt):  rename game->Save to
game->Save-and-exit and game->Quit to game->Quit-without-saving.

OSX-specific changes:  add separate nethack->Quit and change
game->Quit-without-saving to game->_Quit-without-saving to prevent
that from being hijacked for the nethack menu.  nethack->Quit menu
entry works.  Command+Q is a keyboard shortcut for it.  They bring
up a menu with choices of "Quit without saving" and "Cancel and
return to game".  It's not the same as the handler for the window
Close button, which used to offer "Save" or "Cancel" (with the
latter triggering an infinite loop) but now offers "Save and exit"
or "Quit without saving".  They don't share any code.  The
game->_Quit-without-saving entry doesn't work; it runs nethack's '?'
command like a bunch of other broken menu entries.  If it did work,
it would give nethack's "Really quit?" prompt and proceed from there.
The "Quit without saving" response for nethack->Quit confirmation
bypasses that and just quits.

Also OSX, add a second 'about' entry.  The first one is hijacked and
added to the nethack menu, the second is help->_About_Qt_NetHack_
and avoids hijacking.  Both nethack->About and help->_About_ bring
up the same dialog box showing version and assorted other info.

A lot of flailing about with for relatively small amount of progress.
2020-08-09 14:55:05 -07:00

97 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_main.h -- the main window
#ifndef QT4MAIN_H
#define QT4MAIN_H
#ifdef KDE
#include <kapp.h>
#include <ktopwidget.h>
#else
#include "qt_kde0.h"
#endif
namespace nethack_qt_ {
class NetHackQtInvUsageWindow;
class NetHackQtKeyBuffer;
class NetHackQtMapWindow2;
class NetHackQtMessageWindow;
class NetHackQtStatusWindow;
class NetHackQtWindow;
// This class is the main widget for NetHack
//
// It is a collection of Message, Map, and Status windows. In the current
// version of nethack there is only one of each, and this class makes this
// assumption, not showing itself until all are inserted.
//
// This class simply knows how to layout such children sensibly.
//
// Since it is only responsible for layout, the class does not
// note the actual class of the windows.
//
class NetHackQtMainWindow : public KTopLevelWidget {
Q_OBJECT
public:
NetHackQtMainWindow(NetHackQtKeyBuffer&);
void AddMessageWindow(NetHackQtMessageWindow* window);
NetHackQtMessageWindow * GetMessageWindow();
void AddMapWindow(NetHackQtMapWindow2* window);
void AddStatusWindow(NetHackQtStatusWindow* window);
void RemoveWindow(NetHackQtWindow* window);
void updateInventory();
void fadeHighlighting();
public slots:
void doMenuItem(QAction *);
void doQtSettings(bool);
void doAbout(bool);
void doQuit(bool);
//RLC void doGuidebook(bool);
void doKeys(const QString&);
protected:
virtual void resizeEvent(QResizeEvent*);
virtual void keyPressEvent(QKeyEvent*);
virtual void keyReleaseEvent(QKeyEvent* event);
virtual void closeEvent(QCloseEvent*);
private slots:
void layout();
void raiseMap();
void zoomMap();
void raiseMessages();
void raiseStatus();
private:
void ShowIfReady();
#ifdef KDE
KMenuBar* menubar;
#else
QMenuBar* menubar;
#endif
NetHackQtMessageWindow* message;
NetHackQtMapWindow2* map;
NetHackQtStatusWindow* status;
NetHackQtInvUsageWindow* invusage;
QSplitter *hsplitter;
QSplitter *vsplitter;
NetHackQtKeyBuffer& keysink;
QStackedWidget* stack;
int dirkey;
};
} // namespace nethack_qt_
#endif