Engines can now be stopped. Removed engine analysis from the menu.
[tagua/yd.git] / src / ui.h
blobabbef6543940fca7bf94dca054035bf417f7ed59
1 /*
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.
9 */
11 #ifndef UI_H
12 #define UI_H
14 #include <boost/shared_ptr.hpp>
15 #include <qobject.h>
16 #include "common.h"
17 #include "controllers/entitytoken.h"
18 #include "tagua.h"
19 #include <map>
21 class Controller;
22 class Engine;
24 class UI : public QObject {
25 Q_OBJECT
26 typedef std::map<QWidget*, boost::shared_ptr<Controller> > ControllerMap;
27 ControllerMap m_controller;
28 QWidget* m_current_tab;
29 boost::shared_ptr<Controller>& controller();
30 const boost::shared_ptr<Controller>& controller() const;
31 public:
32 UI();
33 void addController(QWidget* w, const boost::shared_ptr<Controller>&);
34 void setController(const boost::shared_ptr<Controller>&);
35 void removeController(QWidget* w);
36 public Q_SLOTS:
37 void setCurrentTab(QWidget* w);
39 bool undo();
40 bool redo();
41 bool truncate();
42 bool promoteVariation();
43 bool back();
44 bool forward();
45 void gotoFirst();
46 void gotoLast();
47 void setTurn(int);
48 void createCtrlAction();
49 void destroyCtrlAction();
51 void pgnCopy();
52 void pgnPaste();
53 void pgnPaste(const QString&);
55 // promotion type
56 void promoteToQueen();
57 void promoteToRook();
58 void promoteToBishop();
59 void promoteToKnight();
60 int promotionType() const;
62 // do promotion
63 void setDoPromotion(bool);
64 bool doPromotion() const;
66 // editing
67 void clearBoard();
68 void setStartingPosition();
69 void copyPosition();
70 void pastePosition();
71 AbstractPosition::Ptr position() const;
73 EntityToken addPlayingEngine(int side, const boost::shared_ptr<Engine>& engine);
74 // EntityToken addAnalysingEngine(const boost::shared_ptr<Engine>& engine);
75 void removeEntity(const EntityToken& token);
77 void end();
78 void detach();
80 QString currentVariant() const;
83 #endif