MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); webView = new QWebView(); webView->setWindowTitle("contentEditor preview"); webView->setWindowFlags(Qt::WindowStaysOnTopHint); // | Qt::FramelessWindowHint pageHandler::loadPages(); pageHandler::treeWidget = ui->pagesList; pageHandler::pageStack = ui->pageStack; pageHandler::webView = webView; pageHandler::setup(); setGeometry(50, 50, 1200, 700); connect(ui->savePage,SIGNAL(triggered()),pageHandler::getSingleton(), SLOT(savePage())); connect(ui->togglePagesList,SIGNAL(triggered()),this, SLOT(togglePagesList())); connect(ui->toggleFullscreen,SIGNAL(triggered()),this, SLOT(toggleFullscreen())); connect(ui->togglePreview,SIGNAL(triggered()),this, SLOT(togglePreview())); connect(ui->newPage,SIGNAL(triggered()),this, SLOT(addPage())); connect(ui->newField,SIGNAL(triggered()),this, SLOT(addField())); connect(ui->backgroundColor, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(setFieldBackgroundColor())); connect(ui->addImage, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(addImage())); connect(ui->toggleText, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(toggleTextEdit())); connect(ui->pageBackgroundColor, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(setPageBackgroundColor())); connect(ui->printPDF, SIGNAL(triggered()), pageHandler::getSingleton(), SLOT(exportPDF())); lastWebViewGeometry = QRect(200,200,500,400); }
teamStats::teamStats( QWidget * parent, Qt::WFlags f) : QWidget(parent, f) { setupUi(this); printPage = new QTextBrowser(); printButton->setEnabled(false); pdfButton->setEnabled(false); QObject::connect(printButton, SIGNAL( clicked() ), this, SLOT( printStats() ) ); QObject::connect(pdfButton, SIGNAL( clicked() ), this, SLOT( exportPDF() ) ); }
NativeRenderDialog::NativeRenderDialog(Document *aDoc, const CoordBox& aCoordBox, QWidget *parent) :QObject(parent), theDoc(aDoc), theOrigBox(aCoordBox) { thePrinter = new QPrinter(); thePrinter->setDocName(aDoc->title()); mapview = new MapView(NULL); mapview->setDocument(theDoc); preview = new QPrintPreviewDialog( thePrinter, parent ); QMainWindow* mw = preview->findChild<QMainWindow*>(); prtW = dynamic_cast<QPrintPreviewWidget*>(mw->centralWidget()); QWidget* myWidget = new QWidget(preview); ui.setupUi(myWidget); ui.verticalLayout->addWidget(prtW); mw->setCentralWidget(myWidget); /* Set the DPI validator to accept positive values only. */ dpiValidator = new QIntValidator( ui.fieldDpi ); dpiValidator->setBottom( 0 ); ui.fieldDpi->setValidator( dpiValidator ); /* Set the UI parameters first, before we tie in the updatePreview signal/slot. */ setBoundingBox(aCoordBox); setOptions(M_PREFS->getRenderOptions()); /* Tie in the updatePreview slot to the UI. */ connect(ui.cbShowNodes, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowRelations, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowGrid, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowScale, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowUnstyled, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.sbMinLat, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMaxLat, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMinLon, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMaxLon, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.btExportPDF, SIGNAL(clicked()), SLOT(exportPDF())); connect(ui.btExportSVG, SIGNAL(clicked()), SLOT(exportSVG())); connect(ui.btExportRaster, SIGNAL(clicked()), SLOT(exportRaster())); connect( preview, &QPrintPreviewDialog::paintRequested, this, &NativeRenderDialog::renderPreview ); }
NativeRenderDialog::NativeRenderDialog(Document *aDoc, const CoordBox& aCoordBox, QWidget *parent) :QObject(parent), theDoc(aDoc), theOrigBox(aCoordBox) { thePrinter = new QPrinter(); thePrinter->setDocName(aDoc->title()); mapview = new MapView(NULL); mapview->setDocument(theDoc); preview = new QPrintPreviewDialog( thePrinter, parent ); QMainWindow* mw = preview->findChild<QMainWindow*>(); prtW = dynamic_cast<QPrintPreviewWidget*>(mw->centralWidget()); QWidget* myWidget = new QWidget(preview); ui.setupUi(myWidget); ui.verticalLayout->addWidget(prtW); mw->setCentralWidget(myWidget); connect(ui.cbShowNodes, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowRelations, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowGrid, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowScale, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.cbShowUnstyled, SIGNAL(toggled(bool)), prtW, SLOT(updatePreview())); connect(ui.sbMinLat, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMaxLat, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMinLon, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.sbMaxLon, SIGNAL(valueChanged(double)), prtW, SLOT(updatePreview())); connect(ui.btExportPDF, SIGNAL(clicked()), SLOT(exportPDF())); connect(ui.btExportSVG, SIGNAL(clicked()), SLOT(exportSVG())); connect(ui.btExportRaster, SIGNAL(clicked()), SLOT(exportRaster())); connect( preview, SIGNAL(paintRequested(QPrinter*)), SLOT(print(QPrinter*)) ); setBoundingBox(aCoordBox); setOptions(M_PREFS->getRenderOptions()); }
void testApp::keyPressed( int key ) { cout << "key : " << key << endl ; // if ( canvasAlpha > 0.0f ) // { WordBlock * wb = quote.getEditableBlock( ) ; if ( wb == NULL ) { switch ( key ) { case 'p': case 'P': exportPDF() ; break ; case 'r': case 'R': resetAgents() ; break ; case 's': case 'S': saveProjectFile( ) ; break ; case 'o': case 'O': openProjectFile( ) ; break ; case ' ': bRunAgents = !bRunAgents ; break ; case 'd': case 'D': bDebugDraw = !bDebugDraw ; break ; case 'n': case 'N': cout << "new WordBlock" << endl ; createNewWordBlock() ; break ; case 13 : cout << "end typing wordBlock" << endl ; break ; case 'e': case 'E': quote.editWordBlockAt ( mouseX , mouseY ) ; break ; case 'f': case 'F': openFontDialogue() ; break ; case 127 : case 8 : quote.removeWordBlockAt ( mouseX , mouseY ) ; break ; } cout << "no editable path!" << endl; } else { if ( key == 13 ) { wb->bEditable = false ; return ; } //Backspace else if ( key == 127|| key == 8 ) { string word = wb->word ; if ( word.size() > 0 ) { string word1 = word.substr( 0 , word.size()-1 ) ; word = word1 ; } wb->word = word ; updateNewWordBlock( wb->word , newFontSize ) ; //updateNewWordBlock( wb->word , newFontSize ) ; return ; } wb->word += key ; cout << "updating word blcok with : " << wb->word << endl ; //void testApp::updateNewWordBlock ( string _word , float _fontSize ) // WordBlock * wb = quote.getEditableBlock( ) ; updateNewWordBlock( wb->word , newFontSize ) ; } // } }
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 }