Debian Codegraph @

src/board/boardwindow.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #ifndef BOARDWINDOW_H
24 #define BOARDWINDOW_H
25
26 #include "gamedata.h"
27 #include <QMainWindow>
28
29 class BoardDispatch;
30 class qGoBoard;
31 class ClockDisplay;
32 class Tree;
33 class QLabel;
34 class QButtonGroup;
35 class Board;
36 class Move;
37 namespace Ui {
38 class BoardWindow;
39 }
40
41 enum TimeWarnState { TimeOK, TimeLow, TimeExpired };
42
43 class BoardWindow : public QMainWindow
44 {
45 Q_OBJECT
46
47 friend class BoardDispatch;
48 friend class CountDialog;
49
50 public:
51 BoardWindow(GameData *gamedata = 0 , bool iAmBlack = true, bool iAmWhite = true, class BoardDispatch * _dispatch = 0);
52 ~BoardWindow();
53
54 void init();
55 bool doSave(QString fileName, bool force);
56 QString getCandidateFileName();
57
58 int getBoardSize() const {return boardSize;}
59 Tree *getTree() {return tree;}
60 GameMode getGameMode() {return gameData->gameMode; }
61 GamePhase getGamePhase() {return gamePhase;}
62 bool getMyColorIsBlack() {return myColorIsBlack;}
63 bool getMyColorIsWhite() {return myColorIsWhite;}
64 GameData *getGameData() {return gameData;}
65 int getId() {return gameData->number;}
66 MarkType getEditMark() {return editMark;}
67 void setGamePhase(GamePhase gp);
68 void gameDataChanged(void);
69 ClockDisplay *getClockDisplay() {return clockDisplay;}
70 void swapColors(bool noswap = false);
71 void saveRecordToGameData(void);
72
73 bool okayToQuit(void);
74
75 BoardDispatch * getBoardDispatch(void) { return dispatch; }
76 void setBoardDispatch(BoardDispatch * d);
77
78 void clearData();
79 void setMoveData(int n, bool black, int brothers, int sons, bool hasParent,
80 bool hasPrev, bool hasNext, int lastX=-1, int lastY=-1);
81
82 void setUndoEnabled(bool state);
83 void setDrawEnabled(bool state);
84 void setCountEnabled(bool state);
85 void setDoneEnabled(bool state);
86 void setAdjournEnabled(bool state);
87 void setResignEnabled(bool state);
88 void setObserverModel(QAbstractItemModel * model);
89
90 void setTimeBlack(QString time);
91 void setTimeWhite(QString time);
92 void warnTimeBlack(TimeWarnState state);
93 void warnTimeWhite(TimeWarnState state);
94 void displayComment(QString comment);
95
96 protected:
97 void closeEvent(QCloseEvent *e);
98 void resizeEvent(QResizeEvent *e);
99
100 signals:
101 void signal_boardClosed(int);
102 void signal_duplicate( GameData *, const QString&, int);
103
104 public:
105 void slotEditButtonPressed( int id );
106 void slotGameInfo(bool toggle);
107 bool slotFileSave();
108 bool slotFileSaveAs();
109 void slotEditDelete();
110 void slotExportSGFtoClipB();
111 void slotExportPicClipB();
112 void slotExportPic();
113 void slotDuplicate();
114 void slot_addtime_menu(QAction *);
115 void setComputerBlack(bool val);
116 void setComputerWhite(bool val);
117 void requestComputerMove();
118 void setBlackName(QString name);
119 void setWhiteName(QString name);
120 void switchToEditMode();
121 void switchToLocalMode();
122 void slotUpdateComment();
123 void slotNavIntersection();
124 void slotWheelEvent(QWheelEvent *e);
125 void slotGetScore(int terrBlack, int captBlack, int deadWhite, int terrWhite, int captWhite, int deadBlack);
126 void updateMove(Move *m);
127 void slotSendComment(void);
128
129 private:
130 void updateCaption();
131 void setMode(GameMode gameMode);
132 void setSliderMax(int n);
133 void checkHideToolbar(int h);
134 void updateButtons(StoneColor lastMoveColor=stoneNone);
135 void updateCursor(StoneColor c=stoneNone);
136
137 qGoBoard *qgoboard;
138 QLabel *moveNumLabel,*komiLabel,*buyoyomiLabel,*handicapLabel,*freeratedLabel;
139
140 Ui::BoardWindow * ui;
141 QMenu * addtime_menu;
142 Tree *tree;
143 const int boardSize; //the true boardsize
144 class BoardDispatch * dispatch; //may not be the best place!!!
145
146 GameData *gameData;
147 GamePhase gamePhase;
148 bool myColorIsBlack , myColorIsWhite ;
149 bool localStoneSound ;
150
151 QButtonGroup *editButtons;
152 MarkType editMark;
153 ClockDisplay *clockDisplay;
154 QTime wheelTime;
155 };
156
157 #endif