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.h>
17 #include <kmainwindow.h>
19 #include <QApplication>
20 #include <QMainWindow>
22 #include "boost/shared_ptr.hpp"
44 class TAGUA_EXPORT MainWindow
: public KXmlGuiWindow
{
46 QDockWidget
* movelist_dock
;
47 QDockWidget
* console_dock
;
50 QStackedWidget
* m_movelist_stack
;
51 boost::shared_ptr
<ICSConnection
> m_connection
;
58 UI
& ui() { return m_ui
; }
59 void createTab(ChessTable
*, const boost::shared_ptr
<Controller
>&,
60 const QString
& label
, int index
= -1);
63 std::vector
<EngineInfo
*> m_engines
;
65 boost::shared_ptr
<QConnect
> quickConnectDialog
;
66 NewGame
* newGameDialog
;
68 // QAction *mkAction(const QString& txt, QKeySequence shk, QObject *o,
69 // const char *sl, QString name, QObject *par = NULL);
71 void setupEngineMenu();
72 KAction
* addPromotionAction(const QString
& name
, const QString
& text
, const char* uiSlot
);
73 KAction
* installRegularAction(const QString
& name
, const KIcon
& icon
, const QString
& text
,
74 QObject
* obj
, const char* slot
);
75 void updateVariantActions();
77 bool openFile(const QString
&);
82 MainWindow(const QString
& variant
);
83 virtual ~MainWindow();
86 void closeEvent(QCloseEvent
*);
87 void keyPressEvent(QKeyEvent
*);
88 void keyReleaseEvent(QKeyEvent
*);
93 void createConnection(const QString
&, const QString
&, const QString
&,
94 quint16
, const QString
&, const QString
&);
95 void destroyConnection();
96 void testConnect(); // DEBUG
99 // // void receivedCommand(const QString&);
101 void onEstablishConnection();
103 void onConnectionError(int);
107 void sendBlankPassword();
109 void cleanupGame(const QString
&, const QString
&);
113 void setupGame(const GameInfo
*, const PositionInfo
&);
114 void setupPGN(const QString
& s
);
115 void setupExaminedGame(const GameInfo
*, const PositionInfo
&);
116 void setupObservedGame(const GameInfo
*, const PositionInfo
&);
118 bool newGame(const QString
& var
, AbstractPosition::Ptr
, bool);
122 void toggleConsole();
123 void toggleMoveList();
125 void displayMessage(const QString
& msg
);
126 void displayErrorMessage(ErrorCode
);
129 // void prefHighlight();
131 void settingsChanged();
136 #endif // MAINWINDOW_H