Debian Codegraph @

src/history.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2004-2005 Artur Wiebe *
3 * [email protected] *
4 * *
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 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef _HISTORY_H_
21 #define _HISTORY_H_
22
23
24 #include <QFrame>
25 #include <QTreeWidget>
26 #include <QComboBox>
27 #include <QToolButton>
28 #include <QLabel>
29
30 #include "pdn.h"
31
32
33 #define MOVE_SPLIT '#'
34
35
36 class myHistory : public QFrame
37 {
38 Q_OBJECT
39
40 public:
41 myHistory(QWidget* parent);
42 ~myHistory();
43
44 void newPdn(const QString& event, bool freeplace);
45 bool openPdn(const QString& filename, QString& log_text);
46 bool savePdn(const QString& fn);
47
48 void clear();
49
50 bool isPaused() const { return m_paused; }
51 bool isFreePlacement() const { return m_freeplace; }
52
53 void setTag(PdnGame::Tag, const QString& val);
54 QString getTag(PdnGame::Tag);
55
56 void appendMove(const QString& move, const QString& comment);
57 // FIXME - provide a function that returns who is next, black or white.
58 int moveCount() const { return m_movelist->topLevelItemCount()-1; }
59
60 static QString typeToString(int type);
61
62 void setCurrent(const QString& t) { m_current->setText(t); }
63
64 signals:
65 void previewGame(int game_type);
66 void applyMoves(const QString& moves);
67 void newMode(bool paused, bool freeplace);
68
69 public slots:
70 void slotWorking(bool);
71
72 private slots:
73 void slot_move(QTreeWidgetItem*, QTreeWidgetItem*);
74 void slot_game_selected(int index);
75 void slot_modify_tag(QTreeWidgetItem* item, int col);
76 void slot_modify_comment(QTreeWidgetItem* item, int col);
77
78 void slot_undo();
79 void slot_redo();
80 void slot_continue();
81
82 private:
83 QString tag_to_string(PdnGame::Tag);
84 void set_mode(bool);
85
86 void do_moves();
87 void history_undo(bool move_backwards);
88 void delete_moves();
89
90
91 private:
92 QTreeWidget* m_taglist;
93 QTreeWidget* m_movelist;
94 QComboBox* m_gamelist;
95 Pdn* m_pdn;
96 PdnGame* m_game;
97
98 bool m_paused;
99 bool m_freeplace;
100 bool m_disable_moves;
101
102 QToolButton* m_undo;
103 QToolButton* m_redo;
104 QToolButton* m_cont;
105
106 QLabel* m_mode_icon;
107 QLabel* m_current;
108 };
109
110
111 #endif
112