MemoryViewer::MemoryViewer(RobotMemoryManager::const_ptr memoryManager) : memoryManager(memoryManager) { MRawImages::const_ptr rawImages = memoryManager->getMemory()->get<MRawImages>(); FastYUVToBMPImage* rawTopBMP = new FastYUVToBMPImage(rawImages, Camera::TOP, this); FastYUVToBMPImage* rawBottomBMP = new FastYUVToBMPImage(rawImages, Camera::BOTTOM, this); VisualInfoImage* shapesBottom = new VisualInfoImage(memoryManager->getMemory()->get<MVision>(), Camera::BOTTOM); VisualInfoImage* shapesTop = new VisualInfoImage(memoryManager->getMemory()->get<MVision>(), Camera::TOP); OverlayedImage* comboBottom = new OverlayedImage(rawBottomBMP, shapesBottom, this); OverlayedImage* comboTop = new OverlayedImage(rawTopBMP, shapesTop, this); BMPImageViewer* bottomImageViewer = new BMPImageViewer(comboBottom, this); BMPImageViewer* topImageViewer = new BMPImageViewer(comboTop, this); BMPImageViewer* top = new BMPImageViewer(comboTop, this); BMPImageViewer* bottom = new BMPImageViewer(comboBottom, this); QHBoxLayout* mainLayout = new QHBoxLayout; QWidget* mainWidget = new QWidget; QTabWidget* imageTabs = new QTabWidget(); imageTabs->addTab(topImageViewer, QString("Top Image")); imageTabs->addTab(bottomImageViewer, QString("Bottom Image")); mainLayout->addWidget(imageTabs); mainWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); mainWidget->setLayout(mainLayout); this->setCentralWidget(mainWidget); //TODO: we call updateView twice per vision frame memoryManager->connectSlot(bottomImageViewer, SLOT(updateView()), "MVision"); memoryManager->connectSlot(topImageViewer, SLOT(updateView()), "MVision"); //need another set of these to connect the BMPImageViewer copies (top, bottom) memoryManager->connectSlot(bottom, SLOT(updateView()), "MVision"); memoryManager->connectSlot(top, SLOT(updateView()), "MVision"); //corner ownership this->setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); this->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); Memory::const_ptr memory = memoryManager->getMemory(); std::vector<QTreeView> messageViewers; for (Memory::const_iterator iterator = memory->begin(); iterator != memory->end(); iterator++) { if (iterator->first != "MRawImages" && iterator->first != "GroundTruth") { QDockWidget* dockWidget = new QDockWidget(QString(iterator->first.c_str()), this); dockWidget->setMinimumWidth(300); dockWidget->setMaximumHeight(125); MObjectViewer* view = new MObjectViewer(iterator->second, dockWidget); dockWidget->setWidget(view); this->addDockWidget(Qt::RightDockWidgetArea, dockWidget); memoryManager->connectSlot(view, SLOT(updateView()), iterator->first); } } }
//----------------------------------------------------------------------------- ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent), _saved(false), _WWHEnabled(0) { // kDebug(11001) << ": ConfigDialog"; setWindowTitle( i18n("Configure Highscores") ); setModal( true ); QWidget *page = 0; QTabWidget *tab = 0; QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); if ( internal->isWWHSAvailable() ) { tab = new QTabWidget(this); layout->addWidget(tab); page = new QWidget; tab->addTab(page, i18n("Main")); } else { page = new QWidget(this); layout->addWidget(page); } QGridLayout *pageTop = new QGridLayout(page); //pageTop->setMargin(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); //pageTop->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); layout->addLayout(pageTop); QLabel *label = new QLabel(i18n("Nickname:"), page); pageTop->addWidget(label, 0, 0); _nickname = new QLineEdit(page); connect(_nickname, SIGNAL(textChanged(QString)), SLOT(modifiedSlot())); connect(_nickname, SIGNAL(textChanged(QString)), SLOT(nickNameChanged(QString))); _nickname->setMaxLength(16); pageTop->addWidget(_nickname, 0, 1); label = new QLabel(i18n("Comment:"), page); pageTop->addWidget(label, 1, 0); _comment = new QLineEdit(page); connect(_comment, SIGNAL(textChanged(QString)), SLOT(modifiedSlot())); _comment->setMaxLength(50); pageTop->addWidget(_comment, 1, 1); if (tab) { _WWHEnabled = new QCheckBox(i18n("World-wide highscores enabled"), page); connect(_WWHEnabled, SIGNAL(toggled(bool)), SLOT(modifiedSlot())); pageTop->addWidget(_WWHEnabled, 2, 0, 1, 2 ); // advanced tab QWidget *page = new QWidget; tab->addTab(page, i18n("Advanced")); QVBoxLayout *pageTop = new QVBoxLayout(page); //pageTop->setMargin(QApplication::style()->pixelMetric(QStyle::PM_DefaultChildMargin)); //pageTop->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); QGroupBox *group = new QGroupBox(page); group->setTitle( i18n("Registration Data") ); pageTop->addWidget(group); QGridLayout *groupLayout = new QGridLayout(group); //groupLayout->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); label = new QLabel(i18n("Nickname:"), group); groupLayout->addWidget(label, 0, 0); _registeredName = new KLineEdit(group); _registeredName->setReadOnly(true); groupLayout->addWidget(_registeredName, 0, 1); label = new QLabel(i18n("Key:"), group); groupLayout->addWidget(label, 1, 0); _key = new KLineEdit(group); _key->setReadOnly(true); groupLayout->addWidget(_key, 1, 1); KGuiItem gi = KStandardGuiItem::clear(); gi.setText(i18n("Remove")); _removeButton = new QPushButton(group); KGuiItem::assign(_removeButton, gi); groupLayout->addWidget(_removeButton, 2, 0); connect(_removeButton, SIGNAL(clicked()), SLOT(removeSlot())); } buttonBox = new QDialogButtonBox(this); buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // TODO mapping for Apply button pageTop->addWidget(buttonBox); load(); buttonBox->button(QDialogButtonBox::Ok)->setEnabled( !_nickname->text().isEmpty() ); buttonBox->button(QDialogButtonBox::Apply)->setEnabled( false ); }
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QgsDistanceArea myDa, QWidget* parent, bool showDialogButtons ) : QObject( parent ) , mDialog( 0 ) , mSettingsPath( "/Windows/AttributeDialog/" ) , mLayer( vl ) , mFeature( thepFeature ) , mFeatureOwner( featureOwner ) , mHighlight( 0 ) , mFormNr( -1 ) , mShowDialogButtons( showDialogButtons ) { if ( !mFeature || !vl->dataProvider() ) return; const QgsFields &theFields = vl->pendingFields(); if ( theFields.isEmpty() ) return; QgsAttributes myAttributes = mFeature->attributes(); QDialogButtonBox *buttonBox = NULL; if ( vl->editorLayout() == QgsVectorLayer::UiFileLayout && !vl->editForm().isEmpty() ) { // UI-File defined layout QFile file( vl->editForm() ); if ( file.open( QFile::ReadOnly ) ) { QUiLoader loader; QFileInfo fi( vl->editForm() ); loader.setWorkingDirectory( fi.dir() ); QWidget *myWidget = loader.load( &file, parent ); file.close(); mDialog = qobject_cast<QDialog*>( myWidget ); buttonBox = myWidget->findChild<QDialogButtonBox*>(); } } else if ( vl->editorLayout() == QgsVectorLayer::TabLayout ) { // Tab display mDialog = new QDialog( parent ); QGridLayout *gridLayout; QTabWidget *tabWidget; mDialog->resize( 447, 343 ); gridLayout = new QGridLayout( mDialog ); gridLayout->setObjectName( QString::fromUtf8( "gridLayout" ) ); tabWidget = new QTabWidget( mDialog ); gridLayout->addWidget( tabWidget ); foreach ( const QgsAttributeEditorElement *widgDef, vl->attributeEditorElements() ) { QWidget* tabPage = new QWidget( tabWidget ); tabWidget->addTab( tabPage, widgDef->name() ); QGridLayout *tabPageLayout = new QGridLayout( tabPage ); if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer ) { tabPageLayout->addWidget( QgsAttributeEditor::createWidgetFromDef( widgDef, tabPage, vl, myAttributes, mProxyWidgets, false ) ); } else { QgsDebugMsg( "No support for fields in attribute editor on top level" ); } } buttonBox = new QDialogButtonBox( mDialog ); buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) ); gridLayout->addWidget( buttonBox ); }
AboutWidget::AboutWidget() { setWindowTitle(tr("About QMPlay2")); setAttribute(Qt::WA_DeleteOnClose); QString labelText; labelText += "<b>QMPlay2:</b> " + tr("video and audio player"); labelText += "<br/><b>" + tr("Programmer") + ":</b> <a href='mailto:[email protected]'>Błażej Szczygieł</a>"; labelText += "<br/><b>" + tr("Version") + ":</b> " + QMPlay2Core.getSettings().getString("Version"); QLabel *label = new QLabel(labelText); QLabel *iconL = new QLabel; iconL->setPixmap(Functions::getPixmapFromIcon(QMPlay2Core.getQMPlay2Icon(), QSize(128, 128), this)); QPalette palette; palette.setBrush(QPalette::Base, palette.window()); QTabWidget *tabW = new QTabWidget; const QFont font(QFontDatabase::systemFont(QFontDatabase::FixedFont)); logE = new QPlainTextEdit; logE->setFont(font); logE->setPalette(palette); logE->setFrameShape(QFrame::NoFrame); logE->setFrameShadow(QFrame::Plain); logE->setReadOnly(true); logE->setLineWrapMode(QPlainTextEdit::NoWrap); logE->viewport()->setProperty("cursor", QCursor(Qt::ArrowCursor)); tabW->addTab(logE, tr("Logs")); clE = new QPlainTextEdit; clE->setFont(font); clE->setPalette(palette); clE->setFrameShape(QFrame::NoFrame); clE->setFrameShadow(QFrame::Plain); clE->setReadOnly(true); clE->viewport()->setProperty("cursor", QCursor(Qt::ArrowCursor)); tabW->addTab(clE, tr("Change log")); auE = new QPlainTextEdit; auE->setFont(font); auE->setPalette(palette); auE->setFrameShape(QFrame::NoFrame); auE->setFrameShadow(QFrame::Plain); auE->setReadOnly(true); auE->viewport()->setProperty("cursor", QCursor(Qt::ArrowCursor)); tabW->addTab(auE, tr("Contributors")); clrLogB = new QPushButton; clrLogB->setText(tr("Clear log")); QPushButton *closeB = new QPushButton; closeB->setText(tr("Close")); closeB->setShortcut(QKeySequence("ESC")); QGridLayout *layout = new QGridLayout; layout->setContentsMargins(2, 2, 2, 2); layout->addWidget(iconL, 0, 0, 1, 1); layout->addWidget(label, 0, 1, 1, 2); layout->addWidget(tabW, 1, 0, 1, 3); layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 2, 0, 1, 1); //hSpacer layout->addWidget(clrLogB, 2, 1, 1, 1); layout->addWidget(closeB, 2, 2, 1, 1); setLayout(layout); connect(label, SIGNAL(linkActivated(const QString &)), this, SLOT(linkActivated(const QString &))); connect(clrLogB, SIGNAL(clicked()), this, SLOT(clrLog())); connect(closeB, SIGNAL(clicked()), this, SLOT(close())); connect(tabW, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); connect(&logWatcher, SIGNAL(fileChanged(const QString &)), this, SLOT(refreshLog())); show(); }
KawaiiGL::KawaiiGL(QWidget *parent) : QMainWindow(parent), m_kView(NULL), m_edDlg(NULL), m_doc(NULL) { ui.setupUi(this); m_sett.loadFromReg(); connect(&m_sett, SIGNAL(changed()), &m_sett, SLOT(storeToReg())); setWindowTitle("KawaiiGL"); show(); // needed becase we're creating display lists in the c'tor. QDir::setCurrent(EXAMPLES_DIR); // we're reading the config and textures from there m_progMenu = new QMenu(this); m_modelsMenu = new QMenu(this); m_doc = new Document(this); // adds to the menus m_progMenu->addSeparator(); QAction *loadFromFileAct = m_progMenu->addAction("From file..."); connect(loadFromFileAct, SIGNAL(triggered(bool)), m_doc, SLOT(loadProgramFile())); m_kView = new T2GLWidget(this, m_doc); setCentralWidget(m_kView); m_edDlg = new KwEdit(this, m_sett.disp, m_doc, m_kView); // need the view for tracking vec2s m_edDlg->show(); m_edDlg->move(pos() + QPoint(width() - 20, 30)); m_control = new MyDialog(this); QBoxLayout *control_l = new QVBoxLayout(); m_control->setLayout(control_l); control_l->setMargin(0); control_l->setSpacing(0); QTabWidget *tabs = new QTabWidget(); control_l->addWidget(tabs); m_contDlg = new ControlPanel(&m_sett.disp, this, m_doc, m_kView); tabs->addTab(m_contDlg, "Config"); m_browse = new ProjBrowser(this, m_doc); tabs->addTab(m_browse, "Browser"); tabs->setCurrentWidget(m_browse); //tabs->setCurrentIndex(m_sett.gui.configWindowTab); tabs->setCurrentIndex(0); m_control->show(); m_control->move(pos() + QPoint(-30, 20)); m_control->resize(100, 100); // make it as small as possible m_doc->model()->m_errAct = new ErrorHighlight(m_edDlg); connect(m_kView, SIGNAL(message(const QString&)), this, SLOT(message(const QString&))); connect(m_edDlg, SIGNAL(changedModel(DocSrc*)), m_doc, SLOT(calc(DocSrc*))); connect(m_edDlg, SIGNAL(updateShaders()), m_doc, SLOT(compileShaders())); // connect(m_kView, SIGNAL(decompProgChanged(const QString&)), m_edDlg, SLOT(curChanged(const QString&))); connect(m_doc, SIGNAL(loaded()), m_kView, SLOT(newModelLoaded())); //connect(m_doc, SIGNAL(loaded()), m_edDlg, SLOT(doVarsUpdate())); // parsed new text. vars defs may be wrong connect(m_doc, SIGNAL(modelChanged()), m_kView, SLOT(updateGL())); connect(m_doc, SIGNAL(progChanged()), m_kView, SLOT(redoFrameBuffers())); connect(m_kView, SIGNAL(changedFBOs()), m_contDlg, SLOT(updateTexEdits())); connect(m_kView, SIGNAL(makeGradientTex(int, const QString&)), m_contDlg, SLOT(externalGradient(int, const QString&))); connect(m_doc, SIGNAL(progParamChanged()), m_kView, SLOT(updateGL())); connect(m_doc, SIGNAL(addModelLine(const QString&)), m_edDlg, SLOT(addModelLine(const QString&))); connect(m_contDlg, SIGNAL(changedRend()), m_doc, SLOT(calcNoParse())); // passes update connect(m_contDlg, SIGNAL(changedFont()), m_kView, SLOT(updateCoordFont())); connect(m_contDlg, SIGNAL(doUpdate()), m_kView, SLOT(updateGL())); // passes update connect(m_contDlg, SIGNAL(resetView()), m_kView, SLOT(resetState())); connect(m_contDlg, SIGNAL(resetLight()), m_kView, SLOT(resetLight())); connect(m_contDlg, SIGNAL(changedTexFile(int)), m_kView, SLOT(setTexture(int))); // connect(m_contDlg, SIGNAL(reassertTex(int)), m_kView, SLOT(rebindTexture(int))); connect(m_contDlg, SIGNAL(saveMesh()), m_doc, SLOT(calcSave())); connect(m_browse, SIGNAL(openDocText(DocElement*)), m_edDlg, SLOT(addPage(DocElement*)) ); connect(m_browse, SIGNAL(openPassConf(DocElement*)), m_edDlg, SLOT(addPage(DocElement*)) ); connect(m_browse, SIGNAL(commitGuiData()), m_edDlg, SLOT(commitAll())); connect(m_doc, SIGNAL(goingToClearProg()), m_edDlg, SLOT(clearingProg())); connect(m_doc, SIGNAL(didReadProg(ProgKeep*)), m_edDlg, SLOT(readProg(ProgKeep*)) ); connect(m_doc, SIGNAL(didReadProg(ProgKeep*)), m_browse, SLOT(readProg(ProgKeep*)) ); connect(m_doc, SIGNAL(didReadModel(DocSrc*)), m_browse, SLOT(readModel()) ); connect(m_doc, SIGNAL(didReadModel(DocSrc*)), m_edDlg, SLOT(readModel(DocSrc*))); connect(&m_sett.disp.bVtxNormals, SIGNAL(changed()), m_doc, SLOT(calcNoParse())); // TBD - this is bad. connect(m_contDlg->ui.clipSlider, SIGNAL(valueChanged(int)), m_kView, SLOT(setClipValue(int))); m_kView->setContextMenuPolicy(Qt::ActionsContextMenu); QPushButton *viewBot = new QPushButton("View"); viewBot->setMaximumSize(60, 19); statusBar()->addPermanentWidget(viewBot); QMenu *view = new QMenu("View"); viewBot->setMenu(view); QPushButton *fpsBot = new QPushButton(QIcon(":/images/arrow-circle.png"), QString()); fpsBot->setMaximumSize(20, 19); statusBar()->addPermanentWidget(fpsBot); (new CheckBoxIn(&m_sett.disp.fullFps, fpsBot))->reload(); QCheckBox *vSyncBox = new QCheckBox("vSync"); vSyncBox->setMaximumHeight(19); statusBar()->addPermanentWidget(vSyncBox); (new CheckBoxIn(&m_sett.disp.vSync, vSyncBox))->reload(); QAction *confVis = new QAction("Display", view); view->addAction(confVis); m_control->connectAction(confVis); QAction *editVis = new QAction("Edit", view); view->addAction(editVis); m_edDlg->connectAction(editVis); m_kView->connectedInit(); processCmdArgs(); }
QWidget *QmlProfilerTool::createWidgets() { // Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); // Utils::FancyMainWindow *mw = analyzerMgr->mainWindow(); QWidget *mw = this; d->m_traceWindow = new TraceWindow(mw); d->m_traceWindow->reset(d->m_client); connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int))); connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal))); d->m_statistics = new QmlProfilerEventStatistics(mw); d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView); connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); connect(d->m_traceWindow, SIGNAL(viewUpdated()), d->m_statistics, SLOT(complete())); connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView); connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics); d->m_callerView->setViewType(QmlProfilerEventsView::CallersView); connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); #if 0 Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); Core::ActionContainer *manalyzer = am->actionContainer(Analyzer::Constants::M_DEBUG_ANALYZER); const Core::Context globalcontext(Core::Constants::C_GLOBAL); d->m_attachAction = new QAction(tr("Attach..."), manalyzer); Core::Command *command = am->registerAction(d->m_attachAction, Constants::ATTACH, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); //manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP); connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach())); updateAttachAction(false); QDockWidget *eventsDock = AnalyzerManager::createDockWidget (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea); QDockWidget *timelineDock = AnalyzerManager::createDockWidget (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea); QDockWidget *calleeDock = AnalyzerManager::createDockWidget (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea); QDockWidget *callerDock = AnalyzerManager::createDockWidget (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea); mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical); mw->tabifyDockWidget(eventsDock, timelineDock); mw->tabifyDockWidget(timelineDock, calleeDock); mw->tabifyDockWidget(calleeDock, callerDock); #endif QTabWidget *tabWidget = new QTabWidget; tabWidget->addTab(d->m_eventsView, tr("Events")); tabWidget->addTab(d->m_traceWindow, tr("Timeline")); tabWidget->addTab(d->m_calleeView, tr("Callees")); tabWidget->addTab(d->m_callerView, tr("Callers")); // // Toolbar // QWidget *toolbarWidget = new QWidget; toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget")); QHBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->setSpacing(0); d->m_recordButton = new QToolButton(toolbarWidget); // icon and tooltip set in setRecording(), called later d->m_recordButton->setCheckable(true); connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool))); d->m_recordButton->setChecked(true); layout->addWidget(d->m_recordButton); d->m_clearButton = new QToolButton(toolbarWidget); d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png"))); d->m_clearButton->setToolTip(tr("Discard data")); connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay())); layout->addWidget(d->m_clearButton); QLabel *timeLabel = new QLabel(tr("Elapsed: 0 s")); QPalette palette = timeLabel->palette(); palette.setColor(QPalette::WindowText, Qt::white); timeLabel->setPalette(palette); timeLabel->setIndent(10); connect(this, SIGNAL(setTimeLabel(QString)), timeLabel, SLOT(setText(QString))); layout->addWidget(timeLabel); toolbarWidget->setLayout(layout); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(toolbarWidget); mainLayout->addWidget(tabWidget); return toolbarWidget; }
BioXASXASScanConfigurationEditor::BioXASXASScanConfigurationEditor(BioXASXASScanConfiguration *configuration, QWidget *parent) : BioXASXASScanConfigurationView(parent) { // Create scan name editor. QLabel *namePrompt = new QLabel("Name: "); nameLineEdit_ = new QLineEdit(); // Create scan energy editor. QLabel *energyPrompt = new QLabel("Energy: "); energySpinBox_ = new QDoubleSpinBox(); energySpinBox_->setSuffix(" eV"); energySpinBox_->setMinimum(0); energySpinBox_->setMaximum(30000); edgeEditor_ = new BioXASXASScanConfigurationEdgeEditor(0); // Create scan regions editor. regionsEditor_ = new BioXASXASScanConfigurationRegionsEditor(0); // Create scan detectors editor. scientificDetectorsView_ = new AMGenericStepScanConfigurationDetectorsView(0, BioXASBeamline::bioXAS()->exposedScientificDetectors()); QVBoxLayout *scientificDetectorsWidgetLayout = new QVBoxLayout(); scientificDetectorsWidgetLayout->addWidget(scientificDetectorsView_); scientificDetectorsWidgetLayout->addStretch(); QWidget *scientificDetectorsWidget = new QWidget(); scientificDetectorsWidget->setLayout(scientificDetectorsWidgetLayout); allDetectorsView_ = new AMGenericStepScanConfigurationDetectorsView(0, BioXASBeamline::bioXAS()->defaultXASScanDetectorOptions()); QVBoxLayout *allDetectorsWidgetLayout = new QVBoxLayout(); allDetectorsWidgetLayout->addWidget(allDetectorsView_); allDetectorsWidgetLayout->addStretch(); QWidget *allDetectorsWidget = new QWidget(); allDetectorsWidget->setLayout(allDetectorsWidgetLayout); QTabWidget *detectorsViews = new QTabWidget(); detectorsViews->addTab(scientificDetectorsWidget, "Scientific"); detectorsViews->addTab(allDetectorsWidget, "All"); exportSpectraCheckBox_ = new QCheckBox("Export spectra"); collectICRsCheckBox_ = new QCheckBox("Collect ICRs"); // Create and set main layouts QHBoxLayout *edgeEditorLayout = new QHBoxLayout(); edgeEditorLayout->addStretch(); edgeEditorLayout->addWidget(edgeEditor_); QGridLayout *propertiesLayout = new QGridLayout(); propertiesLayout->addWidget(namePrompt, 0, 0, 1, 1, Qt::AlignRight); propertiesLayout->addWidget(nameLineEdit_, 0, 1); propertiesLayout->addWidget(energyPrompt, 1, 0, 1, 1, Qt::AlignRight); propertiesLayout->addWidget(energySpinBox_, 1, 1); propertiesLayout->addLayout(edgeEditorLayout, 1, 2); QVBoxLayout *scanBoxLayout = new QVBoxLayout(); scanBoxLayout->addLayout(propertiesLayout); scanBoxLayout->addWidget(regionsEditor_); QGroupBox *scanBox = new QGroupBox("Scan"); scanBox->setLayout(scanBoxLayout); QVBoxLayout *detectorBoxLayout = new QVBoxLayout(); detectorBoxLayout->addWidget(detectorsViews); detectorBoxLayout->addWidget(exportSpectraCheckBox_); detectorBoxLayout->addWidget(collectICRsCheckBox_); detectorBoxLayout->addStretch(); QGroupBox *detectorBox = new QGroupBox("Detectors"); detectorBox->setLayout(detectorBoxLayout); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(scanBox); layout->addWidget(detectorBox); setLayout(layout); // Make connections. connect( nameLineEdit_, SIGNAL(textChanged(QString)), this, SLOT(updateConfigurationName()) ); connect( energySpinBox_, SIGNAL(valueChanged(double)), this, SLOT(updateConfigurationEnergy()) ); connect( exportSpectraCheckBox_, SIGNAL(clicked(bool)), this, SLOT(updateConfigurationExportSpectraPreference()) ); connect( collectICRsCheckBox_, SIGNAL(clicked(bool)), this, SLOT(updateConfigurationCollectICRsPreference()) ); // Current settings. setConfiguration(configuration); }
CVectorWindow::CVectorWindow() : QWidget( NULL ), theActualImage(NULL), theActualOverlay(NULL) { dImageLut[0] = 0.0; dImageLut[1] = 127.0; dOverlayLut[0] = 0.0; dOverlayLut[1] = 1.0; dImageClampValues[0] = 0.0; dImageClampValues[1] = 127.0; dOverlayClampValues[0] = 0.0; dOverlayClampValues[1] = 1.0; //setFixedSize(260,260); setMinimumSize(256,256); aGlobalColumnPtr = new QVBox( this ); aGlobalColumnPtr->setGeometry(0,0,250,250); aGlobalColumnPtr->setMargin(2); aGlobalColumnPtr->setSpacing(8); display = new vtkQtRenderWindow( aGlobalColumnPtr ); //display->setMinimumSize(128,128); interactor = vtkQtRenderWindowInteractor::New(); interactor->SetRenderWindow( display ); interactor->SetInteractorStyle( vtkInteractorStyleImage::New() ); renderer = vtkRenderer::New(); display->AddRenderer( renderer ); theImageLookupTable = vtkLookupTable::New(); theImageLookupTable->SetTableRange( 0.0, 127.0 ); theImageLookupTable->SetRampToLinear(); theImageLookupTable->SetSaturationRange( 0.0, 0.0 ); theImageLookupTable->SetValueRange( 0.0, 1.0 ); theImageLookupTable->SetHueRange( 0.0, 0.0); theImageLookupTable->Build(); theImageLookupTable->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 ); theImageColorBar = vtkScalarBarActor::New(); theImageColorBar->SetLookupTable( theImageLookupTable ); theImageColorBar->SetOrientationToVertical(); theImageColorBar->SetWidth( 0.05 ); theImageColorBar->SetHeight( 0.9 ); dImageClampValues[0] = dImageLut[0]; dImageClampValues[1] = dImageLut[1]; theImage = vtkImageActor::New(); theImageColorsMapper = vtkImageMapToColors::New(); theImageColorsMapper->SetLookupTable( theImageLookupTable ); theImageColorsMapper->SetOutputFormatToRGBA(); theImageColorsMapper->PassAlphaToOutputOff(); renderer->AddActor( theImageColorBar ); theOverlayLookupTable = vtkLookupTable::New(); theOverlayLookupTable->SetTableRange( 0.0, 127.0 ); theOverlayLookupTable->SetRampToLinear(); theOverlayLookupTable->SetSaturationRange( 0.0, 0.0 ); theOverlayLookupTable->SetValueRange( 0.0, 1.0 ); theOverlayLookupTable->SetHueRange( 0.0, 1.0); theOverlayLookupTable->Build(); theOverlayLookupTable->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 ); theOverlayColorBar = vtkScalarBarActor::New(); theOverlayColorBar->SetLookupTable( theOverlayLookupTable ); theOverlayColorBar->SetLayerNumber( 1 ); theOverlayColorBar->SetOrientationToVertical(); theOverlayColorBar->SetWidth( 0.05 ); theOverlayColorBar->SetHeight( 0.9 ); dOverlayClampValues[0] = dOverlayLut[0]; dOverlayClampValues[1] = dOverlayLut[1]; theGlyphSource = vtkArrowSource::New(); theFieldGlyphs = vtkGlyph2D::New(); theFieldGlyphs->SetScaleModeToScaleByVector(); theFieldGlyphs->SetColorModeToColorByVector(); theFieldGlyphs->SetVectorModeToUseVector(); theFieldGlyphs->SetSource( theGlyphSource->GetOutput() ); theFieldMapper = vtkPolyDataMapper2D::New(); theFieldMapper->SetInput( theFieldGlyphs->GetOutput() ); theFieldMapper->SetLookupTable( theOverlayLookupTable ); theOverlay = vtkActor2D::New(); theOverlay->SetMapper( theFieldMapper ); theImage->SetInput( theImageColorsMapper->GetOutput() ); //renderer->AddActor( theImage ); renderer->AddActor( theOverlay ); renderer->AddActor( theOverlayColorBar ); double* pos = theImageColorBar->GetPosition(); theOverlayColorBar->SetPosition( pos[0]+0.05, pos[1] ); QTabWidget* dialog = new QTabWidget( aGlobalColumnPtr ); // Setup tab 1 QVBox* aColumn1Ptr = new QVBox( this ); dialog->addTab( aColumn1Ptr, "Image" ); aColumn1Ptr->setGeometry(0,0,250,250); aColumn1Ptr->setMargin(2); aColumn1Ptr->setSpacing(8); theImageLutFileButton = new QPushButton( "Color table", aColumn1Ptr ); theImageLutFileButton->setMinimumSize( 200, 25 ); QLabel* doc1 = new QLabel( "Data range minimum", aColumn1Ptr ); QHBox* aRow3Ptr = new QHBox ( aColumn1Ptr ); theImageDataMin = new QScrollBar ( 0, 1000, 1, 50, 0, Qt::Horizontal, aRow3Ptr ); theImageDataMin->setMinimumSize(256,16); aRow3Ptr->setStretchFactor( theImageDataMin, 3 ); aRow3Ptr->setSpacing(10); theImageMinDisplay = new QLineEdit( QString::number( dImageLut[0] ), aRow3Ptr ); theImageMinDisplay->setFixedSize(96,16); theImageMinDisplay->setValidator( new QDoubleValidator(0) ); theImageMinDisplay->setText( QString::number( dImageClampValues[0] ) ); QLabel* doc2 = new QLabel( "Data range maximum", aColumn1Ptr ); QHBox* aRow4Ptr = new QHBox ( aColumn1Ptr ); theImageDataMax = new QScrollBar (0, 1000, 1, 50, 1000, Qt::Horizontal, aRow4Ptr ); theImageDataMax->setMinimumSize(256,16); aRow4Ptr->setStretchFactor( theImageDataMax, 3 ); aRow4Ptr->setSpacing(10); theImageMaxDisplay = new QLineEdit( QString::number( dImageLut[1] ), aRow4Ptr ); theImageMaxDisplay->setFixedSize(96,16); theImageMaxDisplay->setValidator( new QDoubleValidator(0) ); theImageMaxDisplay->setText( QString::number( dImageClampValues[1] ) ); QHBox* aRow1Ptr = new QHBox ( aColumn1Ptr ); aRow1Ptr->setSpacing(5); theImageTransparency = new QCheckBox( aRow1Ptr ); theImageTransparency->setFixedSize(16,16); theImageTransparency->setChecked( true ); QLabel* doc3 = new QLabel( "Background transparency", aRow1Ptr ); QHBox* aRow2Ptr = new QHBox ( aColumn1Ptr ); aRow2Ptr->setSpacing(5); theImageInterpolate = new QCheckBox( aRow2Ptr ); theImageInterpolate->setFixedSize(16,16); theImageInterpolate->setChecked( true ); QLabel* doc4 = new QLabel( "Interpolate", aRow2Ptr ); connect( theImageLutFileButton, SIGNAL( clicked( ) ), this, SLOT( loadImageLutFile() ) ); connect ( theImageDataMin, SIGNAL( valueChanged( int ) ), this, SLOT( updateImageMin( int ) ) ); connect ( theImageDataMax, SIGNAL( valueChanged( int ) ), this, SLOT( updateImageMax( int ) ) ); connect( theImageTransparency, SIGNAL( stateChanged( int ) ), this, SLOT( toggleImageTransparency( int ) ) ); connect( theImageInterpolate, SIGNAL( stateChanged( int ) ), this, SLOT( toggleImageInterpolation( int ) ) ); connect( theImageMinDisplay, SIGNAL( returnPressed() ), this, SLOT( imageMinDataChanged() ) ); connect( theImageMinDisplay, SIGNAL( lostFocus() ), this, SLOT( imageMinDataChanged() ) ); connect( theImageMaxDisplay, SIGNAL( returnPressed() ), this, SLOT( imageMaxDataChanged() ) ); connect( theImageMaxDisplay, SIGNAL( lostFocus() ), this, SLOT( imageMaxDataChanged() ) ); // Setup tab 2 aColumn1Ptr = new QVBox( this ); dialog->addTab( aColumn1Ptr, "Overlay" ); aColumn1Ptr->setGeometry(0,0,250,250); aColumn1Ptr->setMargin(2); aColumn1Ptr->setSpacing(8); theOverlayLutFileButton = new QPushButton( "Color table", aColumn1Ptr ); theOverlayLutFileButton->setMinimumSize( 200, 25 ); doc1 = new QLabel( "Data range minimum", aColumn1Ptr ); aRow3Ptr = new QHBox ( aColumn1Ptr ); theOverlayDataMin = new QScrollBar ( 0, 1000, 1, 50, 0, Qt::Horizontal, aRow3Ptr ); theOverlayDataMin->setMinimumSize(256,16); aRow3Ptr->setStretchFactor( theOverlayDataMin, 3 ); aRow3Ptr->setSpacing(10); theOverlayMinDisplay = new QLineEdit( QString::number( dImageLut[0] ), aRow3Ptr ); theOverlayMinDisplay->setFixedSize(96,16); theOverlayMinDisplay->setValidator( new QDoubleValidator(0) ); theOverlayMinDisplay->setText( QString::number( dOverlayClampValues[0] ) ); doc2 = new QLabel( "Data range maximum", aColumn1Ptr ); aRow4Ptr = new QHBox ( aColumn1Ptr ); theOverlayDataMax = new QScrollBar (0, 1000, 1, 50, 1000, Qt::Horizontal, aRow4Ptr ); theOverlayDataMax->setMinimumSize(256,16); aRow4Ptr->setStretchFactor( theOverlayDataMax, 3 ); aRow4Ptr->setSpacing(10); theOverlayMaxDisplay = new QLineEdit( QString::number( dImageLut[1] ), aRow4Ptr ); theOverlayMaxDisplay->setFixedSize(96,16); theOverlayMaxDisplay->setValidator( new QDoubleValidator(0) ); theOverlayMaxDisplay->setText( QString::number( dOverlayClampValues[1] ) ); aRow1Ptr = new QHBox ( aColumn1Ptr ); aRow1Ptr->setSpacing(5); theOverlayTransparency = new QCheckBox( aRow1Ptr ); theOverlayTransparency->setFixedSize(16,16); theOverlayTransparency->setChecked( true ); doc3 = new QLabel( "Background transparency", aRow1Ptr ); aRow2Ptr = new QHBox ( aColumn1Ptr ); aRow2Ptr->setSpacing(5); theOverlayInterpolate = new QCheckBox( aRow2Ptr ); theOverlayInterpolate->setFixedSize(16,16); theOverlayInterpolate->setChecked( true ); doc4 = new QLabel( "Interpolate", aRow2Ptr ); connect( theOverlayLutFileButton, SIGNAL( clicked( ) ), this, SLOT( loadOverlayLutFile() ) ); connect ( theOverlayDataMin, SIGNAL( valueChanged( int ) ), this, SLOT( updateOverlayMin( int ) ) ); connect ( theOverlayDataMax, SIGNAL( valueChanged( int ) ), this, SLOT( updateOverlayMax( int ) ) ); connect( theOverlayTransparency, SIGNAL( stateChanged( int ) ), this, SLOT( toggleOverlayTransparency( int ) ) ); connect( theOverlayInterpolate, SIGNAL( stateChanged( int ) ), this, SLOT( toggleOverlayInterpolation( int ) ) ); connect( theOverlayMinDisplay, SIGNAL( returnPressed() ), this, SLOT( overlayMinDataChanged() ) ); connect( theOverlayMinDisplay, SIGNAL( lostFocus() ), this, SLOT( overlayMinDataChanged() ) ); connect( theOverlayMaxDisplay, SIGNAL( returnPressed() ), this, SLOT( overlayMaxDataChanged() ) ); connect( theOverlayMaxDisplay, SIGNAL( lostFocus() ), this, SLOT( overlayMaxDataChanged() ) ); }
AboutDialog::AboutDialog(bool showAtStartup) { QString websiteText = tr("<a href=\"http://www.vpaint.org\">http://www.vpaint.org</a>"); QString aboutText = tr( "VPaint is an experimental vector graphics editor based on the Vector Animation" " Complex (VAC), a technology developed by a collaboration of researchers at" " Inria and the University of British Columbia, featured at SIGGRAPH 2015. It" " allows you to create resolution-independent illustrations and animations using" " innovative techniques.<br><br>" " " "<b>DISCLAIMER:</b> VPaint 1.5, or any upcoming 1.x release, is considered BETA. It" " lacks plenty of useful features commonly found in other editors, and you" " should expect glitches and crashes once in a while. <b>It is distributed" " primarily for research purposes, and for curious artists interested in early" " testing of cutting-edge but unstable technology.</b><br><br>" " " "New VPaint 1.x versions (1.6, 1.7, etc.) are expected every two months, with" " new features and increased stability. VPaint 2.0, full-featured and stable, is" " expected for 2017. <b>If you want to be notified when a new version is released," " just enter your email address below.</b>"); QString licenseText = tr( "Copyright (C) 2012-2015 Boris Dalstein.<br><br>" " " "Permission is hereby granted, free of charge, to any person obtaining a copy" " of this software and associated documentation files (the \"Software\"), to deal" " in the Software without restriction, including without limitation the rights" " to use, copy, modify, merge, publish, distribute, sublicense, and/or sell" " copies of the Software, and to permit persons to whom the Software is" " furnished to do so, subject to the following conditions:<br><br>" " " "The above copyright notice and this permission notice shall be included in" " all copies or substantial portions of the Software.<br><br>" " " "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN" " THE SOFTWARE."); // Window title setWindowTitle(tr("About")); setMinimumSize(500, 500); // About widget QWidget * aboutWidget = new QWidget(); QLabel * logoLabel = new QLabel(); logoLabel->setPixmap(QPixmap(":/images/logo_1-5.png")); logoLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); QLabel * websiteLabel = new QLabel(websiteText); websiteLabel->setTextFormat(Qt::RichText); websiteLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); websiteLabel->setOpenExternalLinks(true); QFont websiteFont = websiteLabel->font(); websiteFont.setPointSize(15); websiteLabel->setFont(websiteFont); QLabel * aboutLabel = new QLabel(aboutText); aboutLabel->setWordWrap(true); aboutLabel->setTextFormat(Qt::RichText); aboutLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); subscribeLineEdit_ = new QLineEdit(); subscribeLineEdit_->setPlaceholderText(tr("Your email address")); networkManager_ = new QNetworkAccessManager(this); QPushButton * subscribeButton = new QPushButton(tr("Subscribe")); connect(subscribeButton, SIGNAL(clicked(bool)), this, SLOT(processSubscribe_())); QHBoxLayout * subscribeLayout = new QHBoxLayout(); subscribeLayout->addWidget(subscribeLineEdit_); subscribeLayout->addWidget(subscribeButton); QVBoxLayout * aboutWidgetLayout = new QVBoxLayout(); aboutWidgetLayout->addWidget(logoLabel); aboutWidgetLayout->addSpacing(10); aboutWidgetLayout->addWidget(websiteLabel); aboutWidgetLayout->addSpacing(10); aboutWidgetLayout->addWidget(aboutLabel); aboutWidgetLayout->addSpacing(10); aboutWidgetLayout->addLayout(subscribeLayout); aboutWidgetLayout->addStretch(); aboutWidget->setLayout(aboutWidgetLayout); // License widget QWidget * licenseWidget = new QWidget(); QLabel * licenseLabel = new QLabel(licenseText); licenseLabel->setWordWrap(true); licenseLabel->setTextFormat(Qt::RichText); licenseLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); QVBoxLayout * licenseWidgetLayout = new QVBoxLayout(); licenseWidgetLayout->addWidget(licenseLabel); aboutWidgetLayout->addStretch(); licenseWidget->setLayout(licenseWidgetLayout); // Tab widget QTabWidget * tabWidget = new QTabWidget(); tabWidget->addTab(aboutWidget, tr("About")); tabWidget->addTab(licenseWidget, tr("License")); // Show at startup checkbox showAtStartupCheckBox_ = new QCheckBox(tr("Show this message at startup")); showAtStartupCheckBox_->setChecked(showAtStartup); // Dialog button box QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // Main layout QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget(tabWidget); layout->addWidget(showAtStartupCheckBox_); layout->addWidget(buttonBox); setLayout(layout); }
HelpWidget::HelpWidget(const SimRobot::Object& object) : QSplitter(Qt::Horizontal), object(object) { QString qhc = QFileInfo(HelpModule::application->getAppPath()).dir().path() + #ifdef MACOSX "/../Resources" + #endif "/helpcollection.qhc"; helpEngine = new QHelpEngine(qhc, this); helpBrowser = new HelpBrowser(helpEngine, this); helpBrowser->setFrameStyle(QFrame::NoFrame); if(!helpEngine->setupData()) HelpModule::application->showWarning(tr("SimRobotHelp"), helpEngine->error()); QHelpContentWidget* contentWidget = helpEngine->contentWidget(); contentWidget->setFrameStyle(QFrame::NoFrame); QHelpIndexWidget* indexWidget = helpEngine->indexWidget(); indexWidget->setFrameStyle(QFrame::NoFrame); QTabWidget* leftWidget = new QTabWidget(this); leftWidget->addTab(contentWidget, "Contents"); leftWidget->addTab(indexWidget, "Index"); QWidget* searchTabWidget = new QWidget(this); QVBoxLayout* searchTabLayout = new QVBoxLayout(this); searchTabLayout->addWidget(helpEngine->searchEngine()->queryWidget()); searchTabLayout->addWidget(new QLabel("Search results:", this)); searchResultsWidget = new QTextBrowser(this); searchTabLayout->addWidget(searchResultsWidget); searchTabWidget->setLayout(searchTabLayout); leftWidget->addTab(searchTabWidget, "Search"); QToolBar* toolBar = new QToolBar(this); QAction* navigateHomeAction = new QAction(QIcon(":/Icons/home.png"), tr("Home"), this); navigateHomeAction->setStatusTip(tr("Navigate Home")); connect(navigateHomeAction, SIGNAL(triggered()), this, SLOT(navigateHome())); toolBar->addAction(navigateHomeAction); QAction* locatePageAction = new QAction(QIcon(":/Icons/locate.png"), tr("Locate"), this); locatePageAction->setStatusTip(tr("Locate current page in contents window")); connect(locatePageAction, SIGNAL(triggered()), this, SLOT(locatePage())); toolBar->addAction(locatePageAction); toolBar->addSeparator(); QAction* navigateBackwardAction = new QAction(QIcon(":/Icons/back.png"), tr("Back"), this); navigateBackwardAction->setStatusTip(tr("Navigate Back")); connect(navigateBackwardAction, SIGNAL(triggered()), this, SLOT(navigateBackward())); toolBar->addAction(navigateBackwardAction); QAction* navigateForwardAction = new QAction(QIcon(":/Icons/forward.png"), tr("Forward"), this); navigateForwardAction->setStatusTip(tr("Navigate Forward")); connect(navigateForwardAction, SIGNAL(triggered()), this, SLOT(navigateForward())); toolBar->addAction(navigateForwardAction); QWidget* rightWidget = new QWidget(this); QVBoxLayout* rightWidgetLayout = new QVBoxLayout(this); rightWidgetLayout->addWidget(toolBar); rightWidgetLayout->addWidget(helpBrowser); rightWidget->setLayout(rightWidgetLayout); addWidget(leftWidget); addWidget(rightWidget); connect(helpBrowser, SIGNAL(forwardAvailable(bool)), navigateForwardAction, SLOT(setEnabled(bool))); connect(helpBrowser, SIGNAL(backwardAvailable(bool)), navigateBackwardAction, SLOT(setEnabled(bool))); connect(contentWidget, SIGNAL(linkActivated(const QUrl&)), helpBrowser, SLOT(setSource(const QUrl &))); connect(indexWidget, SIGNAL(linkActivated(const QUrl&, const QString&)), helpBrowser, SLOT(setSource(const QUrl &))); connect(this, SIGNAL(tabChangeRequested(int)), leftWidget, SLOT(setCurrentIndex(int))); connect(helpEngine->searchEngine()->queryWidget(), SIGNAL(search()), this, SLOT(searchInvoked())); connect(helpEngine->searchEngine(), SIGNAL(searchingFinished(int)), this, SLOT(searchFinished(int))); helpEngine->searchEngine()->reindexDocumentation(); searchResultsWidget->setOpenLinks(false); searchResultsWidget->setOpenExternalLinks(false); connect(searchResultsWidget, SIGNAL(anchorClicked(const QUrl&)), helpBrowser, SLOT(setSource(const QUrl&))); navigateHome(); setStretchFactor(0,1); setStretchFactor(1,2); setFrameStyle(QFrame::NoFrame); QSettings& settings = HelpModule::application->getLayoutSettings(); settings.beginGroup(object.getFullName()); restoreState(settings.value("State").toByteArray()); settings.endGroup(); }
void ZObjsManagerWidget::createWidget() { QTabWidget *tabs = new QTabWidget(this); tabs->setElideMode(Qt::ElideNone); tabs->setUsesScrollButtons(true); m_swcObjsTreeView = new QTreeView(this); m_swcObjsTreeView->setTextElideMode(Qt::ElideLeft); m_swcObjsTreeView->setExpandsOnDoubleClick(false); m_swcObjsTreeView->setModel(m_doc->swcObjsModel()); m_swcObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_swcObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_swcObjsTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(swcItemDoubleClicked(QModelIndex))); connect(m_swcObjsTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(swcSelectionChangedFromTreeView(QItemSelection,QItemSelection))); tabs->addTab(m_swcObjsTreeView, "Neurons"); if (NeutubeConfig::getInstance().getObjManagerConfig().isCategorizedSwcNodeOn()) { m_swcNodeObjsTreeView = new QTreeView(this); m_swcNodeObjsTreeView->setExpandsOnDoubleClick(false); m_swcNodeObjsTreeView->setModel(m_doc->swcNodeObjsModel()); m_swcNodeObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_swcNodeObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_swcNodeObjsTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(processDoubleClickOnCategorizedSwcNode(QModelIndex))); connect(m_swcNodeObjsTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateSelectionFromCategorizedSwcNode(QItemSelection,QItemSelection))); tabs->addTab(m_swcNodeObjsTreeView, "Neuron Nodes"); } if (NeutubeConfig::getInstance().getMainWindowConfig().isMarkPunctaOn()) { m_punctaObjsTreeView = new QTreeView(this); m_punctaObjsTreeView->setSortingEnabled(true); m_punctaObjsTreeView->setExpandsOnDoubleClick(false); m_punctaProxyModel = new QSortFilterProxyModel(this); m_punctaProxyModel->setSourceModel(m_doc->punctaObjsModel()); //m_punctaObjsTreeView->setModel(m_doc->punctaObjsModel()); m_punctaObjsTreeView->setModel(m_punctaProxyModel); m_punctaObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_punctaObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_punctaObjsTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(punctaItemDoubleClicked(QModelIndex))); connect(m_punctaObjsTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(punctaSelectionChangedFromTreeView(QItemSelection,QItemSelection))); m_punctaObjsTreeView->sortByColumn(0, Qt::AscendingOrder); tabs->addTab(m_punctaObjsTreeView, "Puncta"); } if (GET_APPLICATION_NAME == "FlyEM") { m_seedObjsTreeView = new QTreeView(this); m_seedObjsTreeView->setSortingEnabled(false); m_seedObjsTreeView->setExpandsOnDoubleClick(false); m_seedObjsTreeView->setModel(m_doc->seedObjsModel()); m_seedObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_seedObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); tabs->addTab(m_seedObjsTreeView, "Seeds"); } QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(tabs); setLayout(layout); if (m_doc->hasSelectedPuncta()) { //std::set<ZPunctum*> *selectedPuncta = m_doc->selectedPuncta(); QList<ZPunctum*> selected = m_doc->getSelectedObjectList<ZPunctum>(ZStackObject::TYPE_PUNCTUM); QList<ZPunctum*> deselected; //std::copy(selectedPuncta->begin(), selectedPuncta->end(), std::back_inserter(selected)); punctaSelectionChanged(selected, deselected); } if (!m_doc->hasSelectedSwc()) { //std::set<ZSwcTree*> *selectedSwcs = m_doc->selectedSwcs(); QList<ZSwcTree*> selected = m_doc->getSelectedObjectList<ZSwcTree>(ZStackObject::TYPE_SWC); QList<ZSwcTree*> deselected; //std::copy(selectedSwcs->begin(), selectedSwcs->end(), std::back_inserter(selected)); swcSelectionChanged(selected, deselected); } if (m_doc->hasSelectedSwcNode()) { std::set<Swc_Tree_Node*> nodeSet = m_doc->getSelectedSwcNodeSet(); QList<Swc_Tree_Node*> selected; QList<Swc_Tree_Node*> deselected; std::copy(nodeSet.begin(), nodeSet.end(), std::back_inserter(selected)); swcTreeNodeSelectionChanged(selected, deselected); } connect(m_doc, SIGNAL(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>)), this, SLOT(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>))); connect(m_doc, SIGNAL(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>)), this, SLOT(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>))); connect(m_doc, SIGNAL(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>)), this, SLOT(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>))); }
PolygonView::PolygonView(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f) : QWidget(parent, name, f) { assert(doc != NULL); p_Doc = doc; p_Shape = NULL; p_Polygon = NULL; m_bSelectionChanged = true; p_Doc->registerUpdateable(this, "polygon"); p_Doc->registerRebuildable(this, "polygon"); // the polygon list view p_PolygonListView = new Q3ListView(this); connect(p_PolygonListView, SIGNAL(selectionChanged()), this, SLOT(slotChanged())); p_PolygonListView->setSelectionMode(Q3ListView::Extended); p_PolygonListView->addColumn(QString("polygons")); p_PolygonListView->setMinimumSize(200, 240); // the vertex list view p_VertexListView = new Q3ListView(this); connect(p_VertexListView, SIGNAL(selectionChanged()), this, SLOT(slotVertexChanged())); p_VertexListView->setSelectionMode(Q3ListView::Single); p_VertexListView->addColumn(QString("vertices for polygon")); p_VertexListView->setMinimumSize(200, 80); // tabs and widgets QTabWidget * tabWidget = new QTabWidget(this); //tabWidget->setFixedSize(200, 80); tabWidget->setMinimumSize(200, 80); // main layout Q3BoxLayout * vlayout = new Q3VBoxLayout(this); vlayout->addWidget(p_PolygonListView); vlayout->addWidget(p_VertexListView); vlayout->addWidget(tabWidget); vlayout->setStretchFactor(p_PolygonListView, 3); vlayout->setStretchFactor(p_PolygonListView, 2); vlayout->setStretchFactor(tabWidget, 0); // the vertex order widget { QWidget * widget = new QWidget(this); tabWidget->addTab(widget, "order"); p_ButtonUp = new QPushButton("up", widget); connect(p_ButtonUp, SIGNAL(clicked()), this, SLOT(slotVertexUp())); p_ButtonDown = new QPushButton("down", widget); connect(p_ButtonDown, SIGNAL(clicked()), this, SLOT(slotVertexDown())); Q3BoxLayout * layout = new Q3HBoxLayout(widget); layout->addWidget(p_ButtonUp); layout->addWidget(p_ButtonDown); } // the position widget { QWidget * widget = new QWidget(this); tabWidget->addTab(widget, "position"); p_EditX = new QLineEdit(widget); p_EditY = new QLineEdit(widget); p_EditZ = new QLineEdit(widget); connect(p_EditX, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex())); connect(p_EditY, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex())); connect(p_EditZ, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex())); p_ApplyVertexButton = new QPushButton("apply", widget); connect(p_ApplyVertexButton, SIGNAL(clicked()), this, SLOT(slotApplyVertex())); Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget); Q3BoxLayout * hlayout = new Q3HBoxLayout(vlayoutc); hlayout->addWidget(p_EditX); hlayout->addWidget(p_EditY); hlayout->addWidget(p_EditZ); vlayoutc->addWidget(p_ApplyVertexButton); } // the color widget { QWidget * widget = new QWidget(this); tabWidget->addTab(widget, "color"); p_EditR = new QLineEdit(widget); p_EditG = new QLineEdit(widget); p_EditB = new QLineEdit(widget); p_EditA = new QLineEdit(widget); connect(p_EditR, SIGNAL(returnPressed()), this, SLOT(slotApplyColor())); connect(p_EditG, SIGNAL(returnPressed()), this, SLOT(slotApplyColor())); connect(p_EditB, SIGNAL(returnPressed()), this, SLOT(slotApplyColor())); connect(p_EditA, SIGNAL(returnPressed()), this, SLOT(slotApplyColor())); p_ApplyColorButton = new QPushButton("apply", widget); connect(p_ApplyColorButton, SIGNAL(clicked()), this, SLOT(slotApplyColor())); Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget); Q3BoxLayout * hlayoutb = new Q3HBoxLayout(vlayoutc); hlayoutb->addWidget(p_EditR); hlayoutb->addWidget(p_EditG); hlayoutb->addWidget(p_EditB); hlayoutb->addWidget(p_EditA); vlayoutc->addWidget(p_ApplyColorButton); } // properties widget { QWidget * widget = new QWidget(this); tabWidget->addTab(widget, "prop"); p_TransBox = new QCheckBox("transparent", widget); p_ApplyPropButton = new QPushButton("apply", widget); connect(p_ApplyPropButton, SIGNAL(clicked()), this, SLOT(slotApplyProp())); Q3BoxLayout * vlayout = new Q3VBoxLayout(widget); vlayout->addWidget(p_TransBox); vlayout->addWidget(p_ApplyPropButton); } this->doRebuild(); //this->doUpdate(); }
void K3b::AudioRippingDialog::setupGui() { QWidget *frame = mainWidget(); QGridLayout* Form1Layout = new QGridLayout( frame ); Form1Layout->setContentsMargins( 0, 0, 0, 0 ); QTreeWidgetItem* header = new QTreeWidgetItem; header->setText( 0, i18n( "Filename") ); header->setText( 1, i18n( "Length") ); header->setText( 2, i18n( "File Size") ); header->setText( 3, i18n( "Type") ); d->viewTracks = new QTreeWidget( frame ); d->viewTracks->setSortingEnabled( false ); d->viewTracks->setAllColumnsShowFocus( true ); d->viewTracks->setHeaderItem( header ); d->viewTracks->setRootIsDecorated( false ); d->viewTracks->setSelectionMode( QAbstractItemView::NoSelection ); d->viewTracks->setFocusPolicy( Qt::NoFocus ); d->viewTracks->header()->setStretchLastSection( false ); d->viewTracks->header()->setSectionResizeMode( 0, QHeaderView::Stretch ); d->viewTracks->header()->setSectionResizeMode( 1, QHeaderView::ResizeToContents ); d->viewTracks->header()->setSectionResizeMode( 2, QHeaderView::ResizeToContents ); d->viewTracks->header()->setSectionResizeMode( 3, QHeaderView::ResizeToContents ); QTabWidget* mainTab = new QTabWidget( frame ); m_optionWidget = new K3b::AudioConvertingOptionWidget( mainTab ); mainTab->addTab( m_optionWidget, i18n("Settings") ); // setup filename pattern page // ------------------------------------------------------------------------------------------- m_patternWidget = new K3b::CddbPatternWidget( mainTab ); mainTab->addTab( m_patternWidget, i18n("File Naming") ); connect( m_patternWidget, SIGNAL(changed()), this, SLOT(refresh()) ); // setup advanced page // ------------------------------------------------------------------------------------------- QWidget* advancedPage = new QWidget( mainTab ); QGridLayout* advancedPageLayout = new QGridLayout( advancedPage ); mainTab->addTab( advancedPage, i18n("Advanced") ); m_comboParanoiaMode = K3b::StdGuiItems::paranoiaModeComboBox( advancedPage ); m_spinRetries = new QSpinBox( advancedPage ); m_checkIgnoreReadErrors = new QCheckBox( i18n("Ignore read errors"), advancedPage ); m_checkUseIndex0 = new QCheckBox( i18n("Do not read pregaps"), advancedPage ); advancedPageLayout->addWidget( new QLabel( i18n("Paranoia mode:"), advancedPage ), 0, 0 ); advancedPageLayout->addWidget( m_comboParanoiaMode, 0, 1 ); advancedPageLayout->addWidget( new QLabel( i18n("Read retries:"), advancedPage ), 1, 0 ); advancedPageLayout->addWidget( m_spinRetries, 1, 1 ); advancedPageLayout->addWidget( m_checkIgnoreReadErrors, 2, 0, 0, 1 ); advancedPageLayout->addWidget( m_checkUseIndex0, 3, 0, 0, 1 ); advancedPageLayout->setRowStretch( 4, 1 ); advancedPageLayout->setColumnStretch( 2, 1 ); // ------------------------------------------------------------------------------------------- Form1Layout->addWidget( d->viewTracks, 0, 0 ); Form1Layout->addWidget( mainTab, 1, 0 ); Form1Layout->setRowStretch( 0, 1 ); setStartButtonText( i18n( "Start Ripping" ), i18n( "Starts copying the selected tracks") ); connect( m_checkUseIndex0, SIGNAL(toggled(bool)), this, SLOT(refresh()) ); connect( m_optionWidget, SIGNAL(changed()), this, SLOT(refresh()) ); }
WndCustomizeGUI::WndCustomizeGUI(): Wnd("Customize GUI") { QVBoxLayout * topLayout = new QVBoxLayout(this); QTabWidget * tabWidet = new QTabWidget(this); topLayout->addWidget( tabWidet); QWidget * colorsWidget = new QWidget( this); tabWidet->addTab( colorsWidget, "Colors"); colorsWidget->setBackgroundRole( QPalette::Mid); colorsWidget->setAutoFillBackground( true); QWidget * starsWidget = new QWidget( this); tabWidet->addTab( starsWidget, "Stars Shape"); starsWidget->setBackgroundRole( QPalette::Mid); starsWidget->setAutoFillBackground( true); QWidget * fontsWidget = new QWidget( this); tabWidet->addTab( fontsWidget, "Fonts"); fontsWidget->setBackgroundRole( QPalette::Mid); fontsWidget->setAutoFillBackground( true); QWidget * imagesWidget = new QWidget( this); tabWidet->addTab( imagesWidget, "Images"); imagesWidget->setBackgroundRole( QPalette::Mid); imagesWidget->setAutoFillBackground( true); QHBoxLayout * hlayout; QVBoxLayout * vlayout; QLabel * label; ColorWidget * cw; NumberWidget * nw; FontWidget * ftw; FileWidget * flw; hlayout = new QHBoxLayout( colorsWidget); vlayout = new QVBoxLayout(); #if QT_VERSION >= 0x040300 vlayout->setContentsMargins( 1, 1, 1, 1); #endif vlayout->setSpacing( 2); hlayout->addLayout( vlayout); label = new QLabel("QT standart GUI pallete:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Window )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_WindowText )); //vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_AlternateBase )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Base )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Text )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Button )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Light )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Midlight )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Mid )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Dark )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Shadow )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Highlight )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_HighlightedText )); label = new QLabel("Watch specific colors:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_item )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_selected )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_running )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_done )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_error )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_outline )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_star )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_starline )); vlayout = new QVBoxLayout(); #if QT_VERSION >= 0x040300 vlayout->setContentsMargins( 1, 1, 1, 1); #endif vlayout->setSpacing( 2); hlayout->addLayout( vlayout); label = new QLabel("Qt not used palette:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Link )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_LinkVisited )); label = new QLabel("Job Item Colors:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjoberror )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjoboff )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobwtime )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobwdep )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobdone )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjob )); label = new QLabel("Render Item Colors:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrender )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderoff )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderbusy )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrendernimby )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderpltclr )); label = new QLabel("Watch Nodes Font Colors:", this); label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter); vlayout->addWidget( label); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textbright )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textmuted )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textdone )); vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textstars )); // Stars: vlayout = new QVBoxLayout( starsWidget); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_numpoints )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_radiusin )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_radiusout )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_rotate )); // Images: vlayout = new QVBoxLayout( imagesWidget); QString filesmask("PNG Images [*.png] (*.png)"); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_back, filesmask)); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_top, filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_topleft , filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_topright, filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_bot, filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_botleft , filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_botright, filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_leftoff , filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_lefton , filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_rightoff, filesmask )); vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_righton , filesmask )); // Fonts: vlayout = new QVBoxLayout( fontsWidget); vlayout->addWidget( new FontWidget( this, &afqt::QEnvironment::font_family )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizename )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizeinfo )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizemin )); vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizeplotter)); QPushButton * button = new QPushButton("Save GUI Preferences", this); connect( button, SIGNAL( pressed()), this, SLOT(save())); topLayout->addWidget( button); }
void CelestiaAppWindow::init(const QString& qConfigFileName, const QStringList& qExtrasDirectories) { QString celestia_data_dir = QString::fromLocal8Bit(::getenv("CELESTIA_DATA_DIR")); if (celestia_data_dir.isEmpty()) { QString celestia_data_dir = CONFIG_DATA_DIR; QDir::setCurrent(celestia_data_dir); } else if (QDir(celestia_data_dir).isReadable()) { QDir::setCurrent(celestia_data_dir); } else { QMessageBox::critical(0, "Celestia", _("Celestia is unable to run because the data directroy was not " "found, probably due to improper installation.")); exit(1); } // Get the config file name string configFileName; if (qConfigFileName.isEmpty()) configFileName = DEFAULT_CONFIG_FILE.toUtf8().data(); else configFileName = qConfigFileName.toUtf8().data(); // Translate extras directories from QString -> std::string vector<string> extrasDirectories; for (QStringList::const_iterator iter = qExtrasDirectories.begin(); iter != qExtrasDirectories.end(); iter++) { extrasDirectories.push_back(iter->toUtf8().data()); } #ifdef TARGET_OS_MAC static short domains[] = { kUserDomain, kLocalDomain, kNetworkDomain }; int domain = 0; int domainCount = (sizeof domains / sizeof(short)); QString resourceDir = QDir::currentPath(); while (!QDir::setCurrent(resourceDir+"/CelestiaResources") && domain < domainCount) { FSRef folder; CFURLRef url; UInt8 fullPath[PATH_MAX]; if (noErr == FSFindFolder(domains[domain++], kApplicationSupportFolderType, FALSE, &folder)) { url = CFURLCreateFromFSRef(nil, &folder); if (CFURLGetFileSystemRepresentation(url, TRUE, fullPath, PATH_MAX)) resourceDir = (const char *)fullPath; CFRelease(url); } } if (domain >= domainCount) { QMessageBox::critical(0, "Celestia", _("Celestia is unable to run because the CelestiaResources folder was not " "found, probably due to improper installation.")); exit(1); } #endif initAppDataDirectory(); m_appCore = new CelestiaCore(); AppProgressNotifier* progress = new AppProgressNotifier(this); alerter = new AppAlerter(this); m_appCore->setAlerter(alerter); setWindowIcon(QIcon(":/icons/celestia.png")); m_appCore->initSimulation(&configFileName, &extrasDirectories, progress); delete progress; // Enable antialiasing if requested in the config file. // TODO: Make this settable via the GUI QGLFormat glformat = QGLFormat::defaultFormat(); if (m_appCore->getConfig()->aaSamples > 1) { glformat.setSampleBuffers(true); glformat.setSamples(m_appCore->getConfig()->aaSamples); QGLFormat::setDefaultFormat(glformat); } glWidget = new CelestiaGlWidget(NULL, "Celestia", m_appCore); glWidget->makeCurrent(); GLenum glewErr = glewInit(); if (glewErr != GLEW_OK) { QMessageBox::critical(0, "Celestia", QString(_("Celestia was unable to initialize OpenGL extensions (error %1). Graphics quality will be reduced.")).arg(glewErr)); } m_appCore->setCursorHandler(glWidget); m_appCore->setContextMenuCallback(ContextMenu); MainWindowInstance = this; // TODO: Fix context menu callback setCentralWidget(glWidget); setWindowTitle("Celestia"); actions = new CelestiaActions(this, m_appCore); createMenus(); QTabWidget* tabWidget = new QTabWidget(this); tabWidget->setObjectName("celestia-tabbed-browser"); toolsDock = new QDockWidget(_("Celestial Browser"), this); toolsDock->setObjectName("celestia-tools-dock"); toolsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); // Create the various browser widgets celestialBrowser = new CelestialBrowser(m_appCore, NULL); celestialBrowser->setObjectName("celestia-browser"); connect(celestialBrowser, SIGNAL(selectionContextMenuRequested(const QPoint&, Selection&)), this, SLOT(slotShowSelectionContextMenu(const QPoint&, Selection&))); QWidget* deepSkyBrowser = new DeepSkyBrowser(m_appCore, NULL); deepSkyBrowser->setObjectName("deepsky-browser"); connect(deepSkyBrowser, SIGNAL(selectionContextMenuRequested(const QPoint&, Selection&)), this, SLOT(slotShowSelectionContextMenu(const QPoint&, Selection&))); SolarSystemBrowser* solarSystemBrowser = new SolarSystemBrowser(m_appCore, NULL); solarSystemBrowser->setObjectName("ssys-browser"); connect(solarSystemBrowser, SIGNAL(selectionContextMenuRequested(const QPoint&, Selection&)), this, SLOT(slotShowSelectionContextMenu(const QPoint&, Selection&))); // Set up the browser tabs tabWidget->addTab(solarSystemBrowser, _("Solar System")); tabWidget->addTab(celestialBrowser, _("Stars")); tabWidget->addTab(deepSkyBrowser, _("Deep Sky Objects")); toolsDock->setWidget(tabWidget); addDockWidget(Qt::LeftDockWidgetArea, toolsDock); infoPanel = new InfoPanel(_("Info Browser"), this); infoPanel->setObjectName("info-panel"); infoPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, infoPanel); infoPanel->setVisible(false); eventFinder = new EventFinder(m_appCore, _("Event Finder"), this); eventFinder->setObjectName("event-finder"); eventFinder->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, eventFinder); eventFinder->setVisible(false); //addDockWidget(Qt::DockWidgetArea, eventFinder); // Create the time toolbar TimeToolBar* timeToolBar = new TimeToolBar(m_appCore, _("Time")); timeToolBar->setObjectName("time-toolbar"); timeToolBar->setFloatable(true); timeToolBar->setMovable(true); addToolBar(Qt::TopToolBarArea, timeToolBar); // Create the guides toolbar QToolBar* guidesToolBar = new QToolBar(_("Guides")); guidesToolBar->setObjectName("guides-toolbar"); guidesToolBar->setFloatable(true); guidesToolBar->setMovable(true); guidesToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly); guidesToolBar->addAction(actions->equatorialGridAction); guidesToolBar->addAction(actions->galacticGridAction); guidesToolBar->addAction(actions->eclipticGridAction); guidesToolBar->addAction(actions->horizonGridAction); guidesToolBar->addAction(actions->eclipticAction); guidesToolBar->addAction(actions->markersAction); guidesToolBar->addAction(actions->constellationsAction); guidesToolBar->addAction(actions->boundariesAction); guidesToolBar->addAction(actions->orbitsAction); guidesToolBar->addAction(actions->labelsAction); addToolBar(Qt::TopToolBarArea, guidesToolBar); // Give keyboard focus to the 3D view glWidget->setFocus(); m_bookmarkManager = new BookmarkManager(this); // Load the bookmarks file and nitialize the bookmarks menu if (!loadBookmarks()) m_bookmarkManager->initializeBookmarks(); populateBookmarkMenu(); connect(m_bookmarkManager, SIGNAL(bookmarkTriggered(const QString&)), this, SLOT(slotBookmarkTriggered(const QString&))); m_bookmarkToolBar = new BookmarkToolBar(m_bookmarkManager, this); m_bookmarkToolBar->setObjectName("bookmark-toolbar"); m_bookmarkToolBar->rebuild(); addToolBar(Qt::TopToolBarArea, m_bookmarkToolBar); // Read saved window preferences readSettings(); // Build the view menu // Add dockable panels and toolbars to the view menu viewMenu->addAction(timeToolBar->toggleViewAction()); viewMenu->addAction(guidesToolBar->toggleViewAction()); viewMenu->addAction(m_bookmarkToolBar->toggleViewAction()); viewMenu->addSeparator(); viewMenu->addAction(toolsDock->toggleViewAction()); viewMenu->addAction(infoPanel->toggleViewAction()); viewMenu->addAction(eventFinder->toggleViewAction()); viewMenu->addSeparator(); QAction* fullScreenAction = new QAction(_("Full screen"), this); fullScreenAction->setCheckable(true); fullScreenAction->setShortcut(QString(_("Shift+F11"))); // Set the full screen check state only after reading settings fullScreenAction->setChecked(isFullScreen()); connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(slotToggleFullScreen())); viewMenu->addAction(fullScreenAction); // We use a timer with a null timeout value // to add m_appCore->tick to Qt's event loop QTimer *t = new QTimer(dynamic_cast<QObject *>(this)); QObject::connect(t, SIGNAL(timeout()), SLOT(celestia_tick())); t->start(0); }
void mtsIntuitiveResearchKitConsoleQt::Configure(mtsIntuitiveResearchKitConsole * console) { mtsComponentManager * componentManager = mtsComponentManager::GetInstance(); mtsIntuitiveResearchKitConsoleQtWidget * consoleGUI = new mtsIntuitiveResearchKitConsoleQtWidget("consoleGUI"); componentManager->AddComponent(consoleGUI); // connect consoleGUI to console Connections.push_back(new ConnectionType("consoleGUI", "Main", "console", "Main")); if (console->GetInterfaceRequired("Clutch")) { Connections.push_back(new ConnectionType("consoleGUI", "Clutch", "console", "Clutch")); } if (console->GetInterfaceRequired("OperatorPresent")) { Connections.push_back(new ConnectionType("consoleGUI", "OperatorPresent", "console", "OperatorPresent")); } if (console->GetInterfaceRequired("Camera")) { Connections.push_back(new ConnectionType("consoleGUI", "Camera", "console", "Camera")); } TabWidget = consoleGUI->GetTabWidget(); // IOs if (console->mHasIO) { // connect ioGUIMaster to io mtsRobotIO1394QtWidgetFactory * robotWidgetFactory = new mtsRobotIO1394QtWidgetFactory("robotWidgetFactory"); componentManager->AddComponent(robotWidgetFactory); // this connect needs to happen now so the factory can figure out the io interfaces componentManager->Connect("robotWidgetFactory", "RobotConfiguration", "io", "Configuration"); robotWidgetFactory->Configure(); // add all IO GUI to tab QTabWidget * ioTabWidget; if (robotWidgetFactory->Widgets().size() > 1) { ioTabWidget = new QTabWidget(); TabWidget->addTab(ioTabWidget, "IOs"); } else { ioTabWidget = TabWidget; // use current tab widget } mtsRobotIO1394QtWidgetFactory::WidgetListType::const_iterator iterator; for (iterator = robotWidgetFactory->Widgets().begin(); iterator != robotWidgetFactory->Widgets().end(); ++iterator) { ioTabWidget->addTab(*iterator, (*iterator)->GetName().c_str()); } if (robotWidgetFactory->ButtonsWidget()) { ioTabWidget->addTab(robotWidgetFactory->ButtonsWidget(), "Buttons"); } } // Arm and PID widgets QTabWidget * pidTabWidget; QTabWidget * armTabWidget; if (console->mArms.size() > 1) { pidTabWidget = new QTabWidget(); TabWidget->addTab(pidTabWidget, "PIDs"); armTabWidget = new QTabWidget(); TabWidget->addTab(armTabWidget, "Arms"); } else { pidTabWidget = TabWidget; // use current tab widget armTabWidget = TabWidget; // use current tab widget } const mtsIntuitiveResearchKitConsole::ArmList::iterator armsEnd = console->mArms.end(); mtsIntuitiveResearchKitConsole::ArmList::iterator armIter; for (armIter = console->mArms.begin(); armIter != armsEnd; ++armIter) { mtsIntuitiveResearchKitArmQtWidget * armGUI; mtsIntuitiveResearchKitSUJQtWidget * sujGUI; mtsPIDQtWidget * pidGUI; mtsSocketBaseQtWidget * socketGUI; const std::string name = armIter->first; switch(armIter->second->mType) { case mtsIntuitiveResearchKitConsole::Arm::ARM_MTM: case mtsIntuitiveResearchKitConsole::Arm::ARM_MTM_DERIVED: case mtsIntuitiveResearchKitConsole::Arm::ARM_PSM: case mtsIntuitiveResearchKitConsole::Arm::ARM_PSM_DERIVED: case mtsIntuitiveResearchKitConsole::Arm::ARM_ECM: case mtsIntuitiveResearchKitConsole::Arm::ARM_ECM_DERIVED: // PID widget unsigned int numberOfJoints; if ((armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_PSM) || (armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_PSM_DERIVED)) { numberOfJoints = 7; } else if ((armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_MTM) || (armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_MTM_DERIVED)) { numberOfJoints = 7; } else if ((armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_ECM) || (armIter->second->mType == mtsIntuitiveResearchKitConsole::Arm::ARM_ECM_DERIVED)) { numberOfJoints = 4; } else { numberOfJoints = 0; // can't happen but prevents compiler warning } pidGUI = new mtsPIDQtWidget(name + "-PID-GUI", numberOfJoints); pidGUI->Configure(); componentManager->AddComponent(pidGUI); Connections.push_back(new ConnectionType(pidGUI->GetName(), "Controller", armIter->second->PIDComponentName(), "Controller")); pidTabWidget->addTab(pidGUI, (name + " PID").c_str()); // Arm widget armGUI = new mtsIntuitiveResearchKitArmQtWidget(name + "-GUI"); armGUI->Configure(); componentManager->AddComponent(armGUI); Connections.push_back(new ConnectionType(armGUI->GetName(), "Manipulator", armIter->second->ComponentName(), armIter->second->InterfaceName())); armTabWidget->addTab(armGUI, name.c_str()); // PSM server if (armIter->second->mSocketServer) { socketGUI = new mtsSocketBaseQtWidget(name + "-Server-GUI"); socketGUI->Configure(); componentManager->AddComponent(socketGUI); Connections.push_back(new ConnectionType(socketGUI->GetName(), "SocketBase", armIter->second->mSocketComponentName, "System")); armTabWidget->addTab(socketGUI, (name + "-Server").c_str()); break; } break; case mtsIntuitiveResearchKitConsole::Arm::ARM_SUJ: sujGUI = new mtsIntuitiveResearchKitSUJQtWidget("PSM1-SUJ"); componentManager->AddComponent(sujGUI); Connections.push_back(new ConnectionType(sujGUI->GetName(), "Manipulator", "SUJ", "PSM1")); armTabWidget->addTab(sujGUI, "PSM1 SUJ"); sujGUI = new mtsIntuitiveResearchKitSUJQtWidget("ECM-SUJ"); componentManager->AddComponent(sujGUI); Connections.push_back(new ConnectionType(sujGUI->GetName(), "Manipulator", "SUJ", "ECM")); armTabWidget->addTab(sujGUI, "ECM SUJ"); sujGUI = new mtsIntuitiveResearchKitSUJQtWidget("PSM2-SUJ"); componentManager->AddComponent(sujGUI); Connections.push_back(new ConnectionType(sujGUI->GetName(), "Manipulator", "SUJ", "PSM2")); armTabWidget->addTab(sujGUI, "PSM2 SUJ"); sujGUI = new mtsIntuitiveResearchKitSUJQtWidget("PSM3-SUJ"); componentManager->AddComponent(sujGUI); Connections.push_back(new ConnectionType(sujGUI->GetName(), "Manipulator", "SUJ", "PSM3")); armTabWidget->addTab(sujGUI, "PSM3 SUJ"); break; case mtsIntuitiveResearchKitConsole::Arm::ARM_PSM_SOCKET: socketGUI = new mtsSocketBaseQtWidget(name + "-GUI"); socketGUI->Configure(); componentManager->AddComponent(socketGUI); Connections.push_back(new ConnectionType(socketGUI->GetName(), "SocketBase", armIter->second->mName, "System")); armTabWidget->addTab(socketGUI, name.c_str()); break; case mtsIntuitiveResearchKitConsole::Arm::ARM_ECM_GENERIC: case mtsIntuitiveResearchKitConsole::Arm::ARM_MTM_GENERIC: case mtsIntuitiveResearchKitConsole::Arm::ARM_PSM_GENERIC: { // Arm widget QWidget * genericComponentGUI = new QWidget(); QHBoxLayout * genericComponentLayout = new QHBoxLayout(); genericComponentGUI->setLayout(genericComponentLayout); mtsMessageQtWidgetComponent * messageGUI = new mtsMessageQtWidgetComponent(name + "-Message-GUI"); componentManager->AddComponent(messageGUI); genericComponentLayout->addWidget(messageGUI); Connections.push_back(new ConnectionType(messageGUI->GetName(), "Component", armIter->second->ComponentName(), armIter->second->InterfaceName())); mtsIntervalStatisticsQtWidgetComponent * timingGUI = new mtsIntervalStatisticsQtWidgetComponent(name + "-Timing-GUI"); componentManager->AddComponent(timingGUI); genericComponentLayout->addWidget(timingGUI); Connections.push_back(new ConnectionType(timingGUI->GetName(), "Component", armIter->second->ComponentName(), armIter->second->InterfaceName())); armTabWidget->addTab(genericComponentGUI, name.c_str()); } break; default: CMN_LOG_CLASS_INIT_ERROR << "mtsIntuitiveResearchKitConsoleQt: arm " << name << ": unable to create appropriate Qt widgets for arm of this type" << std::endl; } } // add teleop PSM widgets bool hasTeleOp = false; const mtsIntuitiveResearchKitConsole::TeleopPSMList::iterator teleopsEnd = console->mTeleopsPSM.end(); mtsIntuitiveResearchKitConsole::TeleopPSMList::iterator teleopIter; for (teleopIter = console->mTeleopsPSM.begin(); teleopIter != teleopsEnd; ++teleopIter) { hasTeleOp = true; const std::string name = teleopIter->first; mtsTeleOperationPSMQtWidget * teleopGUI = new mtsTeleOperationPSMQtWidget(name + "-GUI"); teleopGUI->Configure(); componentManager->AddComponent(teleopGUI); Connections.push_back(new ConnectionType(teleopGUI->GetName(), "TeleOperation", name, "Setting")); TabWidget->addTab(teleopGUI, name.c_str()); } // add teleop ECM widget if (console->mTeleopECM) { hasTeleOp = true; const std::string name = console->mTeleopECM->Name(); mtsTeleOperationECMQtWidget * teleopGUI = new mtsTeleOperationECMQtWidget(name + "-GUI"); teleopGUI->Configure(); componentManager->AddComponent(teleopGUI); Connections.push_back(new ConnectionType(teleopGUI->GetName(), "TeleOperation", name, "Setting")); TabWidget->addTab(teleopGUI, name.c_str()); } consoleGUI->HasTeleOp(hasTeleOp); // show all widgets TabWidget->show(); }
void QgsAttributeDialog::init() { if ( !mFeature || !mLayer->dataProvider() ) return; const QgsFields &theFields = mLayer->pendingFields(); if ( theFields.isEmpty() ) return; QDialogButtonBox *buttonBox = NULL; if ( mLayer->editorLayout() == QgsVectorLayer::UiFileLayout && !mLayer->editForm().isEmpty() ) { // UI-File defined layout QFile file( mLayer->editForm() ); if ( file.open( QFile::ReadOnly ) ) { QUiLoader loader; QFileInfo fi( mLayer->editForm() ); loader.setWorkingDirectory( fi.dir() ); QWidget *myWidget = loader.load( &file, qobject_cast<QWidget*>( parent() ) ); file.close(); mDialog = qobject_cast<QDialog*>( myWidget ); buttonBox = myWidget->findChild<QDialogButtonBox*>(); } } else if ( mLayer->editorLayout() == QgsVectorLayer::TabLayout ) { // Tab display mDialog = new QDialog( qobject_cast<QWidget*>( parent() ) ); QGridLayout *gridLayout; QTabWidget *tabWidget; mDialog->resize( 447, 343 ); gridLayout = new QGridLayout( mDialog ); gridLayout->setObjectName( QString::fromUtf8( "gridLayout" ) ); tabWidget = new QTabWidget( mDialog ); gridLayout->addWidget( tabWidget ); foreach ( const QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() ) { QWidget* tabPage = new QWidget( tabWidget ); tabWidget->addTab( tabPage, widgDef->name() ); QGridLayout *tabPageLayout = new QGridLayout( tabPage ); if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer ) { QString dummy1; bool dummy2; tabPageLayout->addWidget( QgsAttributeEditor::createWidgetFromDef( widgDef, tabPage, mLayer, *mFeature, mContext, dummy1, dummy2 ) ); } else { QgsDebugMsg( "No support for fields in attribute editor on top level" ); } } buttonBox = new QDialogButtonBox( mDialog ); buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) ); gridLayout->addWidget( buttonBox ); }
void Robot::init(myData * _data, QVBoxLayout * boxLayout) { initFlag = true; addBaseGui(boxLayout); data = _data; industrialRobot = new ofxIndustrialRobot(data->baseApp); nameid = "Robot"; QTabWidget *robotTab = new QTabWidget(); QWidget * robotGeneralTab = new QWidget(); QGridLayout *robotGeneralTabLayout = new QGridLayout(); // //Motor control // QGroupBox * robotMotorArea = new QGroupBox("Motors"); QGridLayout *robotMotorLayout = new QGridLayout; // if(industrialRobot->thread.lock()){ for(int i=0;i<5;i++){ motorSlider[i] = new QSlider(Qt::Horizontal); // motorSlider[i]->setValue(industrialRobot->thread.coreData.arms[i].rotation); // motorSlider[i]->setFixedWidth(220); motorLabel[i] = new QLabel(""); motorLabel[i]->setFixedWidth(55); motorLabel2[i] = new QLabel(""); motorLabel2[i]->setFixedWidth(55); setValue[i] = new QPushButton("Set"); robotMotorLayout->addWidget( new QLabel(("Motor "+ofToString(i, 0)).c_str()),i,0); robotMotorLayout->addWidget(motorSlider[i],i,1); robotMotorLayout->addWidget(motorLabel[i],i,2); robotMotorLayout->addWidget(motorLabel2[i],i,3); robotMotorLayout->addWidget(setValue[i],i,4); } loadXmlButton = new QPushButton("Load xml"); robotMotorLayout->addWidget(loadXmlButton,6,0); variantSlider = new QSlider(Qt::Horizontal); variantSlider->setEnabled(false); variantSlider->setMinimum(0); variantSlider->setMaximum(1000.0); robotMotorLayout->addWidget( new QLabel("Variant"),5,0); robotMotorLayout->addWidget(variantSlider,5,1); // } robotMotorLayout->setAlignment(Qt::AlignTop); robotMotorArea->setLayout(robotMotorLayout); robotMotorArea->setMinimumWidth(460); robotGeneralTabLayout->addWidget(robotMotorArea,0,0); // //Mode/input selector // QWidget * robotModePositionArea = new QWidget(); QGridLayout *robotModePositionLayout = new QGridLayout; QGroupBox * robotModeArea = new QGroupBox("Mode"); QGridLayout *robotModeLayout = new QGridLayout; inputRadio[0] = new QRadioButton("Timeline", robotModeArea); inputRadio[1] = new QRadioButton("Manual Motor", robotModeArea); inputRadio[1]->setChecked(true); inputRadio[2] = new QRadioButton("Gravity", robotModeArea); inputRadio[3] = new QRadioButton("Manual position", robotModeArea); // inputRadio[4] = new QRadioButton("Change Variant", robotModeArea); setControlMode(CONTROL_MODE_MOTOR); robotModeLayout->addWidget(inputRadio[0],0,0); robotModeLayout->addWidget(inputRadio[1],1,0); robotModeLayout->addWidget(inputRadio[2],2,0); robotModeLayout->addWidget(inputRadio[3],3,0); // robotModeLayout->addWidget(inputRadio[4],4,0); // robotModeArea->setMinimumWidth(460); robotModeArea->setLayout(robotModeLayout); robotModePositionLayout->addWidget(robotModeArea,0,0); QGroupBox * robotPositionArea = new QGroupBox("Position"); QGridLayout *robotPositionLayout = new QGridLayout; robotPositionArea->setLayout(robotPositionLayout); robotModePositionLayout->addWidget(robotPositionArea,0,1); int n = 0, l =0; for(int i=0;i<6;i++){ manualPosition[i] = new QDoubleSpinBox(); robotPositionLayout->addWidget(manualPosition[i],l,1+n); if(i>2){ manualPosition[i]->setSingleStep(0.1); } n++; if(n>2){ n = 0; l++; } } manualPosition[0]->setMinimum(-300.0); manualPosition[0]->setMaximum(300.0); manualPosition[1]->setMinimum(00.0); manualPosition[1]->setMaximum(300.0); manualPosition[2]->setMinimum(-300.0); manualPosition[2]->setMaximum(300.0); for(int i=3;i<6;i++){ manualPosition[i]->setMinimum(-1.0); manualPosition[i]->setMaximum(1.0); } robotPositionLayout->addWidget(new QLabel("Pos"),0,0); robotPositionLayout->addWidget(new QLabel("Dir"),1,0); robotModePositionArea->setLayout(robotModePositionLayout); robotGeneralTabLayout->addWidget(robotModePositionArea,1,0); // //Serial control // QWidget * robotGeneralTabBottomWidget = new QWidget(); QGridLayout *robotGeneralTabBottomLayout = new QGridLayout; QWidget * robotSerialControlArea = new QWidget(); QGridLayout *robotSerialControlLayout = new QGridLayout; for(int i=0;i<5;i++){ motorStatusLabel[i] = new QLabel(""); robotSerialControlLayout->addWidget(motorStatusLabel[i],i,0); } panicStatus = new QLabel("Status: OK"); resetMotors = new QPushButton("Reset all motors"); unlockMotors = new QPushButton("Un&lock"); unlockMotors->setCheckable(true); robotSerialControlLayout->addWidget(panicStatus,6,0); robotSerialControlLayout->addWidget(resetMotors,7,0); robotSerialControlLayout->addWidget(unlockMotors,8,0); robotSerialControlArea->setLayout(robotSerialControlLayout); robotGeneralTabBottomLayout->addWidget(robotSerialControlArea,0,0); robotGeneralTabBottomWidget->setLayout(robotGeneralTabBottomLayout); robotGeneralTabLayout->addWidget(robotGeneralTabBottomWidget,2,0); QWidget * robotControllerWidget = new QWidget(); robotControllerLayout = new QVBoxLayout(); robotControllerLayout->setAlignment(Qt::AlignTop); robotControllerWidget->setLayout(robotControllerLayout); robotGeneralTabBottomLayout->addWidget(robotControllerWidget,0,1); controllerItemLocked = new QCheckBox("Locked"); controllerItemLocked->setEnabled(false); robotControllerLayout->addWidget(controllerItemLocked); QWidget * robotSerialTab = new QWidget(); QGridLayout *robotSerialTabLayout = new QGridLayout(); for(int i=0;i<8;i++){ byteone[i] = new QCheckBox(("Byte 1-"+ofToString(i, 0)).c_str()); bytetwo[i] = new QCheckBox(("Byte 2-"+ofToString(i, 0)).c_str()); bytestatus[i] = new QCheckBox(("Byte status-"+ofToString(i, 0)).c_str()); robotSerialTabLayout->addWidget(byteone[i],i,0); robotSerialTabLayout->addWidget(bytetwo[i],i,1); robotSerialTabLayout->addWidget(bytestatus[i],i,2); } robotGeneralTabLayout->setAlignment(Qt::AlignTop); robotGeneralTab->setMinimumWidth(500); robotGeneralTab->setLayout(robotGeneralTabLayout); robotSerialTabLayout->setAlignment(Qt::AlignTop); robotSerialTab->setMinimumWidth(500); robotSerialTab->setLayout(robotSerialTabLayout); robotTab->addTab(robotGeneralTab,"General"); robotTab->addTab(robotSerialTab,"Serial"); //robotTab->addTab(robotControllerTab,"Robot controller"); robotGeneralTabLayout->setAlignment(Qt::AlignTop); // robotInputTab->setLayout(robotInputTabLayout); // robotTab->addTab(robotInputTab,"Inputs"); boxLayout->addWidget(robotTab); boxLayout->setAlignment(Qt::AlignTop); // lastReverseHead = true; resetting = 0; manualControllerItem =addRobotController("Manual", CONTROL_MODE_MOTOR); currentControllerItem = manualControllerItem; setRobotController(manualControllerItem); warningShown = false; }
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent) { // set application icon ///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Filter " PACKAGE_VERSION); all = new Q3VBoxLayout(this); // -------- create menubar ------------------- Q3PopupMenu *fileMenu = new Q3PopupMenu(); fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q); Q3PopupMenu *helpMenu = new Q3PopupMenu(); helpMenu->insertItem( tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0); helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0); QMenuBar *bar = new QMenuBar(this); bar->insertItem(tr("&File"), fileMenu); bar->insertSeparator (); bar->insertItem(tr("&Help"), helpMenu); all->addWidget(bar); // reserve space for menubar all->addSpacing (bar->height() + 2); QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QWidget *Tab1 = new QWidget(t); Q3GridLayout *gp1 = new Q3GridLayout(Tab1,12,6,5,5); FilterName = new QComboBox(FALSE, Tab1); gp1->addWidget(FilterName,0,0); TformName = new QComboBox(FALSE, Tab1); gp1->addWidget(TformName,0,1); OrderBox = new QCheckBox(tr("Specify order"), Tab1); gp1->addWidget(OrderBox,1,0); Q3HBox *h1 = new Q3HBox(Tab1); h1->setSpacing (5); OrderCombo = new QComboBox(FALSE, h1); OrderCombo->setEnabled(TRUE); SubOrderCombo = new QComboBox(FALSE, h1); SubOrderCombo->setEnabled(FALSE); SubOrderCombo->insertItem( tr( "b" ) ); SubOrderCombo->insertItem( tr( "c" ) ); gp1->addWidget(h1,1,1); CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1); gp1->addWidget(CutoffLabel,2,0); EnterCutoff = new QLineEdit(Tab1); gp1->addWidget(EnterCutoff,2,1); CutoffCombo = new QComboBox(Tab1); CutoffCombo->insertItem( tr( "Hz" ) ); CutoffCombo->insertItem( tr( "kHz" ) ); CutoffCombo->insertItem( tr( "MHz" ) ); CutoffCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(CutoffCombo,2,2); RippleLabel = new QLabel(tr("Ripple"),Tab1); gp1->addWidget(RippleLabel,3,0); EnterRipple = new QLineEdit(Tab1); gp1->addWidget(EnterRipple,3,1); RippleUnitLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(RippleUnitLabel,3,2); AngleLabel = new QLabel(tr("Angle"),Tab1); gp1->addWidget(AngleLabel,3,3); EnterAngle = new QLineEdit(Tab1); gp1->addWidget(EnterAngle,3,4); AngleUnitLabel = new QLabel(tr("°"),Tab1); gp1->addWidget(AngleUnitLabel,3,5); ZinLabel = new QLabel(tr("Zin"),Tab1); gp1->addWidget(ZinLabel,7,0); EnterZin = new QLineEdit(Tab1); gp1->addWidget(EnterZin,7,1); OhmLabel = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel,7,2); ZoutLabel = new QLabel(tr("Zout"),Tab1); ZoutLabel->setEnabled(false); gp1->addWidget(ZoutLabel,7,3); EnterZout = new QLineEdit(Tab1); gp1->addWidget(EnterZout,7,4); OhmLabel_2 = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel_2,7,5); StopbandLabel = new QLabel(tr("Stopband corner"),Tab1); gp1->addWidget(StopbandLabel,5,0); EnterStopband = new QLineEdit(Tab1); gp1->addWidget(EnterStopband,5,1); StopbandCombo = new QComboBox(FALSE, Tab1); StopbandCombo->insertItem( tr( "Hz" ) ); StopbandCombo->insertItem( tr( "kHz" ) ); StopbandCombo->insertItem( tr( "MHz" ) ); StopbandCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(StopbandCombo,5,2); BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1); BandwidthLabel->setEnabled(FALSE); gp1->addWidget(BandwidthLabel,4,0); EnterBandwidth = new QLineEdit(Tab1); gp1->addWidget(EnterBandwidth,4,1); BandwidthCombo = new QComboBox(FALSE, Tab1); BandwidthCombo->setEnabled(FALSE); BandwidthCombo->insertItem( tr( "Hz" ) ); BandwidthCombo->insertItem( tr( "kHz" ) ); BandwidthCombo->insertItem( tr( "MHz" ) ); BandwidthCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(BandwidthCombo,4,2); AttenuationLabel = new QLabel(tr("Attenuation"),Tab1); gp1->addWidget(AttenuationLabel,6,0); EnterAttenuation = new QLineEdit(Tab1); gp1->addWidget(EnterAttenuation,6,1); dBLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(dBLabel,6,2); DualBox = new QCheckBox(tr("dual"),Tab1); gp1->addMultiCellWidget(DualBox,8,8,0,2); CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1); CauerPoleBox->setEnabled(FALSE); gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2); OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1); OptimizeCauerBox->setEnabled(FALSE); gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2); EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1); EqualInductorBox->setEnabled(FALSE); gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5); UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1); UseCrossBox->setEnabled(FALSE); gp1->addMultiCellWidget(UseCrossBox,9,9,3,5); Cboxes = new Q3VButtonGroup(tr("Optimize C"),Tab1); Cmin = new QRadioButton(tr("Cmin"),Cboxes); Cmax = new QRadioButton(tr("Cmax"),Cboxes); NoC = new QRadioButton(tr("noC"),Cboxes); gp1->addMultiCellWidget(Cboxes,11,11,0,2); Lboxes = new Q3VButtonGroup(tr("Optimize L"),Tab1); Lmin = new QRadioButton(tr("Lmin"),Lboxes); Lmax = new QRadioButton(tr("Lmax"),Lboxes); NoL = new QRadioButton(tr("noL"),Lboxes); gp1->addMultiCellWidget(Lboxes,11,11,3,5); t->addTab(Tab1, tr("LC Filters")); // ........................................................... QWidget *Tab2 = new QWidget(t); t->addTab(Tab2, tr("Microstrip Filters")); // ........................................................... QWidget *Tab3 = new QWidget(t); t->addTab(Tab3, tr("Active Filters")); // reserve space for vertical resizing all->addStretch(); // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) Q3HBox *Butts = new Q3HBox(this); Butts->setSpacing(3); Butts->setMargin(3); all->addWidget(Butts); cancelButton = new QPushButton(tr("Exit"),Butts); okButton = new QPushButton(tr("Calculate"),Butts); okButton->setEnabled(FALSE); // signals and slots connections connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); }
MLPredictInspector::MLPredictInspector(QWidget *parent) : AlgorithmInspector(parent) { _type = AlgorithmManager::MLPredict; // input QTabWidget *tabInput = new QTabWidget(this); _listImagery = new SourceList(ContentNode::LayerImagery, this); _listROI = new SourceList( ContentNode::LayerLabelmap | ContentNode::LayerShape, this); tabInput->addTab(_listImagery, "Imagery"); tabInput->addTab(_listROI, "ROI"); connect(_listImagery, SIGNAL(SourcesChanged()), this, SLOT(SetExample())); GVBoxLayout *layInput = new GVBoxLayout; layInput->setContentsMargins(15, 0, 4, 4); layInput->addWidget(tabInput); ToggleGroup *groupInput = new ToggleGroup(this); groupInput->setTitle("Input"); groupInput->addLayout(layInput); // param _valueModel = new FileEdit(this); connect(_valueModel, SIGNAL(open()), this, SLOT(SetModel())); // processor _comboMethod = new ComboBox(this); _comboMethod->addItem("Road Modeling"); _comboMethod->addItem("TV Segmentation"); connect(_comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetMethod(int))); // road modeling _valueRoadProbThresh = new QDoubleSpinBox(this); _valueRoadProbThresh->setMinimum(0.0); _valueRoadProbThresh->setMaximum(1.0); _valueRoadProbThresh->setValue(0.93); // tv segmentation _valueTVResolution = new QDoubleSpinBox(this); _valueTVResolution->setMinimum(0.0); _valueTVResolution->setMaximum(1000.0); _valueTVResolution->setValue(0.5); _valueTVAreaThresh = new QSpinBox(this); _valueTVAreaThresh->setMinimum(0); _valueTVAreaThresh->setMaximum(99999); _valueTVAreaThresh->setValue(100); _valueTVEdgeBeta = new QDoubleSpinBox(this); _valueTVEdgeBeta->setMinimum(0.0); _valueTVEdgeBeta->setMaximum(100.0); _valueTVEdgeBeta->setValue(0.6); _valueTVSmoothness = new QDoubleSpinBox(this); _valueTVSmoothness->setMinimum(0.0); _valueTVSmoothness->setMaximum(1000.0); _valueTVSmoothness->setValue(1.5); _valueTVNumSteps = new QSpinBox(this); _valueTVNumSteps->setMinimum(0); _valueTVNumSteps->setMaximum(99999); _valueTVNumSteps->setValue(100); // vectorization _valueVectorizeEps = new QDoubleSpinBox(this); _valueVectorizeEps->setMinimum(0.0); _valueVectorizeEps->setMaximum(1000.0); _valueVectorizeEps->setValue(2.0); GParamLayout *layParams = new GParamLayout; layParams->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layParams->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_TOP, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_BOTTOM); layParams->addParam("Model", _valueModel); layParams->addParam("Processor", _comboMethod); // road GParamLayout *layParams0 = new GParamLayout; layParams0->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layParams0->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, 0, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, 0); layParams0->addParam(new TextLabel("Probility Threshold"), _valueRoadProbThresh, Qt::AlignRight); _containerRoad = new QWidget(this); _containerRoad->setLayout(layParams0); // tv segmentation GParamLayout *layParams1 = new GParamLayout; layParams1->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layParams1->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, 0, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, 0); layParams1->addParam(new TextLabel("Resolution"), _valueTVResolution); layParams1->addParam(new TextLabel("Area Threshold"), _valueTVAreaThresh); layParams1->addParam(new TextLabel("Edge Beta"), _valueTVEdgeBeta); layParams1->addParam(new TextLabel("Smoothness"), _valueTVSmoothness); layParams1->addParam(new TextLabel("Number of Steps "), _valueTVNumSteps); _containerTVSeg = new QWidget(this); _containerTVSeg->setLayout(layParams1); // vectorization GParamLayout *layParams2 = new GParamLayout; layParams2->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layParams2->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_TOP, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_BOTTOM); layParams2->addParam(new TextLabel("Vectorization Tolerance "), _valueVectorizeEps, Qt::AlignRight); ToggleGroup *groupParams = new ToggleGroup(this); groupParams->setTitle("Params"); groupParams->addLayout(layParams); groupParams->addWidget(_containerRoad); groupParams->addWidget(_containerTVSeg); groupParams->addLayout(layParams2); // param settings _comboMethod->setCurrentIndex(0); SetMethod(0); // output format RadioButton *buttOutputShp = new RadioButton("Shapefile", this); RadioButton *buttOutputLbm = new RadioButton("Labelmap", this); buttOutputShp->setChecked(true); _valueOutputFormat = new QButtonGroup(this); _valueOutputFormat->addButton(buttOutputShp, AlgorithmLabelFlags::Shapefile); _valueOutputFormat->addButton(buttOutputLbm, AlgorithmLabelFlags::Labelmap); connect(_valueOutputFormat, SIGNAL(buttonClicked(int)), this, SLOT(SetExample())); GHBoxLayout *layFormatButtons = new GHBoxLayout; layFormatButtons->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layFormatButtons->addWidget(buttOutputShp); layFormatButtons->addWidget(buttOutputLbm); QGroupBox *contFormatButtons = new QGroupBox("Format", this); contFormatButtons->setLayout(layFormatButtons); GHBoxLayout *layOutputFormat = new GHBoxLayout; layOutputFormat->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, 0, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, 0); layOutputFormat->addWidget(contFormatButtons); layOutputFormat->addStretch(1); // output directory _valueOutputFolder = new FileEdit(this); _valueOutputSuffix = new LineEdit(this); _valueExample = new LineEdit(this); _valueExample->setReadOnly(true); connect(_valueOutputFolder, SIGNAL(open()), this, SLOT(SetOutputFolder())); connect(_valueOutputFolder, SIGNAL(textChanged(QString)), this, SLOT(SetExample())); connect(_valueOutputSuffix, SIGNAL(textChanged(QString)), this, SLOT(SetExample())); GParamLayout *layOutput = new GParamLayout; layOutput->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING); layOutput->setContentsMargins( _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_TOP, _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT, _config_ui().INSPECTORVIEW_PARAM_MARGIN_BOTTOM); layOutput->addParam("Directory", _valueOutputFolder); layOutput->addParam("Suffix", _valueOutputSuffix); layOutput->addParam("Example", _valueExample); ToggleGroup *groupOutput = new ToggleGroup(this); groupOutput->setTitle("Output"); groupOutput->addLayout(layOutputFormat); groupOutput->addLayout(layOutput); // overall GVBoxLayout *layout = new GVBoxLayout; layout->addWidget(groupInput, 0); layout->addWidget(groupParams, 0); layout->addWidget(groupOutput, 0); layout->addStretch(1); layout->setSpacing(10); QWidget *cont = new QWidget(this); cont->setLayout(layout); // settings _area->setWidget(cont); _textAlgorithm->setText("Prediction"); }
void CQIllustratorAlignToolbar:: addWidgets() { QBoxLayout *layout = qobject_cast<QBoxLayout *>(CQIllustratorToolbar::layout()); QGridLayout *grid = new QGridLayout; grid->setMargin(0); grid->setSpacing(2); layout->addLayout(grid); //----- QTabWidget *tab = new QTabWidget; QFont font = tab->font(); font.setPointSizeF(font.pointSizeF()*0.7); tab->setFont(font); //------ alignw_ = new CQAlignButtons; tab->addTab(alignw_, "Align"); connect(alignw_, SIGNAL(alignLeft()), this, SIGNAL(alignLeft())); connect(alignw_, SIGNAL(alignBottom()), this, SIGNAL(alignBottom())); connect(alignw_, SIGNAL(alignRight()), this, SIGNAL(alignRight())); connect(alignw_, SIGNAL(alignTop()), this, SIGNAL(alignTop())); connect(alignw_, SIGNAL(alignHorizontal()), this, SIGNAL(alignHorizontal())); connect(alignw_, SIGNAL(alignVertical()), this, SIGNAL(alignVertical())); connect(alignw_, SIGNAL(alignLeftPreview()), this, SIGNAL(alignLeftPreview())); connect(alignw_, SIGNAL(alignBottomPreview()), this, SIGNAL(alignBottomPreview())); connect(alignw_, SIGNAL(alignRightPreview()), this, SIGNAL(alignRightPreview())); connect(alignw_, SIGNAL(alignTopPreview()), this, SIGNAL(alignTopPreview())); connect(alignw_, SIGNAL(alignHorizontalPreview()), this, SIGNAL(alignHorizontalPreview())); connect(alignw_, SIGNAL(alignVerticalPreview()), this, SIGNAL(alignVerticalPreview())); connect(alignw_, SIGNAL(alignPreviewClear()), this, SIGNAL(alignPreviewClear())); //------ distw_ = new CQDistButtons; tab->addTab(distw_, "Distribute"); //------ spreadw_ = new CQSpreadButtons; tab->addTab(spreadw_, "Spread"); //------ grid->addWidget(tab, 0, 0, 2, 1); //------ QLabel *olabel = new QLabel("<small><b>Offset</b></small>"); offset_ = new CQRealEdit(0.0); offset_->setFocusPolicy(Qt::ClickFocus); grid->addWidget(olabel , 0, 1); grid->addWidget(offset_, 1, 1); //------ anchor_ = new CQAlignAnchor; connect(anchor_, SIGNAL(selectObject()), this, SIGNAL(selectAnchorObject())); connect(anchor_, SIGNAL(selectPosition()), this, SIGNAL(selectAnchorPosition())); connect(anchor_, SIGNAL(cancelSelect()), this, SIGNAL(cancelSelectAnchor())); grid->addWidget(anchor_, 0, 2, 2, 1); //------ grid->setColumnStretch(3, 1); }
static int dynamicNormalizerGuiMain(int argc, char* argv[]) { uint32_t versionMajor, versionMinor, versionPatch; MDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch); //initialize application QApplication app(argc, argv); app.setWindowIcon(QIcon(":/res/chart_curve.png")); app.setStyle(new QPlastiqueStyle()); //create basic tab widget QTabWidget window; window.setWindowTitle(QString("Dynamic Audio Normalizer - Log Viewer [%1]").arg(QString().sprintf("v%u.%02u-%u", versionMajor, versionMinor, versionPatch))); window.setMinimumSize(640, 480); window.show(); //get arguments const QStringList args = app.arguments(); //choose input file const QString logFileName = (args.size() < 2) ? QFileDialog::getOpenFileName(&window, "Open Log File", QString(), QString("Log File (*.log)")) : args.at(1); if(logFileName.isEmpty()) { return EXIT_FAILURE; } //check for existence if(!(QFileInfo(logFileName).exists() && QFileInfo(logFileName).isFile())) { QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The specified log file could not be found!")); return EXIT_FAILURE; } //open the input file QFile logFile(logFileName); if(!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The selected log file could not opened for reading!")); return EXIT_FAILURE; } //wrap into text stream QTextStream textStream(&logFile); textStream.setCodec("UTF-8"); double minValue = DBL_MAX; double maxValue = 0.0; unsigned int channels = 0; //parse header if(!parseHeader(textStream, channels)) { QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to parse the header of the log file!\nProbably the file is of an unsupported type.")); return EXIT_FAILURE; } //allocate buffers LogFileData *data = new LogFileData[channels]; QCustomPlot *plot = new QCustomPlot[channels]; //load data parseData(textStream, channels, data, minValue, maxValue); logFile.close(); //check data if((data[0].original.size() < 1) || (data[0].minimal.size() < 1) || (data[0].smoothed.size() < 1)) { QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to load data. Log file countains no valid data!")); delete [] data; delete [] plot; return EXIT_FAILURE; } //determine length of data unsigned int length = UINT_MAX; for(unsigned int c = 0; c < channels; c++) { length = qMin(length, (unsigned int) data[c].original.count()); length = qMin(length, (unsigned int) data[c].minimal .count()); length = qMin(length, (unsigned int) data[c].smoothed.count()); } //create x-axis steps QVector<double> steps(length); for(unsigned int i = 0; i < length; i++) { steps[i] = double(i); } //now create the plots for(unsigned int c = 0; c < channels; c++) { //init the legend plot[c].legend->setVisible(true); plot[c].legend->setFont(QFont("Helvetica", 9)); //create graph and assign data to it: createGraph(&plot[c], steps, data[c].original, Qt::blue, Qt::SolidLine, 1); createGraph(&plot[c], steps, data[c].minimal, Qt::green, Qt::SolidLine, 1); createGraph(&plot[c], steps, data[c].smoothed, Qt::red, Qt::DashLine, 2); //set plot names plot[c].graph(0)->setName("Local Max. Gain"); plot[c].graph(1)->setName("Minimum Filtered"); plot[c].graph(2)->setName("Final Smoothed"); //set axes labels: plot[c].xAxis->setLabel("Frame #"); plot[c].yAxis->setLabel("Gain Factor"); makeAxisBold(plot[c].xAxis); makeAxisBold(plot[c].yAxis); //set axes ranges plot[c].xAxis->setRange(0.0, length); plot[c].yAxis->setRange(minValue - 0.25, maxValue + 0.25); plot[c].yAxis->setScaleType(QCPAxis::stLinear); plot[c].yAxis->setTickStep(1.0); plot[c].yAxis->setAutoTickStep(false); //add title plot[c].plotLayout()->insertRow(0); plot[c].plotLayout()->addElement(0, 0, new QCPPlotTitle(&plot[c], QString("%1 (Channel %2/%3)").arg(QFileInfo(logFile).fileName(), QString::number(c+1), QString::number(channels)))); //show the plot plot[c].replot(); window.addTab(&plot[c], QString().sprintf("Channel #%u", c + 1)); } //run application window.showMaximized(); app.exec(); //clean up delete [] data; delete [] plot; return EXIT_SUCCESS; }
AboutDialog::AboutDialog(const QString &lang, QWidget *parent) : Dialog(parent, Qt::MSWindowsFixedSizeDialogHint) { setWindowTitle(tr("About")); setWindowFlags (windowFlags() & ~Qt::WindowContextHelpButtonHint); setObjectName("AboutDialog"); setMinimumWidth(480); QTabWidget *tabWidget = new QTabWidget(); QyurSqlTreeView treeView; QString revisionStr; if (QString("%1").arg(VCS_REVISION) != "0") { revisionStr = "<BR>" + tr("Revision") + " " + QString("%1").arg(VCS_REVISION); } QString appInfo = "<html><style>a { color: blue; text-decoration: none; }</style><body>" "<CENTER>" "<IMG SRC=\":/images/images/logo.png\">" "<BR><IMG SRC=\":/images/images/logo_text.png\">" "<P>" + tr("Version") + " " + "<B>" + QString(STRPRODUCTVER) + "</B>" + QString(" (%1)").arg(STRDATE) + revisionStr + "</P>" + "<BR>" + tr("QuiteRSS is a open-source cross-platform RSS/Atom news reader") + "<P>" + tr("Includes:") + QString(" Qt-%1, SQLite-%2, QyurSqlTreeView-%3,"). arg(QT_VERSION_STR).arg(SQLITE_VERSION). arg(treeView.metaObject()->classInfo(treeView.metaObject()->indexOfClassInfo("Version")).value()) + "<BR>" + QString(" WebKit-%4, QupZilla-1.7.0"). arg(qWebKitVersion()) + "</P>" + QString("<a href=\"%1\">%1</a>").arg("http://quiterss.org") + "<P>Copyright © 2011-2015 QuiteRSS Team " + QString("<a href=\"%1\">E-mail</a>").arg("mailto:[email protected]") + "</P>" "</CENTER></body></html>"; QLabel *infoLabel = new QLabel(appInfo); infoLabel->setOpenExternalLinks(true); infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->addWidget(infoLabel); QWidget *mainWidget = new QWidget(); mainWidget->setLayout(mainLayout); QTextEdit *authorsTextEdit = new QTextEdit(this); authorsTextEdit->setReadOnly(true); QFile file; file.setFileName(":/file/AUTHORS"); file.open(QFile::ReadOnly); authorsTextEdit->setText(QString::fromUtf8(file.readAll())); file.close(); QHBoxLayout *authorsLayout = new QHBoxLayout(); authorsLayout->addWidget(authorsTextEdit); QWidget *authorsWidget = new QWidget(); authorsWidget->setLayout(authorsLayout); QTextBrowser *historyTextBrowser = new QTextBrowser(); historyTextBrowser->setOpenExternalLinks(true); if (lang.contains("ru", Qt::CaseInsensitive)) file.setFileName(":/file/HISTORY_RU"); else file.setFileName(":/file/HISTORY_EN"); file.open(QFile::ReadOnly); historyTextBrowser->setHtml(QString::fromUtf8(file.readAll())); file.close(); QHBoxLayout *historyLayout = new QHBoxLayout(); historyLayout->addWidget(historyTextBrowser); QWidget *historyWidget = new QWidget(); historyWidget->setLayout(historyLayout); QTextEdit *licenseTextEdit = new QTextEdit(); licenseTextEdit->setReadOnly(true); file.setFileName(":/file/COPYING"); file.open(QFile::ReadOnly); QString str = QString(QString::fromUtf8(file.readAll())).section("-----", 1, 1); licenseTextEdit->setText(str); file.close(); QHBoxLayout *licenseLayout = new QHBoxLayout(); licenseLayout->addWidget(licenseTextEdit); QWidget *licenseWidget = new QWidget(); licenseWidget->setLayout(licenseLayout); QString portable; if (mainApp->isPortable()) { if (!mainApp->isPortableAppsCom()) portable = "(Portable)"; else portable = "(PortableApps)"; } Settings settings; QString information = "<table border=\"0\"><tr>" "<td>" + tr("Version") + " </td>" "<td>" + QString("%1.%2 %3 %4").arg(STRPRODUCTVER).arg(VCS_REVISION).arg(portable).arg(STRDATE) + "</td>" "</tr><tr></tr><tr>" "<td>" + tr("Application directory:") + " </td>" "<td>" + QCoreApplication::applicationDirPath() + "</td>" "</tr><tr>" "<td>" + tr("Resource directory:") + " </td>" "<td>" + mainApp->resourcesDir() + "</td>" "</tr><tr>" "<td>" + tr("Data directory:") + " </td>" "<td>" + mainApp->dataDir() + "</td>" "</tr><tr>" "<td>" + tr("Backup directory:") + " </td>" "<td>" + mainApp->dataDir() + "/backup" + "</td>" "</tr><tr></tr><tr>" "<td>" + tr("Database file:") + " </td>" "<td>" + mainApp->dbFileName() + "</td>" "</tr><tr>" "<td>" + tr("Settings file:") + " </td>" "<td>" + settings.fileName() + "</td>" "</tr><tr>" "<td>" + tr("Log file:") + " </td>" "<td>" + mainApp->dataDir() + "/debug.log" + "</td>" "</tr></table>"; QTextEdit *informationTextEdit = new QTextEdit(); informationTextEdit->setReadOnly(true); informationTextEdit->setText(information); QHBoxLayout *informationLayout = new QHBoxLayout(); informationLayout->addWidget(informationTextEdit); QWidget *informationWidget = new QWidget(); informationWidget->setLayout(informationLayout); tabWidget->addTab(mainWidget, tr("Version")); tabWidget->addTab(authorsWidget, tr("Authors")); tabWidget->addTab(historyWidget, tr("History")); tabWidget->addTab(licenseWidget, tr("License")); tabWidget->addTab(informationWidget, tr("Information")); pageLayout->addWidget(tabWidget); buttonBox->addButton(QDialogButtonBox::Close); }
PreferencesDialog::PreferencesDialog(Preferences& preferences, QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint), m_preferences(preferences) { setWindowTitle(tr("Preferences")); QTabWidget* tabs = new QTabWidget(this); tabs->addTab(initGeneralTab(), tr("General")); tabs->addTab(initStatisticsTab(), tr("Statistics")); tabs->addTab(initToolbarTab(), tr("Toolbar")); tabs->addTab(initSpellingTab(), tr("Spell Checking")); tabs->setUsesScrollButtons(false); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(tabs); layout->addWidget(buttons); // Load settings switch (m_preferences.goalType()) { case 1: m_option_time->setChecked(true); break; case 2: m_option_wordcount->setChecked(true); break; default: m_option_none->setChecked(true); break; } m_time->setValue(m_preferences.goalMinutes()); m_wordcount->setValue(m_preferences.goalWords()); m_show_characters->setChecked(m_preferences.showCharacters()); m_show_pages->setChecked(m_preferences.showPages()); m_show_paragraphs->setChecked(m_preferences.showParagraphs()); m_show_words->setChecked(m_preferences.showWords()); switch (m_preferences.pageType()) { case 1: m_option_paragraphs->setChecked(true); break; case 2: m_option_words->setChecked(true); break; default: m_option_characters->setChecked(true); break; } m_page_characters->setValue(m_preferences.pageCharacters()); m_page_paragraphs->setValue(m_preferences.pageParagraphs()); m_page_words->setValue(m_preferences.pageWords()); if (m_preferences.accurateWordcount()) { m_option_accurate_wordcount->setChecked(true); } else { m_option_estimate_wordcount->setChecked(true); } m_always_center->setChecked(m_preferences.alwaysCenter()); m_block_cursor->setChecked(m_preferences.blockCursor()); m_rich_text->setChecked(m_preferences.richText()); m_smooth_fonts->setChecked(m_preferences.smoothFonts()); m_smart_quotes->setChecked(m_preferences.smartQuotes()); m_double_quotes->setCurrentIndex(m_preferences.doubleQuotes()); m_single_quotes->setCurrentIndex(m_preferences.singleQuotes()); m_typewriter_sounds->setChecked(m_preferences.typewriterSounds()); m_auto_save->setChecked(m_preferences.autoSave()); m_save_positions->setChecked(m_preferences.savePositions()); int style = m_toolbar_style->findData(m_preferences.toolbarStyle()); if (style == -1) { style = m_toolbar_style->findData(Qt::ToolButtonTextUnderIcon); } m_toolbar_style->setCurrentIndex(style); QStringList actions = m_preferences.toolbarActions(); int pos = 0; foreach (const QString& action, actions) { QString text = action; bool checked = !text.startsWith("^"); if (!checked) { text.remove(0, 1); } QListWidgetItem* item = 0; if (text != "|") { int count = m_toolbar_actions->count(); for (int i = pos; i < count; ++i) { if (m_toolbar_actions->item(i)->data(Qt::UserRole).toString() == text) { item = m_toolbar_actions->takeItem(i); break; } } } else if (checked) { item = new QListWidgetItem(QString(20, QChar('-'))); item->setData(Qt::UserRole, "|"); } if (item != 0) { item->setCheckState(checked ? Qt::Checked : Qt::Unchecked); m_toolbar_actions->insertItem(pos, item); pos++; } }
QWidget *ConfigDialog::createSolverWidget() { logMessage("ConfigDialog::createSolverWidget()"); // general chkDeleteTriangleMeshFiles = new QCheckBox(tr("Delete files with initial mesh (Triangle)")); chkDeleteHermes2DMeshFile = new QCheckBox(tr("Delete files with solution mesh (Hermes2D)")); chkShowConvergenceChart = new QCheckBox(tr("Show convergence chart after solving")); QVBoxLayout *layoutSolver = new QVBoxLayout(); layoutSolver->addWidget(chkDeleteTriangleMeshFiles); layoutSolver->addWidget(chkDeleteHermes2DMeshFile); layoutSolver->addWidget(chkShowConvergenceChart); QGroupBox *grpSolver = new QGroupBox(tr("Solver")); grpSolver->setLayout(layoutSolver); txtMeshAngleSegmentsCount = new QSpinBox(this); txtMeshAngleSegmentsCount->setMinimum(2); txtMeshAngleSegmentsCount->setMaximum(20); chkMeshCurvilinearElements = new QCheckBox(tr("Curvilinear elements")); QGridLayout *layoutMesh = new QGridLayout(); layoutMesh->addWidget(new QLabel(tr("Angle segments count:")), 0, 0); layoutMesh->addWidget(txtMeshAngleSegmentsCount, 0, 1); layoutMesh->addWidget(chkMeshCurvilinearElements, 1, 0, 1, 2); QGroupBox *grpMesh = new QGroupBox(tr("Mesh")); grpMesh->setLayout(layoutMesh); QVBoxLayout *layoutGeneral = new QVBoxLayout(); layoutGeneral->addWidget(grpSolver); layoutGeneral->addWidget(grpMesh); layoutGeneral->addStretch(); QWidget *solverGeneralWidget = new QWidget(this); solverGeneralWidget->setLayout(layoutGeneral); // adaptivity lblMaxDofs = new QLabel(tr("Maximum number of DOFs:")); txtMaxDOFs = new QSpinBox(this); txtMaxDOFs->setMinimum(1e2); txtMaxDOFs->setMaximum(1e9); txtMaxDOFs->setSingleStep(1e2); /* chkIsoOnly = new QCheckBox(tr("Isotropic refinement")); lblIsoOnly = new QLabel(tr("<table>" "<tr><td><b>true</b></td><td>isotropic refinement</td></tr>" "<tr><td><b>false</b></td><td>anisotropic refinement</td></tr>" "</table>")); */ txtConvExp = new SLineEditDouble(); lblConvExp = new QLabel(tr("<b></b>default value is 1.0, this parameter influences<br/>the selection of candidates in hp-adaptivity")); txtThreshold = new SLineEditDouble(); lblThreshold = new QLabel(tr("<b></b>quantitative parameter of the adapt(...) function<br/>with different meanings for various adaptive strategies")); cmbStrategy = new QComboBox(); cmbStrategy->addItem(tr("0"), 0); cmbStrategy->addItem(tr("1"), 1); cmbStrategy->addItem(tr("2"), 2); lblStrategy = new QLabel(tr("<table>" "<tr><td><b>0</b></td><td>refine elements until sqrt(<b>threshold</b>)<br/>times total error is processed.<br/>If more elements have similar errors,<br/>refine all to keep the mesh symmetric</td></tr>" "<tr><td><b>1</b></td><td>refine all elements<br/>whose error is larger than <b>threshold</b><br/>times maximum element error</td></tr>" "<tr><td><b>2</b></td><td>refine all elements<br/>whose error is larger than <b>threshold</b></td></tr>" "</table>")); cmbMeshRegularity = new QComboBox(); cmbMeshRegularity->addItem(tr("arbitrary level hang. nodes"), -1); cmbMeshRegularity->addItem(tr("at most one-level hang. nodes"), 1); cmbMeshRegularity->addItem(tr("at most two-level hang. nodes"), 2); cmbMeshRegularity->addItem(tr("at most three-level hang. nodes"), 3); cmbMeshRegularity->addItem(tr("at most four-level hang. nodes"), 4); cmbMeshRegularity->addItem(tr("at most five-level hang. nodes"), 5); cmbProjNormType = new QComboBox(); cmbProjNormType->addItem(errorNormString(HERMES_H1_NORM), HERMES_H1_NORM); cmbProjNormType->addItem(errorNormString(HERMES_L2_NORM), HERMES_L2_NORM); cmbProjNormType->addItem(errorNormString(HERMES_H1_SEMINORM), HERMES_H1_SEMINORM); // default QPushButton *btnAdaptivityDefault = new QPushButton(tr("Default")); connect(btnAdaptivityDefault, SIGNAL(clicked()), this, SLOT(doAdaptivityDefault())); QGridLayout *layoutAdaptivitySettings = new QGridLayout(); layoutAdaptivitySettings->addWidget(lblMaxDofs, 0, 0); layoutAdaptivitySettings->addWidget(txtMaxDOFs, 0, 1, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Conv. exp.:")), 2, 0); layoutAdaptivitySettings->addWidget(txtConvExp, 2, 1); layoutAdaptivitySettings->addWidget(lblConvExp, 3, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Strategy:")), 4, 0); layoutAdaptivitySettings->addWidget(cmbStrategy, 4, 1); layoutAdaptivitySettings->addWidget(lblStrategy, 5, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Threshold:")), 6, 0); layoutAdaptivitySettings->addWidget(txtThreshold, 6, 1); layoutAdaptivitySettings->addWidget(lblThreshold, 7, 0, 1, 2); layoutAdaptivitySettings->addWidget(new QLabel(tr("Mesh regularity:")), 8, 0); layoutAdaptivitySettings->addWidget(cmbMeshRegularity, 8, 1); layoutAdaptivitySettings->addWidget(new QLabel(tr("Norm:")), 9, 0); layoutAdaptivitySettings->addWidget(cmbProjNormType, 9, 1); QVBoxLayout *layoutAdaptivity = new QVBoxLayout(); layoutAdaptivity->addLayout(layoutAdaptivitySettings); layoutAdaptivity->addStretch(); layoutAdaptivity->addWidget(btnAdaptivityDefault, 0, Qt::AlignLeft); QWidget *solverAdaptivityWidget = new QWidget(this); solverAdaptivityWidget->setLayout(layoutAdaptivity); // commands txtArgumentTriangle = new QLineEdit(""); txtArgumentFFmpeg = new QLineEdit(""); // default QPushButton *btnCommandsDefault = new QPushButton(tr("Default")); connect(btnCommandsDefault, SIGNAL(clicked()), this, SLOT(doCommandsDefault())); QVBoxLayout *layoutCommands = new QVBoxLayout(); layoutCommands->addWidget(new QLabel(tr("Triangle"))); layoutCommands->addWidget(txtArgumentTriangle); layoutCommands->addWidget(new QLabel(tr("FFmpeg"))); layoutCommands->addWidget(txtArgumentFFmpeg); layoutCommands->addStretch(); layoutCommands->addWidget(btnCommandsDefault, 0, Qt::AlignLeft); QWidget *solverCommandsWidget = new QWidget(this); solverCommandsWidget->setLayout(layoutCommands); QTabWidget *solverWidget = new QTabWidget(this); solverWidget->addTab(solverGeneralWidget, icon(""), tr("General")); solverWidget->addTab(solverAdaptivityWidget, icon(""), tr("Adaptivity")); solverWidget->addTab(solverCommandsWidget, icon(""), tr("Commands")); return solverWidget; }
MainWindow::MainWindow() : m_settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard")) { QMenu *file = menuBar()->addMenu(tr("File")); file->addAction(tr("Open..."), this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O); m_recentMenu = file->addMenu(tr("Open recent")); file->addAction(tr("Save"), this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S); file->addAction(tr("Save as..."), this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S); file->addAction(tr("Quit"), this, SLOT(quit()), Qt::CTRL+Qt::Key_Q); QMenu *settings = menuBar()->addMenu(tr("Settings")); settings->addAction(tr("Reset to factory defaults"), this,SLOT(resetToDefaults())); settings->addAction(tr("Use current settings at startup"), this,SLOT(makeDefaults())); settings->addAction(tr("Clear recent list"), this,SLOT(clearRecent())); QMenu *help = menuBar()->addMenu(tr("Help")); help->addAction(tr("Online manual"), this, SLOT(manual()), Qt::Key_F1); help->addAction(tr("About"), this, SLOT(about()) ); m_expert = new Expert; m_wizard = new Wizard(m_expert->modelData()); // ----------- top part ------------------ QWidget *topPart = new QWidget; QVBoxLayout *rowLayout = new QVBoxLayout(topPart); // select working directory QHBoxLayout *dirLayout = new QHBoxLayout; m_workingDir = new QLineEdit; m_selWorkingDir = new QPushButton(tr("Select...")); dirLayout->addWidget(m_workingDir); dirLayout->addWidget(m_selWorkingDir); //------------- bottom part -------------- QWidget *runTab = new QWidget; QVBoxLayout *runTabLayout = new QVBoxLayout(runTab); // run doxygen QHBoxLayout *runLayout = new QHBoxLayout; m_run = new QPushButton(tr("Run doxygen")); m_run->setEnabled(false); m_runStatus = new QLabel(tr("Status: not running")); m_saveLog = new QPushButton(tr("Save log...")); m_saveLog->setEnabled(false); QPushButton *showSettings = new QPushButton(tr("Show configuration")); runLayout->addWidget(m_run); runLayout->addWidget(m_runStatus); runLayout->addStretch(1); runLayout->addWidget(showSettings); runLayout->addWidget(m_saveLog); // output produced by doxygen runTabLayout->addLayout(runLayout); runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen"))); QGridLayout *grid = new QGridLayout; m_outputLog = new QTextEdit; m_outputLog->setReadOnly(true); m_outputLog->setFontFamily(QString::fromAscii("courier")); m_outputLog->setMinimumWidth(600); grid->addWidget(m_outputLog,0,0); grid->setColumnStretch(0,1); grid->setRowStretch(0,1); QHBoxLayout *launchLayout = new QHBoxLayout; m_launchHtml = new QPushButton(tr("Show HTML output")); launchLayout->addWidget(m_launchHtml); launchLayout->addStretch(1); grid->addLayout(launchLayout,1,0); runTabLayout->addLayout(grid); QTabWidget *tabs = new QTabWidget; tabs->addTab(m_wizard,tr("Wizard")); tabs->addTab(m_expert,tr("Expert")); tabs->addTab(runTab,tr("Run")); rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run"))); rowLayout->addLayout(dirLayout); rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation"))); rowLayout->addWidget(tabs); setCentralWidget(topPart); statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout); m_runProcess = new QProcess; m_running = false; m_timer = new QTimer; // connect signals and slots connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int))); connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir())); connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*))); connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir())); connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout())); connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete())); connect(m_timer,SIGNAL(timeout()),SLOT(readStdout())); connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen())); connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput())); connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog())); connect(showSettings,SIGNAL(clicked()),SLOT(showSettings())); connect(m_expert,SIGNAL(changed()),SLOT(configChanged())); loadSettings(); updateLaunchButtonState(); m_modified = false; updateTitle(); m_wizard->refresh(); }
SingleActionEditor::SingleActionEditor(QWidget * par,ActionEditor * ed) : QWidget(par) { m_pActionEditor = ed; m_pActionData = 0; QGridLayout * g = new QGridLayout(this); QLabel * l = new QLabel(__tr2qs_ctx("Name:","editor"),this); g->addWidget(l,0,0); m_pNameEdit = new QLineEdit(this); g->addWidget(m_pNameEdit,0,1); m_pNameEdit->setToolTip(__tr2qs_ctx("Internal unique name for the action","editor")); l = new QLabel(__tr2qs_ctx("Label:","editor"),this); g->addWidget(l,1,0); m_pVisibleNameEdit = new QLineEdit(this); g->addWidget(m_pVisibleNameEdit,1,1); m_pVisibleNameEdit->setToolTip(__tr2qs_ctx("Visible name for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here","editor")); QTabWidget * tw = new QTabWidget(this); g->addWidget(tw,2,0,1,2); // code tab QWidget * tab = new QWidget(tw); QGridLayout * gl = new QGridLayout(tab); m_pScriptEditor = KviScriptEditor::createInstance(tab); gl->addWidget(m_pScriptEditor,0,0); m_pScriptEditor->setToolTip(__tr2qs_ctx("Action code","editor")); tw->addTab(tab,__tr2qs_ctx("Code","editor")); // properties tab tab = new QWidget(tw); gl = new QGridLayout(tab); l = new QLabel(__tr2qs_ctx("Category:","editor"),tab); gl->addWidget(l,0,0); m_pCategoryCombo = new QComboBox(tab); gl->addWidget(m_pCategoryCombo,0,1,1,3); m_pCategoryCombo->setToolTip(__tr2qs_ctx("Choose the category that best fits for this action","editor")); l = new QLabel(__tr2qs_ctx("Description:","editor"),tab); gl->addWidget(l,1,0); m_pDescriptionEdit = new QLineEdit(tab); gl->addWidget(m_pDescriptionEdit,1,1,1,3); m_pDescriptionEdit->setToolTip(__tr2qs_ctx("Visible short description for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here","editor")); l = new QLabel(__tr2qs_ctx("Small icon:","editor"),tab); gl->addWidget(l,2,0); m_pSmallIconEdit = new QLineEdit(tab); gl->addWidget(m_pSmallIconEdit,2,1); m_pSmallIconButton = new QToolButton(tab); m_pSmallIconButton->setMinimumSize(QSize(20,20)); connect(m_pSmallIconButton,SIGNAL(clicked()),this,SLOT(chooseSmallIcon())); gl->addWidget(m_pSmallIconButton,2,2); QString s= __tr2qs_ctx("The small icon associated to this action.<br>" \ "It will appear at least in the popup menus when this action is inserted.<br>" \ "It has to be 16x16 pixels.","editor"); m_pSmallIconEdit->setToolTip(s); m_pSmallIconButton->setToolTip(s); l = new QLabel(__tr2qs_ctx("Big icon:","editor"),tab); gl->addWidget(l,3,0); m_pBigIconEdit = new QLineEdit(tab); gl->addWidget(m_pBigIconEdit,3,1); m_pBigIconButton = new QToolButton(tab); m_pBigIconButton->setMinimumSize(QSize(48,48)); m_pBigIconButton->setIconSize(QSize(32,32)); connect(m_pBigIconButton,SIGNAL(clicked()),this,SLOT(chooseBigIcon())); gl->addWidget(m_pBigIconButton,3,2,2,2); s = __tr2qs_ctx("The big icon associated to this action.<br>" \ "It will appear at least in the toolbar buttons when this action is inserted.<br>" \ "It has to be 32x32 pixels.","editor"); m_pBigIconEdit->setToolTip(s); m_pBigIconButton->setToolTip(s); l = new QLabel(__tr2qs_ctx("Key sequence:","editor"),tab); gl->addWidget(l,4,0,2,1); m_pKeySequenceEdit = new QLineEdit(tab); gl->addWidget(m_pKeySequenceEdit,4,1,2,1); m_pKeySequenceEdit->setToolTip(__tr2qs_ctx("Optional keyboard sequence that will activate this action.<br>" \ "The sequence has to be expressed as a string of up to four key codes separated by commas " \ "eventually combined with the modifiers \"Ctrl\",\"Shift\",\"Alt\" and \"Meta\".<br>" \ "Examples of such sequences are \"Ctrl+X\", \"Ctrl+Alt+Z\", \"Ctrl+X,Ctrl+C\" ...","editor")); l = new QLabel(tab); gl->addWidget(l,6,0,1,4); gl->setColumnStretch(1,1); gl->setRowStretch(6,1); tw->addTab(tab,__tr2qs_ctx("Properties","editor")); // flags tab tab = new QWidget(tw); gl = new QGridLayout(tab); m_pNeedsContextCheck = new QCheckBox(__tr2qs_ctx("Needs IRC context","editor"),tab); connect(m_pNeedsContextCheck,SIGNAL(toggled(bool)),this,SLOT(needsContextCheckToggled(bool))); m_pNeedsContextCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window belongs to an IRC context","editor")); gl->addWidget(m_pNeedsContextCheck,0,0,1,4); l = new QLabel(tab); l->setMinimumWidth(40); gl->addWidget(l,1,0); m_pNeedsConnectionCheck = new QCheckBox(__tr2qs_ctx("Needs IRC connection","editor"),tab); connect(m_pNeedsConnectionCheck,SIGNAL(toggled(bool)),this,SLOT(needsConnectionCheckToggled(bool))); m_pNeedsConnectionCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window has an active IRC connection","editor")); gl->addWidget(m_pNeedsConnectionCheck,1,1,1,3); l = new QLabel(tab); l->setMinimumWidth(40); gl->addWidget(l,2,1); m_pEnableAtLoginCheck = new QCheckBox(__tr2qs_ctx("Enable at login","editor"),tab); m_pEnableAtLoginCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled also during " \ "the login operations (so when the logical IRC connection hasn't been established yet)","editor")); gl->addWidget(m_pEnableAtLoginCheck,2,2,1,2); m_pSpecificWindowsCheck = new QCheckBox(__tr2qs_ctx("Enable only in specified windows","editor"),tab); connect(m_pSpecificWindowsCheck,SIGNAL(toggled(bool)),this,SLOT(specificWindowsCheckToggled(bool))); m_pSpecificWindowsCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window is of a specified type","editor")); gl->addWidget(m_pSpecificWindowsCheck,3,0,1,4); m_pWindowConsoleCheck = new QCheckBox(__tr2qs_ctx("Enable in console windows","editor"),tab); m_pWindowConsoleCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window is a console","editor")); connect(m_pWindowConsoleCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); gl->addWidget(m_pWindowConsoleCheck,4,1,1,3); m_pConsoleOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab); m_pConsoleOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \ "selected users in the active window","editor")); gl->addWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,2,1,2); m_pWindowChannelCheck = new QCheckBox(__tr2qs_ctx("Enable in channel windows","editor"),tab); m_pWindowChannelCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window is a channel","editor")); connect(m_pWindowChannelCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); gl->addWidget(m_pWindowChannelCheck,6,1,1,3); m_pChannelOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab); m_pChannelOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \ "selected users in the active window","editor")); gl->addWidget(m_pChannelOnlyIfUsersSelectedCheck,7,2,1,2); m_pWindowQueryCheck = new QCheckBox(__tr2qs_ctx("Enable in query windows","editor"),tab); m_pWindowQueryCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window is a query","editor")); connect(m_pWindowQueryCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); gl->addWidget(m_pWindowQueryCheck,8,1,1,3); m_pQueryOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs_ctx("Only if there are selected users","editor"),tab); m_pQueryOnlyIfUsersSelectedCheck->setToolTip(__tr2qs_ctx("This will enable the action only if there are " \ "selected users in the active window","editor")); gl->addWidget(m_pQueryOnlyIfUsersSelectedCheck,9,2,1,2); m_pWindowDccChatCheck = new QCheckBox(__tr2qs_ctx("Enable in DCC chat windows","editor"),tab); m_pWindowDccChatCheck->setToolTip(__tr2qs_ctx("Check this option if this action should be enabled only when " \ "the active window is a DCC chat","editor")); gl->addWidget(m_pWindowDccChatCheck,10,1,1,2); l = new QLabel(tab); gl->addWidget(l,11,0,1,4); gl->setColumnStretch(3,1); gl->setRowStretch(11,1); tw->addTab(tab,__tr2qs_ctx("Flags","editor")); tw->setCurrentIndex(0); g->setRowStretch(2,1); g->setColumnStretch(1,1); KviPointerHashTableIterator<QString,KviActionCategory> it(*(KviActionManager::instance()->categories())); while(KviActionCategory * ac = it.current()) { m_pCategoryCombo->addItem(ac->visibleName() + " (" + ac->name() + ")"); ++it; } }
FunkytownConfigDialog::FunkytownConfigDialog( QWidget *parent ) : QDialog( parent ) , mpProxyWidget( new ProxyWidget( this ) ) , mpLogList( new QListWidget( this ) ) , mpHelpText( new QTextBrowser( this ) ) , mpGlobalConfigWidget( new GlobalConfigWidget( this ) ) , mpOverwrite( new QCheckBox( tr("Overwrite Files During Download"), this ) ) , mpCoverArt( new QCheckBox( tr("Download Cover-Like Artwork"), this ) ) , mpTollKeep( new QCheckBox( tr("Count Downloaded Files And Bytes"), this ) ) , mpDownloadedFiles( new QLabel( this ) ) , mpDownloadedBytes( new QLabel( this ) ) , mpClearButton( new QPushButton( tr("Clear"), this ) ) { setWindowTitle( QApplication::applicationName() + ": " + tr("Settings") ); setWindowIcon( QIcon( ":/Funkytown/Icon.png" ) ); mpHelpText->setReadOnly( true ); mpHelpText->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); mpHelpText->setOpenExternalLinks( true ); mpHelpText->setSource( QUrl("qrc:/Usage.html") ); AboutWidget *about( new AboutWidget( this ) ); QPushButton *okButton( new QPushButton(tr("OK"), this) ); QPushButton *cancelButton( new QPushButton(tr("Cancel"), this) ); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget( okButton ); buttonLayout->addWidget( cancelButton ); QWidget *settingsTab = new QWidget( this ); QGridLayout *settingsLayout = new QGridLayout( settingsTab ); settingsLayout->addWidget( mpOverwrite, 0, 0, 1, 3 ); settingsLayout->addWidget( mpCoverArt, 1, 0, 1, 3 ); settingsLayout->addWidget( mpTollKeep, 2, 0, 1, 3 ); settingsLayout->addWidget( new QLabel( tr("Downloaded Files:"), this ), 3, 0 ); settingsLayout->addWidget( mpDownloadedFiles, 3, 1 ); settingsLayout->addWidget( new QLabel( tr("Downloaded Bytes:"), this ), 4, 0 ); settingsLayout->addWidget( mpDownloadedBytes, 4, 1 ); settingsLayout->addWidget( mpClearButton, 3, 2, 2, 1 ); settingsLayout->setRowStretch( 5, 1 ); QBoxLayout *mainLayout = new QVBoxLayout( this ); QTabWidget *tabs = new QTabWidget( this ); tabs->addTab( mpHelpText, tr("Help") ); tabs->addTab( settingsTab, tr("Funkytown") ); tabs->addTab( mpProxyWidget, tr("Proxy") ); tabs->addTab( mpGlobalConfigWidget, tr("Global") ); tabs->addTab( mpLogList, tr("Log") ); mainLayout->addWidget( about ); mainLayout->addWidget( tabs ); mainLayout->addLayout( buttonLayout ); setLayout( mainLayout ); connect( mpClearButton, SIGNAL(clicked()), this, SLOT(handleClear()) ); connect( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) ); connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) ); connect( this, SIGNAL(rejected()), this, SLOT(readSettings()) ); readSettings(); }
QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent, const char *name) : QDialog(parent, name) { App = parent; setWindowTitle(tr("Edit Qucs Properties")); Expr.setPattern("[\\w_]+"); Validator = new QRegExpValidator(Expr, this); all = new QVBoxLayout(this); // to provide the necessary size QTabWidget *t = new QTabWidget(); all->addWidget(t); // ........................................................... // The application settings tab QWidget *appSettingsTab = new QWidget(t); QGridLayout *appSettingsGrid = new QGridLayout(appSettingsTab); appSettingsGrid->addWidget(new QLabel(tr("Font (set after reload):"), appSettingsTab), 0,0); FontButton = new QPushButton(appSettingsTab); connect(FontButton, SIGNAL(clicked()), SLOT(slotFontDialog())); appSettingsGrid->addWidget(FontButton,0,1); val50 = new QIntValidator(1, 50, this); appSettingsGrid->addWidget(new QLabel(tr("Large font size:"), appSettingsTab), 1,0); LargeFontSizeEdit = new QLineEdit(appSettingsTab); LargeFontSizeEdit->setValidator(val50); appSettingsGrid->addWidget(LargeFontSizeEdit,1,1); appSettingsGrid->addWidget(new QLabel(tr("Document Background Color:"), appSettingsTab) ,2,0); BGColorButton = new QPushButton(" ", appSettingsTab); connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog())); appSettingsGrid->addWidget(BGColorButton,2,1); appSettingsGrid->addWidget(new QLabel(tr("Language (set after reload):"), appSettingsTab) ,3,0); LanguageCombo = new QComboBox(appSettingsTab); LanguageCombo->insertItem(tr("system language")); LanguageCombo->insertItem(tr("English")+" (en)"); LanguageCombo->insertItem(tr("German")+" (de)"); LanguageCombo->insertItem(tr("French")+" (fr)"); LanguageCombo->insertItem(tr("Spanish")+" (es)"); LanguageCombo->insertItem(tr("Italian")+" (it)"); LanguageCombo->insertItem(tr("Polish")+" (pl)"); LanguageCombo->insertItem(tr("Romanian")+" (ro)"); LanguageCombo->insertItem(tr("Japanese")+" (jp)"); LanguageCombo->insertItem(tr("Swedish")+" (sv)"); LanguageCombo->insertItem(tr("Hungarian")+" (hu)"); LanguageCombo->insertItem(tr("Hebrew")+" (he)"); LanguageCombo->insertItem(tr("Portuguese-BR")+" (pt_BR)"); LanguageCombo->insertItem(tr("Portuguese-PT")+" (pt_PT)"); LanguageCombo->insertItem(tr("Turkish")+" (tr)"); LanguageCombo->insertItem(tr("Ukrainian")+" (uk)"); LanguageCombo->insertItem(tr("Russian")+" (ru)"); LanguageCombo->insertItem(tr("Czech")+" (cs)"); LanguageCombo->insertItem(tr("Catalan")+" (ca)"); LanguageCombo->insertItem(tr("Arabic")+" (ar)"); LanguageCombo->insertItem(tr("Kazakh")+" (kk)"); appSettingsGrid->addWidget(LanguageCombo,3,1); val200 = new QIntValidator(0, 200, this); appSettingsGrid->addWidget(new QLabel(tr("Maximum undo operations:"), appSettingsTab) ,4,0); undoNumEdit = new QLineEdit(appSettingsTab); undoNumEdit->setValidator(val200); appSettingsGrid->addWidget(undoNumEdit,4,1); appSettingsGrid->addWidget(new QLabel(tr("Text editor:"), appSettingsTab) ,5,0); editorEdit = new QLineEdit(appSettingsTab); editorEdit->setToolTip(tr("Set to qucs, qucsedit or the path to your favorite text editor.")); appSettingsGrid->addWidget(editorEdit,5,1); appSettingsGrid->addWidget(new QLabel(tr("Start wiring when clicking open node:"), appSettingsTab) ,6,0); checkWiring = new QCheckBox(appSettingsTab); appSettingsGrid->addWidget(checkWiring,6,1); appSettingsGrid->addWidget(new QLabel(tr("Load documents from future versions:"))); checkLoadFromFutureVersions = new QCheckBox(appSettingsTab); checkLoadFromFutureVersions->setToolTip(tr("Try to load also documents created with newer versions of Qucs.")); appSettingsGrid->addWidget(checkLoadFromFutureVersions,7,1); checkLoadFromFutureVersions->setChecked(QucsSettings.IgnoreFutureVersion); appSettingsGrid->addWidget(new QLabel(tr("Draw diagrams with anti-aliasing feature:"))); checkAntiAliasing = new QCheckBox(appSettingsTab); checkAntiAliasing->setToolTip(tr("Use anti-aliasing for graphs for a smoother appereance.")); appSettingsGrid->addWidget(checkAntiAliasing,8,1); checkAntiAliasing->setChecked(QucsSettings.GraphAntiAliasing); appSettingsGrid->addWidget(new QLabel(tr("Draw text with anti-aliasing feature:"))); checkTextAntiAliasing = new QCheckBox(appSettingsTab); checkTextAntiAliasing->setToolTip(tr("Use anti-aliasing for text for a smoother appereance.")); appSettingsGrid->addWidget(checkTextAntiAliasing,9,1); checkTextAntiAliasing->setChecked(QucsSettings.TextAntiAliasing); t->addTab(appSettingsTab, tr("Settings")); // ........................................................... // The source code editor settings tab QWidget *editorTab = new QWidget(t); QGridLayout *editorGrid = new QGridLayout(editorTab); editorGrid->addMultiCellWidget(new QLabel(tr("Colors for Syntax Highlighting:"), editorTab), 0,0,0,1); ColorComment = new QPushButton(tr("Comment"), editorTab); ColorComment->setPaletteForegroundColor(QucsSettings.Comment); ColorComment->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorComment, SIGNAL(clicked()), SLOT(slotColorComment())); editorGrid->addWidget(ColorComment,1,0); ColorString = new QPushButton(tr("String"), editorTab); ColorString->setPaletteForegroundColor(QucsSettings.String); ColorString->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorString, SIGNAL(clicked()), SLOT(slotColorString())); editorGrid->addWidget(ColorString,1,1); ColorInteger = new QPushButton(tr("Integer Number"), editorTab); ColorInteger->setPaletteForegroundColor(QucsSettings.Integer); ColorInteger->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorInteger, SIGNAL(clicked()), SLOT(slotColorInteger())); editorGrid->addWidget(ColorInteger,1,2); ColorReal = new QPushButton(tr("Real Number"), editorTab); ColorReal->setPaletteForegroundColor(QucsSettings.Real); ColorReal->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorReal, SIGNAL(clicked()), SLOT(slotColorReal())); editorGrid->addWidget(ColorReal,2,0); ColorCharacter = new QPushButton(tr("Character"), editorTab); ColorCharacter->setPaletteForegroundColor(QucsSettings.Character); ColorCharacter->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorCharacter, SIGNAL(clicked()), SLOT(slotColorCharacter())); editorGrid->addWidget(ColorCharacter,2,1); ColorDataType = new QPushButton(tr("Data Type"), editorTab); ColorDataType->setPaletteForegroundColor(QucsSettings.Type); ColorDataType->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorDataType, SIGNAL(clicked()), SLOT(slotColorDataType())); editorGrid->addWidget(ColorDataType,2,2); ColorAttribute = new QPushButton(tr("Attribute"), editorTab); ColorAttribute->setPaletteForegroundColor(QucsSettings.Attribute); ColorAttribute->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorAttribute, SIGNAL(clicked()), SLOT(slotColorAttribute())); editorGrid->addWidget(ColorAttribute,3,0); ColorDirective = new QPushButton(tr("Directive"), editorTab); ColorDirective->setPaletteForegroundColor(QucsSettings.Directive); ColorDirective->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorDirective, SIGNAL(clicked()), SLOT(slotColorDirective())); editorGrid->addWidget(ColorDirective,3,1); ColorTask = new QPushButton(tr("Task"), editorTab); ColorTask->setPaletteForegroundColor(QucsSettings.Task); ColorTask->setPaletteBackgroundColor(QucsSettings.BGColor); connect(ColorTask, SIGNAL(clicked()), SLOT(slotColorTask())); editorGrid->addWidget(ColorTask,3,2); t->addTab(editorTab, tr("Source Code Editor")); // ........................................................... // The file types tab QWidget *fileTypesTab = new QWidget(t); QGridLayout *fileTypesGrid = new QGridLayout(fileTypesTab); QLabel *note = new QLabel( tr("Register filename extensions here in order to\nopen files with an appropriate program.")); fileTypesGrid->addWidget(note,0,0,1,2); // the fileTypesTableWidget displays information on the file types fileTypesTableWidget = new QTableWidget(fileTypesTab); fileTypesTableWidget->setColumnCount(2); QTableWidgetItem *item1 = new QTableWidgetItem(); QTableWidgetItem *item2 = new QTableWidgetItem(); fileTypesTableWidget->setHorizontalHeaderItem(0, item1); fileTypesTableWidget->setHorizontalHeaderItem(1, item2); item1->setText(tr("Suffix")); item2->setText(tr("Program")); fileTypesTableWidget->horizontalHeader()->setStretchLastSection(true); fileTypesTableWidget->verticalHeader()->hide(); connect(fileTypesTableWidget, SIGNAL(cellClicked(int,int)), SLOT(slotTableClicked(int,int))); fileTypesGrid->addWidget(fileTypesTableWidget,1,0,3,1); // fill listview with already registered file extensions QStringList::Iterator it = QucsSettings.FileTypes.begin(); while(it != QucsSettings.FileTypes.end()) { int row = fileTypesTableWidget->rowCount(); fileTypesTableWidget->setRowCount(row+1); QTableWidgetItem *suffix = new QTableWidgetItem(QString((*it).section('/',0,0))); QTableWidgetItem *program = new QTableWidgetItem(QString((*it).section('/',1,1))); suffix->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); program->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); fileTypesTableWidget->setItem(row, 0, suffix); fileTypesTableWidget->setItem(row, 1, program); it++; } QLabel *l5 = new QLabel(tr("Suffix:"), fileTypesTab); fileTypesGrid->addWidget(l5,1,1); Input_Suffix = new QLineEdit(fileTypesTab); Input_Suffix->setValidator(Validator); fileTypesGrid->addWidget(Input_Suffix,1,2); // connect(Input_Suffix, SIGNAL(returnPressed()), SLOT(slotGotoProgEdit())); //not implemented QLabel *l6 = new QLabel(tr("Program:"), fileTypesTab); fileTypesGrid->addWidget(l6,2,1); Input_Program = new QLineEdit(fileTypesTab); fileTypesGrid->addWidget(Input_Program,2,2); QPushButton *AddButt = new QPushButton(tr("Set")); fileTypesGrid->addWidget(AddButt,3,1); connect(AddButt, SIGNAL(clicked()), SLOT(slotAddFileType())); QPushButton *RemoveButt = new QPushButton(tr("Remove")); fileTypesGrid->addWidget(RemoveButt,3,2); connect(RemoveButt, SIGNAL(clicked()), SLOT(slotRemoveFileType())); fileTypesGrid->setRowStretch(3,4); t->addTab(fileTypesTab, tr("File Types")); // ........................................................... // The locations tab QWidget *locationsTab = new QWidget(t); QGridLayout *locationsGrid = new QGridLayout(locationsTab); QLabel *note2 = new QLabel( tr("Edit the standard paths and external applications")); locationsGrid->addWidget(note2,0,0,1,2); locationsGrid->addWidget(new QLabel(tr("Qucs Home:"), locationsTab) ,1,0); homeEdit = new QLineEdit(locationsTab); locationsGrid->addWidget(homeEdit,1,1); QPushButton *HomeButt = new QPushButton("..."); locationsGrid->addWidget(HomeButt, 1, 2); connect(HomeButt, SIGNAL(clicked()), SLOT(slotHomeDirBrowse())); locationsGrid->addWidget(new QLabel(tr("AdmsXml Path:"), locationsTab) ,2,0); admsXmlEdit = new QLineEdit(locationsTab); locationsGrid->addWidget(admsXmlEdit,2,1); QPushButton *AdmsXmlButt = new QPushButton("..."); locationsGrid->addWidget(AdmsXmlButt, 2, 2); connect(AdmsXmlButt, SIGNAL(clicked()), SLOT(slotAdmsXmlDirBrowse())); locationsGrid->addWidget(new QLabel(tr("ASCO Path:"), locationsTab) ,3,0); ascoEdit = new QLineEdit(locationsTab); locationsGrid->addWidget(ascoEdit,3,1); QPushButton *ascoButt = new QPushButton("..."); locationsGrid->addWidget(ascoButt, 3, 2); connect(ascoButt, SIGNAL(clicked()), SLOT(slotAscoDirBrowse())); locationsGrid->addWidget(new QLabel(tr("Octave Path:"), locationsTab) ,4,0); octaveEdit = new QLineEdit(locationsTab); locationsGrid->addWidget(octaveEdit,4,1); QPushButton *OctaveButt = new QPushButton("..."); locationsGrid->addWidget(OctaveButt, 4, 2); connect(OctaveButt, SIGNAL(clicked()), SLOT(slotOctaveDirBrowse())); // the pathsTableWidget displays the path list pathsTableWidget = new QTableWidget(locationsTab); pathsTableWidget->setColumnCount(1); QTableWidgetItem *pitem1 = new QTableWidgetItem(); pathsTableWidget->setHorizontalHeaderItem(0, pitem1); pitem1->setText(tr("Subcircuit Search Path List")); pathsTableWidget->horizontalHeader()->setStretchLastSection(true); pathsTableWidget->verticalHeader()->hide(); // allow multiple items to be selected pathsTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(pathsTableWidget, SIGNAL(cellClicked(int,int)), SLOT(slotPathTableClicked(int,int))); locationsGrid->addWidget(pathsTableWidget,5,0,3,2); QPushButton *AddPathButt = new QPushButton("Add Path"); locationsGrid->addWidget(AddPathButt, 5, 2); connect(AddPathButt, SIGNAL(clicked()), SLOT(slotAddPath())); QPushButton *AddPathSubFolButt = new QPushButton("Add Path With SubFolders"); locationsGrid->addWidget(AddPathSubFolButt, 6, 2); connect(AddPathSubFolButt, SIGNAL(clicked()), SLOT(slotAddPathWithSubFolders())); QPushButton *RemovePathButt = new QPushButton("Remove Path"); locationsGrid->addWidget(RemovePathButt , 7, 2); connect(RemovePathButt, SIGNAL(clicked()), SLOT(slotRemovePath())); // create a copy of the current global path list currentPaths = QStringList(qucsPathList); makePathTable(); t->addTab(locationsTab, tr("Locations")); // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) QHBoxLayout *Butts = new QHBoxLayout(); Butts->setSpacing(3); Butts->setMargin(3); all->addLayout(Butts); QPushButton *OkButt = new QPushButton(tr("OK")); Butts->addWidget(OkButt); connect(OkButt, SIGNAL(clicked()), SLOT(slotOK())); QPushButton *ApplyButt = new QPushButton(tr("Apply")); Butts->addWidget(ApplyButt); connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply())); QPushButton *CancelButt = new QPushButton(tr("Cancel")); Butts->addWidget(CancelButt); connect(CancelButt, SIGNAL(clicked()), SLOT(reject())); QPushButton *DefaultButt = new QPushButton(tr("Default Values")); Butts->addWidget(DefaultButt); connect(DefaultButt, SIGNAL(clicked()), SLOT(slotDefaultValues())); OkButt->setDefault(true); // ........................................................... // fill the fields with the Qucs-Properties Font = QucsSettings.font; FontButton->setText(Font.toString()); QString s = QString::number(QucsSettings.largeFontSize, 'f', 1); LargeFontSizeEdit->setText(s); BGColorButton->setPaletteBackgroundColor(QucsSettings.BGColor); undoNumEdit->setText(QString::number(QucsSettings.maxUndo)); editorEdit->setText(QucsSettings.Editor); checkWiring->setChecked(QucsSettings.NodeWiring); for(int z=LanguageCombo->count()-1; z>=0; z--) if(LanguageCombo->text(z).section('(',1,1).remove(')') == QucsSettings.Language) LanguageCombo->setCurrentItem(z); /*! Load paths from settings */ homeEdit->setText(QucsSettings.QucsHomeDir.canonicalPath()); admsXmlEdit->setText(QucsSettings.AdmsXmlBinDir.canonicalPath()); ascoEdit->setText(QucsSettings.AscoBinDir.canonicalPath()); octaveEdit->setText(QucsSettings.OctaveBinDir.canonicalPath()); resize(300, 200); }
int main(int argc, char ** argv) { // configuration const double periodIO = 0.5 * cmn_ms; const double periodKinematics = 1.0 * cmn_ms; const double periodTeleop = 1.0 * cmn_ms; const double periodUDP = 20.0 * cmn_ms; // log configuration cmnLogger::SetMask(CMN_LOG_ALLOW_ALL); cmnLogger::SetMaskDefaultLog(CMN_LOG_ALLOW_ALL); cmnLogger::SetMaskFunction(CMN_LOG_ALLOW_ALL); cmnLogger::SetMaskClassMatching("mtsIntuitiveResearchKit", CMN_LOG_ALLOW_ALL); cmnLogger::AddChannel(std::cerr, CMN_LOG_ALLOW_ERRORS_AND_WARNINGS); // parse options cmnCommandLineOptions options; int firewirePort = 0; std::string gcmip = "-1"; std::string jsonMainConfigFile; std::string jsonCollectionConfigFile; typedef std::map<std::string, std::string> ConfigFilesType; ConfigFilesType configFiles; std::string masterName, slaveName; options.AddOptionOneValue("j", "json-config", "json configuration file", cmnCommandLineOptions::REQUIRED_OPTION, &jsonMainConfigFile); options.AddOptionOneValue("f", "firewire", "firewire port number(s)", cmnCommandLineOptions::OPTIONAL_OPTION, &firewirePort); options.AddOptionOneValue("g", "gcmip", "global component manager IP address", cmnCommandLineOptions::OPTIONAL_OPTION, &gcmip); options.AddOptionOneValue("c", "collection-config", "json configuration file for data collection", cmnCommandLineOptions::OPTIONAL_OPTION, &jsonCollectionConfigFile); // check that all required options have been provided std::string errorMessage; if (!options.Parse(argc, argv, errorMessage)) { std::cerr << "Error: " << errorMessage << std::endl; options.PrintUsage(std::cerr); return -1; } std::string arguments; options.PrintParsedArguments(arguments); std::cout << "Options provided:" << std::endl << arguments << std::endl; // make sure the json config file exists and can be parsed fileExists("JSON configuration", jsonMainConfigFile); std::ifstream jsonStream; jsonStream.open(jsonMainConfigFile.c_str()); Json::Value jsonConfig; Json::Reader jsonReader; if (!jsonReader.parse(jsonStream, jsonConfig)) { std::cerr << "Error: failed to parse configuration\n" << jsonReader.getFormattedErrorMessages(); return -1; } // start initializing the cisstMultiTask manager std::cout << "FirewirePort: " << firewirePort << std::endl; std::string processname = "dvTeleop"; mtsManagerLocal * componentManager = 0; if (gcmip != "-1") { try { componentManager = mtsManagerLocal::GetInstance(gcmip, processname); } catch(...) { std::cerr << "Failed to get GCM instance." << std::endl; return -1; } } else { componentManager = mtsManagerLocal::GetInstance(); } // create a Qt application and tab to hold all widgets mtsQtApplication * qtAppTask = new mtsQtApplication("QtApplication", argc, argv); qtAppTask->Configure(); componentManager->AddComponent(qtAppTask); // console mtsIntuitiveResearchKitConsole * console = new mtsIntuitiveResearchKitConsole("console"); componentManager->AddComponent(console); mtsIntuitiveResearchKitConsoleQtWidget * consoleGUI = new mtsIntuitiveResearchKitConsoleQtWidget("consoleGUI"); componentManager->AddComponent(consoleGUI); // connect consoleGUI to console componentManager->Connect("console", "Main", "consoleGUI", "Main"); // organize all widgets in a tab widget QTabWidget * tabWidget = new QTabWidget; tabWidget->addTab(consoleGUI, "Main"); // IO is shared accross components mtsRobotIO1394 * io = new mtsRobotIO1394("io", periodIO, firewirePort); // find name of button event used to detect if operator is present std::string operatorPresentComponent = jsonConfig["operator-present"]["component"].asString(); std::string operatorPresentInterface = jsonConfig["operator-present"]["interface"].asString(); //set defaults if (operatorPresentComponent == "") { operatorPresentComponent = "io"; } if (operatorPresentInterface == "") { operatorPresentInterface = "COAG"; } std::cout << "Using \"" << operatorPresentComponent << "::" << operatorPresentInterface << "\" to detect if operator is present" << std::endl; // setup io defined in the json configuration file const Json::Value pairs = jsonConfig["pairs"]; for (unsigned int index = 0; index < pairs.size(); ++index) { // master Json::Value jsonMaster = pairs[index]["master"]; std::string armName = jsonMaster["name"].asString(); std::string ioFile = jsonMaster["io"].asString(); fileExists(armName + " IO", ioFile); io->Configure(ioFile); // slave Json::Value jsonSlave = pairs[index]["slave"]; armName = jsonSlave["name"].asString(); ioFile = jsonSlave["io"].asString(); fileExists(armName + " IO", ioFile); io->Configure(ioFile); } componentManager->AddComponent(io); // connect ioGUIMaster to io mtsRobotIO1394QtWidgetFactory * robotWidgetFactory = new mtsRobotIO1394QtWidgetFactory("robotWidgetFactory"); componentManager->AddComponent(robotWidgetFactory); componentManager->Connect("robotWidgetFactory", "RobotConfiguration", "io", "Configuration"); robotWidgetFactory->Configure(); // add all IO GUI to tab mtsRobotIO1394QtWidgetFactory::WidgetListType::const_iterator iterator; for (iterator = robotWidgetFactory->Widgets().begin(); iterator != robotWidgetFactory->Widgets().end(); ++iterator) { tabWidget->addTab(*iterator, (*iterator)->GetName().c_str()); } tabWidget->addTab(robotWidgetFactory->ButtonsWidget(), "Buttons"); // setup arms defined in the json configuration file for (unsigned int index = 0; index < pairs.size(); ++index) { Json::Value jsonMaster = pairs[index]["master"]; std::string masterName = jsonMaster["name"].asString(); std::string masterPIDFile = jsonMaster["pid"].asString(); std::string masterKinematicFile = jsonMaster["kinematic"].asString(); std::string masterUDPIP = jsonMaster["UDP-IP"].asString(); short masterUDPPort = jsonMaster["UDP-port"].asInt(); fileExists(masterName + " PID", masterPIDFile); fileExists(masterName + " kinematic", masterKinematicFile); mtsIntuitiveResearchKitConsole::Arm * mtm = new mtsIntuitiveResearchKitConsole::Arm(masterName, io->GetName()); mtm->ConfigurePID(masterPIDFile); mtm->ConfigureArm(mtsIntuitiveResearchKitConsole::Arm::ARM_MTM, masterKinematicFile, periodKinematics); console->AddArm(mtm); if (masterUDPIP != "" || masterUDPPort != 0) { if (masterUDPIP != "" && masterUDPPort != 0) { std::cout << "Adding UDPStream component for master " << masterName << " to " << masterUDPIP << ":" << masterUDPPort << std::endl; mtsIntuitiveResearchKitUDPStreamer * streamer = new mtsIntuitiveResearchKitUDPStreamer(masterName + "UDP", periodUDP, masterUDPIP, masterUDPPort); componentManager->AddComponent(streamer); // connect to mtm interface to get cartesian position componentManager->Connect(streamer->GetName(), "Robot", mtm->Name(), "Robot"); // connect to io to get clutch events componentManager->Connect(streamer->GetName(), "Clutch", "io", "CLUTCH"); // connect to io to get coag events componentManager->Connect(streamer->GetName(), "Coag", "io", "COAG"); } else { std::cerr << "Error for master arm " << masterName << ", you can provided UDP-IP w/o UDP-port" << std::endl; exit(-1); } } Json::Value jsonSlave = pairs[index]["slave"]; std::string slaveName = jsonSlave["name"].asString(); std::string slavePIDFile = jsonSlave["pid"].asString(); std::string slaveKinematicFile = jsonSlave["kinematic"].asString(); fileExists(slaveName + " PID", slavePIDFile); fileExists(slaveName + " kinematic", slaveKinematicFile); mtsIntuitiveResearchKitConsole::Arm * psm = new mtsIntuitiveResearchKitConsole::Arm(slaveName, io->GetName()); psm->ConfigurePID(slavePIDFile); psm->ConfigureArm(mtsIntuitiveResearchKitConsole::Arm::ARM_PSM, slaveKinematicFile, periodKinematics); console->AddArm(psm); // PID Master GUI std::string masterPIDName = masterName + " PID"; mtsPIDQtWidget * pidMasterGUI = new mtsPIDQtWidget(masterPIDName, 8); pidMasterGUI->Configure(); componentManager->AddComponent(pidMasterGUI); componentManager->Connect(pidMasterGUI->GetName(), "Controller", mtm->PIDComponentName(), "Controller"); tabWidget->addTab(pidMasterGUI, masterPIDName.c_str()); // PID Slave GUI std::string slavePIDName = slaveName + " PID"; mtsPIDQtWidget * pidSlaveGUI = new mtsPIDQtWidget(slavePIDName, 7); pidSlaveGUI->Configure(); componentManager->AddComponent(pidSlaveGUI); componentManager->Connect(pidSlaveGUI->GetName(), "Controller", psm->PIDComponentName(), "Controller"); tabWidget->addTab(pidSlaveGUI, slavePIDName.c_str()); // Master GUI mtsIntuitiveResearchKitArmQtWidget * masterGUI = new mtsIntuitiveResearchKitArmQtWidget(mtm->Name() + "GUI"); masterGUI->Configure(); componentManager->AddComponent(masterGUI); tabWidget->addTab(masterGUI, mtm->Name().c_str()); // connect masterGUI to master componentManager->Connect(masterGUI->GetName(), "Manipulator", mtm->Name(), "Robot"); // Slave GUI mtsIntuitiveResearchKitArmQtWidget * slaveGUI = new mtsIntuitiveResearchKitArmQtWidget(psm->Name() + "GUI"); slaveGUI->Configure(); componentManager->AddComponent(slaveGUI); tabWidget->addTab(slaveGUI, psm->Name().c_str()); // connect slaveGUI to slave componentManager->Connect(slaveGUI->GetName(), "Manipulator", psm->Name(), "Robot"); // Teleoperation std::string teleName = masterName + "-" + slaveName; mtsTeleOperationQtWidget * teleGUI = new mtsTeleOperationQtWidget(teleName + "GUI"); teleGUI->Configure(); componentManager->AddComponent(teleGUI); tabWidget->addTab(teleGUI, teleName.c_str()); mtsTeleOperation * tele = new mtsTeleOperation(teleName, periodTeleop); // Default orientation between master and slave vctMatRot3 master2slave; master2slave.From(vctAxAnRot3(vct3(0.0, 0.0, 1.0), 180.0 * cmnPI_180)); tele->SetRegistrationRotation(master2slave); componentManager->AddComponent(tele); // connect teleGUI to tele componentManager->Connect(teleGUI->GetName(), "TeleOperation", tele->GetName(), "Setting"); componentManager->Connect(tele->GetName(), "Master", mtm->Name(), "Robot"); componentManager->Connect(tele->GetName(), "Slave", psm->Name(), "Robot"); componentManager->Connect(tele->GetName(), "Clutch", "io", "CLUTCH"); componentManager->Connect(tele->GetName(), "OperatorPresent", operatorPresentComponent, operatorPresentInterface); console->AddTeleOperation(tele->GetName()); } // configure data collection if needed if (options.IsSet("collection-config")) { // make sure the json config file exists fileExists("JSON data collection configuration", jsonCollectionConfigFile); mtsCollectorFactory * collectorFactory = new mtsCollectorFactory("collectors"); collectorFactory->Configure(jsonCollectionConfigFile); componentManager->AddComponent(collectorFactory); collectorFactory->Connect(); mtsCollectorQtWidget * collectorQtWidget = new mtsCollectorQtWidget(); tabWidget->addTab(collectorQtWidget, "Collection"); mtsCollectorQtFactory * collectorQtFactory = new mtsCollectorQtFactory("collectorsQt"); collectorQtFactory->SetFactory("collectors"); componentManager->AddComponent(collectorQtFactory); collectorQtFactory->Connect(); collectorQtFactory->ConnectToWidget(collectorQtWidget); } // show all widgets tabWidget->show(); //-------------- create the components ------------------ io->CreateAndWait(2.0 * cmn_s); // this will also create the pids as they are in same thread io->StartAndWait(2.0 * cmn_s); // start all other components componentManager->CreateAllAndWait(2.0 * cmn_s); componentManager->StartAllAndWait(2.0 * cmn_s); // QtApplication will run in main thread and return control // when exited. componentManager->KillAllAndWait(2.0 * cmn_s); componentManager->Cleanup(); // delete dvgc robot delete io; delete robotWidgetFactory; // stop all logs cmnLogger::Kill(); return 0; }