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.
15 #include <kxmlguiwindow.h>
16 #include <kmainwindow.h>
18 #include <QApplication>
19 #include <QMainWindow>
21 #include "boost/shared_ptr.hpp"
42 class MainWindow
: public KXmlGuiWindow
{
44 QDockWidget
* movelist_dock
;
45 QDockWidget
* console_dock
;
48 QStackedWidget
* m_movelist_stack
;
49 boost::shared_ptr
<ICSConnection
> m_connection
;
53 KAction
* m_promote_queen
;
54 KAction
* m_promote_rook
;
55 KAction
* m_promote_bishop
;
56 KAction
* m_promote_knight
;
57 QActionGroup
* m_promote_group
;
59 KAction
* m_do_promotion
;
63 UI
& ui() { return m_ui
; }
64 void createTab(ChessTable
*, const boost::shared_ptr
<Controller
>&,
65 const QString
& label
, int index
= -1);
68 std::vector
<EngineInfo
*> m_engines
;
70 boost::shared_ptr
<QConnect
> quickConnectDialog
;
71 NewGame
* newGameDialog
;
73 // QAction *mkAction(const QString& txt, QKeySequence shk, QObject *o,
74 // const char *sl, QString name, QObject *par = NULL);
76 KAction
* addPromotionAction(const QString
& name
, const QString
& text
, const char* uiSlot
);
77 KAction
* installRegularAction(const QString
& name
, const KIcon
& icon
, const QString
& text
,
78 QObject
* obj
, const char* slot
);
79 void updatePromotionType();
81 bool openFile(const QString
&);
87 virtual ~MainWindow();
90 void closeEvent(QCloseEvent
*);
91 void keyPressEvent(QKeyEvent
*);
92 void keyReleaseEvent(QKeyEvent
*);
97 void createConnection(const QString
&, const QString
&, const QString
&,
98 quint16
, const QString
&, const QString
&);
99 void destroyConnection();
100 void testConnect(); // DEBUG
102 void icsDisconnect();
103 // // void receivedCommand(const QString&);
105 void onEstablishConnection();
107 void onConnectionError(int);
111 void sendBlankPassword();
113 void cleanupGame(const QString
&, const QString
&);
117 void setupGame(const GameInfo
*, const PositionInfo
&);
118 void setupPGN(const QString
& s
);
119 void setupExaminedGame(const GameInfo
*, const PositionInfo
&);
120 void setupObservedGame(const GameInfo
*, const PositionInfo
&);
122 bool newGame(const QString
& var
, AbstractPosition::Ptr
);
126 void toggleConsole();
127 void toggleMoveList();
129 void displayMessage(const QString
& msg
);
130 void displayErrorMessage(ErrorCode
);
133 // void prefHighlight();
140 #endif // MAINWINDOW_H