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.
11 #ifndef EDITGAMECONTROLLER_H
12 #define EDITGAMECONTROLLER_H
16 #include "agentgroup.h"
25 class GraphicalSystem
;
29 * @brief A controller to edit or play games.
31 * EditGameController is used to play games, either locally or
32 * on an ICS server. A pair of entities @code m_players, representing
33 * the two players, is mantained as well as a set of additional entities,
35 * If an entity needs to be notified about how the game progresses, one
36 * should register it as an agent, adding it to @code m_agents.
38 class EditGameController
: public Controller
{
39 void init(AbstractPosition::Ptr
);
40 boost::shared_ptr
<Agent
> m_clock_agent
;
41 boost::shared_ptr
<Agent
> m_update_agent
;
43 virtual void onNavigation();
45 boost::shared_ptr
<UserEntity
> m_entity
;
46 boost::shared_ptr
<GraphicalSystem
> m_graphical
;
49 boost::shared_ptr
<GraphicalGame
> m_game
;
50 virtual boost::shared_ptr
<UserEntity
> entity() const { return m_entity
; }
51 boost::shared_ptr
<Entity
> m_players
[2];
52 std::set
<boost::shared_ptr
<Entity
> > m_entities
;
54 EditGameController(ChessTable
*, const VariantPtr
& variant
,
55 AbstractPosition::Ptr startingPos
= AbstractPosition::Ptr());
56 ~EditGameController();
58 virtual ActionCollection
* variantActions() const;
59 virtual QString
variant() const;
60 EntityToken
addPlayingEngine(int side
, const boost::shared_ptr
<Engine
>& engine
);
61 // EntityToken addAnalysingEngine(const boost::shared_ptr<Engine>& engine);
62 void removeEntity(const EntityToken
& token
);
63 bool addICSPlayer(int side
, int game_number
, const boost::shared_ptr
<ICSConnection
>& connection
);
64 bool setExaminationMode(int game_number
, const boost::shared_ptr
<ICSConnection
>& connection
);
65 bool setObserveMode(int game_number
, const boost::shared_ptr
<ICSConnection
>& connection
);
67 virtual void loadPGN(const PGN
&);
69 virtual void createCtrlAction();
70 virtual void destroyCtrlAction();
72 virtual boost::shared_ptr
<Controller
> end();
73 virtual void detach();
75 virtual void reloadSettings();
76 virtual void setUI(UI
& ui
);
77 virtual void activate();