2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
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.h>
17 #include <kmainwindow.h>
19 #include <QApplication>
20 #include <QMainWindow>
22 #include "boost/shared_ptr.hpp"
43 class MainWindow
: public KXmlGuiWindow
{
45 QDockWidget
* movelist_dock
;
46 QDockWidget
* console_dock
;
49 QStackedWidget
* m_movelist_stack
;
50 boost::shared_ptr
<ICSConnection
> m_connection
;
54 KAction
* m_promote_queen
;
55 KAction
* m_promote_rook
;
56 KAction
* m_promote_bishop
;
57 KAction
* m_promote_knight
;
58 QActionGroup
* m_promote_group
;
60 KAction
* m_do_promotion
;
64 UI
& ui() { return m_ui
; }
65 void createTab(ChessTable
*, const boost::shared_ptr
<Controller
>&,
66 const QString
& label
, int index
= -1);
69 std::vector
<EngineInfo
*> m_engines
;
71 boost::shared_ptr
<QConnect
> quickConnectDialog
;
72 NewGame
* newGameDialog
;
74 // QAction *mkAction(const QString& txt, QKeySequence shk, QObject *o,
75 // const char *sl, QString name, QObject *par = NULL);
77 void setupEngineMenu();
78 KAction
* addPromotionAction(const QString
& name
, const QString
& text
, const char* uiSlot
);
79 KAction
* installRegularAction(const QString
& name
, const KIcon
& icon
, const QString
& text
,
80 QObject
* obj
, const char* slot
);
81 void updatePromotionType();
83 bool openFile(const QString
&);
89 virtual ~MainWindow();
92 void closeEvent(QCloseEvent
*);
93 void keyPressEvent(QKeyEvent
*);
94 void keyReleaseEvent(QKeyEvent
*);
99 void createConnection(const QString
&, const QString
&, const QString
&,
100 quint16
, const QString
&, const QString
&);
101 void destroyConnection();
102 void testConnect(); // DEBUG
104 void icsDisconnect();
105 // // void receivedCommand(const QString&);
107 void onEstablishConnection();
109 void onConnectionError(int);
113 void sendBlankPassword();
115 void cleanupGame(const QString
&, const QString
&);
119 void setupGame(const GameInfo
*, const PositionInfo
&);
120 void setupPGN(const QString
& s
);
121 void setupExaminedGame(const GameInfo
*, const PositionInfo
&);
122 void setupObservedGame(const GameInfo
*, const PositionInfo
&);
124 bool newGame(const QString
& var
, AbstractPosition::Ptr
);
128 void toggleConsole();
129 void toggleMoveList();
131 void displayMessage(const QString
& msg
);
132 void displayErrorMessage(ErrorCode
);
135 // void prefHighlight();
142 #endif // MAINWINDOW_H