📄 mainwindow.cpp
字号:
// Navigation previous comment navPrevComment = new QAction(tr("Previous commented move"), previousCommentIcon, tr("Previous &commented move") , 0, this); //added eb navPrevComment->setStatusTip(tr("To previous comment")); navPrevComment->setWhatsThis(tr("Previous comment\n\nMove to the previous move that has a comment")); connect(navPrevComment, SIGNAL(activated()), this, SLOT(slotNavPrevComment())); // Navigation next comment navNextComment = new QAction(tr("Next commented move"), nextCommentIcon, tr("Next c&ommented move") , 0, this); navNextComment->setStatusTip(tr("To next comment")); navNextComment->setWhatsThis(tr("Next comment\n\nMove to the next move that has a comment")); connect(navNextComment, SIGNAL(activated()), this, SLOT(slotNavNextComment())); // end add eb // Navigation to clicked intersection added eb 11 navIntersection = new QAction(tr("Goto stone at clicked move"), navIntersectionIcon, tr("Goto clic&ked move") , 0, this); navIntersection->setStatusTip(tr("To clicked move")); navIntersection->setWhatsThis(tr("Click on a board intersection\n\nMove to the stone played at this intersection (if any)")); connect(navIntersection, SIGNAL(activated()), this, SLOT(slotNavIntersection())); // end add eb // end add eb 11 /* * Menu Settings */ // Settings Preferences setPreferences = new QAction(tr("Preferences"), prefsIcon, tr("&Preferences"), QAccel::stringToKey(tr("Alt+P")), this); setPreferences->setStatusTip(tr("Edit the preferences")); setPreferences->setWhatsThis(tr("Preferences\n\nEdit the applications preferences.")); connect(setPreferences, SIGNAL(activated()), this, SLOT(slotSetPreferences())); // Setings GameInfo setGameInfo = new QAction(tr("Game Info"), infoIcon, tr("&Game Info"), QAccel::stringToKey(tr("Ctrl+I")), this); setGameInfo->setStatusTip(tr("Display game information")); setGameInfo->setWhatsThis(tr("Game Info\n\nDisplay game information.")); connect(setGameInfo, SIGNAL(activated()), this, SLOT(slotSetGameInfo())); //Toggling sound QIconSet OIC; OIC.setPixmap ( sound_offIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::On); OIC.setPixmap ( sound_onIcon, QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); soundToggle = new QAction(tr("Mute stones sound"), OIC, tr("&Mute stones sound"),0, this,0,true); soundToggle->setOn(!setting->readBoolEntry("SOUND_STONE")); soundToggle->setStatusTip(tr("Toggle stones sound on/off")); soundToggle->setWhatsThis(tr("Stones sound\n\nToggle stones sound on/off\nthis toggles only the stones sounds")); connect(soundToggle, SIGNAL(toggled(bool)), this, SLOT(slotSoundToggle(bool))); /* * Menu View */ // View Filebar toggle viewFileBar = new QAction(tr("File toolbar"), tr("&File toolbar"), 0, this, 0, true); viewFileBar->setOn(true); viewFileBar->setStatusTip(tr("Enables/disables the file toolbar")); viewFileBar->setWhatsThis(tr("File toolbar\n\nEnables/disables the file toolbar.")); connect(viewFileBar, SIGNAL(toggled(bool)), this, SLOT(slotViewFileBar(bool))); // View Toolbar toggle viewToolBar = new QAction(tr("Navigation toolbar"), tr("Navigation &toolbar"), 0, this, 0, true); viewToolBar->setOn(true); viewToolBar->setStatusTip(tr("Enables/disables the navigation toolbar")); viewToolBar->setWhatsThis(tr("Navigation toolbar\n\nEnables/disables the navigation toolbar.")); connect(viewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool))); // View Editbar toggle viewEditBar = new QAction(tr("Edit toolbar"), tr("&Edit toolbar"), 0, this, 0, true); viewEditBar->setOn(true); viewEditBar->setStatusTip(tr("Enables/disables the edit toolbar")); viewEditBar->setWhatsThis(tr("Edit toolbar\n\nEnables/disables the edit toolbar.")); connect(viewEditBar, SIGNAL(toggled(bool)), this, SLOT(slotViewEditBar(bool))); // View Menubar toggle viewMenuBar = new QAction(tr("Menubar"), tr("&Menubar"), QAccel::stringToKey(tr("F7")), this, 0, true); viewMenuBar->setOn(true); viewMenuBar->setStatusTip(tr("Enables/disables the menubar")); viewMenuBar->setWhatsThis(tr("Menubar\n\nEnables/disables the menubar.")); connect(viewMenuBar, SIGNAL(toggled(bool)), this, SLOT(slotViewMenuBar(bool))); // View Statusbar toggle viewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true); viewStatusBar->setOn(true); viewStatusBar->setStatusTip(tr("Enables/disables the statusbar")); viewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar.")); connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool))); // View Coordinates toggle viewCoords = new QAction(tr("Coordinates"),coordsIcon, tr("C&oordinates"), QAccel::stringToKey(tr("F8")), this, 0, true); viewCoords->setOn(false); viewCoords->setStatusTip(tr("Enables/disables the coordinates")); viewCoords->setWhatsThis(tr("Coordinates\n\nEnables/disables the coordinates.")); connect(viewCoords, SIGNAL(toggled(bool)), this, SLOT(slotViewCoords(bool))); // View Slider toggle viewSlider = new QAction(tr("Slider"), tr("Sli&der"), QAccel::stringToKey(tr("Ctrl+F8")), this, 0, true); viewSlider->setOn(false); viewSlider->setStatusTip(tr("Enables/disables the slider")); viewSlider->setWhatsThis(tr("Slider\n\nEnables/disables the slider.")); connect(viewSlider, SIGNAL(toggled(bool)), this, SLOT(slotViewSlider(bool))); // View Sidebar toggle viewSidebar = new QAction(tr("Sidebar"), tr("Side&bar"), QAccel::stringToKey(tr("F9")), this, 0, true); viewSidebar->setOn(true); viewSidebar->setStatusTip(tr("Enables/disables the sidebar")); viewSidebar->setWhatsThis(tr("Sidebar\n\nEnables/disables the sidebar.")); connect(viewSidebar, SIGNAL(toggled(bool)), this, SLOT(slotViewSidebar(bool))); // View Comment toggle viewComment = new QAction(tr("Comment"), tr("&Comment"), QAccel::stringToKey(tr("F10")), this, 0, true); viewComment->setOn(true); viewComment->setStatusTip(tr("Enables/disables the comment field")); viewComment->setWhatsThis(tr("Comment field\n\nEnables/disables the comment field.")); connect(viewComment, SIGNAL(toggled(bool)), this, SLOT(slotViewComment(bool))); // View Vertical Comment toggle viewVertComment = new QAction(tr("Vertical comment"), tr("&Vertical comment"), QAccel::stringToKey(tr("Shift+F10")), this, 0, true); viewVertComment->setOn(setting->readIntEntry("VIEW_COMMENT") == 2 || setting->readIntEntry("VIEW_COMMENT") == 0 && setting->readIntEntry("BOARDVERTCOMMENT_0")); viewVertComment->setStatusTip(tr("Enables/disables a vertical direction of the comment field")); viewVertComment->setWhatsThis(tr("Vertical comment field\n\n" "Enables/disables a vertical direction of the comment field.\n\nNote: This setting is temporary for this board. In order to set permanent horizontal/vertical comment use 'Preferences'.")); connect(viewVertComment, SIGNAL(toggled(bool)), this, SLOT(slotViewVertComment(bool))); // View Pin comment viewPinComment = new QAction(tr("Pin comment"), tr("&Pin comment"), QAccel::stringToKey(tr("Ctrl+F10")), this, 0, true); viewPinComment->setOn(false); viewPinComment->setStatusTip(tr("Enables/disables pinning the comment field")); viewPinComment->setWhatsThis(tr("Pin comment field\n\nEnables/disables pinning the comment field.")); connect(viewPinComment, SIGNAL(toggled(bool)), this, SLOT(slotViewPinComment(bool))); // View Increase Size viewIncreaseSize = new QAction(tr("Zoom In"), increaseIcon, tr("Zoom &In"), QAccel::stringToKey(tr("Alt++")), this); viewIncreaseSize->setStatusTip(tr("Zooms in the board")); viewIncreaseSize->setWhatsThis(tr("Zoom In\n\nZooms in the board.")); connect(viewIncreaseSize, SIGNAL(activated()), this, SLOT(slotViewIncreaseSize())); // View Decrease Size viewDecreaseSize = new QAction(tr("Zoom Out"), decreaseIcon, tr("Zoom &Out"), QAccel::stringToKey(tr("Alt+-")), this); viewDecreaseSize->setStatusTip(tr("Zooms out the board")); viewDecreaseSize->setWhatsThis(tr("Zoom Out\n\nZooms out the board.")); connect(viewDecreaseSize, SIGNAL(activated()), this, SLOT(slotViewDecreaseSize())); // View Save Size viewSaveSize = new QAction(tr("Save size"), tr("Save si&ze"), QAccel::stringToKey("Alt+0"), this, 0, false); viewSaveSize->setStatusTip(tr("Save the current window size")); viewSaveSize->setWhatsThis(tr("Save size\n\n" "Saves the current window size and restores it on the next program start.\n\nUse ALT + <number key> to store own sizes\nRestore with CTRL + <number key>\n\n<0> is default value at program start.\n<9> is default for edit window.")); connect(viewSaveSize, SIGNAL(activated()), this, SLOT(slotViewSaveSize())); // View Fullscreen viewFullscreen = new QAction(tr("Fullscreen"), fullscreenIcon, tr("&Fullscreen"), QAccel::stringToKey(tr("F11")), this, 0, true); viewFullscreen->setOn(false); viewFullscreen->setStatusTip(tr("Enable/disable fullscreen mode")); viewFullscreen->setWhatsThis(tr("Fullscreen\n\nEnable/disable fullscreen mode.")); connect(viewFullscreen, SIGNAL(toggled(bool)), this, SLOT(slotViewFullscreen(bool))); /* * Menu Help */ // Help Manual helpManual = new QAction(tr("Manual"), manualIcon, tr("&Manual"), QAccel::stringToKey(tr("F1")), this); helpManual->setStatusTip(tr("Opens the manual")); helpManual->setWhatsThis(tr("Help\n\nOpens the manual of the application.")); connect(helpManual, SIGNAL(activated()), this, SLOT(slotHelpManual())); // Sound Info helpSoundInfo = new QAction(tr("Sound Info"), tr("&Sound"), 0, this); helpSoundInfo->setStatusTip(tr("Short info on sound availability")); helpSoundInfo->setWhatsThis(tr("Sound Info\n\nViews a message box with a short comment about sound.")); connect(helpSoundInfo, SIGNAL(activated()), this, SLOT(slotHelpSoundInfo())); // Help About helpAboutApp = new QAction(tr("About"), tr("&About..."), 0, this); helpAboutApp->setStatusTip(tr("About the application")); helpAboutApp->setWhatsThis(tr("About\n\nAbout the application.")); connect(helpAboutApp, SIGNAL(activated()), this, SLOT(slotHelpAbout())); // Help AboutQt helpAboutQt = new QAction(tr("About Qt"), tr("About &Qt..."), 0, this); helpAboutQt->setStatusTip(tr("About Qt")); helpAboutQt->setWhatsThis(tr("About Qt\n\nAbout Qt.")); connect(helpAboutQt, SIGNAL(activated()), this, SLOT(slotHelpAboutQt())); // Disable some toolbuttons at startup navForward->setEnabled(false); navBackward->setEnabled(false); navFirst->setEnabled(false); navLast->setEnabled(false); navPrevVar->setEnabled(false); navNextVar->setEnabled(false); navMainBranch->setEnabled(false); navStartVar->setEnabled(false); navNextBranch->setEnabled(false); navSwapVariations->setEnabled(false); navPrevComment->setEnabled(false); navNextComment->setEnabled(false); navIntersection->setEnabled(false); //SL added eb 11 editPaste->setEnabled(false); editPasteBrother->setEnabled(false);}void MainWindow::initMenuBar(){//#ifdef USE_XPM QIconSet wtIcon(QPixmap(const_cast<const char**>(contexthelp_xpm)));//#else// QIconSet wtIcon(QPixmap(ICON_WHATSTHIS));//#endif // submenu Import/Export importExportMenu = new QPopupMenu(); importExportMenu->insertTearOffHandle(); fileImportASCII->addTo(importExportMenu); fileImportASCIIClipB->addTo(importExportMenu); fileExportASCII->addTo(importExportMenu); importExportMenu->insertSeparator(); fileImportSgfClipB->addTo(importExportMenu); fileExportSgfClipB->addTo(importExportMenu); importExportMenu->insertSeparator(); fileExportPic->addTo(importExportMenu); fileExportPicClipB->addTo(importExportMenu); // menuBar entry fileMenu fileMenu = new QPopupMenu(); fileMenu->insertTearOffHandle(); fileNewBoard->addTo(fileMenu); fileNew->addTo(fileMenu); fileOpen->addTo(fileMenu); fileSave->addTo(fileMenu); fileSaveAs->addTo(fileMenu); fileClose->addTo(fileMenu); fileMenu->insertSeparator(); fileMenu->insertItem(tr("&Import/Export"), importExportMenu); fileMenu->insertSeparator(); fileQuit->addTo(fileMenu); // menuBar entry editMenu editMenu = new QPopupMenu(); editMenu->insertTearOffHandle(); editCut->addTo(editMenu); editPaste->addTo(editMenu); editPasteBrother->addTo(editMenu); editDelete->addTo(editMenu); editMenu->insertSeparator(); editHideStones->addTo(editMenu); //QQQ editNumberMoves->addTo(editMenu); editMarkBrothers->addTo(editMenu); editMarkSons->addTo(editMenu); // menuBar entry navMenu navMenu = new QPopupMenu(); navMenu->insertTearOffHandle(); navFirst->addTo(navMenu); navBackward->addTo(navMenu); navForward->addTo(navMenu); navLast->addTo(navMenu); navMenu->insertSeparator(); navMainBranch->addTo(navMenu); navStartVar->addTo(navMenu); navPrevVar->addTo(navMenu); navNextVar->addTo(navMenu); navNextBranch->addTo(navMenu); navMenu->insertSeparator(); navNthMove->addTo(navMenu); navAutoplay->addTo(navMenu); navMenu->insertSeparator(); navEmptyBranch->addTo(navMenu); navCloneNode->addTo(navMenu); navSwapVariations->addTo(navMenu); navMenu->insertSeparator(); //added eb navPrevComment->addTo(navMenu); navNextComment->addTo(navMenu); // end add // menuBar entry settingsMenu settingsMenu = new QPopupMenu(); settingsMenu->insertTearOffHandle(); setPreferences->addTo(settingsMenu); setGameInfo->addTo(settingsMenu); settingsMenu->insertSeparator(); soundToggle->addTo(settingsMenu); // menuBar entry viewMenu viewMenu = new QPopupMenu(); viewMenu->insertTearOffHandle(); viewFileBar->addTo(viewMenu); viewToolBar->addTo(viewMenu); viewEditBar->addTo(viewMenu); viewMenuBar->addTo(viewMenu); viewStatusBar->addTo(viewMenu); viewCoords->addTo(viewMenu); viewSlider->addTo(viewMenu); viewSidebar->addTo(viewMenu); viewComment->addTo(viewMenu); viewVertComment->addTo(viewMenu); viewPinComment->addTo(viewMenu); viewMenu->insertSeparator(); viewIncreaseSize->addTo(viewMenu); viewDecreaseSize->addTo(viewMenu); viewMenu->insertSeparator(); viewSaveSize->addTo(viewMenu); viewMenu->insertSeparator(); viewFullscreen->addTo(viewMenu); // menuBar entry helpMenu helpMenu = new QPopupMenu(); helpManual->addTo(helpMenu); helpMenu->insertItem(wtIcon, tr("What's &This?"), this, SLOT(whatsThis()), SHIFT+Key_F1); helpMenu->insertSeparator(); helpSoundInfo->addTo(helpMenu); helpMenu->insertSeparator(); helpAboutApp->addTo(helpMenu); helpAboutQt->addTo(helpMenu); // menubar configuration menuBar()->insertItem(tr("&File"), fileMenu); menuBar()->insertItem(tr("&Edit"), editMenu); menuBar()->insertItem(tr("&Navigation"), navMenu); menuBar()->insertItem(tr("&Settings"), settingsMenu); menuBar()->insertItem(tr("&View"), viewMenu); menuBar()->insertSeparator(); menuBar()->insertItem(tr("&Help"), helpMenu);}void MainWindow::initToolBar(){ // File toolbar fileBar = new QToolBar(this, "filebar"); fileNew->addTo(fileBar); fileOpen->addTo(fileBar); fileSave->addTo(fileBar); fileSaveAs->addTo(fileBar); // Navigation toolbar toolBar = new QToolBar(this, "toolbar"); navFirst->addTo(toolBar);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -