📄 mainwindow.cpp
字号:
filter, true); if (fileName.isEmpty()) return; //fileName.append(".").append(filter->left(3).lower()); // Confirm overwriting file. if ( QFile::exists( fileName ) ) if (QMessageBox::information(this, PACKAGE, tr("This file already exists. Do you want to overwrite it?"), tr("Yes"), tr("No"), 0, 0, 1) == 1) return; //QString filter = dlg.selectedFilter().left(3); board->exportPicture(fileName, filter->left(3));// }}void MainWindow::slotFileExportPicClipB(){ board->exportPicture(NULL, NULL, true); }void MainWindow::slotEditCut(){ board->cutNode();}void MainWindow::slotEditPaste(){ board->pasteNode();}void MainWindow::slotEditPasteBrother(){ board->pasteNode(true);}void MainWindow::slotEditDelete(){ board->deleteNode();}void MainWindow::slotEditHideStones() // QQQ{ board->hideStones();}void MainWindow::slotEditNumberMoves(){ board->numberMoves();}void MainWindow::slotEditMarkBrothers(){ board->markVariations(false);}void MainWindow::slotEditMarkSons(){ board->markVariations(true);}void MainWindow::slotNavBackward(){ board->previousMove();}void MainWindow::slotNavForward(){ board->nextMove();}void MainWindow::slotNavFirst(){ board->gotoFirstMove();}void MainWindow::slotNavLast(){ board->gotoLastMove();}// this slot is used for edit window to navigate to last made movevoid MainWindow::slotNavLastByTime(){ board->gotoLastMoveByTime();}void MainWindow::slotNavNextVar(){ board->nextVariation();}void MainWindow::slotNavPrevVar(){ board->previousVariation();}void MainWindow::slotNavNextComment() //added eb{ board->nextComment();}void MainWindow::slotNavPrevComment(){ board->previousComment();} //end add ebvoid MainWindow::slotNavStartVar(){ board->gotoVarStart();}void MainWindow::slotNavMainBranch(){ board->gotoMainBranch();}void MainWindow::slotNavNextBranch(){ board->gotoNextBranch();}void MainWindow::slotNavIntersection() // added eb 11{ board->navIntersection();} // end add eb 11void MainWindow::slotNavNthMove(){ NthMoveDialog dlg(this, tr("entermove"), true); dlg.moveSpinBox->setValue(board->getCurrentMoveNumber()); dlg.moveSpinBox->setFocus(); if (dlg.exec() == QDialog::Accepted) board->gotoNthMove(dlg.moveSpinBox->value());}void MainWindow::slotNavAutoplay(bool toggle){ if (!toggle) { timer->stop(); statusBar()->message(tr("Autoplay stopped.")); } else { if (setting->readIntEntry("TIMER_INTERVAL") < 0) setting->writeIntEntry("TIMER_INTERVAL", 0); else if (setting->readIntEntry("TIMER_INTERVAL") > 10) setting->writeIntEntry("TIMER_INTERVAL", 10); // check if time info available from sgf file if (setting->readBoolEntry("SGF_TIME_TAGS") && board->getGameData()->timeSystem != none) // set time to 1 sec timer->start(1000); else // set time interval as selected timer->start(int(timerIntervals[setting->readIntEntry("TIMER_INTERVAL")] * 1000)); statusBar()->message(tr("Autoplay started.")); }}void MainWindow::slotNavEmptyBranch(){ board->clearNode();}void MainWindow::slotNavCloneNode(){ board->duplicateNode(); statusBar()->message(tr("Variation duplicated."));}void MainWindow::slotNavSwapVariations(){ if (board->swapVariations()) statusBar()->message(tr("Variations swapped.")); else statusBar()->message(tr("No previous variation available."));}void MainWindow::slotSetPreferences(){ // default tab dlgSetPreferences(-1);}void MainWindow::dlgSetPreferences(int tab){ PreferencesDialog dlg(this, tr("preferences"), true); if (tab >= 0) { // set to default tab - no check for Qt 2.3.x if (dlg.tabWidget->count() <= tab+1) dlg.tabWidget->setCurrentPage(tab); } // Interface tab// dlg.styleListBox->setCurrentItem(setting->readIntEntry("STYLE"));// dlg.woodListBox->setCurrentItem(setting->readIntEntry("SKIN")); dlg.LineEdit_goban->setText(setting->readEntry("SKIN")); dlg.LineEdit_Table->setText(setting->readEntry("SKIN_TABLE")); dlg.languageComboBox->insertStringList(setting->getAvailableLanguages()); dlg.languageComboBox->setCurrentItem(setting->convertLanguageCodeToNumber()); dlg.commentComboBox->setCurrentItem(setting->readIntEntry("VIEW_COMMENT"));// dlg.stonesShadowCheckBox->setChecked(setting->readBoolEntry("STONES_SHADOW")); dlg.radioButtonStones_2D->setChecked((setting->readIntEntry("STONES_LOOK")==1)); dlg.radioButtonStones_3D->setChecked((setting->readIntEntry("STONES_LOOK")==2)); dlg.radioButtonStone_real->setChecked((setting->readIntEntry("STONES_LOOK")==3));// dlg.stonesShellsCheckBox->setChecked(setting->readBoolEntry("STONES_SHELLS")); dlg.stoneSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_STONE")); dlg.autoplaySoundCheckBox->setChecked(setting->readBoolEntry("SOUND_AUTOPLAY")); dlg.talkSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_TALK")); dlg.matchSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_MATCH")); dlg.passSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_PASS")); dlg.gameEndSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_GAMEEND")); dlg.timeSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_TIME")); dlg.saySoundCheckBox->setChecked(setting->readBoolEntry("SOUND_SAY")); dlg.enterSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_ENTER")); dlg.leaveSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_LEAVE")); dlg.disConnectSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_DISCONNECT")); dlg.connectSoundCheckBox->setChecked(setting->readBoolEntry("SOUND_CONNECT")); dlg.variationComboBox->setCurrentItem(setting->readIntEntry("VAR_GHOSTS")); dlg.coordsCheckBox->setChecked(setting->readBoolEntry("BOARD_COORDS")); dlg.sgfCoordsCheckBox->setChecked(setting->readBoolEntry("SGF_BOARD_COORDS")); dlg.toolTipCoordsCheckBox->setChecked(setting->readBoolEntry("BOARD_COORDS_TIP")); dlg.cursorCheckBox->setChecked(setting->readBoolEntry("CURSOR")); dlg.smallerMarksCheckBox->setChecked(setting->readBoolEntry("SMALL_MARKS")); dlg.boldMarksCheckBox->setChecked(setting->readBoolEntry("BOLD_MARKS")); dlg.adjustFontSizeCheckBox->setChecked(setting->readBoolEntry("ADJ_FONT")); //dlg.smallerStonesCheckBox->setChecked(setting->readBoolEntry("SMALL_STONES")); dlg.tooltipsCheckBox->setChecked(!(setting->readBoolEntry("TOOLTIPS"))); dlg.timerComboBox->setCurrentItem(setting->readIntEntry("TIMER_INTERVAL")); dlg.BYTimeSpin->setValue(setting->readIntEntry("BY_TIMER")); dlg.sgfTimeTagsCheckBox->setChecked(setting->readBoolEntry("SGF_TIME_TAGS")); dlg.sliderCheckBox->setChecked(setting->readBoolEntry("SLIDER")); dlg.sidebarCheckBox->setChecked(setting->readBoolEntry("SIDEBAR")); dlg.sidebarLeftCheckBox->setChecked(setting->readBoolEntry("SIDEBAR_LEFT"));// dlg.rememberFontCheckBox->setChecked(setting->readBoolEntry("REM_FONT")); dlg.variableFontCheckBox->setChecked(setting->readBoolEntry("VAR_FONT")); dlg.antiClickoCheckBox->setChecked(setting->readBoolEntry("ANTICLICKO")); // Import tab dlg.blackStoneEdit->setText(QString(QChar(setting->charset->blackStone))); dlg.whiteStoneEdit->setText(QString(QChar(setting->charset->whiteStone))); dlg.starPointEdit->setText(QString(QChar(setting->charset->starPoint))); dlg.emptyPointEdit->setText(QString(QChar(setting->charset->emptyPoint))); dlg.hBorderEdit->setText(QString(QChar(setting->charset->hBorder))); dlg.vBorderEdit->setText(QString(QChar(setting->charset->vBorder))); dlg.addBrotherCheckBox->setChecked(setting->addImportAsBrother); // SGF Loading tab dlg.fastLoadCheckBox->setChecked(board->fastLoad); dlg.rememberDirCheckBox->setChecked(setting->readBoolEntry("REM_DIR")); dlg.codecListBox->setCurrentItem(setting->readIntEntry("CODEC")); // Client Window tab dlg.LineEdit_watch->setText(setting->readEntry("WATCH")); dlg.LineEdit_exclude->setText(setting->readEntry("EXCLUDE")); dlg.CheckBox_extUserInfo->setChecked(setting->readBoolEntry("EXTUSERINFO"));// dlg.CheckBox_useNmatch->setChecked(setting->readBoolEntry("USE_NMATCH")); dlg.checkBox_Nmatch_Black->setChecked(setting->readBoolEntry("NMATCH_BLACK")); dlg.checkBox_Nmatch_White->setChecked(setting->readBoolEntry("NMATCH_WHITE")); dlg.checkBox_Nmatch_Nigiri->setChecked(setting->readBoolEntry("NMATCH_NIGIRI")); dlg.HandicapSpin_Nmatch->setValue(setting->readIntEntry("NMATCH_HANDICAP")); dlg.timeSpin_Nmatch->setValue(setting->readIntEntry("NMATCH_MAIN_TIME")); dlg.BYSpin_Nmatch->setValue(setting->readIntEntry("NMATCH_BYO_TIME")); dlg.LineEdit_computer->setText(setting->readEntry("COMPUTER_PATH")); //SL added eb 12 dlg.computerButtonWhite->setChecked(setting->readBoolEntry("COMPUTER_WHITE")); dlg.computerButtonBlack->setChecked(setting->readBoolEntry("COMPUTER_BLACK")); dlg.humanButtonWhite->setChecked(!setting->readBoolEntry("COMPUTER_WHITE")); dlg.humanButtonBlack->setChecked(!setting->readBoolEntry("COMPUTER_BLACK")); dlg.computerSizeSpin->setValue(setting->readIntEntry("COMPUTER_SIZE")); dlg.computerHandicapSpin->setValue(setting->readIntEntry("COMPUTER_HANDICAP")); // Go Server tab dlg.boardSizeSpin->setValue(setting->readIntEntry("DEFAULT_SIZE")); dlg.timeSpin->setValue(setting->readIntEntry("DEFAULT_TIME")); dlg.BYSpin->setValue(setting->readIntEntry("DEFAULT_BY")); dlg.komiSpinDefault->setValue(setting->readIntEntry("DEFAULT_KOMI")); dlg.automaticNegotiationCheckBox->setChecked(setting->readBoolEntry("DEFAULT_AUTONEGO")); dlg.CheckBox_autoSave->setChecked(setting->readBoolEntry("AUTOSAVE")); dlg.CheckBox_autoSave_Played->setChecked(setting->readBoolEntry("AUTOSAVE_PLAYED")); /* // do some size changes QSize qs = dlg.pb_add->minimumSizeHint(); if (dlg.pb_new->minimumSizeHint().width() > qs.width()) qs = dlg.pb_new->minimumSizeHint(); if (dlg.pb_delete->minimumSizeHint().width() > qs.width()) qs = dlg.pb_delete->minimumSizeHint(); if (qs.width() > 0) { dlg.pb_add->setMaximumSize(qs); dlg.pb_new->setMaximumSize(qs); dlg.pb_delete->setMaximumSize(qs); } dlg.pb_add->resize( QSize().expandedTo(qs)); dlg.pb_new->resize( QSize().expandedTo(qs)); dlg.pb_delete->resize( QSize().expandedTo(qs));*/ if (dlg.exec() == QDialog::Accepted) { preferencesSave(&dlg); preferencesAccept(); }}bool MainWindow::preferencesSave(PreferencesDialog *dlg){ ASSERT (dlg);// setting->writeIntEntry("STYLE", dlg->styleListBox->currentItem());// setting->writeIntEntry("SKIN", dlg->woodListBox->currentItem()); setting->writeEntry("SKIN", dlg->LineEdit_goban->text()); setting->writeEntry("SKIN_TABLE", dlg->LineEdit_Table->text()); setting->writeEntry("LANG", setting->convertNumberToLanguage(dlg->languageComboBox->currentItem())); setting->writeIntEntry("VIEW_COMMENT", dlg->commentComboBox->currentItem());// setting->writeBoolEntry("STONES_SHADOW", dlg->stonesShadowCheckBox->isChecked());// setting->writeBoolEntry("STONES_SHELLS", dlg->stonesShellsCheckBox->isChecked()); int i = 3; if ( dlg->radioButtonStones_2D->isChecked()) i=1; else if ( dlg->radioButtonStones_3D->isChecked()) i=2; setting->writeIntEntry("STONES_LOOK", i); setting->writeBoolEntry("SOUND_STONE", dlg->stoneSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_AUTOPLAY", dlg->autoplaySoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_TALK", dlg->talkSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_MATCH", dlg->matchSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_GAMEEND", dlg->passSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_PASS", dlg->gameEndSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_TIME", dlg->timeSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_SAY", dlg->saySoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_ENTER", dlg->enterSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_LEAVE", dlg->leaveSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_DISCONNECT", dlg->disConnectSoundCheckBox->isChecked()); setting->writeBoolEntry("SOUND_CONNECT", dlg->connectSoundCheckBox->isChecked()); setting->writeIntEntry("VAR_GHOSTS", dlg->variation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -