void Gist::addActions() { /// Expand current node auto expand_action = new QAction("Expand", this); expand_action->setShortcut(QKeySequence("Return")); addAction(expand_action); connect(expand_action, SIGNAL(triggered()), m_Canvas, SLOT(expandCurrentNode())); reset = new QAction("Reset", this); addAction(reset); connect(reset, SIGNAL(triggered()), m_Canvas, SLOT(reset())); // reset->setShortcut(QKeySequence("Ctrl+R")); showPixelTree = new QAction("Pixel Tree View", this); addAction(showPixelTree); connect(showPixelTree, SIGNAL(triggered()), m_Canvas, SLOT(showPixelTree())); showIcicleTree = new QAction("Icicle Tree View", this); addAction(showIcicleTree); connect(showIcicleTree, SIGNAL(triggered()), m_Canvas, SLOT(showIcicleTree())); showWebscript = new QAction("Webscript View", this); addAction(showWebscript); connect(showWebscript, SIGNAL(triggered()), m_Canvas, SLOT(showWebscript())); followPath = new QAction("Follow Path", this); addAction(followPath); connect(followPath, SIGNAL(triggered()), m_Canvas, SLOT(followPath())); /// Collect ML stats auto collectMLStats_action = new QAction("Collect ML stats", this); addAction(collectMLStats_action); connect(collectMLStats_action, SIGNAL(triggered()), m_Canvas, SLOT(collectMLStats())); deleteWhiteNodes = new QAction{"Delete Unexplored Nodes", this}; addAction(deleteWhiteNodes); connect(deleteWhiteNodes, &QAction::triggered, m_Canvas, &TreeCanvas::deleteWhiteNodes); navUp = new QAction("Up", this); addAction(navUp); navUp->setShortcut(QKeySequence("Up")); connect(navUp, SIGNAL(triggered()), m_Canvas, SLOT(navUp())); navDown = new QAction("Down", this); addAction(navDown); navDown->setShortcut(QKeySequence("Down")); connect(navDown, SIGNAL(triggered()), m_Canvas, SLOT(navDown())); navLeft = new QAction("Left", this); addAction(navLeft); navLeft->setShortcut(QKeySequence("Left")); connect(navLeft, SIGNAL(triggered()), m_Canvas, SLOT(navLeft())); navRight = new QAction("Right", this); addAction(navRight); navRight->setShortcut(QKeySequence("Right")); connect(navRight, SIGNAL(triggered()), m_Canvas, SLOT(navRight())); navRoot = new QAction("Root", this); addAction(navRoot); navRoot->setShortcut(QKeySequence("R")); connect(navRoot, SIGNAL(triggered()), m_Canvas, SLOT(navRoot())); navNextSol = new QAction("To next solution", this); addAction(navNextSol); navNextSol->setShortcut(QKeySequence("Shift+Right")); connect(navNextSol, SIGNAL(triggered()), m_Canvas, SLOT(navNextSol())); navPrevSol = new QAction("To previous solution", this); addAction(navPrevSol); navPrevSol->setShortcut(QKeySequence("Shift+Left")); connect(navPrevSol, SIGNAL(triggered()), m_Canvas, SLOT(navPrevSol())); navNextLeaf = new QAction("To next leaf", this); addAction(navNextLeaf); navNextLeaf->setShortcut(QKeySequence("Ctrl+Right")); connect(navNextLeaf, SIGNAL(triggered()), m_Canvas, SLOT(navNextLeaf())); navPrevLeaf = new QAction("To previous leaf", this); addAction(navPrevLeaf); navPrevLeaf->setShortcut(QKeySequence("Ctrl+Left")); connect(navPrevLeaf, SIGNAL(triggered()), m_Canvas, SLOT(navPrevLeaf())); searchNext = new QAction("Next solution", this); addAction(searchNext); searchNext->setShortcut(QKeySequence("N")); searchAll = new QAction("All solutions", this); addAction(searchAll); searchAll->setShortcut(QKeySequence("A")); toggleHidden = new QAction("Hide/unhide", this); addAction(toggleHidden); toggleHidden->setShortcut(QKeySequence("H")); connect(toggleHidden, SIGNAL(triggered()), m_Canvas, SLOT(toggleHidden())); hideFailed = new QAction("Hide failed subtrees", this); addAction(hideFailed); hideFailed->setShortcut(QKeySequence("F")); connect(hideFailed, SIGNAL(triggered()), m_Canvas, SLOT(hideFailed())); hideSize = new QAction("Hide small subtrees", this); addAction(hideSize); connect(hideSize, SIGNAL(triggered()), m_Canvas, SLOT(hideSize())); #ifdef MAXIM_DEBUG auto printDebugInfo = new QAction("Print Debug Info", this); printDebugInfo->setShortcut(QKeySequence("Ctrl+Shift+D")); connect(printDebugInfo, &QAction::triggered, m_Canvas, &TreeCanvas::printDebugInfo); addAction(printDebugInfo); auto updateCanvas = new QAction{"Update Canvas", this}; updateCanvas->setShortcut(QKeySequence("Shift+U")); connect(updateCanvas, &QAction::triggered, [this]() { qDebug() << "action: update canvas"; m_Canvas->update(); }); addAction(updateCanvas); auto addChildren = new QAction{"Add 2 Children", this}; addChildren->setShortcut(QKeySequence("Shift+C")); connect(addChildren, &QAction::triggered, m_Canvas, &TreeCanvas::addChildren); addAction(addChildren); deleteNode = new QAction{"Delete Node", this}; deleteNode->setShortcut(QKeySequence("del")); connect(deleteNode, &QAction::triggered, m_Canvas, &TreeCanvas::deleteSelectedNode); addAction(deleteNode); dirtyUpNode = new QAction{"Dirty Up Node", this}; dirtyUpNode->setShortcut(QKeySequence("D")); connect(dirtyUpNode, &QAction::triggered, m_Canvas, &TreeCanvas::dirtyUpNode); addAction(dirtyUpNode); #endif unhideAll = new QAction("Unhide all", this); addAction(unhideAll); unhideAll->setShortcut(QKeySequence("U")); connect(unhideAll, SIGNAL(triggered()), m_Canvas, SLOT(unhideAll())); labelBranches = new QAction("Label/clear branches", this); addAction(labelBranches); labelBranches->setShortcut(QKeySequence("L")); /// TODO(maxim): should this be the default (Qt::WindowShortcut) instead? labelBranches->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(labelBranches, SIGNAL(triggered()), m_Canvas, SLOT(labelBranches())); labelPath = new QAction("Label/clear path", this); addAction(labelPath); labelPath->setShortcut(QKeySequence("Shift+L")); connect(labelPath, SIGNAL(triggered()), m_Canvas, SLOT(labelPath())); // labelPath->setShortcutContext(Qt::ApplicationShortcut); analyzeSimilarSubtrees = new QAction("Symilar Subtree Analysis", this); addAction(analyzeSimilarSubtrees); analyzeSimilarSubtrees->setShortcut(QKeySequence("Shift+s")); connect(analyzeSimilarSubtrees, SIGNAL(triggered()), m_Canvas, SLOT(analyzeSimilarSubtrees())); highlightNodesMenu = new QAction("Highlight Nodes Based On ...", this); addAction(highlightNodesMenu); connect(highlightNodesMenu, SIGNAL(triggered()), m_Canvas, SLOT(highlightNodesMenu())); showNogoods = new QAction("Show no-goods", this); addAction(showNogoods); showNogoods->setShortcut(QKeySequence("Shift+N")); connect(showNogoods, SIGNAL(triggered()), m_Canvas, SLOT(showNogoods())); showNodeInfo = new QAction("Show node info", this); addAction(showNodeInfo); showNodeInfo->setShortcut(QKeySequence("I")); connect(showNodeInfo, SIGNAL(triggered()), m_Canvas, SLOT(showNodeInfo())); showNodeOnPixelTree = new QAction("Show node on a pixel tree", this); addAction(showNodeOnPixelTree); showNodeOnPixelTree->setShortcut(QKeySequence("J")); connect(showNodeOnPixelTree, SIGNAL(triggered()), m_Canvas, SLOT(showNodeOnPixelTree())); toggleStop = new QAction("Stop/unstop", this); addAction(toggleStop); toggleStop->setShortcut(QKeySequence("X")); connect(toggleStop, SIGNAL(triggered()), m_Canvas, SLOT(toggleStop())); unstopAll = new QAction("Do not stop in subtree", this); addAction(unstopAll); unstopAll->setShortcut(QKeySequence("Shift+X")); connect(unstopAll, SIGNAL(triggered()), m_Canvas, SLOT(unstopAll())); zoomToFit = new QAction("Zoom to fit", this); addAction(zoomToFit); zoomToFit->setShortcut(QKeySequence("Z")); connect(zoomToFit, SIGNAL(triggered()), m_Canvas, SLOT(zoomToFit())); center = new QAction("Center current node", this); addAction(center); center->setShortcut(QKeySequence("C")); connect(center, SIGNAL(triggered()), m_Canvas, SLOT(centerCurrentNode())); exportPDF = new QAction("Export subtree PDF...", this); addAction(exportPDF); exportPDF->setShortcut(QKeySequence("P")); connect(exportPDF, SIGNAL(triggered()), m_Canvas, SLOT(exportPDF())); exportWholeTreePDF = new QAction("Export PDF...", this); addAction(exportWholeTreePDF); exportWholeTreePDF->setShortcut(QKeySequence("Ctrl+Shift+P")); connect(exportWholeTreePDF, SIGNAL(triggered()), m_Canvas, SLOT(exportWholeTreePDF())); print = new QAction("Print...", this); addAction(print); print->setShortcut(QKeySequence("Ctrl+P")); connect(print, SIGNAL(triggered()), m_Canvas, SLOT(print())); printSearchLog = new QAction("Export search log...", this); addAction(printSearchLog); connect(printSearchLog, SIGNAL(triggered()), m_Canvas, SLOT(printSearchLog())); bookmarkNode = new QAction("Add/remove bookmark", this); bookmarkNode->setShortcut(QKeySequence("Shift+B")); connect(bookmarkNode, SIGNAL(triggered()), m_Canvas, SLOT(bookmarkNode())); nullBookmark = new QAction("<none>",this); nullBookmark->setCheckable(true); nullBookmark->setChecked(false); nullBookmark->setEnabled(false); bookmarksGroup = new QActionGroup(this); bookmarksGroup->setExclusive(false); bookmarksGroup->addAction(nullBookmark); connect(bookmarksGroup, SIGNAL(triggered(QAction*)), this, SLOT(selectBookmark(QAction*))); bookmarksMenu = new QMenu("Bookmarks", this); connect(bookmarksMenu, SIGNAL(aboutToShow()), this, SLOT(populateBookmarksMenu())); showNodeStats = new QAction("Node statistics", this); addAction(showNodeStats); showNodeStats->setShortcut(QKeySequence("S")); connect(showNodeStats, SIGNAL(triggered()), this, SLOT(showStats())); nullComparator = new QAction("<none>",this); nullComparator->setCheckable(true); nullComparator->setChecked(false); nullComparator->setEnabled(false); comparatorGroup = new QActionGroup(this); comparatorGroup->setExclusive(false); comparatorGroup->addAction(nullComparator); // connect(comparatorGroup, SIGNAL(triggered(QAction*)), // this, SLOT(selectComparator(QAction*))); comparatorMenu = new QMenu("Comparators", this); comparatorMenu->addActions(comparatorGroup->actions()); contextMenu = new QMenu(this); contextMenu->addAction(collectMLStats_action); contextMenu->addAction(showNodeStats); contextMenu->addAction(center); contextMenu->addSeparator(); contextMenu->addAction(searchNext); contextMenu->addAction(searchAll); contextMenu->addSeparator(); contextMenu->addAction(toggleHidden); contextMenu->addAction(hideFailed); contextMenu->addAction(hideSize); contextMenu->addAction(unhideAll); contextMenu->addAction(labelBranches); contextMenu->addAction(labelPath); contextMenu->addAction(showNogoods); contextMenu->addAction(showNodeInfo); contextMenu->addAction(showNodeOnPixelTree); contextMenu->addAction(toggleStop); contextMenu->addAction(unstopAll); contextMenu->addSeparator(); contextMenu->addMenu(bookmarksMenu); contextMenu->addSeparator(); #ifdef MAXIM_DEBUG contextMenu->addAction(deleteNode); contextMenu->addAction(dirtyUpNode); #endif }
void TreeCanvas::navPrevSol(void) { navNextSol(true); }