2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
16 #include <KXmlGuiWindow>
18 #include <QApplication>
19 #include <QMainWindow>
21 #include "boost/shared_ptr.hpp"
23 #include <core/state_fwd.h>
45 class TAGUA_EXPORT MainWindow
: public KXmlGuiWindow
{
47 QDockWidget
* movelist_dock
;
48 QDockWidget
* console_dock
;
51 QStackedWidget
* m_movelist_stack
;
52 boost::shared_ptr
<ICSConnection
> m_connection
;
59 UI
& ui() { return m_ui
; }
60 void createTab(ChessTable
*, const boost::shared_ptr
<Controller
>&,
61 const QString
& label
, int index
= -1);
64 std::vector
<EngineInfo
*> m_engines
;
66 boost::shared_ptr
<QConnect
> quickConnectDialog
;
67 NewGame
* newGameDialog
;
69 // QAction *mkAction(const QString& txt, QKeySequence shk, QObject *o,
70 // const char *sl, QString name, QObject *par = NULL);
72 void setupEngineMenu();
73 KAction
* addPromotionAction(const QString
& name
, const QString
& text
, const char* uiSlot
);
74 KAction
* installRegularAction(const QString
& name
, const KIcon
& icon
, const QString
& text
,
75 QObject
* obj
, const char* slot
);
76 void updateVariantActions(bool unplug
= true);
78 bool openFile(const QString
&);
79 void saveFile(QFile
&);
80 KUrl
saveGame(const KUrl
& url
);
85 MainWindow(const QString
& variant
);
86 virtual ~MainWindow();
89 void closeEvent(QCloseEvent
*);
90 void keyPressEvent(QKeyEvent
*);
91 void keyReleaseEvent(QKeyEvent
*);
96 void createConnection(const QString
&, const QString
&, const QString
&,
97 quint16
, const QString
&, const QString
&);
98 void destroyConnection();
99 void testConnect(); // DEBUG
101 void icsDisconnect();
102 // // void receivedCommand(const QString&);
104 void onEstablishConnection();
106 void onConnectionError(int);
110 void sendBlankPassword();
112 void cleanupGame(const QString
&, const QString
&);
116 void setupGame(const GameInfo
*, const PositionInfo
&);
117 void setupPGN(const QString
& s
);
118 void setupExaminedGame(const GameInfo
*, const PositionInfo
&);
119 void setupObservedGame(const GameInfo
*, const PositionInfo
&);
121 bool newGame(const QString
& var
, const StatePtr
&, bool);
125 bool checkOverwrite(const KUrl
& url
);
128 void toggleConsole();
129 void toggleMoveList();
131 void displayMessage(const QString
& msg
);
132 void displayErrorMessage(ErrorCode
);
135 // void prefHighlight();
137 void settingsChanged();
142 #endif // MAINWINDOW_H