📄 qgo_interface.cpp
字号:
SLOT(slot_doAdjourn())); connect(qgobrd->get_win()->get_fileQuit(), SIGNAL(activated()), qgobrd, SLOT(slot_doAdjourn())); */ connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_adjourn()), qgobrd, SLOT(slot_doAdjourn())); connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_undo()), qgobrd, SLOT(slot_doUndo())); connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_resign()), qgobrd, SLOT(slot_doResign())); connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_done()), qgobrd, SLOT(slot_doDone())); connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_refresh()), qgobrd, SLOT(slot_doRefresh())); connect(qgobrd->get_win()->getBoard(), SIGNAL(signal_editBoardInNewWindow()), qgobrd->get_win(), SLOT(slot_editBoardInNewWindow())); // teach tools connect(qgobrd->get_win()->getMainWidget()->cb_opponent, SIGNAL(activated(const QString&)), qgobrd, SLOT(slot_ttOpponentSelected(const QString&))); connect(qgobrd->get_win()->getMainWidget()->pb_controls, SIGNAL(toggled(bool)), qgobrd, SLOT(slot_ttControls(bool))); connect(qgobrd->get_win()->getMainWidget()->pb_mark, SIGNAL(toggled(bool)), qgobrd, SLOT(slot_ttMark(bool))); if (src == 2) { qgobrd->set_sentmovescmd(true); emit signal_sendcommand("games " + txt, false); emit signal_sendcommand("moves " + txt, false); emit signal_sendcommand("all " + txt, false); } // for own games send "games" cmd to get full info if (src == 3 || src == 4 || src == 13 || src == 14 )//|| src == 0) { connect(qgobrd->get_win()->getInterfaceHandler()->normalTools->pb_timeBlack, SIGNAL(clicked()), qgobrd, SLOT(slot_addtimePauseB())); connect(qgobrd->get_win()->getInterfaceHandler()->normalTools->pb_timeWhite, SIGNAL(clicked()), qgobrd, SLOT(slot_addtimePauseW())); if (src == 13 || src == 14 )//|| src== 0) { // src changed from 1 to 3/4 qgobrd->set_sentmovescmd(true); emit signal_sendcommand("games " + g->nr, false); emit signal_sendcommand("moves " + g->nr, false); emit signal_sendcommand("all " + g->nr, false); if (src == 13) src = 3; else src = 4; } else emit signal_sendcommand("games " + txt, false); if (src == 4) { // make teaching features visible qgobrd->get_win()->getMainWidget()->cb_opponent->setEnabled(true); qgobrd->get_win()->getMainWidget()->pb_controls->setDisabled(true); qgobrd->get_win()->getMainWidget()->pb_mark->setEnabled(true); qgobrd->ExtendedTeachingGame = true; qgobrd->IamTeacher = true; qgobrd->havePupil = false; qgobrd->mark_set = false; } } // set correct mode in qGo qgobrd->set_id(game_id); qgobrd->set_gsName(gsName); qgobrd->set_myName(myName); if ((game_id == 0) && (src != 6)) //SL added eb 12 // set local board qgobrd->set_Mode(5); //else if (src==0) // qgobrd->set_Mode(2); // special case when not triggered by the 'observe' command (trail, for instance) else qgobrd->set_Mode(src); // increase number of observed games emit signal_addToObservationList(-2); return true; } } switch (src) { // regular move info (parser) case 0:#ifdef SHOW_MOVES_DLG dlg->write("Spiel " + gi->nr + gi->type + "\n");#endif if (gi->mv_col == "T") {#ifdef SHOW_MOVES_DLG dlg->write("W: " + gi->wname + " " + gi->wprisoners + " " + gi->wtime + " " + gi->wstones + "\n"); dlg->write("B: " + gi->bname + " " + gi->bprisoners + " " + gi->btime + " " + gi->bstones + "\n");#endif // set times qgobrd->setTimerInfo(gi->btime, gi->bstones, gi->wtime, gi->wstones); } else if (gi->mv_col == "B" || gi->mv_col == "W") {#ifdef SHOW_MOVES_DLG dlg->write(gi->mv_col + " " + gi->mv_nr + " " + gi->mv_pt + "\n");#endif // set move if game is initialized if (qgobrd->get_havegd()) { // get all moves till now one times if kibitzing if (qgobrd->get_Mode() == modeObserve && !qgobrd->get_sentmovescmd()) { qgobrd->set_sentmovescmd(true); emit signal_sendcommand("moves " + gi->nr, false); emit signal_sendcommand("all " + gi->nr, false); } else { // do normal move qgobrd->set_move(sc, pt, mv_nr); } } } break; // adjourn/end/resume of a game (parser) case 1:#ifdef SHOW_MOVES_DLG dlg->write("Spiel " + g->nr + (g->running ? " running\n" : " STOPPED\n")); dlg->write(g->Sz + "\n");#endif if (!g->running) { // stopped game do not need a timer qgobrd->set_stopTimer(); ASSERT(g->Sz); if (g->Sz == "-") { return false; } /* if (g->Sz.contains("adjourned")) qgobrd->send_kibitz(tr("Game has adjourned")); else if (g->Sz.contains("White forfeits")) qgobrd->send_kibitz(tr("White forfeits on time")); else if (g->Sz.contains("Black forfeits")) qgobrd->send_kibitz(tr("Black forfeits on time")); else if (g->Sz.contains("White resigns")) qgobrd->send_kibitz(tr("White resigns")); else if (g->Sz.contains("Black resigns")) qgobrd->send_kibitz(tr("Black resigns")); else */ qgobrd->send_kibitz(g->Sz); // set correct result entry QString rs = QString(); QString extended_rs = g->Sz; if (g->Sz.contains("White forfeits")) rs = "B+T"; else if (g->Sz.contains("Black forfeits")) rs = "W+T"; else if (g->Sz.contains("has run out of time")) rs = ((( g->Sz.contains(myName) && qgobrd->get_myColorIsBlack() ) || ( !g->Sz.contains(myName) && !qgobrd->get_myColorIsBlack() )) ? "W+T" : "B+T"); else if (g->Sz.contains("W ", true) && g->Sz.contains("B ", true)) { // NNGS: White resigns. W 59.5 B 66.0 // IGS: W 62.5 B 93.0 // calculate result first int posw, posb; float re1, re2; posw = g->Sz.find("W "); posb = g->Sz.find("B "); bool wfirst = posw < posb; if (!wfirst) { int h = posw; posw = posb; posb = h; } QString t1 = g->Sz.mid(posw+1, posb-posw-2); QString t2 = g->Sz.right(g->Sz.length()-posb-1); re1 = t1.toFloat(); re2 = t2.toFloat(); re1 = re2-re1; if (re1 < 0) { re1 = -re1; wfirst = !wfirst; } if (re1 < 0.2) { rs = "Jigo"; extended_rs = " Jigo "; } else if (wfirst) { rs = "B+" + QString::number(re1); extended_rs = "Black won by " + QString::number(re1) + " points"; } else { rs = "W+" + QString::number(re1); extended_rs = "White won by " + QString::number(re1) + " points"; } } else if (g->Sz.contains("White resigns")) rs = "B+R"; else if (g->Sz.contains("Black resigns")) rs = "W+R"; else if (g->Sz.contains("has resigned the game")) rs = ((( g->Sz.contains(myName) && qgobrd->get_myColorIsBlack() ) || ( !g->Sz.contains(myName) && !qgobrd->get_myColorIsBlack() )) ? "W+R" : "B+R"); if (rs) { qgobrd->get_win()->getBoard()->getGameData()->result = rs; qgobrd->send_kibitz(rs); qDebug("Result: " + rs); } if (g->Sz.contains("adjourned") && qgobrd->get_bplayer() && qgobrd->get_wplayer()) { if (qgobrd->get_bplayer() == myName || qgobrd->get_wplayer() == myName) // can only reload own games qgobrd->get_win()->getInterfaceHandler()->refreshButton->setText(tr("LOAD")); qDebug("game adjourned... #" + QString::number(qgobrd->get_id())); qgobrd->set_adj(true); qgobrd->set_id(10000); qgobrd->clearObserverList(); qgo->playGameEndSound(); } else { // case: error -> game has not correctly been removed from list GameMode owngame = qgobrd->get_Mode(); // game ended - if new game started with same number -> prohibit access qgobrd->set_id(-qgobrd->get_id()); // enable Menus// qgobrd->get_win()->setOnlineMenu(false); // set board editable... qgobrd->set_Mode(1); // toggle score 2x qgobrd->get_win()->getInterfaceHandler()->toggleMode(); qgobrd->get_win()->getInterfaceHandler()->toggleMode(); //autosave ? //if ((setting->readBoolEntry("AUTOSAVE")) && (owngame == modeObserve)) //{ // qgobrd->get_win()->doSave(qgobrd->get_win()->getBoard()->getCandidateFileName(),true); // qDebug("Game saved"); //} // but allow to use "say" cmd if it was an own game //if (owngame == modeMatch) bool doSave = ((setting->readBoolEntry("AUTOSAVE")) && (owngame == modeObserve)) || ((setting->readBoolEntry("AUTOSAVE_PLAYED")) && (owngame == modeMatch)); wrapupMatchGame(qgobrd, doSave); QMessageBox::information(qgobrd->get_win() , tr("Game n
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -