void FormsSample::initialize() { setMultiTouch(true); setVsync(false); _formSelect = Form::create("res/common/forms/formSelect.form"); _formSelect->setFocus(); RadioButton* form0Button = static_cast<RadioButton*>(_formSelect->getControl("form0")); form0Button->addListener(this, Control::Listener::CLICK); RadioButton* form1Button = static_cast<RadioButton*>(_formSelect->getControl("form1")); form1Button->addListener(this, Control::Listener::CLICK); RadioButton* form2Button = static_cast<RadioButton*>(_formSelect->getControl("form2")); form2Button->addListener(this, Control::Listener::CLICK); RadioButton* form3Button = static_cast<RadioButton*>(_formSelect->getControl("form3")); form3Button->addListener(this, Control::Listener::CLICK); RadioButton* form4Button = static_cast<RadioButton*>(_formSelect->getControl("form4")); form4Button->addListener(this, Control::Listener::CLICK); RadioButton* form5Button = static_cast<RadioButton*>(_formSelect->getControl("form5")); form5Button->addListener(this, Control::Listener::CLICK); for (unsigned int i = 0; i < _formFiles.size(); i++) { Form* form = Form::create(_formFiles[i]); form->setEnabled(false); _forms.push_back(form); } _formIndex = 0; // Create a form programmatically. createSampleForm(); Button* button = static_cast<Button*>(_forms[0]->getControl("testButton")); button->setFocus(); // Create a scene with a camera node. Camera* camera = Camera::createPerspective(45.0f, (float)getWidth() / (float)getHeight(), 0.25f, 100.0f); _scene = Scene::create(); Node* cameraNode = _scene->addNode("Camera"); cameraNode->setCamera(camera); _scene->setActiveCamera(camera); SAFE_RELEASE(camera); _formNodeParent = _scene->addNode("FormParent"); _formNode = Node::create("Form"); _formNodeParent->addChild(_formNode); formChanged(); _gamepad = getGamepad(0); // This is needed because the virtual gamepad is shared between all samples. // SamplesGame always ensures the virtual gamepad is disabled when a sample is exited. if (_gamepad && _gamepad->isVirtual()) _gamepad->getForm()->setEnabled(true); }
void QtDesignerChild::setFileBuffer( const QString& content ) { createNewForm(); mHostWidget->formWindow()->setFileName( filePath() ); mHostWidget->formWindow()->setContents( content ); mHostWidget->formWindow()->setDirty( true ); formChanged(); QTimer::singleShot( 500, this, SLOT( formFileBufferChanged() ) ); }
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent),wasItMe(false) { m_config = new Ui_OutputWidget(); m_config->setupUi(this); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_config->saveRCOutputToRAM->setVisible(false); UAVSettingsImportExportFactory * importexportplugin = pm->getObject<UAVSettingsImportExportFactory>(); connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests())); // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10. // Register for ActuatorSettings changes: for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0); m_config->channelLayout->addWidget(outputForm); connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool))); connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int))); connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty())); } connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); // Configure the task widget // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); // Track the ActuatorSettings object addUAVObject("ActuatorSettings"); // Associate the buttons with their UAVO fields addWidget(m_config->cb_outputRate4); addWidget(m_config->cb_outputRate3); addWidget(m_config->cb_outputRate2); addWidget(m_config->cb_outputRate1); addWidget(m_config->spinningArmed); disconnect(this, SLOT(refreshWidgetsValues(UAVObject*))); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObject* obj = objManager->getObject(QString("ActuatorCommand")); if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) this->setEnabled(false); connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*))); connect(SystemSettings::GetInstance(objManager), SIGNAL(objectUpdated(UAVObject*)),this,SLOT(assignOutputChannels(UAVObject*))); refreshWidgetsValues(); }
void XxxForm::saveAndContinueSavingAction(void) { if (!save()) { errorStatus(qApp->tr("Failure trying to register the record.")); } else { if (xXxModel->getId() > 0) { emit formChanged(); okStatus(QString(qApp->tr( "The xxx \"%1\" was changed successfully.")).arg( xXxModel->getName())); } else { emit formAdded(); okStatus(QString(qApp->tr( "The xxx \"%1\" was added successfully.")).arg( xXxModel->getName())); } updateModels(); updateForms(); } }
void QtDesignerChild::createNewForm() { delete mHostWidget; // create form host widget QDesignerFormWindowInterface* form = mDesignerManager->createNewForm( this ); mDesignerManager->addFormWindow( form ); mHostWidget = new SharedTools::WidgetHost( this, form ); mHostWidget->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); mHostWidget->setFocusProxy( form ); setWidget( mHostWidget ); if ( isVisible() ) { mDesignerManager->setActiveFormWindow( mHostWidget->formWindow() ); } connect( mHostWidget->formWindow(), SIGNAL( changed() ), this, SLOT( formChanged() ) ); connect( mHostWidget->formWindow(), SIGNAL( selectionChanged() ), this, SLOT( formSelectionChanged() ) ); connect( mHostWidget->formWindow(), SIGNAL( geometryChanged() ), this, SLOT( formGeometryChanged() ) ); connect( mHostWidget->formWindow(), SIGNAL( mainContainerChanged( QWidget* ) ), this, SLOT( formMainContainerChanged( QWidget* ) ) ); }
void FormsSample::controlEvent(Control* control, EventType evt) { if (evt == CLICK) { if (strcmp("form0", control->getId()) == 0) { _formIndex = 0; formChanged(); } else if (strcmp("form1", control->getId()) == 0) { _formIndex = 1; formChanged(); } else if (strcmp("form2", control->getId()) == 0) { _formIndex = 2; formChanged(); } else if (strcmp("form3", control->getId()) == 0) { _formIndex = 3; formChanged(); } else if (strcmp("form4", control->getId()) == 0) { _formIndex = 4; formChanged(); } else if (strcmp("form5", control->getId()) == 0) { _formIndex = 5; formChanged(); } else if (strcmp("opacityButton", control->getId()) == 0) { float from[] = { 1.0f }; float to[] = { 0.5f }; control->createAnimationFromTo("opacityButton", Form::ANIMATE_OPACITY, from, to, Curve::LINEAR, 1000)->getClip()->play(); } } }
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_config = new Ui_OutputWidget(); m_config->setupUi(this); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_config->saveRCOutputToRAM->setVisible(false); /* There's lots of situations where it's unsafe to run tests. * Import/export: */ UAVSettingsImportExportFactory * importexportplugin = pm->getObject<UAVSettingsImportExportFactory>(); connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests())); /* Board connection/disconnection: */ TelemetryManager* telMngr = pm->getObject<TelemetryManager>(); connect(telMngr, SIGNAL(connected()), this, SLOT(stopTests())); connect(telMngr, SIGNAL(disconnected()), this, SLOT(stopTests())); /* When we go into wizards, etc.. time to stop this too. */ Core::ModeManager *modeMngr = Core::ModeManager::instance(); connect(modeMngr, SIGNAL(currentModeAboutToChange(Core::IMode *)), this, SLOT(stopTests())); connect(modeMngr, SIGNAL(currentModeChanged(Core::IMode *)), this, SLOT(stopTests())); // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10. // Register for ActuatorSettings changes: for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0); m_config->channelLayout->addWidget(outputForm); connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool))); connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int))); connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty())); } connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); connect(m_config->calibrateESC, SIGNAL(clicked()), this, SLOT(startESCCalibration())); // Configure the task widget // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); // Track the ActuatorSettings object addUAVObject("ActuatorSettings"); // Associate the buttons with their UAVO fields addWidget(m_config->cb_outputRate6); addWidget(m_config->cb_outputRate5); addWidget(m_config->cb_outputRate4); addWidget(m_config->cb_outputRate3); addWidget(m_config->cb_outputRate2); addWidget(m_config->cb_outputRate1); addWidget(m_config->spinningArmed); // Cache all the combo boxes and labels lblList.clear(); lblList << m_config->chBank1 << m_config->chBank2 << m_config->chBank3 << m_config->chBank4 << m_config->chBank5 << m_config->chBank6; rateList.clear(); rateList << m_config->cb_outputRate1 << m_config->cb_outputRate2 << m_config->cb_outputRate3 << m_config->cb_outputRate4 << m_config->cb_outputRate5 << m_config->cb_outputRate6; resList.clear(); resList << m_config->cb_outputResolution1 << m_config->cb_outputResolution2 << m_config->cb_outputResolution3 << m_config->cb_outputResolution4 << m_config->cb_outputResolution5 << m_config->cb_outputResolution6; // Get the list of output resolutions and assign to the resolution dropdowns ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); Q_ASSERT(actuatorSettings); UAVObjectField *resolutions = actuatorSettings->getField("TimerPwmResolution"); Q_ASSERT(resolutions); QList<QComboBox*>::iterator resIter; for (resIter = resList.begin(); resIter != resList.end(); resIter++) { QComboBox *res = *resIter; res->clear(); res->addItems(resolutions->getOptions()); addWidget(res); connect(res, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges())); } QList<QComboBox*>::iterator rateIter; for (rateIter = rateList.begin(); rateIter != rateList.end(); rateIter++) { QComboBox *rate = *rateIter; connect(rate, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges())); } disconnect(this, SLOT(refreshWidgetsValues(UAVObject*))); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObject* obj = objManager->getObject(QString("ActuatorCommand")); if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) this->setEnabled(false); connect(SystemSettings::GetInstance(objManager), SIGNAL(objectUpdated(UAVObject*)),this,SLOT(assignOutputChannels(UAVObject*))); refreshWidgetsValues(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); form = new Form(this); view = new GraphicsView(form, this); setCentralWidget(view); itemWidget = new ItemWidget(ui->propertyWidget); itemWidget->setHidden(true); connect(view, SIGNAL(mouseDoubleClick()), itemWidget, SLOT(selectPicture())); formWidget = new FormWidget(ui->propertyWidget); formWidget->connectForm(form); formWidget->update(form); ui->propertyWidget->setWidget(formWidget); fontCombo = new QFontComboBox(this); ui->formatToolBar->insertWidget(ui->actionBold, fontCombo); insertGroup = new QActionGroup(this); insertGroup->addAction(ui->actionSelect); insertGroup->addAction(ui->actionPaint); connect(insertGroup, SIGNAL(triggered(QAction*)), this, SLOT(insertObject(QAction*))); ui->actionLeft->setData(Qt::AlignLeft); ui->actionCenter->setData(Qt::AlignHCenter); ui->actionRight->setData(Qt::AlignRight); zoomGroup = new QActionGroup(this); zoomGroup->addAction(ui->actionActualSize); zoomGroup->addAction(ui->actionFitWidth); zoomGroup->addAction(ui->actionFitHeight); connect(zoomGroup, SIGNAL(triggered(QAction*)), this, SLOT(zoom(QAction*))); ui->actionActualSize->setData(GraphicsView::ActualSize); ui->actionFitWidth->setData(GraphicsView::FitWidth); ui->actionFitHeight->setData(GraphicsView::FitHeight); horzAlignGroup = new QActionGroup(this); horzAlignGroup->addAction(ui->actionLeft); horzAlignGroup->addAction(ui->actionCenter); horzAlignGroup->addAction(ui->actionRight); connect(horzAlignGroup, SIGNAL(triggered(QAction*)), this, SLOT(horzAlign(QAction*))); sizeGroup = new QActionGroup(this); sizeGroup->addAction(ui->actionShrinkWidth); sizeGroup->addAction(ui->actionGrowWidth); sizeGroup->addAction(ui->actionPageWidth); sizeGroup->addAction(ui->actionShrinkHeight); sizeGroup->addAction(ui->actionGrowHeight); sizeGroup->addAction(ui->actionPageHeight); sizeGroup->addAction(ui->actionShrinkBoth); sizeGroup->addAction(ui->actionGrowBoth); sizeGroup->addAction(ui->actionPageBoth); ui->actionShrinkWidth->setData(Form::ShrinkWidth); ui->actionGrowWidth->setData(Form::GrowWidth); ui->actionPageWidth->setData(Form::PageWidth); ui->actionShrinkHeight->setData(Form::ShrinkHeight); ui->actionGrowHeight->setData(Form::GrowHeight); ui->actionPageHeight->setData(Form::PageHeight); ui->actionShrinkBoth->setData(Form::ShrinkBoth); ui->actionGrowBoth->setData(Form::GrowBoth); ui->actionPageBoth->setData(Form::PageBoth); connect(sizeGroup, SIGNAL(triggered(QAction*)), this, SLOT(size(QAction*))); connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newForm())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openForm())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveForm())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveFormAs())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveFormAsPdf())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpenPrintData, SIGNAL(triggered()), this, SLOT(openPrintData())); connect(ui->actionPageSetup, SIGNAL(triggered()), form, SLOT(pageSetup())); connect(ui->actionPagePreview, SIGNAL(triggered()), this, SLOT(preview())); connect(ui->actionSend, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionFullScreen, SIGNAL(triggered()), this, SLOT(fullScreen())); connect(ui->actionMargins, SIGNAL(toggled(bool)), form, SLOT(showMargins(bool))); connect(ui->actionGrid, SIGNAL(toggled(bool)), form, SLOT(showGrid(bool))); connect(ui->actionPrintData, SIGNAL(toggled(bool)), form, SLOT(showData(bool))); connect(ui->actionSelectAll, SIGNAL(triggered()), form, SLOT(selectAll())); connect(ui->actionDelete, SIGNAL(triggered()), form, SLOT(deleteSelected())); connect(ui->actionProperties, SIGNAL(toggled(bool)), ui->propertyWidget, SLOT(setVisible(bool))); connect(ui->actionMoveForwards, SIGNAL(triggered()), form, SLOT(moveForwards())); connect(ui->actionMoveBackwards, SIGNAL(triggered()), form, SLOT(moveBackwards())); connect(ui->actionAlignLeft, SIGNAL(triggered()), form, SLOT(alignLeft())); connect(ui->actionAlignRight, SIGNAL(triggered()), form, SLOT(alignRight())); connect(ui->actionAlignTop, SIGNAL(triggered()), form, SLOT(alignTop())); connect(ui->actionAlignBottom, SIGNAL(triggered()), form, SLOT(alignBottom())); connect(ui->actionCut, SIGNAL(triggered()), form, SLOT(cut())); connect(ui->actionCopy, SIGNAL(triggered()), form, SLOT(copy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(paste())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateViewMenu())); connect(form, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(form, SIGNAL(changed()), this, SLOT(formChanged())); connect(view, SIGNAL(doneRubberBanding(QRectF)), this, SLOT(doneRubberBanding(QRectF))); connectForm(); loadSettings(); QTimer::singleShot(0, this, SLOT(init())); }