Cleaned up CrazyhouseMove.
[tagua/yd.git] / src / movelist_table.h
blob6c43161374470d619700fa4df0a4f000e14c7cce
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 MOVELIST_TABLE_H
12 #define MOVELIST_TABLE_H
14 #include <QWidget>
15 #include "movelist_widget.h"
17 class QAction;
18 class QScrollArea;
20 namespace MoveList {
21 class Widget;
22 class Textual;
24 /**
25 * @class Table <movelist_table.h>
26 * @brief The widget that holds the move list in a scrolled view.
28 * This class is a widget that contains a MoveList::Widget and a few
29 * convenience buttons for undo and redo.
31 class Table : public QWidget {
32 Q_OBJECT
33 public:
34 /** the action for undo */
35 QAction *m_undo;
37 /** the action for redo */
38 QAction *m_redo;
40 /** the scroll area that contains the move list */
41 QScrollArea *m_scroll_area;
43 /** the move list widget */
44 Widget *m_movelist;
46 /** the move list textual widget */
47 Textual *m_movelist_textual;
49 Table(QWidget* p = NULL);
51 void settingsChanged();
53 void setLoaderBasePath(const QString& p);
55 /** Sets the move comment at the given index */
56 void setComment(const Index& index, const QString& comment);
58 /** Sets the comment at the given index before the give subvariation */
59 void setVComment(const Index& index, int v, const QString& comment, bool confirm_promotion = false);
61 /** Sets the move at the given index */
62 void setMove(const Index& index, int turn, const DecoratedMove& move,
63 const QString& comment = QString(), bool confirm_promotion = false);
65 /** Sets the move at the given index */
66 void setMove(const Index& index, int turn, const QString& move,
67 const QString& comment = QString(), bool confirm_promotion = false);
69 /** Removes the given index and all those that come after */
70 void remove(const Index& index, bool confirm_promotion = false);
72 /** Promotes the given variation in the main line */
73 void promoteVariation(const Index& ix, int v);
75 void reset();
77 Notifier* getNotifier();
79 void setNotifier(Notifier* n, bool detach_prev=true);
81 int layoutStyle();
83 void setLayoutStyle(int x);
85 /** Sets the currently selected index */
86 void select(const Index& index, bool confirm_promotion = false);
88 /** Enables/disables the undo action */
89 void enableUndo(bool e);
91 /** Enables/disables the redo action */
92 void enableRedo(bool e);
94 private slots:
95 void onUndo();
96 void onRedo();
98 } //end namespace MoveList
100 #endif //MOVELIST_TABLE_H