MainWindow() { QToolBar *toolBar = new QToolBar(this); toolBar->setFixedHeight(80); #if QT_VERSION < 0x040000 setDockEnabled(TornOff, true); setRightJustification(true); #else toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); #endif QWidget *hBox = new QWidget(toolBar); QLabel *label = new QLabel("Timer Interval", hBox); QwtCounter *counter = new QwtCounter(hBox); counter->setRange(-1.0, 100.0, 1.0); QHBoxLayout *layout = new QHBoxLayout(hBox); layout->addWidget(label); layout->addWidget(counter); layout->addWidget(new QWidget(hBox), 10); // spacer); #if QT_VERSION >= 0x040000 toolBar->addWidget(hBox); #endif addToolBar(toolBar); DataPlot *plot = new DataPlot(this); setCentralWidget(plot); connect(counter, SIGNAL(valueChanged(double)), plot, SLOT(setTimerInterval(double)) ); counter->setValue(20.0); }
FancyTabWidget::FancyTabWidget(QWidget *parent) : QWidget(parent) { m_tabBar = new FancyTabBar(this); m_tabBar->setShape(QTabBar::RoundedEast); m_tabBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_tabBar->setUsesScrollButtons(false); m_selectionWidget = new QWidget(this); QVBoxLayout *selectionLayout = new QVBoxLayout; selectionLayout->setSpacing(0); selectionLayout->setMargin(0); QToolBar *bar = new QToolBar; bar->addWidget(new FancyColorButton(this)); bar->setFixedHeight(StyleHelper::navigationWidgetHeight()); selectionLayout->addWidget(bar); selectionLayout->addWidget(m_tabBar, 1); m_selectionWidget->setLayout(selectionLayout); m_selectionWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); m_cornerWidgetContainer = new QWidget(this); m_cornerWidgetContainer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); m_cornerWidgetContainer->setAutoFillBackground(false); QVBoxLayout *cornerWidgetLayout = new QVBoxLayout; cornerWidgetLayout->setSpacing(0); cornerWidgetLayout->setMargin(0); cornerWidgetLayout->addStretch(); m_cornerWidgetContainer->setLayout(cornerWidgetLayout); selectionLayout->addWidget(m_cornerWidgetContainer, 0); m_modesStack = new QStackedLayout; m_statusBar = new QStatusBar; m_statusBar->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setMargin(0); vlayout->setSpacing(0); vlayout->addLayout(m_modesStack); vlayout->addWidget(m_statusBar); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->setSpacing(1); layout->addWidget(m_selectionWidget); layout->addLayout(vlayout); setLayout(layout); connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(showWidget(int))); }
dtkPlotViewToolBar::dtkPlotViewToolBar(dtkPlotView *parent) : QFrame(parent->widget()), d(new dtkPlotViewToolBarPrivate()) { QToolBar *bar = new QToolBar(this); d->view = parent; d->defaultViewAction = new QAction("Default", this); d->defaultViewAction->setToolTip("Show default view"); d->defaultViewAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotAxis.png")); d->gridAction = new QAction("Grid", this); d->gridAction->setCheckable(true); d->gridAction->setChecked(false); d->gridAction->setToolTip("Draw grid coodinates"); d->gridAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotGrid.png")); d->pickingAction = new QAction("Picking", this); d->pickingAction->setCheckable(true); d->pickingAction->setChecked(false); d->pickingAction->setToolTip("Activate picking"); d->pickingAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotPicking.png")); d->zoomAction = new QAction("Zoom", this); d->zoomAction->setCheckable(true); d->zoomAction->setChecked(false); d->zoomAction->setToolTip("Activate zoom"); d->zoomAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotZoom.png")); d->legendAction = new QAction("Legend", this); d->legendAction->setCheckable(true); d->legendAction->setChecked(false); d->legendAction->setToolTip("Activate legend"); d->legendAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotLegend.png")); d->exportAction = new QAction("Export", this); d->exportAction->setToolTip("Export view"); d->exportAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotSupportExport.png")); bar->addAction(d->defaultViewAction); bar->addAction(d->zoomAction); bar->addAction(d->gridAction); bar->addAction(d->pickingAction); bar->addAction(d->legendAction); bar->addWidget(new dtkSpacer); bar->addAction(d->exportAction); bar->setFloatable(false); bar->setIconSize(QSize(18, 18)); bar->setMovable(false); bar->setOrientation(Qt::Horizontal); bar->setFixedHeight(25); bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(bar); connect(d->defaultViewAction, SIGNAL(triggered(bool)), this, SLOT(onDefaultView())); connect(d->zoomAction, SIGNAL(triggered(bool)), this, SLOT(onZoomActivated(bool))); connect(d->gridAction, SIGNAL(triggered(bool)), this, SLOT(onGridActivated(bool))); connect(d->pickingAction, SIGNAL(triggered(bool)), this, SLOT(onPickingActivated(bool))); connect(d->legendAction, SIGNAL(triggered(bool)), this, SLOT(onLegendActivated(bool))); connect(d->exportAction, SIGNAL(triggered()), this, SLOT(onExport())); }
MainWindow(ResourceFinder *rf) { //if (VERBOSE) fprintf(stderr, "Passing RF by address ..."); resFind = rf; //if (VERBOSE) fprintf(stderr, "done \n"); Property options; options.fromString(resFind->toString()); Value &robot = options.find("robot"); Value &part = options.find("part"); Value &rows = options.find("rows"); Value &cols = options.find("cols"); if (!options.check("robot")) printf("Missing --robot option. Using icub.\n"); if (!options.check("part")) printf("Missing --part option. Using head.\n"); if (!options.check("local")) printf("Missing --name option. Using /portScope/vector:i.\n"); if (!options.check("remote")) printf("Missing --remote option. Will wait for the connection...\n"); if (!options.check("rows")) printf("Missing --rows option. Disabling subplotting.\n"); //if (VERBOSE) fprintf(stderr, "Start plotting the GUI\n"); QToolBar *toolBar = new QToolBar(this); toolBar->setFixedHeight(80); #if QT_VERSION < 0x040000 setDockEnabled(TornOff, true); setRightJustification(true); #else toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); #endif QWidget *hBox = new QWidget(toolBar); QLabel *label = new QLabel("Timer Interval", hBox); QwtCounter *counter = new QwtCounter(hBox); QLabel *labelActions = new QLabel("Actions", hBox); QPushButton *toggleAcquireButton = new QPushButton("stop", hBox, "stop"); counter->setRange(-1.0, 1000.0, 1.0); QHBoxLayout *layout = new QHBoxLayout(hBox); layout->addWidget(label); layout->addWidget(counter); layout->addWidget(labelActions); layout->addWidget(toggleAcquireButton); layout->addWidget(new QWidget(hBox), 10); // spacer); #if QT_VERSION >= 0x040000 toolBar->addWidget(hBox); #endif addToolBar(toolBar); if (options.check("rows")) nRows = rows.asInt(); else nRows = 1; if (options.check("cols")) nCols = cols.asInt(); else nCols = nRows; nPlots = nRows*nCols; nPortInputsInPlots = new int[nPlots]; QGrid *grid = new QGrid( nRows, Qt::Vertical, this ); plot = new DataPlot*[nPlots]; setCentralWidget(grid); for( int r = 0 ; r < nRows ; r++ ) { for( int c = 0 ; c < nCols ; c++ ) { char rcS[256]; sprintf(rcS, "%d%d", r, c); ConstString rS(rcS); ConstString local; local = resFind->find("local").toString(); //local port name local = local + rcS; //dataPlot creation plot[r+nRows*c] = new DataPlot(grid); //dataPlot set plot to read from setInputPort(resFind, r+nRows*c, local); //dataPlot set indeces of ports to plot setIndexMask(resFind, r+nRows*c, nPortInputsInPlots[r+nRows*c]); } } for( int r = 0 ; r < nRows ; r++ ) { for( int c = 0 ; c < nCols ; c++ ) { //stop acquisition button connect( toggleAcquireButton, SIGNAL(clicked()), plot[r+nRows*c], SLOT(toggleAcquire()) ); plot[r+nRows*c]->initSignalDimensions(); //counter button connect(counter, SIGNAL(valueChanged(double)), plot[r+nRows*c], SLOT(setTimerInterval(double)) ); counter->setValue(50.0); QSizePolicy sizePolicy2(QSizePolicy::Maximum, QSizePolicy::Maximum); grid->setSizePolicy(sizePolicy2); QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); sizePolicy.setHeightForWidth(plot[r+nRows*c]->sizePolicy().hasHeightForWidth()); plot[r+nRows*c]->setSizePolicy(sizePolicy); //QSize gridSize= grid->sizeHint(); //gridSize.setWidth(500); //gridSize.setHeight(500); plot[r+nRows*c]->setMinimumWidth(10); plot[r+nRows*c]->setMaximumWidth(800); plot[r+nRows*c]->setMinimumHeight(10); plot[r+nRows*c]->setMaximumHeight(800); //if (VERBOSE) fprintf(stderr, "Grid max is: hInt=%d, vInt=%d\n", grid->maximumHeight(), grid->maximumWidth()); //if (VERBOSE) fprintf(stderr, "Plot max is: hInt=%d, vInt=%d\n", plot[r+nRows*c]->maximumHeight(), plot[r+nRows*c]->maximumWidth()); //QSize plotSize= plot[r+nRows*c]->sizeHint(); //if (VERBOSE) fprintf(stderr, "Plot Hint is: hInt=%d, vInt=%d\n", plotSize.height(), plotSize.width()); } } }
VectorizerPopup::VectorizerPopup(QWidget *parent, Qt::WFlags flags) #endif : Dialog(TApp::instance()->getMainWindow(), true, false, "Vectorizer"), m_sceneHandle(TApp::instance()->getCurrentScene()) { struct Locals { int m_bit; Locals() : m_bit() {} static void addParameterGroup( std::vector<ParamGroup> ¶mGroups, int group, int startRow, int separatorRow = -1) { assert(group <= paramGroups.size()); if (group == paramGroups.size()) paramGroups.push_back(ParamGroup(startRow, separatorRow)); } void addParameter( std::vector<ParamGroup> ¶mGroups, const QString ¶mName) { paramGroups.back().m_params.push_back(Param(paramName, m_bit++)); } } locals; // Su MAC i dialog modali non hanno bottoni di chiusura nella titleBar setModal(false); setWindowTitle(tr("Convert-to-Vector Settings")); setLabelWidth(125); setTopMargin(0); setTopSpacing(0); // Build vertical layout beginVLayout(); QSplitter *splitter = new QSplitter(Qt::Vertical, this); splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); addWidget(splitter); QToolBar *leftToolBar = new QToolBar, *rightToolBar = new QToolBar; { QWidget *toolbarsContainer = new QWidget(this); toolbarsContainer->setFixedHeight(22); addWidget(toolbarsContainer); QHBoxLayout *toolbarsLayout = new QHBoxLayout(toolbarsContainer); toolbarsContainer->setLayout(toolbarsLayout); toolbarsLayout->setMargin(0); toolbarsLayout->setSpacing(0); QToolBar *spacingToolBar = new QToolBar(toolbarsContainer); // The spacer object must be a toolbar. spacingToolBar->setFixedHeight(22); // It's related to qss choices... I know it's stinky toolbarsLayout->addWidget(leftToolBar, 0, Qt::AlignLeft); toolbarsLayout->addWidget(spacingToolBar, 1); toolbarsLayout->addWidget(rightToolBar, 0, Qt::AlignRight); } endVLayout(); // Build parameters area QScrollArea *paramsArea = new QScrollArea(splitter); paramsArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); paramsArea->setWidgetResizable(true); splitter->addWidget(paramsArea); splitter->setStretchFactor(0, 1); m_paramsWidget = new QFrame(paramsArea); paramsArea->setWidget(m_paramsWidget); m_paramsLayout = new QGridLayout; m_paramsWidget->setLayout(m_paramsLayout); int group = 0, row = 0; locals.addParameterGroup(::l_centerlineParamGroups, group, row); locals.addParameterGroup(::l_outlineParamGroups, group++, row); // Vectorization mode m_typeMenu = new QComboBox(this); m_typeMenu->setFixedSize(245, WidgetHeight); QStringList formats; formats << tr("Centerline") << tr("Outline"); m_typeMenu->addItems(formats); m_typeMenu->setMinimumHeight(WidgetHeight); bool isOutline = m_sceneHandle->getScene()->getProperties()->getVectorizerParameters()->m_isOutline; m_typeMenu->setCurrentIndex(isOutline ? 1 : 0); connect(m_typeMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(onTypeChange(int))); m_paramsLayout->addWidget(new QLabel(tr("Mode")), row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_typeMenu, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Mode")); locals.addParameter(l_outlineParamGroups, tr("Mode")); //-------------------- Parameters area - Centerline ------------------------ locals.addParameterGroup(l_centerlineParamGroups, group++, row); // Threshold m_cThresholdLabel = new QLabel(tr("Threshold")); m_cThreshold = new IntField(this); m_paramsLayout->addWidget(m_cThresholdLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cThreshold, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Threshold")); // Accuracy m_cAccuracyLabel = new QLabel(tr("Accuracy")); m_cAccuracy = new IntField(this); m_paramsLayout->addWidget(m_cAccuracyLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cAccuracy, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Accuracy")); // Despeckling m_cDespecklingLabel = new QLabel(tr("Despeckling")); m_cDespeckling = new IntField(this); m_paramsLayout->addWidget(m_cDespecklingLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cDespeckling, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Despeckling")); // Max Thickness m_cMaxThicknessLabel = new QLabel(tr("Max Thickness")); m_paramsLayout->addWidget(m_cMaxThicknessLabel, row, 0, Qt::AlignRight); m_cMaxThickness = new IntField(this); m_cMaxThickness->enableSlider(false); m_paramsLayout->addWidget(m_cMaxThickness, row++, 1, Qt::AlignLeft); locals.addParameter(l_centerlineParamGroups, tr("Max Thickness")); // Thickness Calibration m_cThicknessRatioLabel = new QLabel(tr("Thickness Calibration")); m_paramsLayout->addWidget(m_cThicknessRatioLabel, row, 0, Qt::AlignRight); /*m_cThicknessRatio = new IntField(this); paramsLayout->addWidget(m_cThicknessRatio, row++, 1);*/ QHBoxLayout *cThicknessRatioLayout = new QHBoxLayout; cThicknessRatioLayout->addSpacing(20); m_cThicknessRatioFirstLabel = new QLabel(tr("Start:")); cThicknessRatioLayout->addWidget(m_cThicknessRatioFirstLabel); m_cThicknessRatioFirst = new MeasuredDoubleLineEdit(this); m_cThicknessRatioFirst->setMeasure("percentage"); cThicknessRatioLayout->addWidget(m_cThicknessRatioFirst); m_cThicknessRatioLastLabel = new QLabel(tr("End:")); cThicknessRatioLayout->addWidget(m_cThicknessRatioLastLabel); m_cThicknessRatioLast = new MeasuredDoubleLineEdit(this); m_cThicknessRatioLast->setMeasure("percentage"); cThicknessRatioLayout->addWidget(m_cThicknessRatioLast); cThicknessRatioLayout->addStretch(1); m_paramsLayout->addLayout(cThicknessRatioLayout, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Thickness Calibration")); // Checkboxes { static const QString name = tr("Preserve Painted Areas"); locals.addParameter(l_centerlineParamGroups, name); m_cPaintFill = new CheckBox(name, this); m_cPaintFill->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cPaintFill, row++, 1); } { static const QString name = tr("Add Border"); locals.addParameter(l_centerlineParamGroups, name); m_cMakeFrame = new CheckBox(name, this); m_cMakeFrame->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cMakeFrame, row++, 1); } locals.addParameterGroup(l_centerlineParamGroups, group++, row + 1, row); m_cNaaSourceSeparator = new Separator(tr("Full color non-AA images")); m_paramsLayout->addWidget(m_cNaaSourceSeparator, row++, 0, 1, 2); { static const QString name = tr("Enhanced ink recognition"); locals.addParameter(l_centerlineParamGroups, name); m_cNaaSource = new CheckBox(name, this); m_cNaaSource->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cNaaSource, row++, 1); } //-------------------- Parameters area - Outline ------------------------ group = 1; locals.addParameterGroup(l_outlineParamGroups, group++, row); //Accuracy m_oAccuracyLabel = new QLabel(tr("Accuracy")); m_oAccuracy = new IntField(this); m_paramsLayout->addWidget(m_oAccuracyLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAccuracy, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Accuracy")); //Despeckling m_oDespecklingLabel = new QLabel(tr("Despeckling")); m_oDespeckling = new IntField(this); m_paramsLayout->addWidget(m_oDespecklingLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oDespeckling, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Despeckling")); //Paint Fill { static const QString name = tr("Preserve Painted Areas"); locals.addParameter(l_outlineParamGroups, name); m_oPaintFill = new CheckBox(name, this); m_oPaintFill->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_oPaintFill, row++, 1); } locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oCornersSeparator = new Separator(tr("Corners")); m_paramsLayout->addWidget(m_oCornersSeparator, row++, 0, 1, 2); //Adherence m_oAdherenceLabel = new QLabel(tr("Adherence")); m_oAdherence = new IntField(this); m_paramsLayout->addWidget(m_oAdherenceLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAdherence, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Adherence")); //Angle m_oAngleLabel = new QLabel(tr("Angle")); m_oAngle = new IntField(this); m_paramsLayout->addWidget(m_oAngleLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAngle, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Angle")); //Relative m_oRelativeLabel = new QLabel(tr("Curve Radius")); m_oRelative = new IntField(this); m_paramsLayout->addWidget(m_oRelativeLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oRelative, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Curve Radius")); locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oFullColorSeparator = new Separator(tr("Raster Levels")); m_paramsLayout->addWidget(m_oFullColorSeparator, row++, 0, 1, 2); //Max Colors m_oMaxColorsLabel = new QLabel(tr("Max Colors")); m_oMaxColors = new IntField(this); m_paramsLayout->addWidget(m_oMaxColorsLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oMaxColors, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Max Colors")); //Transparent Color m_oTransparentColorLabel = new QLabel(tr("Transparent Color"), this); m_oTransparentColor = new ColorField(this, true, TPixel32::Transparent, 48); m_paramsLayout->addWidget(m_oTransparentColorLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oTransparentColor, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Transparent Color")); locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oTlvSeparator = new Separator(tr("TLV Levels")); m_paramsLayout->addWidget(m_oTlvSeparator, row++, 0, 1, 2); //Tone Threshold m_oToneThresholdLabel = new QLabel(tr("Tone Threshold")); m_oToneThreshold = new IntField(this); m_paramsLayout->addWidget(m_oToneThresholdLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oToneThreshold, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Tone Threshold")); m_paramsLayout->setRowStretch(row, 1); //-------------------- Swatch area ------------------------ m_swatchArea = new VectorizerSwatchArea(this); splitter->addWidget(m_swatchArea); m_swatchArea->setEnabled(false); //Initally not enabled connect(this, SIGNAL(valuesChanged()), m_swatchArea, SLOT(invalidateContents())); //---------------------- Toolbar -------------------------- QAction *swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this); swatchAct->setCheckable(true); leftToolBar->addAction(swatchAct); QAction *centerlineAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Centerlines Check"), this); centerlineAct->setCheckable(true); leftToolBar->addAction(centerlineAct); QToolButton *visibilityButton = new QToolButton(this); visibilityButton->setIcon(createQIconPNG("options")); visibilityButton->setPopupMode(QToolButton::InstantPopup); QMenu *visibilityMenu = new QMenu(visibilityButton); visibilityButton->setMenu(visibilityMenu); rightToolBar->addWidget(visibilityButton); rightToolBar->addSeparator(); QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this); rightToolBar->addAction(saveAct); QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this); rightToolBar->addAction(loadAct); rightToolBar->addSeparator(); QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this); rightToolBar->addAction(resetAct); connect(swatchAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enablePreview(bool))); connect(centerlineAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enableDrawCenterlines(bool))); connect(visibilityMenu, SIGNAL(aboutToShow()), this, SLOT(populateVisibilityMenu())); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveParameters())); connect(loadAct, SIGNAL(triggered()), this, SLOT(loadParameters())); connect(resetAct, SIGNAL(triggered()), this, SLOT(resetParameters())); //------------------- Convert Button ---------------------- //Convert Button m_okBtn = new QPushButton(QString(tr("Convert")), this); connect(m_okBtn, SIGNAL(clicked()), this, SLOT(onOk())); addButtonBarWidget(m_okBtn); //All detailed signals convey to the unique valuesChanged() signal. That makes it easier //to disconnect update notifications whenever we loadConfiguration(..). connect(this, SIGNAL(valuesChanged()), this, SLOT(updateSceneSettings())); //Connect value changes to update the global VectorizerPopUpSettingsContainer. //connect(m_typeMenu,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(updateSceneSettings())); connect(m_cThreshold, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cAccuracy, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cMaxThickness, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); //connect(m_cThicknessRatio,SIGNAL(valueChanged(bool)),this,SLOT(onValueEdited(bool))); connect(m_cThicknessRatioFirst, SIGNAL(valueChanged()), this, SLOT(onValueEdited())); connect(m_cThicknessRatioLast, SIGNAL(valueChanged()), this, SLOT(onValueEdited())); connect(m_cMakeFrame, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_cPaintFill, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_cNaaSource, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_oAccuracy, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oPaintFill, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_oAdherence, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oAngle, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oRelative, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oMaxColors, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oTransparentColor, SIGNAL(colorChanged(const TPixel32 &, bool)), this, SLOT(onValueEdited(const TPixel32 &, bool))); connect(m_oToneThreshold, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); refreshPopup(); //Non e' corretto: manca la possibilita' di aggiornare la selezione del livello corrente // connect(TApp::instance()->getCurrentLevel(), SIGNAL(xshLevelChanged()), // this, SLOT(updateValues())); }
void TimeLine::initUI() { Q_ASSERT(editor() != nullptr); setWindowTitle(tr("Timeline")); QWidget* timeLineContent = new QWidget(this); mLayerList = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Layers); mTracks = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Tracks); mHScrollbar = new QScrollBar(Qt::Horizontal); mVScrollbar = new QScrollBar(Qt::Vertical); mVScrollbar->setMinimum(0); mVScrollbar->setMaximum(1); mVScrollbar->setPageStep(1); QWidget* leftWidget = new QWidget(); leftWidget->setMinimumWidth(120); QWidget* rightWidget = new QWidget(); QWidget* leftToolBar = new QWidget(); leftToolBar->setFixedHeight(30); QWidget* rightToolBar = new QWidget(); rightToolBar->setFixedHeight(30); // --- left widget --- // --------- layer buttons --------- QToolBar* layerButtons = new QToolBar(this); QLabel* layerLabel = new QLabel(tr("Layers:")); layerLabel->setIndent(5); QToolButton* addLayerButton = new QToolButton(this); addLayerButton->setIcon(QIcon(":icons/add.png")); addLayerButton->setToolTip(tr("Add Layer")); addLayerButton->setFixedSize(24, 24); QToolButton* removeLayerButton = new QToolButton(this); removeLayerButton->setIcon(QIcon(":icons/remove.png")); removeLayerButton->setToolTip(tr("Remove Layer")); removeLayerButton->setFixedSize(24, 24); layerButtons->addWidget(layerLabel); layerButtons->addWidget(addLayerButton); layerButtons->addWidget(removeLayerButton); layerButtons->setFixedHeight(30); QHBoxLayout* leftToolBarLayout = new QHBoxLayout(); leftToolBarLayout->setMargin(0); leftToolBarLayout->addWidget(layerButtons); leftToolBar->setLayout(leftToolBarLayout); QAction* newBitmapLayerAct = new QAction(QIcon(":icons/layer-bitmap.png"), tr("New Bitmap Layer"), this); QAction* newVectorLayerAct = new QAction(QIcon(":icons/layer-vector.png"), tr("New Vector Layer"), this); QAction* newSoundLayerAct = new QAction(QIcon(":icons/layer-sound.png"), tr("New Sound Layer"), this); QAction* newCameraLayerAct = new QAction(QIcon(":icons/layer-camera.png"), tr("New Camera Layer"), this); QMenu* layerMenu = new QMenu(tr("&Layer", "Timeline add-layer menu"), this); layerMenu->addAction(newBitmapLayerAct); layerMenu->addAction(newVectorLayerAct); layerMenu->addAction(newSoundLayerAct); layerMenu->addAction(newCameraLayerAct); addLayerButton->setMenu(layerMenu); addLayerButton->setPopupMode(QToolButton::InstantPopup); QGridLayout* leftLayout = new QGridLayout(); leftLayout->addWidget(leftToolBar, 0, 0); leftLayout->addWidget(mLayerList, 1, 0); leftLayout->setMargin(0); leftLayout->setSpacing(0); leftWidget->setLayout(leftLayout); // --- right widget --- // --------- key buttons --------- QToolBar* timelineButtons = new QToolBar(this); QLabel* keyLabel = new QLabel(tr("Keys:")); keyLabel->setIndent(5); QToolButton* addKeyButton = new QToolButton(this); addKeyButton->setIcon(QIcon(":icons/add.png")); addKeyButton->setToolTip(tr("Add Frame")); addKeyButton->setFixedSize(24, 24); QToolButton* removeKeyButton = new QToolButton(this); removeKeyButton->setIcon(QIcon(":icons/remove.png")); removeKeyButton->setToolTip(tr("Remove Frame")); removeKeyButton->setFixedSize(24, 24); QToolButton* duplicateKeyButton = new QToolButton(this); duplicateKeyButton->setIcon(QIcon(":icons/controls/duplicate.png")); duplicateKeyButton->setToolTip(tr("Duplicate Frame")); duplicateKeyButton->setFixedSize(24, 24); QLabel* zoomLabel = new QLabel(tr("Zoom:")); zoomLabel->setIndent(5); QSlider* zoomSlider = new QSlider(this); zoomSlider->setRange(4, 40); zoomSlider->setFixedWidth(74); zoomSlider->setValue(mTracks->getFrameSize()); zoomSlider->setToolTip(tr("Adjust frame width")); zoomSlider->setOrientation(Qt::Horizontal); QLabel* onionLabel = new QLabel(tr("Onion skin:")); QToolButton* onionTypeButton = new QToolButton(this); onionTypeButton->setIcon(QIcon(":icons/onion_type.png")); onionTypeButton->setToolTip(tr("Toggle match keyframes")); onionTypeButton->setFixedSize(24, 24); timelineButtons->addWidget(keyLabel); timelineButtons->addWidget(addKeyButton); timelineButtons->addWidget(removeKeyButton); timelineButtons->addWidget(duplicateKeyButton); timelineButtons->addSeparator(); timelineButtons->addWidget(zoomLabel); timelineButtons->addWidget(zoomSlider); timelineButtons->addSeparator(); timelineButtons->addWidget(onionLabel); timelineButtons->addWidget(onionTypeButton); timelineButtons->addSeparator(); timelineButtons->setFixedHeight(30); // --------- Time controls --------- mTimeControls = new TimeControls(this); mTimeControls->setEditor(editor()); mTimeControls->initUI(); mTimeControls->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); updateLength(); QHBoxLayout* rightToolBarLayout = new QHBoxLayout(); rightToolBarLayout->addWidget(timelineButtons); rightToolBarLayout->setAlignment(Qt::AlignLeft); rightToolBarLayout->addWidget(mTimeControls); rightToolBarLayout->setMargin(0); rightToolBarLayout->setSpacing(0); rightToolBar->setLayout(rightToolBarLayout); QGridLayout* rightLayout = new QGridLayout(); rightLayout->addWidget(rightToolBar, 0, 0); rightLayout->addWidget(mTracks, 1, 0); rightLayout->setMargin(0); rightLayout->setSpacing(0); rightWidget->setLayout(rightLayout); // --- Splitter --- QSplitter* splitter = new QSplitter(this); splitter->addWidget(leftWidget); splitter->addWidget(rightWidget); splitter->setSizes(QList<int>() << 100 << 600); QGridLayout* lay = new QGridLayout(); lay->addWidget(splitter, 0, 0); lay->addWidget(mVScrollbar, 0, 1); lay->addWidget(mHScrollbar, 1, 0); lay->setMargin(0); lay->setSpacing(0); timeLineContent->setLayout(lay); setWidget(timeLineContent); setWindowFlags(Qt::WindowStaysOnTopHint); connect(mHScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::hScrollChange); connect(mTracks, &TimeLineCells::offsetChanged, mHScrollbar, &QScrollBar::setValue); connect(mVScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::vScrollChange); connect(mVScrollbar, &QScrollBar::valueChanged, mLayerList, &TimeLineCells::vScrollChange); connect(splitter, &QSplitter::splitterMoved, this, &TimeLine::updateLength); connect(addKeyButton, &QToolButton::clicked, this, &TimeLine::addKeyClick); connect(removeKeyButton, &QToolButton::clicked, this, &TimeLine::removeKeyClick); connect(duplicateKeyButton, &QToolButton::clicked, this, &TimeLine::duplicateKeyClick); connect(zoomSlider, &QSlider::valueChanged, mTracks, &TimeLineCells::setFrameSize); connect(onionTypeButton, &QToolButton::clicked, this, &TimeLine::toogleAbsoluteOnionClick); connect(mTimeControls, &TimeControls::soundToggled, this, &TimeLine::soundClick); connect(mTimeControls, &TimeControls::fpsChanged, this, &TimeLine::fpsChanged); connect(mTimeControls, &TimeControls::fpsChanged, this, &TimeLine::updateLength); connect(mTimeControls, &TimeControls::playButtonTriggered, this, &TimeLine::playButtonTriggered); connect(newBitmapLayerAct, &QAction::triggered, this, &TimeLine::newBitmapLayer); connect(newVectorLayerAct, &QAction::triggered, this, &TimeLine::newVectorLayer); connect(newSoundLayerAct, &QAction::triggered, this, &TimeLine::newSoundLayer); connect(newCameraLayerAct, &QAction::triggered, this, &TimeLine::newCameraLayer); connect(removeLayerButton, &QPushButton::clicked, this, &TimeLine::deleteCurrentLayer); connect(mLayerList, &TimeLineCells::mouseMovedY, mLayerList, &TimeLineCells::setMouseMoveY); connect(mLayerList, &TimeLineCells::mouseMovedY, mTracks, &TimeLineCells::setMouseMoveY); connect(mTracks, &TimeLineCells::lengthChanged, this, &TimeLine::updateLength); connect(editor(), &Editor::currentFrameChanged, this, &TimeLine::updateFrame); LayerManager* layer = editor()->layers(); connect(layer, &LayerManager::layerCountChanged, this, &TimeLine::updateLayerNumber); scrubbing = false; }
MDIClass::MDIClass( QWidget* parent ) : MDIChild( parent ) { setObjectName( "MDIClass" ); setType( ctClass ); setWindowIcon( QIcon( ":/Icons/Icons/projectshowfile.png" ) ); // QVBoxLayout* vboxLayout = new QVBoxLayout( this ); vboxLayout->setObjectName( "vboxLayout" ); vboxLayout->setSpacing( 0 ); vboxLayout->setMargin( 0 ); // Toolbar QToolBar* tb = new QToolBar( tr( "Files" ), this ); tb->setFixedHeight( tb->height() ); tb->setIconSize( QSize(16, 16 ) ); // Action Group aGroup = new QActionGroup( this ); aGroup->setObjectName( "aGroup" ); // Actions actionForm = new QAction( QIcon( ":/Icons/Icons/form.png" ), tr( "Form" ), this ); actionForm->setCheckable( true ); aGroup->addAction( actionForm ); actionHeader = new QAction( QIcon( ":/Icons/Icons/h.png" ), tr( "Header" ), this ); actionHeader->setCheckable( true ); aGroup->addAction( actionHeader ); actionSource = new QAction( QIcon( ":/Icons/Icons/cpp.png" ), tr( "Source" ), this ); actionSource->setCheckable( true ); aGroup->addAction( actionSource ); tb->addActions( aGroup->actions() ); vboxLayout->addWidget( tb ); // Workspace wSpace = new QWorkspace( this ); wSpace->setObjectName( "wSpace" ); vboxLayout->addWidget( wSpace ); // Form // Header teHeader = new TextEditor( this ); teHeader->setObjectName( "teHeader" ); teHeader->setFrameShape( QFrame::NoFrame ); teHeader->setFrameShadow( QFrame::Plain ); teHeader->setMidLineWidth( 1 ); teHeader->setDefaultComponents( true ); teHeader->setWindowIcon( actionHeader->icon() ); setSettings( teHeader ); connect( teHeader, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) ); connect( teHeader->completion(), SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) ); connect( teHeader->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) ); connect( teHeader, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) ); connect( teHeader, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) ); wSpace->addWindow( teHeader, Qt::WindowTitleHint ); // Source teSource = new TextEditor( this ); teSource->setObjectName( "teSource" ); teSource->setFrameShape( QFrame::NoFrame ); teSource->setFrameShadow( QFrame::Plain ); teSource->setMidLineWidth( 1 ); teSource->setDefaultComponents( true ); teSource->setWindowIcon( actionSource->icon() ); setSettings( teSource ); connect( teSource, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) ); connect( teSource, SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) ); connect( teSource->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) ); connect( teSource, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) ); connect( teSource, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) ); wSpace->addWindow( teSource, Qt::WindowTitleHint ); // Connections QMetaObject::connectSlotsByName( this ); }
FilterWindow::FilterWindow() { id = 0; QToolBar *toolBar = new QToolBar(this); QToolBar *lowerToolBar = new QToolBar(this); //lowerToolBar->setFixedHeight(80); toolBar->setFixedHeight(80); #if QT_VERSION < 0x040000 setDockEnabled(TornOff, true); setRightJustification(true); #else toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); lowerToolBar->setAllowedAreas(Qt::BottomToolBarArea); #endif QWidget *hBox = new QWidget(toolBar); QWidget *lowerBox = new QWidget(lowerToolBar); QLabel *label = new QLabel("Frequency", hBox); QLabel *clabel = new QLabel("Range Max", hBox); QLabel *mlabel = new QLabel("Range Min", hBox); QwtCounter *counter = new QwtCounter(hBox); QwtCounter *rangeCounter = new QwtCounter(hBox); QwtCounter *minCounter = new QwtCounter(hBox); QPushButton *scaleButton = new QPushButton("&Autoscale", hBox); QPushButton *mgxButton = new QPushButton("MG&x", lowerBox); QPushButton *avgButton = new QPushButton("Local Avg", lowerBox); QPushButton *eButton = new QPushButton("e", lowerBox); QPushButton *fButton = new QPushButton("f[n]", lowerBox); QPushButton *mavgButton = new QPushButton("Moving Avg", lowerBox); QwtKnob *rcKnob = new QwtKnob(lowerBox); rcKnob->setRange(0,5,.1,0); rcKnob->setScaleMaxMajor(10); rcKnob->setValue(5.0); QLabel *rcLabel = new QLabel("RC", rcKnob); rcLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); QwtKnob *dtKnob = new QwtKnob(lowerBox); dtKnob->setRange(0,5,.1,0); dtKnob->setScaleMaxMajor(10); dtKnob->setValid(1.0); QLabel *dtLabel = new QLabel("Dt", dtKnob); dtLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); QwtKnob *duKnob = new QwtKnob(lowerBox); duKnob->setRange(0,5000,10,1); duKnob->setScaleMaxMajor(10); duKnob->setValid(1.0); QLabel *duLabel = new QLabel("Du", duKnob); duLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); // Sets the range and increment of the widgets counter->setRange(-1.0, 2000.0, 10.0); rangeCounter->setRange(-1048576.0,INT_MAX,100.0); minCounter->setRange(-1048576.0, INT_MAX, 100.0); QHBoxLayout *layout = new QHBoxLayout(hBox); layout->addWidget(label); layout->addWidget(counter); layout->addWidget(clabel); layout->addWidget(rangeCounter); layout->addWidget(mlabel); layout->addWidget(minCounter); layout->addWidget(scaleButton); QHBoxLayout *lowerLayout = new QHBoxLayout(lowerBox); lowerLayout->addWidget(mgxButton); lowerLayout->addWidget(avgButton); lowerLayout->addWidget(eButton); lowerLayout->addWidget(fButton); lowerLayout->addWidget(mavgButton); lowerLayout->addWidget(rcKnob); lowerLayout->addWidget(dtKnob); lowerLayout->addWidget(duKnob); // layout->addWidget(new QWidget(hBox), 10); // spacer); #if QT_VERSION >= 0x040000 toolBar->addWidget(hBox); lowerToolBar->addWidget(lowerBox); #endif addToolBar(toolBar); // Instantiates the plot, this being the parent widget plot = new FilteredDataPlot(this); setCentralWidget(plot); addToolBarBreak(Qt::TopToolBarArea); addToolBar(lowerToolBar); // Connect signals connect(counter, SIGNAL(valueChanged(double)), plot, SLOT(setTimerInterval(double)) ); connect(rangeCounter, SIGNAL(valueChanged(double)), plot, SLOT(setRange(double))); connect(minCounter, SIGNAL(valueChanged(double)), plot, SLOT(setMinRange(double))); connect(mgxButton, SIGNAL(clicked()), plot, SLOT(detachMgx())); connect(avgButton, SIGNAL(clicked()), plot, SLOT(detachAvg())); connect(eButton,SIGNAL(clicked()), plot, SLOT(detachE())); connect(fButton, SIGNAL(clicked()), plot, SLOT(detachF())); connect(mavgButton, SIGNAL(clicked()), plot, SLOT(detachMavg())); connect(scaleButton, SIGNAL(clicked()), plot, SLOT(autoScale())); connect(scaleButton, SIGNAL(clicked()), plot->getDataFilter(), SLOT(resetLocalMax())); connect(rcKnob, SIGNAL(valueChanged(double)), plot->getDataFilter(), SLOT(setRc(double)) ); connect(dtKnob, SIGNAL(valueChanged(double)), plot->getDataFilter(), SLOT(setDt(double)) ); connect(duKnob, SIGNAL(valueChanged(double)), plot->getDataFilter(), SLOT(setU(double))); counter->setValue(50.0); rangeCounter->setValue(10000.0); minCounter->setValue(2000); }