Implemented variant actions.
[tagua/yd.git] / src / controllers / abstract.cpp
blob9373216fed86eef610f498d3ec9dba09aee80a9c
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 #include "abstract.h"
12 #include "entities/userentity.h"
14 Controller::Controller(ChessTable* view)
15 : m_view(view) { }
17 Controller::~Controller() { }
19 ActionCollection* Controller::variantActions() const {
20 return m_variant_actions;
23 bool Controller::undo() {
24 return entity()->undo();
27 bool Controller::redo() {
28 return entity()->redo();
31 bool Controller::truncate() {
32 return entity()->truncate();
35 bool Controller::promoteVariation() {
36 return entity()->promoteVariation();
39 void Controller::setPromotionType(int p) {
40 entity()->changePromotionType(p);
43 int Controller::promotionType() const {
44 return entity()->promotionType();
47 bool Controller::doPromotion() const {
48 return entity()->promotionType() >= 0;
51 void Controller::setDoPromotion(bool value) {
52 return entity()->changePromotionType(value ? 0 : -1);
55 bool Controller::back() {
56 return entity()->back();
59 bool Controller::forward() {
60 return entity()->forward();
63 void Controller::gotoFirst() {
64 entity()->gotoFirst();
67 void Controller::gotoLast() {
68 entity()->gotoLast();
71 QString Controller::save() {
72 return entity()->save();
75 void Controller::loadPGN(const PGN& pgn) {
76 entity()->loadPGN(pgn);