| 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 | class NetworkConnection; |
| 24 | class QString; |
| 25 | |
| 26 | class BoardDispatch |
| 27 | { |
| 28 | public: |
| 29 | BoardDispatch(NetworkConnection * conn, class GameListing * l); |
| 30 | ~BoardDispatch(); |
| 31 | bool canClose(void); |
| 32 | void closeBoard(void); |
| 33 | void setConnection(NetworkConnection * conn); |
| 34 | void recvMove(class MoveRecord * m); |
| 35 | void sendMove(class MoveRecord * m); |
| 36 | void sendRequestMatchMode(); |
| 37 | bool isClockStopped(void) { return clockStopped; }; |
| 38 | void stopTime(void) { clockStopped = true; }; |
| 39 | void startTime(void) { clockStopped = false; }; |
| 40 | void moveControl(QString & player); |
| 41 | void sendTimeLoss(void); |
| 42 | void gameDataChanged(void); |
| 43 | void openBoard(void); |
| 44 | void recvTime(const class TimeRecord & wt, const class TimeRecord & bt); |
| 45 | void recvAddTime(int minutes, QString player_name); |
| 46 | void recvResult(class GameResult * r); |
| 47 | void saveRecordToGameData(void); |
| 48 | void recvObserver(class PlayerListing * p, bool present); |
| 49 | void clearObservers(void); |
| 50 | void recvKibitz(QString name, QString text); |
| 51 | void sendKibitz(QString text); |
| 52 | void recvEnterScoreMode(void); |
| 53 | void recvLeaveScoreMode(void); |
| 54 | void createCountDialog(void); |
| 55 | void sendRequestCount(void); |
| 56 | void recvRequestCount(void); |
| 57 | void recvAcceptCountRequest(void); |
| 58 | void recvRejectCountRequest(void); |
| 59 | void sendAcceptCountRequest(void); |
| 60 | void sendRefuseCountRequest(void); |
| 61 | void recvAcceptDrawRequest(void); |
| 62 | void recvRefuseDrawRequest(void); |
| 63 | void recvRequestDraw(void); |
| 64 | void sendAcceptDrawRequest(void); |
| 65 | void sendRefuseDrawRequest(void); |
| 66 | void recvRequestMatchMode(void); |
| 67 | void sendAcceptMatchModeRequest(void); |
| 68 | void sendRefuseMatchModeRequest(void); |
| 69 | void recvRejectMatchModeRequest(void); |
| 70 | void clearCountDialog(void) { countdialog = 0; }; |
| 71 | void recvRejectCount(void); |
| 72 | void recvAcceptCount(void); |
| 73 | void sendRejectCount(void); |
| 74 | void sendAcceptCount(void); |
| 75 | void sendResult(class GameResult * r); |
| 76 | |
| 77 | void recvRequestAdjourn(void); |
| 78 | void sendAdjournRequest(void); |
| 79 | void sendAdjourn(void); |
| 80 | void sendRefuseAdjourn(void); |
| 81 | void adjournGame(void); |
| 82 | void recvRefuseAdjourn(void); |
| 83 | void setRematchDialog(class ResultDialog * r); |
| 84 | void sendRematchRequest(void); |
| 85 | void sendRematchAccept(void); |
| 86 | void recvRematchRequest(void); |
| 87 | void sendTime(void); |
| 88 | void sendAddTime(int minutes); |
| 89 | void startGame(void); |
| 90 | bool isAttribBoard(QString black_player, unsigned int black_captures, float black_komi, QString white_player, unsigned int white_captures, float white_komi); |
| 91 | bool isOpponentBoard(QString us, QString them); |
| 92 | void swapColors(bool noswap = false); |
| 93 | |
| 94 | void requestGameInfo(void); |
| 95 | bool getReviewInVariation(void) { return reviewInVariation; }; //tygem |
| 96 | void setReviewInVariation(bool b) { reviewInVariation = b; }; //tygem |
| 97 | class GameData * getGameData(void); |
| 98 | class TimeRecord getOurTimeRecord(void); |
| 99 | class TimeRecord getTheirTimeRecord(void); |
| 100 | QString getOpponentName(void); |
| 101 | QString getUsername(void); |
| 102 | QString getOurRank(void); |
| 103 | bool getBlackTurn(void); |
| 104 | class ObserverListModel * getObserverListModelForRematch(void); |
| 105 | void setObserverListModel(class ObserverListModel * olm); |
| 106 | bool flipCoords(void); |
| 107 | bool supportsRequestMatchMode(void); |
| 108 | bool supportsAddTime(void); |
| 109 | bool supportsRequestCount(void); |
| 110 | bool supportsRequestDraw(void); |
| 111 | bool supportsRequestAdjourn(void); |
| 112 | bool supportsRematch(void); |
| 113 | bool undoResetsScore(void); |
| 114 | bool canMarkStonesDeadinScore(void); |
| 115 | public: |
| 116 | NetworkConnection * connection; |
| 117 | private: |
| 118 | void mergeListingIntoRecord(class GameData * r, class GameListing * l); |
| 119 | class BoardWindow * boardwindow; |
| 120 | class GameData * gameData; |
| 121 | class GameListing * gameListing; |
| 122 | class ResultDialog * resultdialog; |
| 123 | class CountDialog * countdialog; |
| 124 | class ObserverListModel * observerListModel; |
| 125 | |
| 126 | bool clockStopped; |
| 127 | bool reviewInVariation; |
| 128 | }; |