void InterfaceHandler::clearData() { clearComment(); setMoveData(0, true, 0, 0, false, false, false); // modeButton->setOn(false); mainWidget->setToolsTabWidget(tabNormalScore); mainWidget->editButtonGroup->setButton(0); // editTools->hide(); normalTools->capturesBlack->setText("0"); normalTools->capturesWhite->setText("0"); if (board->getGameMode() != modeObserve && board->getGameMode() != modeMatch && board->getGameMode() != modeTeach) { normalTools->pb_timeBlack->setText("00:00"); normalTools->pb_timeWhite->setText("00:00"); } normalTools->show(); scoreButton->setOn(false); editPaste->setEnabled(false); editPasteBrother->setEnabled(false); slider->setValue(0); setSliderMax(SLIDER_INIT); scored_flag = false; }
void InterfaceHandler::setMoveData(int n, bool black, int brothers, int sons, bool hasParent, bool hasPrev, bool hasNext, int lastX, int lastY) { QString s(QObject::tr("Move") + " "); s.append(QString::number(n)); if (lastX >= 1 && lastX <= board->getBoardSize() && lastY >= 1 && lastY <= board->getBoardSize()) { s.append(" ("); s.append(black ? QObject::tr("W")+" " : QObject::tr("B")+" "); s.append(QString(QChar(static_cast<const char>('A' + (lastX<9?lastX:lastX+1) - 1))) + QString::number(board->getBoardSize()-lastY+1) + ")"); } else if (lastX == 20 && lastY == 20) // Pass { s.append(" ("); s.append(black ? QObject::tr("W")+" " : QObject::tr("B")+" "); s.append(" " + QObject::tr("Pass") + ")"); } moveNumLabel->setText(s); statusTurn->setText(" " + s.right(s.length() - 5) + " "); // Without 'Move ' statusNav->setText(" " + QString::number(brothers) + "/" + QString::number(sons)); s = black ? QObject::tr("Black to play") : QObject::tr("White to play"); turnLabel->setText(s); s = ""; s.append(QString::number(brothers)); if (brothers == 1) s.append(" " + QObject::tr("brother") + "\n"); else s.append(" " + QObject::tr("brothers") + "\n"); s.append(QString::number(sons)); if (sons == 1) s.append(" " + QObject::tr("son")); else s.append(" " + QObject::tr("sons")); varLabel->setText(s); if (board->getGameMode() == modeNormal || board->getGameMode() == modeEdit) { // Update the toolbar buttons navPrevVar->setEnabled(hasPrev); navNextVar->setEnabled(hasNext); navBackward->setEnabled(hasParent); navForward->setEnabled(sons); navFirst->setEnabled(hasParent); navStartVar->setEnabled(hasParent); navMainBranch->setEnabled(hasParent); navLast->setEnabled(sons); navNextBranch->setEnabled(sons); navSwapVariations->setEnabled(hasPrev); navPrevComment->setEnabled(hasParent); navNextComment->setEnabled(sons); navIntersection->setEnabled(true); //SL added eb 11 slider->setEnabled(true); } else if (board->getGameMode() == modeObserve) // add eb 8 { // Update the toolbar buttons navBackward->setEnabled(hasParent); navForward->setEnabled(sons); navFirst->setEnabled(hasParent); navLast->setEnabled(sons); navPrevComment->setEnabled(hasParent); navNextComment->setEnabled(sons); navIntersection->setEnabled(true); //SL added eb 11 slider->setEnabled(true); board->getBoardHandler()->display_incoming_move = !bool(sons); //SL added eb 9 - This is used to know whether we are browsing through a game or at the last move } else //end add eb 8 slider->setDisabled(true); // Update slider mainWidget->toggleSliderSignal(false); int mv = slider->maxValue(); // add eb 8 int v = slider->value(); if (slider->maxValue() < n) setSliderMax(n); // we need to be carefull with the slider if (board->getGameMode() != modeObserve || // normal case, slider is moved (board->getGameMode() == modeObserve && mv >= n) || // observing, but browsing (no incoming move) (board->getGameMode() == modeObserve && mv < n && v==n-1))// observing, but at the last move, and an incoming move occurs slider->setValue(n); // end add eb 8 mainWidget->toggleSliderSignal(true); }
/* * displays the informations relative to a move on the board window */ void InterfaceHandler::setMoveData(int n, bool black, int brothers, int sons, bool hasParent, bool hasPrev, bool hasNext, int lastX, int lastY) { // move number QString s(QObject::tr("Move") + " "); s.append(QString::number(n)); // color and coordinates if (lastX >= 1 && lastX <= boardwindow->getBoardSize() && lastY >= 1 && lastY <= boardwindow->getBoardSize()) { s.append(" ("); s.append(black ? QObject::tr("W")+" " : QObject::tr("B")+" "); s.append(QString(QChar(static_cast<const char>('A' + (lastX<9?lastX:lastX+1) - 1))) + QString::number(boardwindow->getBoardSize()-lastY+1) + ")"); } //pass move else if (lastX == 20 && lastY == 20) { s.append(" ("); s.append(black ? QObject::tr("W")+" " : QObject::tr("B")+" "); s.append(" " + QObject::tr("Pass") + ")"); } boardwindow->moveNumLabel->setText(s); // statusTurn->setText(" " + s.right(s.length() - 5) + " "); // Without 'Move ' // statusNav->setText(" " + QString::number(brothers) + "/" + QString::number(sons)); // set turn information (and color on the edit button) s = black ? QObject::tr("Black to play") : QObject::tr("White to play"); boardwindow->getUi()->turnLabel->setText(s); boardwindow->getUi()->colorButton->setIcon(black ? QIcon(":/boardicons/resources/pics/stone_black.png") : QIcon(":/boardicons/resources/pics/stone_white.png") ); // sons and variatons display s = ""; s.append(QString::number(brothers)); if (brothers == 1) s.append(" " + QObject::tr("brother") + "\n"); else s.append(" " + QObject::tr("brothers") + "\n"); s.append(QString::number(sons)); if (sons == 1) s.append(" " + QObject::tr("son")); else s.append(" " + QObject::tr("sons")); boardwindow->getUi()->varLabel->setText(s); if(boardwindow->getGameMode() == modeReview) { /* For now, just disable navigation if its in the review mode, they can always duplicate * the board and a lot more is necessary for qgo to do reviews. */ boardwindow->getUi()->navPrevVar->setEnabled(false); boardwindow->getUi()->navNextVar->setEnabled(false); boardwindow->getUi()->navBackward->setEnabled(false); boardwindow->getUi()->navForward->setEnabled(false); boardwindow->getUi()->navFirst->setEnabled(false); boardwindow->getUi()->navStartVar->setEnabled(false); boardwindow->getUi()->navMainBranch->setEnabled(false); boardwindow->getUi()->navLast->setEnabled(false); boardwindow->getUi()->navNextBranch->setEnabled(false); boardwindow->getUi()->swapVarButton->setEnabled(false); boardwindow->getUi()->navPrevComment->setEnabled(false); boardwindow->getUi()->navNextComment->setEnabled(false); boardwindow->getUi()->navIntersection->setEnabled(false); boardwindow->getUi()->slider->setEnabled(false); } else if (boardwindow->getGameMode() == modeNormal || boardwindow->getGameMode() == modeObserve )//|| board->getGameMode() == modeEdit) { // Update the toolbar buttons boardwindow->getUi()->navPrevVar->setEnabled(hasPrev); boardwindow->getUi()->navNextVar->setEnabled(hasNext); boardwindow->getUi()->navBackward->setEnabled(hasParent); boardwindow->getUi()->navForward->setEnabled(sons); boardwindow->getUi()->navFirst->setEnabled(hasParent); boardwindow->getUi()->navStartVar->setEnabled(hasParent); boardwindow->getUi()->navMainBranch->setEnabled(hasParent); boardwindow->getUi()->navLast->setEnabled(sons); boardwindow->getUi()->navNextBranch->setEnabled(sons); boardwindow->getUi()->swapVarButton->setEnabled(hasPrev); boardwindow->getUi()->navPrevComment->setEnabled(hasParent); boardwindow->getUi()->navNextComment->setEnabled(sons); boardwindow->getUi()->navIntersection->setEnabled(true); boardwindow->getUi()->slider->setEnabled(true); } /* else if (board->getGameMode() == modeObserve) { // Update the toolbar buttons navBackward->setEnabled(hasParent); navForward->setEnabled(sons); navFirst->setEnabled(hasParent); navLast->setEnabled(sons); navPrevComment->setEnabled(hasParent); navNextComment->setEnabled(sons); navIntersection->setEnabled(true); slider->setEnabled(true); // board->getBoardHandler()->display_incoming_move = !bool(sons); } else slider->setDisabled(true); */ // Update slider boardwindow->getUi()->slider->blockSignals (true); // int mv = boardwindow->getUi()->slider->maximum(); // int v = boardwindow->getUi()->slider->value(); if (boardwindow->getUi()->slider->maximum() < n) setSliderMax(n); // we need to be carefull with the slider : // normal case, slider is moved // if (board->getGameMode() != modeObserve || // observing, but browsing (no incoming move) // (board->getGameMode() == modeObserve && mv >= n) || // observing, but at the last move, and an incoming move occurs // (board->getGameMode() == modeObserve && mv < n && v==n-1)) boardwindow->getUi()->slider->setValue(n); boardwindow->getUi()->slider->blockSignals (false); }