| 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 | #include "qgoboard_net.h"cxx . . $ `<file>/src/game_interfaces/qgoboard_net.h`/ |
| 24 | #include "tree.h"cxx . . $ `<file>/src/game_tree/tree.h`/ |
| 25 | #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/ |
| 26 | #include "network/boarddispatch.h"cxx . . $ `<file>/src/network/boarddispatch.h`/ |
| 27 | #include "network/messages.h"cxx . . $ `<file>/src/network/messages.h`/ |
| 28 | #include "clockdisplay.h"cxx . . $ `<file>/src/board/clockdisplay.h`/ |
| 29 | #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/ |
| 30 | #include <QMessageBox> |
| 31 | #include "networkconnection.h"cxx . . $ `<file>/src/network/networkconnection.h`/ |
| 32 | |
| 33 | qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#qGoBoardMatchInterface(29a441517101e16e).(BoardWindowcxx . . $ BoardWindow# *bw, Treecxx . . $ Tree# * t, GameDatacxx . . $ GameData# *gd) : qGoBoardNetworkInterfacecxx . . $ qGoBoardNetworkInterface#(bw, t, gd) //, QObject(bw) |
| 34 | { |
| 35 | // warningSound = settings.value("BYO_SOUND_WARNING").toBool(); |
| 36 | // warningSecs = settings.value("BYO_SEC_WARNING").toInt(); |
| 37 | |
| 38 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->startTimerOnOpencxx . . $ NetworkConnection#startTimerOnOpen(c9857a73d68e59ba).() && |
| 39 | (connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).() || connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).())) |
| 40 | boardTimerIdcxx . . $ qGoBoard#boardTimerId. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(1000); |
| 41 | |
| 42 | treecxx . . $ qGoBoard#tree.->slotNavLastcxx . . $ Tree#slotNavLast(49f6e7a06ebc5aa8).(); |
| 43 | } |
| 44 | |
| 45 | /* This timer stuff is awkward looking. FIXME */ |
| 46 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::startGamecxx . . $ qGoBoardMatchInterface#startGame(49f6e7a06ebc5aa8).(void) |
| 47 | { |
| 48 | if(!connectioncxx . . $ qGoBoardNetworkInterface#connection.->startTimerOnOpencxx . . $ NetworkConnection#startTimerOnOpen(c9857a73d68e59ba).() && |
| 49 | (connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).() || connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).())) |
| 50 | boardTimerIdcxx . . $ qGoBoard#boardTimerId. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(1000); |
| 51 | } |
| 52 | |
| 53 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::onFirstMovecxx . . $ qGoBoardMatchInterface#onFirstMove(49f6e7a06ebc5aa8).(void) |
| 54 | { |
| 55 | //we can now start the timer |
| 56 | if(!connectioncxx . . $ qGoBoardNetworkInterface#connection.->startTimerOnOpencxx . . $ NetworkConnection#startTimerOnOpen(c9857a73d68e59ba).() && |
| 57 | (connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).() || connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).())) |
| 58 | boardTimerIdcxx . . $ qGoBoard#boardTimerId. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(1000); |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * We subclass this function, because the server will send the move back |
| 63 | * so there is no need to have it displayed |
| 64 | */ |
| 65 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::localMoveRequestcxx . . $ qGoBoardMatchInterface#localMoveRequest(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y) |
| 66 | { |
| 67 | sendMoveToInterfacecxx . . $ qGoBoardNetworkInterface#sendMoveToInterface(e6b2860cd25699f2).(c,x,y); |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * This functions gets the request (from a board click) |
| 72 | * to mark a stone as dead/undead (score mode). this sends the click coords to server |
| 73 | */ |
| 74 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::localMarkDeadRequestcxx . . $ qGoBoardMatchInterface#localMarkDeadRequest(3e454b8ccf442868).(int x, int y) |
| 75 | { |
| 76 | //color is ignored as far as I know, still iffy FIXME |
| 77 | sendMoveToInterfacecxx . . $ qGoBoardNetworkInterface#sendMoveToInterface(e6b2860cd25699f2).(stoneBlackcxx . . $ stoneBlack.,x,y); |
| 78 | } |
| 79 | |
| 80 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::timerEventcxx . . $ qGoBoardMatchInterface#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#*) |
| 81 | { |
| 82 | if (boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseOngoingcxx . . $ phaseOngoing.) |
| 83 | return; |
| 84 | BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.; |
| 85 | if(!boarddispatch) |
| 86 | { |
| 87 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Match timer event but no board dispatch"); |
| 88 | return; |
| 89 | } |
| 90 | /* I added this clock stopping stuff but it seems unnecessary FIXME |
| 91 | * we could leave it in just in case, actually |
| 92 | * might still somehow be necessary for clientSendsTime()*/ |
| 93 | if(boarddispatch->isClockStoppedcxx . . $ BoardDispatch#isClockStopped(c9857a73d68e59ba).()) |
| 94 | return; |
| 95 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).()) |
| 96 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->setTimeStepcxx . . $ ClockDisplay#setTimeStep(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 97 | |
| 98 | |
| 99 | if ((getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).() && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsBlackcxx . . $ BoardWindow#getMyColorIsBlack(c9857a73d68e59ba).()) || |
| 100 | ((!getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()) && boardwindowcxx . . $ qGoBoard#boardwindow.->getMyColorIsWhitecxx . . $ BoardWindow#getMyColorIsWhite(c9857a73d68e59ba).())) |
| 101 | { |
| 102 | if(!connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).() && connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).()) |
| 103 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->setTimeStepcxx . . $ ClockDisplay#setTimeStep(b45ddcbc8423892c).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).()); |
| 104 | |
| 105 | /* FIXME, probably don't want to send time and time loss... even if |
| 106 | * network protocols are exclusive with these... */ |
| 107 | if(!boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->warningcxx . . $ ClockDisplay#warning(efaadfb7dc14930a).(getBlackTurncxx . . $ qGoBoard#getBlackTurn(efaadfb7dc14930a).())) |
| 108 | boarddispatch->sendTimeLosscxx . . $ BoardDispatch#sendTimeLoss(49f6e7a06ebc5aa8).(); |
| 109 | |
| 110 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).()) |
| 111 | boarddispatch->sendTimecxx . . $ BoardDispatch#sendTime(49f6e7a06ebc5aa8).(); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | * time info has been send by parser |
| 117 | * TODO : make sure we won't need this in qgoboard (code duplicate) |
| 118 | */ |
| 119 | /* FIXME Looks like this function was used for more than it is now and the |
| 120 | * stuff with the interface handler, which I assume goes to the clockdisplay... |
| 121 | * its all a little awkward. */ |
| 122 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::setTimerInfocxx . . $ qGoBoardMatchInterface#setTimerInfo(6d8ce341bc76c5ea).(const QStringcxx . . $ QString# &btime, const QStringcxx . . $ QString# &bstones, const QStringcxx . . $ QString# &wtime, const QStringcxx . . $ QString# &wstones) |
| 123 | { |
| 124 | //int bt_i = btime.toInt(); |
| 125 | //int wt_i = wtime.toInt(); |
| 126 | // b_stones = bstones; |
| 127 | // w_stones = wstones; |
| 128 | /* |
| 129 | #ifdef SHOW_INTERNAL_TIME |
| 130 | if (chk_b < 0) |
| 131 | { |
| 132 | chk_b = bt_i; |
| 133 | chk_w = wt_i; |
| 134 | } |
| 135 | #endif |
| 136 | */ |
| 137 | // set string in any case |
| 138 | // bt = secToTime(bt_i); |
| 139 | // wt = secToTime(wt_i); |
| 140 | //QTime t0 = QTime::QTime(0,0); |
| 141 | // t0.addSecs(bt_i).toString("m:ss"); |
| 142 | //QTime t1 = t0; |
| 143 | |
| 144 | // set initial timer until game is initialized |
| 145 | // if (!have_gameData) |
| 146 | // win->getInterfaceHandler()->setTimes(bt, bstones, wt, wstones); |
| 147 | |
| 148 | //if (boardwindow->getGamePhase() != phaseInit) |
| 149 | // boardwindow->getInterfaceHandler()->setTimes(t0.addSecs(bt_i).toString("m:ss"), bstones, t0.addSecs(wt_i).toString("m:ss"), wstones); |
| 150 | if (boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseInitcxx . . $ phaseInit.) |
| 151 | boardwindowcxx . . $ qGoBoard#boardwindow.->getClockDisplaycxx . . $ BoardWindow#getClockDisplay(41084e4a97dfeac0).()->setTimeInfocxx . . $ ClockDisplay#setTimeInfo(748afa4755bc9595).(btime.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(), bstones.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(), wtime.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(), wstones.toIntcxx . . $ QString#toInt(d7972accae11ee1f).()); |
| 152 | // if time info available, sound can be played |
| 153 | // cause no moves cmd in execution |
| 154 | // sound = true; |
| 155 | } |
| 156 | |
| 157 | /* |
| 158 | * initialises the scoring phase in match mode |
| 159 | */ |
| 160 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::enterScoreModecxx . . $ qGoBoardMatchInterface#enterScoreMode(49f6e7a06ebc5aa8).() |
| 161 | { |
| 162 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() == phaseScorecxx . . $ phaseScore.) |
| 163 | return; |
| 164 | stopTimecxx . . $ qGoBoardNetworkInterface#stopTime(49f6e7a06ebc5aa8).(); |
| 165 | qGoBoardcxx . . $ qGoBoard#::enterScoreModecxx . . $ qGoBoard#enterScoreMode(49f6e7a06ebc5aa8).(); |
| 166 | |
| 167 | //boardwindow->getUi().doneButton->setEnabled(true); |
| 168 | |
| 169 | kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("SCORE MODE: click on a stone to mark as dead...")); |
| 170 | } |
| 171 | |
| 172 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::leaveScoreModecxx . . $ qGoBoardMatchInterface#leaveScoreMode(49f6e7a06ebc5aa8).() |
| 173 | { |
| 174 | if(boardwindowcxx . . $ qGoBoard#boardwindow.->getGamePhasecxx . . $ BoardWindow#getGamePhase(5e5c74c0ced0b080).() != phaseScorecxx . . $ phaseScore.) |
| 175 | return; |
| 176 | qGoBoardcxx . . $ qGoBoard#::leaveScoreModecxx . . $ qGoBoard#leaveScoreMode(49f6e7a06ebc5aa8).(); |
| 177 | /* Make sure this doesn't conflict with game result stuff */ |
| 178 | if(!connectioncxx . . $ qGoBoardNetworkInterface#connection.->startTimerOnOpencxx . . $ NetworkConnection#startTimerOnOpen(c9857a73d68e59ba).() && |
| 179 | (connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientCountsTimecxx . . $ NetworkConnection#clientCountsTime(c9857a73d68e59ba).() || connectioncxx . . $ qGoBoardNetworkInterface#connection.->clientSendsTimecxx . . $ NetworkConnection#clientSendsTime(c9857a73d68e59ba).())) |
| 180 | boardTimerIdcxx . . $ qGoBoard#boardTimerId. = startTimercxx . . $ QObject#startTimer(cf5d4a693bb15cf1).(1000); |
| 181 | |
| 182 | //boardwindow->getUi().doneButton->setEnabled(true); |
| 183 | |
| 184 | kibitzReceivedcxx . . $ qGoBoard#kibitzReceived(3520e46b33348bf6).(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("LEAVING SCORE MODE")); //awkward text FIXME |
| 185 | } |
| 186 | |
| 187 | /* |
| 188 | * 'resign button pressed |
| 189 | */ |
| 190 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::slotReviewPressedcxx . . $ qGoBoardMatchInterface#slotReviewPressed(49f6e7a06ebc5aa8).() |
| 191 | { |
| 192 | #ifdef OLD |
| 193 | emit signal_sendCommandFromBoard("review create_prevgame", false); |
| 194 | #endif //OLD |
| 195 | } |
| 196 | |
| 197 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::slotDrawPressedcxx . . $ qGoBoardMatchInterface#slotDrawPressed(49f6e7a06ebc5aa8).() |
| 198 | { |
| 199 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Request Draw?"),QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Ask %1 to end game in draw?\n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) |
| 200 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 201 | { |
| 202 | if(connectioncxx . . $ qGoBoardNetworkInterface#connection.) |
| 203 | { |
| 204 | stopTimecxx . . $ qGoBoardNetworkInterface#stopTime(49f6e7a06ebc5aa8).(); //protocol specific or not? |
| 205 | boardwindowcxx . . $ qGoBoard#boardwindow.->setDrawEnabledcxx . . $ BoardWindow#setDrawEnabled(b45ddcbc8423892c).(false); |
| 206 | connectioncxx . . $ qGoBoardNetworkInterface#connection.->sendRequestDrawcxx . . $ NetworkConnection#sendRequestDraw(cb2f890c2fdad230).(gameDatacxx . . $ qGoBoard#gameData.->numbercxx . . $ GameData#number.); |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::slotCountPressedcxx . . $ qGoBoardMatchInterface#slotCountPressed(49f6e7a06ebc5aa8).() |
| 212 | { |
| 213 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Request Count?"), |
| 214 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Ask %1 to end game?\n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 215 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRequestCountcxx . . $ BoardDispatch#sendRequestCount(49f6e7a06ebc5aa8).(); |
| 216 | } |
| 217 | |
| 218 | /* |
| 219 | * 'adjourn button pressed |
| 220 | */ |
| 221 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::slotAdjournPressedcxx . . $ qGoBoardMatchInterface#slotAdjournPressed(49f6e7a06ebc5aa8).() |
| 222 | { |
| 223 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("qGBMI::slotAdjournPressed()"); |
| 224 | /* I'm going to tie this to the destructor of the board instead */ |
| 225 | /* Scratch that... actually, its supposed to be something |
| 226 | * that can be denied although that's weird to me... since |
| 227 | * they can always close the window.*/ |
| 228 | /* But I have to figure out the IGS command first, at least...*/ |
| 229 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Adjourn?"), |
| 230 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Ask %1 to adjourn?\n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 231 | { |
| 232 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendAdjournRequestcxx . . $ BoardDispatch#sendAdjournRequest(49f6e7a06ebc5aa8).(); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::recvRefuseAdjourncxx . . $ qGoBoardMatchInterface#recvRefuseAdjourn(49f6e7a06ebc5aa8).(void) |
| 237 | { |
| 238 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Adjourn Declined"), trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 has declined to adjourn the game.").argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())); |
| 239 | } |
| 240 | |
| 241 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::requestAdjournDialogcxx . . $ qGoBoardMatchInterface#requestAdjournDialog(49f6e7a06ebc5aa8).(void) |
| 242 | { |
| 243 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Adjourn?"), |
| 244 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 wants to adjourn\n\nDo you accept ? \n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 245 | { |
| 246 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendAdjourncxx . . $ BoardDispatch#sendAdjourn(49f6e7a06ebc5aa8).(); |
| 247 | /* FIXME |
| 248 | * Once we hit adjourn, the window should close, or at the very least |
| 249 | * should change phase and the clocks should stop. */ |
| 250 | boardwindowcxx . . $ qGoBoard#boardwindow.->setGamePhasecxx . . $ BoardWindow#setGamePhase(6ad67d8601499648).(phaseEndedcxx . . $ phaseEnded.); |
| 251 | // this should active Done button and disable other buttons (review okay?) |
| 252 | // also fix above instance !!! |
| 253 | } |
| 254 | else |
| 255 | { |
| 256 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRefuseAdjourncxx . . $ BoardDispatch#sendRefuseAdjourn(49f6e7a06ebc5aa8).(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::requestCountDialogcxx . . $ qGoBoardMatchInterface#requestCountDialog(49f6e7a06ebc5aa8).(void) |
| 261 | { |
| 262 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("End game?"), |
| 263 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 requests count\n\nDo you accept ? \n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) |
| 264 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 265 | { |
| 266 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendAcceptCountRequestcxx . . $ BoardDispatch#sendAcceptCountRequest(49f6e7a06ebc5aa8).(); |
| 267 | enterScoreModecxx . . $ qGoBoardMatchInterface#enterScoreMode(49f6e7a06ebc5aa8).(); |
| 268 | } |
| 269 | else |
| 270 | { |
| 271 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRefuseCountRequestcxx . . $ BoardDispatch#sendRefuseCountRequest(49f6e7a06ebc5aa8).(); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::recvRefuseCountcxx . . $ qGoBoardMatchInterface#recvRefuseCount(49f6e7a06ebc5aa8).(void) |
| 276 | { |
| 277 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Count Declined"), trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 has declined to count and end the game.").argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())); |
| 278 | } |
| 279 | |
| 280 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::requestMatchModeDialogcxx . . $ qGoBoardMatchInterface#requestMatchModeDialog(49f6e7a06ebc5aa8).(void) |
| 281 | { |
| 282 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(0,trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Return to game?"), |
| 283 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 requests return to match mode\n\nDo you accept ? \n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) |
| 284 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 285 | { |
| 286 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendAcceptMatchModeRequestcxx . . $ BoardDispatch#sendAcceptMatchModeRequest(49f6e7a06ebc5aa8).(); |
| 287 | leaveScoreModecxx . . $ qGoBoardMatchInterface#leaveScoreMode(49f6e7a06ebc5aa8).(); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRefuseMatchModeRequestcxx . . $ BoardDispatch#sendRefuseMatchModeRequest(49f6e7a06ebc5aa8).(); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::recvRefuseMatchModecxx . . $ qGoBoardMatchInterface#recvRefuseMatchMode(49f6e7a06ebc5aa8).(void) |
| 296 | { |
| 297 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Match mode declined"), trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 has declined to return to the game.").argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())); |
| 298 | } |
| 299 | |
| 300 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::requestDrawDialogcxx . . $ qGoBoardMatchInterface#requestDrawDialog(49f6e7a06ebc5aa8).(void) |
| 301 | { |
| 302 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow.,trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("End game?"), |
| 303 | QStringcxx . . $ QString#(trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 requests draw\n\nDo you accept ? \n")).argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())) |
| 304 | == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) |
| 305 | { |
| 306 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendAcceptDrawRequestcxx . . $ BoardDispatch#sendAcceptDrawRequest(49f6e7a06ebc5aa8).(); |
| 307 | //FIXME |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->sendRefuseDrawRequestcxx . . $ BoardDispatch#sendRefuseDrawRequest(49f6e7a06ebc5aa8).(); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | void qGoBoardMatchInterfacecxx . . $ qGoBoardMatchInterface#::recvRefuseDrawcxx . . $ qGoBoardMatchInterface#recvRefuseDraw(49f6e7a06ebc5aa8).(void) |
| 316 | { |
| 317 | QMessageBoxcxx . . $ QMessageBox#::informationcxx . . $ QMessageBox#information(a9e3742e6f7b4147).(boardwindowcxx . . $ qGoBoard#boardwindow., trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("Draw Declined"), trcxx . . $ qGoBoardMatchInterface#tr(75d9f1c324b4579d).("%1 has declined to draw the game.").argcxx . . $ QString#arg(bc823072288cbbb5).(dispatchcxx . . $ qGoBoardNetworkInterface#dispatch.->getOpponentNamecxx . . $ BoardDispatch#getOpponentName(4365c3963150523e).())); |
| 318 | } |