void XMLStdParFrame::extendedView(bool ext,bool help) { for(int i = 0; i < xmlfieldwidgets.count(); i++) xmlfieldwidgets[i]->setVisibility(ext || xmlfieldwidgets[i]->isImportant); if (help) toggleHelp(help); updateGeometry(); adjustSize(); }
void ImageNavigator::initializeActions() { setAttribute(Qt::WA_DeleteOnClose); menu = mainMenuBar->addMenu("Focus Viewer"); QSignalMapper *signalMap = new QSignalMapper(this); QAction *showFullScreenAction = new QAction(tr("Show Full Screen"), this); showFullScreenAction->setShortcut(tr("Ctrl+F")); showFullScreenAction->setCheckable(true); connect(showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(enableFullScreen(bool))); menu->addAction(showFullScreenAction); toggleInfoToolAction = new QAction(tr("Display Coordinate Info"), this); toggleInfoToolAction->setShortcut(tr("I")); toggleInfoToolAction->setCheckable(true); addAction(toggleInfoToolAction); connect(toggleInfoToolAction, SIGNAL(triggered()), this, SLOT(toggleInfoTool())); menu->addAction(toggleInfoToolAction); // #ifdef Q_OS_MAC QMenu *zoomMenu = new QMenu("Zoom", this); menu->addMenu(zoomMenu); QAction *zoomInAction = new QAction(tr("Zoom In"), this); zoomInAction->setShortcut(tr(".")); addAction(zoomInAction); connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomMenu->addAction(zoomInAction); QAction *zoomOutAction = new QAction(tr("Zoom Out"), this); zoomOutAction->setShortcut(tr(",")); addAction(zoomOutAction); connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut())); zoomMenu->addAction(zoomOutAction); QAction *zoomStandardAction = new QAction(tr("Zoom Standard"), this); zoomStandardAction->setShortcut(tr("Space")); addAction(zoomStandardAction); connect(zoomStandardAction, SIGNAL(triggered()), this, SLOT(zoomStandard())); zoomMenu->addAction(zoomStandardAction); menu->addMenu(zoomMenu); //#endif toggleColorToolAction = new QAction(tr("Adjust Contrast/Brightness"), this); toggleColorToolAction->setShortcut(tr("O")); toggleColorToolAction->setCheckable(true); addAction(toggleColorToolAction); connect(toggleColorToolAction, SIGNAL(triggered()), this, SLOT(toggleColorTool())); menu->addAction(toggleColorToolAction); // #ifdef Q_OS_MAC // CHEN: 4.1.2015 // if(imageType =="fft") // { QMenu *brighterMenu = new QMenu("Quick-Adjust Brightness", this); menu->addMenu(brighterMenu); QAction *brighterAction = new QAction(tr("Brighter"), this); brighterAction->setShortcut(tr("b")); addAction(brighterAction); connect(brighterAction, SIGNAL(triggered()), this, SLOT(brighter())); brighterMenu->addAction(brighterAction); QAction *darkerAction = new QAction(tr("Darker"), this); darkerAction->setShortcut(tr("n")); addAction(darkerAction); connect(darkerAction, SIGNAL(triggered()), this, SLOT(darker())); brighterMenu->addAction(darkerAction); // } // #endif toggleMouseAssignAction = new QAction(tr("Show Mouse Button Assignment"), this); toggleMouseAssignAction->setShortcut(tr("M")); toggleMouseAssignAction->setCheckable(true); addAction(toggleMouseAssignAction); connect(toggleMouseAssignAction, SIGNAL(triggered()), this, SLOT(toggleAssignTool())); menu->addAction(toggleMouseAssignAction); QAction *screenshot = new QAction(tr("Screen Shot"), this); screenshot->setShortcut(tr("G")); addAction(screenshot); connect(screenshot, SIGNAL(triggered()), image, SLOT(grabScreen())); menu->addAction(screenshot); int projectMode = projectData.projectMode().toInt(); if (imageType == "fft") { viewDisplayParametersAction = new QAction(tr("Display Parameters"), this); viewDisplayParametersAction->setShortcut(tr("D")); viewDisplayParametersAction->setCheckable(true); addAction(viewDisplayParametersAction); connect(viewDisplayParametersAction, SIGNAL(triggered()), this, SLOT(toggleDisplayParameters())); menu->addAction(viewDisplayParametersAction); toggleCTFViewAction = new QAction(tr("View CTF"), this); toggleCTFViewAction->setShortcut(tr("C")); // toggleCTFViewAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); toggleCTFViewAction->setCheckable(true); addAction(toggleCTFViewAction); connect(toggleCTFViewAction, SIGNAL(triggered()), this, SLOT(toggleCTFView())); //connect(toggleCTFViewAction,SIGNAL(triggered()),image,SLOT(toggleCTFView())); menu->addAction(toggleCTFViewAction); if (projectMode == 1) { QAction *displayMillerIndicesAction = new QAction(tr("Show Miller Indices"), this); displayMillerIndicesAction->setShortcut(tr("Shift+D")); displayMillerIndicesAction->setCheckable(true); addAction(displayMillerIndicesAction); connect(displayMillerIndicesAction, SIGNAL(triggered()), signalMap, SLOT(map())); signalMap->setMapping(displayMillerIndicesAction, "millerindices"); menu->addAction(displayMillerIndicesAction); QAction *viewPSPeaksAction = new QAction(tr("View Peak List"), this); viewPSPeaksAction->setShortcut(tr("Shift+P")); viewPSPeaksAction->setCheckable(true); addAction(viewPSPeaksAction); connect(viewPSPeaksAction, SIGNAL(triggered()), signalMap, SLOT(map())); signalMap->setMapping(viewPSPeaksAction, "pspeaklist"); connect(signalMap, SIGNAL(mapped(const QString &)), image, SLOT(toggleVisible(const QString &))); menu->addAction(viewPSPeaksAction); QAction *loadPSPeaksAction = new QAction(tr("Load Peak List"), this); loadPSPeaksAction->setShortcut(tr("Shift+L")); addAction(loadPSPeaksAction); connect(loadPSPeaksAction, SIGNAL(triggered()), this, SLOT(selectPSList())); menu->addAction(loadPSPeaksAction); } QMenu *spotSelection = new QMenu("Spot Selection"); if (projectMode == 1) menu->addMenu(spotSelection); togglePeakListAction = new QAction(tr("Identify Spots"), spotSelection); togglePeakListAction->setShortcut(tr("P")); togglePeakListAction->setCheckable(true); if (projectMode == 1) { addAction(togglePeakListAction); connect(togglePeakListAction, SIGNAL(triggered()), image, SLOT(togglePeakList())); spotSelection->addAction(togglePeakListAction); } enterSpotSelectionModeAction = new QAction(tr("Enter Spot Selection Mode"), spotSelection); enterSpotSelectionModeAction->setCheckable(true); enterSpotSelectionModeAction->setShortcut(tr("Ctrl+P")); if (projectMode == 1) { addAction(enterSpotSelectionModeAction); connect(enterSpotSelectionModeAction, SIGNAL(triggered()), this, SLOT(toggleSpotSelectMode())); spotSelection->addAction(enterSpotSelectionModeAction); } savePeakListAction = new QAction(tr("Save Spot List"), spotSelection); savePeakListAction->setShortcut(tr("Ctrl+Shift+S")); if (projectMode == 1) { addAction(savePeakListAction); savePeakListAction->setDisabled(true); connect(savePeakListAction, SIGNAL(triggered()), image, SLOT(savePeakList())); spotSelection->addAction(savePeakListAction); } loadPeakListAction = new QAction(tr("Reload Spot List"), spotSelection); loadPeakListAction->setShortcut(tr("Ctrl+R")); if (projectMode == 1) { addAction(loadPeakListAction); loadPeakListAction->setDisabled(true); connect(loadPeakListAction, SIGNAL(triggered()), image, SLOT(loadPeakList())); connect(loadPeakListAction, SIGNAL(triggered()), image, SLOT(update())); spotSelection->addAction(loadPeakListAction); } clearPeakListAction = new QAction(tr("Clear Spot List"), spotSelection); clearPeakListAction->setShortcut(tr("Ctrl+Shift+C")); if (projectMode == 1) { addAction(clearPeakListAction); clearPeakListAction->setDisabled(true); connect(clearPeakListAction, SIGNAL(triggered()), image, SLOT(clearPeakList())); spotSelection->addAction(clearPeakListAction); } QMenu *latticeRefinement = new QMenu("Lattice Refinement"); if (projectMode == 1) menu->addMenu(latticeRefinement); toggleLatticeViewAction = new QAction(tr("View Lattice"), latticeRefinement); toggleLatticeViewAction->setShortcut(tr("L")); toggleLatticeViewAction->setCheckable(true); if (projectMode == 1) { addAction(toggleLatticeViewAction); connect(toggleLatticeViewAction, SIGNAL(triggered()), image, SLOT(toggleLatticeView())); latticeRefinement->addAction(toggleLatticeViewAction); QAction *toggleSecondLatticeViewAction = new QAction(tr("View Second Lattice"), latticeRefinement); toggleSecondLatticeViewAction->setShortcut(tr("S")); toggleSecondLatticeViewAction->setCheckable(true); addAction(toggleSecondLatticeViewAction); connect(toggleSecondLatticeViewAction, SIGNAL(triggered()), image, SLOT(toggleSecondLatticeView())); latticeRefinement->addAction(toggleSecondLatticeViewAction); } enterLatticeRefinementModeAction = new QAction(tr("Enter Lattice Refinement Mode"), latticeRefinement); enterLatticeRefinementModeAction->setShortcut(tr("Shift+R")); enterLatticeRefinementModeAction->setCheckable(true); if (projectMode == 1) { addAction(enterLatticeRefinementModeAction); connect(enterLatticeRefinementModeAction, SIGNAL(triggered()), this, SLOT(toggleLatticeRefinementMode())); latticeRefinement->addAction(enterLatticeRefinementModeAction); } addRefinementPointAction = new QAction(tr("Add Refinement Spot"), latticeRefinement); addRefinementPointAction->setShortcuts(QList<QKeySequence>() << tr("Enter") << tr("Return")); addRefinementPointAction->setEnabled(false); if (projectMode == 1) { addAction(addRefinementPointAction); connect(addRefinementPointAction, SIGNAL(triggered()), latticeTool, SLOT(insertPoint())); latticeRefinement->addAction(addRefinementPointAction); } } else { toggleLatticeViewAction = new QAction(tr("View Lattice"), this); toggleLatticeViewAction->setShortcut(tr("L")); toggleLatticeViewAction->setCheckable(true); if (projectMode == 1) { addAction(toggleLatticeViewAction); menu->addAction(toggleLatticeViewAction); connect(toggleLatticeViewAction, SIGNAL(triggered()), signalMap, SLOT(map())); signalMap->setMapping(toggleLatticeViewAction, "realLattice"); connect(signalMap, SIGNAL(mapped(const QString &)), image, SLOT(toggleVisible(const QString &))); } toggleParticlesViewAction = new QAction(tr("View Particles"), this); toggleParticlesViewAction->setShortcut(tr("P")); toggleParticlesViewAction->setCheckable(true); if (projectMode == 2) { addAction(toggleParticlesViewAction); menu->addAction(toggleParticlesViewAction); connect(toggleParticlesViewAction, SIGNAL(triggered()), image, SLOT(toggleParticleView())); } QMenu *fftSelectionMenu = new QMenu("Selection based FFT"); QAction *fftSelectionAction = new QAction(tr("FFT of Selection"), this); fftSelectionMenu->addAction(fftSelectionAction); fftSelectionAction->setShortcut(tr("Shift+F")); fftSelectionAction->setCheckable(true); addAction(fftSelectionAction); connect(fftSelectionAction, SIGNAL(triggered()), this, SLOT(toggleFFTSelection())); if (projectMode == 1) { QAction *setReferenceOriginAction = new QAction(tr("Set Reference Origin"), this); fftSelectionMenu->addAction(setReferenceOriginAction); setReferenceOriginAction->setShortcut(tr("Shift+O")); addAction(setReferenceOriginAction); connect(setReferenceOriginAction, SIGNAL(triggered()), this, SLOT(setReferenceOrigin())); connect(setReferenceOriginAction, SIGNAL(triggered()), spotSelect, SLOT(updateReferenceOrigin())); } menu->addMenu(fftSelectionMenu); selectionMenu = new QMenu("Polygonal Selection"); if (projectMode == 1) { QAction *selectionAreaAction = new QAction(tr("Polygonal Selection Masking"), this); selectionMenu->addAction(selectionAreaAction); selectionAreaAction->setShortcut(tr("Shift+S")); selectionAreaAction->setCheckable(true); addAction(selectionAreaAction); connect(selectionAreaAction, SIGNAL(triggered()), this, SLOT(toggleCreatePathMode())); QAction *saveSelectionArea = new QAction(tr("Save Selection"), this); selectionMenu->addAction(saveSelectionArea); saveSelectionArea->setShortcut(tr("Ctrl+Shift+S")); addAction(saveSelectionArea); connect(saveSelectionArea, SIGNAL(triggered()), image, SLOT(saveSelectionList())); QAction *clearSelectionArea = new QAction(tr("Clear Selection"), this); selectionMenu->addAction(clearSelectionArea); clearSelectionArea->setShortcut(tr("Ctrl+Shift+C")); addAction(clearSelectionArea); connect(clearSelectionArea, SIGNAL(triggered()), image, SLOT(clearSelectionVertices())); menu->addMenu(selectionMenu); QMenu *referenceMenu = new QMenu("Unbending References", menu); QAction *toggleBoxa1Action = new QAction(tr("View Boxa1"), this); toggleBoxa1Action->setCheckable(true); referenceMenu->addAction(toggleBoxa1Action); addAction(toggleBoxa1Action); connect(toggleBoxa1Action, SIGNAL(triggered()), this, SLOT(toggleBoxa1())); QAction *toggleBoxa2Action = new QAction(tr("View Boxa2"), this); toggleBoxa2Action->setCheckable(true); referenceMenu->addAction(toggleBoxa2Action); addAction(toggleBoxa2Action); connect(toggleBoxa2Action, SIGNAL(triggered()), this, SLOT(toggleBoxa2())); QAction *toggleBoxb1Action = new QAction(tr("View Boxb1"), this); toggleBoxb1Action->setCheckable(true); referenceMenu->addAction(toggleBoxb1Action); addAction(toggleBoxb1Action); connect(toggleBoxb1Action, SIGNAL(triggered()), this, SLOT(toggleBoxb1())); QAction *toggleBoxb2Action = new QAction(tr("View Boxb2"), this); toggleBoxb2Action->setCheckable(true); referenceMenu->addAction(toggleBoxb2Action); addAction(toggleBoxb2Action); connect(toggleBoxb2Action, SIGNAL(triggered()), this, SLOT(toggleBoxb2())); menu->addMenu(referenceMenu); QAction *setPhaseOriginAction = new QAction(tr("Set Phase Origin"), this); menu->addAction(setPhaseOriginAction); setPhaseOriginAction->setShortcut(tr("Shift+P")); addAction(setPhaseOriginAction); connect(setPhaseOriginAction, SIGNAL(triggered()), this, SLOT(setPhaseOrigin())); } } if (projectMode == 1) { QAction *showTiltAxisAction = new QAction(tr("View Tilt Axis in Raw Image (TLTAXIS)"), this); menu->addAction(showTiltAxisAction); showTiltAxisAction->setCheckable(true); showTiltAxisAction->setShortcut(tr("T")); addAction(showTiltAxisAction); connect(showTiltAxisAction, SIGNAL(triggered()), signalMap, SLOT(map())); signalMap->setMapping(showTiltAxisAction, "tiltaxis"); connect(signalMap, SIGNAL(mapped(const QString &)), image, SLOT(toggleVisible(const QString &))); QAction *showTaxisAction = new QAction(tr("View Tilt Axis in Final Map (TAXA)"), this); menu->addAction(showTaxisAction); showTaxisAction->setCheckable(true); showTaxisAction->setShortcut(tr("Shift+T")); addAction(showTaxisAction); connect(showTaxisAction, SIGNAL(triggered()), signalMap, SLOT(map())); signalMap->setMapping(showTaxisAction, "tiltaxa"); connect(signalMap, SIGNAL(mapped(const QString &)), image, SLOT(toggleVisible(const QString &))); } QAction *helpAction = new QAction(tr("Help"), this); helpAction->setShortcut(tr("H")); helpAction->setCheckable(true); addAction(helpAction); connect(helpAction, SIGNAL(triggered()), this, SLOT(toggleHelp())); menu->addAction(helpAction); closeAction = new QAction(tr("Close"), this); closeAction->setShortcut(tr("Esc")); addAction(closeAction); connect(closeAction, SIGNAL(triggered()), this, SLOT(closeCurrent())); menu->addAction(closeAction); // menuBar->addMenu(menu); }
void MeshLabXMLStdDialog::loadFrameContent( ) { assert(qf); qf->hide(); QLabel *ql; QGridLayout *gridLayout = new QGridLayout(qf); qf->setLayout(gridLayout); QString fname(curmfc->act->text()); setWindowTitle(fname); ql = new QLabel("<i>"+curmfc->xmlInfo->filterHelp(fname)+"</i>",qf); ql->setTextFormat(Qt::RichText); ql->setWordWrap(true); gridLayout->addWidget(ql,0,0,1,2,Qt::AlignTop); // this widgets spans over two columns. stdParFrame = new XMLStdParFrame(this,curgla); //connect(stdParFrame,SIGNAL(frameEvaluateExpression(const Expression&,Value**)),this,SIGNAL(dialogEvaluateExpression(const Expression&,Value**)),Qt::DirectConnection); MLXMLPluginInfo::XMLMapList mplist = curmfc->xmlInfo->filterParametersExtendedInfo(fname); EnvWrap wrap(env); stdParFrame->loadFrameContent(mplist,wrap); gridLayout->addWidget(stdParFrame,1,0,1,2); //int buttonRow = 2; // the row where the line of buttons start helpButton = new QPushButton("Help", qf); //helpButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum); closeButton = new QPushButton("Close", qf); //closeButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum); applyButton = new QPushButton("Apply", qf); //applyButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum); defaultButton = new QPushButton("Default", qf); //defaultButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum); applyButton->setFocus(); ExpandButtonWidget* exp = new ExpandButtonWidget(qf); connect(exp,SIGNAL(expandView(bool)),this,SLOT(extendedView(bool))); connect(this->parentWidget(),SIGNAL(filterExecuted()),this,SLOT(postFilterExecution())); #ifdef Q_WS_MAC // Hack needed on mac for correct sizes of button in the bottom of the dialog. helpButton->setMinimumSize(100, 25); closeButton->setMinimumSize(100,25); applyButton->setMinimumSize(100,25); defaultButton->setMinimumSize(100, 25); #endif QString postCond = curmfc->xmlInfo->filterAttribute(fname,MLXMLElNames::filterPostCond); QStringList postCondList = postCond.split(QRegExp("\\W+"), QString::SkipEmptyParts); curmask = MeshLabFilterInterface::convertStringListToMeshElementEnum(postCondList); if(isPreviewable()) { previewCB = new QCheckBox("Preview", qf); previewCB->setCheckState(Qt::Unchecked); gridLayout->addWidget(previewCB, gridLayout->rowCount(),0,Qt::AlignBottom); connect(previewCB,SIGNAL(toggled(bool)),this,SLOT( togglePreview() )); //buttonRow++; } connect(helpButton,SIGNAL(clicked()),this,SLOT(toggleHelp())); connect(closeButton,SIGNAL(clicked()),this,SLOT(closeClick())); connect(defaultButton,SIGNAL(clicked()),this,SLOT(resetExpressions())); connect(applyButton,SIGNAL(clicked()),this,SLOT(applyClick())); gridLayout->addWidget(exp,gridLayout->rowCount(),0,1,2,Qt::AlignJustify); int firstButLine = gridLayout->rowCount(); gridLayout->addWidget(helpButton, firstButLine,1,Qt::AlignBottom); gridLayout->addWidget(defaultButton,firstButLine,0,Qt::AlignBottom); int secButLine = gridLayout->rowCount(); gridLayout->addWidget(closeButton, secButLine,0,Qt::AlignBottom); gridLayout->addWidget(applyButton, secButLine,1,Qt::AlignBottom); qf->showNormal(); qf->adjustSize(); //set the minimum size so it will shrink down to the right size after the help is toggled //this->setMinimumSize(qf->sizeHint()); this->showNormal(); this->adjustSize(); //setSizePolicy(QSizePolicy::Minimum,QSizePolicy::MinimumExpanding); }