void NoiseGen::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: setParameter("Mean", QString::number(mean)); setParameter("Variance", QString::number(variance)); updateMode(2); break; case MODIFY: mean = getParameter("Mean").toDouble(); variance = getParameter("Variance").toDouble(); whitenoisewave.setVariance(variance); initStimulus(); break; case PERIOD: dt = RT::System::getInstance()->getPeriod() * 1e-9; // time in seconds initStimulus(); break; case PAUSE: output(0) = 0.0; break; case UNPAUSE: break; default: break; } }
void QG_PolylineOptions::setAction(RS_ActionInterface* a, bool update) { if (a!=NULL && a->rtti()==RS2::ActionDrawPolyline) { action = (RS_ActionDrawPolyline*)a; QString sd1,sd2; int mode; bool reversed(false);; if (update) { sd1 = QString("%1").arg(action->getRadius()); sd2 = QString("%1").arg(action->getAngle()); mode = action->getMode(); } else { RS_SETTINGS->beginGroup("/Draw"); sd1 = RS_SETTINGS->readEntry("/PolylineRadius", "1.0"); sd2 = RS_SETTINGS->readEntry("/PolylineAngle", "180.0"); mode = RS_SETTINGS->readNumEntry("/PolylineMode",0); reversed = RS_SETTINGS->readNumEntry("/PolylineReversed", 0); RS_SETTINGS->endGroup(); action->setRadius(sd1.toDouble()); action->setAngle(sd2.toDouble()); action->setMode((RS_ActionDrawPolyline::SegmentMode)mode); action->setReversed(reversed); } leRadius->setText(sd1); leAngle->setText(sd2); cbMode->setCurrentIndex(mode); rbNeg->setChecked(reversed); updateMode(mode); } else { std::cerr << "QG_PolylineOptions::setAction: wrong action type\n"; action = NULL; } }
void QG_PolylineOptions::setAction(RS_ActionInterface* a, bool update) { if (a && a->rtti()==RS2::ActionDrawPolyline) { action = static_cast<RS_ActionDrawPolyline*>(a); QString sd1,sd2; int mode; bool reversed(false);; if (update) { sd1 = QString("%1").arg(action->getRadius()); sd2 = QString("%1").arg(action->getAngle()); mode = action->getMode(); } else { RS_SETTINGS->beginGroup("/Draw"); sd1 = RS_SETTINGS->readEntry("/PolylineRadius", "1.0"); sd2 = RS_SETTINGS->readEntry("/PolylineAngle", "180.0"); mode = RS_SETTINGS->readNumEntry("/PolylineMode",0); reversed = RS_SETTINGS->readNumEntry("/PolylineReversed", 0); RS_SETTINGS->endGroup(); action->setRadius(sd1.toDouble()); action->setAngle(sd2.toDouble()); action->setMode((RS_ActionDrawPolyline::SegmentMode)mode); action->setReversed(reversed); } ui->leRadius->setText(sd1); ui->leAngle->setText(sd2); ui->cbMode->setCurrentIndex(mode); ui->rbNeg->setChecked(reversed); updateMode(mode); } else { RS_DEBUG->print(RS_Debug::D_ERROR, QString("QG_PolylineOptions::setAction:" + tr("wrong action type")).toStdString().c_str()); action = nullptr; } }
bool HIDDMXDevice::openOutput() { m_mode |= DMX_MODE_OUTPUT; updateMode(); return true; }
bool HIDDMXDevice::openInput() { m_mode |= DMX_MODE_INPUT; updateMode(); return true; }
MyFracWindow::MyFracWindow() : KDockMainWindow(NULL, "mainwnd", WType_TopLevel), _posValid(false), _juliaMode(false), _maxIter(0.5), _threshold(0.5), _gradientData(NULL), _scrollTimer(NULL), _scrollDir(0), _generator(this, false), _progressDialog(NULL) { KImageIO::registerFormats(); generatorThread.start(QThread::LowPriority); createWidgets(); createActions(); createGUI(); _presets.loadPresets(kapp->config()); readParameters(); onDefaultView(); updateMode(); _scrollTimer = new QTimer(this); connect(_scrollTimer, SIGNAL(timeout()), SLOT(scrollTimer())); resize(700, 520); setAutoSaveSettings(); readDockConfig(); }
bool UARTWidget::close(UARTWidget::WidgetMode mode) { m_mode &= ~mode; updateMode(); return true; }
void ViewController::exec() { updateMode(); if (mode == Mode::NORMAL) { QApplication::instance()->exec(); } }
void iUserControlColorChooser::setMode(iColorChooserMode mode) { if (_mode != mode) { _mode = mode; updateMode(); } }
void MyFracWindow::readJulia() { if (_editJuliaX->hasAcceptableInput()) _juliaX = _editJuliaX->text().toDouble(); if (_editJuliaY->hasAcceptableInput()) _juliaY = _editJuliaY->text().toDouble(); updateMode(); }
void AddressBook::addContactSlot(void) { oldAddress = addressText->toPlainText(); oldName = nameText->text(); nameText->clear(); addressText->clear(); updateMode(AddMode); nameText->setFocus(Qt::OtherFocusReason); }
void OutputDirectory::modeChangedSlot( int mode ) { config->data.general.lastOutputDirectoryMode = mode; disconnect( cDir, SIGNAL(editTextChanged(const QString&)), 0, 0 ); updateMode( (Mode)mode ); connect( cDir, SIGNAL(editTextChanged(const QString&)), this, SLOT(directoryChangedSlot(const QString&)) ); emit modeChanged( mode ); }
bool UARTWidget::open(UARTWidget::WidgetMode mode) { if (mode == Output) m_outputBuffer.fill(0, 513); else if (mode == Input) m_inputBuffer.fill(0, 513); m_mode |= mode; updateMode(); return true; }
void av::osg::TriangleContainer::evaluateLocalSideEffect() { Geometry::evaluateLocalSideEffect(); if(mVecFieldHasChanged) updateVertexBuffer(); if(mColorFieldHasChanged) updateColor(); if(mModeFieldHasChanged) updateMode(); if(mNormalFieldHasChanged) updateNormal(); }
void ViewController::addCall(util::Reference<impl::Call> data) { updateMode(); if (mode == Mode::NORMAL) { ovPanel->addElement(*data); mainWindow->showOverviewTab(); } else if (mode == Mode::FAST_FORWARD) { ovPanel->addElementBuffered(*data); } }
void MyFracWindow::setMandelbrotMode() { if (!_juliaMode) return; _juliaMode = false; _backHistory.clear(); _forwardHistory.clear(); _posValid = false; onDefaultView(); updateMode(); }
QWidget *Tweener::configurator() { if (!k->configurator) { k->mode = TupToolPlugin::View; k->configurator = new Configurator; connect(k->configurator, SIGNAL(initFrameChanged(int)), this, SLOT(updateInitFrame(int))); connect(k->configurator, SIGNAL(clickedApplyTween()), this, SLOT(applyTween())); connect(k->configurator, SIGNAL(clickedSelect()), this, SLOT(setSelection())); connect(k->configurator, SIGNAL(clickedResetInterface()), this, SLOT(applyReset())); connect(k->configurator, SIGNAL(setMode(TupToolPlugin::Mode)), this, SLOT(updateMode(TupToolPlugin::Mode))); connect(k->configurator, SIGNAL(clickedDefineProperties()), this, SLOT(setPropertiesMode())); connect(k->configurator, SIGNAL(getTweenData(const QString &)), this, SLOT(setCurrentTween(const QString &))); connect(k->configurator, SIGNAL(clickedRemoveTween(const QString &)), this, SLOT(removeTween(const QString &))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBoxTypeTx->setCurrentIndex(1); ui->comboBoxTypeRx->setCurrentIndex(1); connect(ui->comboBoxMode,SIGNAL(currentIndexChanged(int)),this,SLOT(updateMode())); connect(&TcpServer,SIGNAL(newConnection()),this,SLOT(newClient())); connect(&LocalServer,SIGNAL(newConnection()),this,SLOT(newClient())); isConnected=false; idConnection=1; ui->comboBoxMode->setItemText(0,"Tcp socket (QTcpServer)"); ui->comboBoxMode->setItemText(1,COMBOBOXTEXTLOCALSOCK); updateMode(); on_compressionType_currentIndexChanged(0); }
/* Switches to the current type of transmission line layout. */ void QucsTranscalc::setMode (int _mode) { // change necessary? if (mode == _mode) return; storeValues (); mode = _mode; setUpdatesEnabled(false); updateMode (); // update selection and results updateSelection (); updateResultItems (); slotAnalyze(); setUpdatesEnabled(true); repaint(); }
void MyFracWindow::setJuliaMode(double jx, double jy) { if (_juliaMode && _juliaX == jx && _juliaY == jy) return; _juliaMode = true; _juliaX = jx; _juliaY = jy; _backHistory.clear(); _forwardHistory.clear(); _posValid = false; onDefaultView(); updateMode(); }
QWidget *Tweener::configurator() { if (!k->configurator) { k->mode = TupToolPlugin::View; k->configurator = new Configurator; connect(k->configurator, SIGNAL(startingFrameChanged(int)), this, SLOT(updateStartFrame(int))); connect(k->configurator, SIGNAL(clickedCreatePath()), this, SLOT(setTweenPath())); connect(k->configurator, SIGNAL(clickedSelect()), this, SLOT(setSelection())); connect(k->configurator, SIGNAL(clickedRemoveTween(const QString &)), this, SLOT(removeTween(const QString &))); connect(k->configurator, SIGNAL(clickedResetInterface()), this, SLOT(applyReset())); connect(k->configurator, SIGNAL(setMode(TupToolPlugin::Mode)), this, SLOT(updateMode(TupToolPlugin::Mode))); connect(k->configurator, SIGNAL(clickedApplyTween()), this, SLOT(applyTween())); connect(k->configurator, SIGNAL(getTweenData(const QString &)), this, SLOT(setCurrentTween(const QString &))); connect(k->configurator, SIGNAL(framesTotalChanged()), this, SLOT(updateTweenPoints())); } else {
bool QDragManager::drag( QDragObject *o, QDragObject::DragMode mode ) { object = drag_object = o; qt_qws_dnd_deco = new QShapedPixmapWidget(); dragSource = (QWidget *)(drag_object->parent()); oldstate = ButtonState(-1); // #### Should use state that caused the drag drag_mode = mode; global_accepted_action = QDropEvent::Copy; // ##### willDrop = FALSE; updateMode(ButtonState(0)); updatePixmap(); updateCursor(); restoreCursor = TRUE; dropWidget = NULL; qApp->installEventFilter( this ); return TRUE; }
void AM2400Commander::Panel::doLoad(const Settings::Object::State &s) { if (s.loadInteger("Maximized")) showMaximized(); else if (s.loadInteger("Minimized")) showMinimized(); if (s.loadInteger("W") != NULL) { resize(s.loadInteger("W"), s.loadInteger("H")); parentWidget()->move(s.loadInteger("X"), s.loadInteger("Y")); } ui->inputChannelSpinBox->setValue( s.loadInteger("Input Channel") ); ui->outputChannelSpinBox->setValue( s.loadInteger("Output Channel") ); ui->ampModeButtonGroup->setButton( s.loadInteger("Mode") ); updateChannels(); updateMode( s.loadInteger("Mode") ); }
void OverlayConductor::update(float dt) { updateMode(); switch (_mode) { case SITTING: { // when sitting, the overlay is at the origin, facing down the -z axis. // the camera is taken directly from the HMD. Transform identity; qApp->getApplicationCompositor().setModelTransform(identity); qApp->getApplicationCompositor().setCameraBaseTransform(identity); break; } case STANDING: { // when standing, the overlay is at a reference position, which is set when the overlay is // enabled. The camera is taken directly from the HMD, but in world space. // So the sensorToWorldMatrix must be applied. MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); Transform t; t.evalFromRawMatrix(myAvatar->getSensorToWorldMatrix()); qApp->getApplicationCompositor().setCameraBaseTransform(t); // detect when head moves out side of sweet spot, or looks away. mat4 headMat = myAvatar->getSensorToWorldMatrix() * qApp->getHMDSensorPose(); vec3 headWorldPos = extractTranslation(headMat); vec3 headForward = glm::quat_cast(headMat) * glm::vec3(0.0f, 0.0f, -1.0f); Transform modelXform = qApp->getApplicationCompositor().getModelTransform(); vec3 compositorWorldPos = modelXform.getTranslation(); vec3 compositorForward = modelXform.getRotation() * glm::vec3(0.0f, 0.0f, -1.0f); const float MAX_COMPOSITOR_DISTANCE = 0.6f; const float MAX_COMPOSITOR_ANGLE = 110.0f; if (_enabled && (glm::distance(headWorldPos, compositorWorldPos) > MAX_COMPOSITOR_DISTANCE || glm::dot(headForward, compositorForward) < cosf(glm::radians(MAX_COMPOSITOR_ANGLE)))) { // fade out the overlay setEnabled(false); } break; } case FLAT: // do nothing break; } }
void SigGen::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: setParameter("Freq (Hz)", QString::number(freq)); setParameter("ZAP max Freq (Hz)", QString::number(freq2)); setParameter("ZAP duration (s)", QString::number(ZAPduration)); setParameter("Delay", QString::number(delay)); setParameter("Width", QString::number(width)); setParameter("Amplitude", QString::number(amp)); setState("Time (s)", systime); updateMode(0); waveShape->setCurrentItem(mode); break; case MODIFY: delay = getParameter("Delay").toDouble(); freq = getParameter("Freq (Hz)").toDouble(); freq2 = getParameter("ZAP max Freq (Hz)").toDouble(); ZAPduration = getParameter("ZAP duration (s)").toDouble(); width = getParameter("Width").toDouble(); amp = getParameter("Amplitude").toDouble(); mode = mode_t(waveShape->currentItem()); initStimulus(); break; case PERIOD: dt = RT::System::getInstance()->getPeriod() * 1e-9; // time in seconds initStimulus(); case PAUSE: output(0) = 0.0; zapWave.setIndex(0); break; case UNPAUSE: systime = 0; count = 0; break; default: break; } }
void Axon200Commander::Panel::doLoad( const Settings::Object::State &s ) { if (s.loadInteger("Maximized")) showMaximized(); else if (s.loadInteger("Minimized")) showMinimized(); if (s.loadInteger("W") != NULL) { resize(s.loadInteger("W"), s.loadInteger("H")); parentWidget()->move(s.loadInteger("X"), s.loadInteger("Y")); } mainUI->inputChannelSpinBox->setValue( s.loadInteger("Input Channel") ); mainUI->outputChannelSpinBox->setValue( s.loadInteger("Output Channel") ); mainUI->gainComboBox->setCurrentItem( s.loadInteger("Gain") ); mainUI->configComboBox->setCurrentItem( s.loadInteger("Headstage Config") ); mainUI->ampModeButtonGroup->setButton( s.loadInteger("Mode") ); mainUI->autoModeButton->setOn( s.loadInteger("Auto Mode") ); updateChannels(); updateGains(); updateMode( s.loadInteger("Mode") ); }
// Load transmission line values from the given file. bool QucsTranscalc::loadFile(QString fname, int * _mode) { QFile file(QDir::convertSeparators (fname)); if(!file.open(QIODevice::ReadOnly)) return false; // file doesn't exist QTextStream stream(&file); QString Line, Name, Unit; double Value; int oldmode = mode; while(!stream.atEnd()) { Line = stream.readLine(); for (int i = 0; i < MAX_TRANS_TYPES; i++) { if (Line == "<" + QString(TransLineTypes[i].description) + ">") { if (_mode) { *_mode = TransLineTypes[i].type; setMode (*_mode); updatePixmap (mode); } else { mode = TransLineTypes[i].type; } while(!stream.atEnd()) { Line = stream.readLine(); if (Line == "</" + QString(TransLineTypes[i].description) + ">") break; Line = Line.simplified(); Name = Line.section(' ',0,0); Value = Line.section(' ',1,1).toDouble(); Unit = Line.section(' ',2,2); setProperty (Name, Value); setUnit (Name, Unit.toAscii()); } break; } } } if (!_mode) mode = oldmode; updateMode (); file.close(); return true; }
bool QDragManager::eventFilter( QObject *o, QEvent *e ) { if ( !o->isWidgetType() ) return FALSE; switch( e->type() ) { case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent *ke = ((QKeyEvent*)e); if ( ke->key() == Key_Escape && e->type() == QEvent::KeyPress ) { cancel(); qApp->removeEventFilter( this ); dragSource = 0; } else { updateMode(ke->stateAfter()); updateCursor(); } return TRUE; // Eat all key events } case QEvent::MouseButtonPress: case QEvent::MouseMove: { QMouseEvent *me = (QMouseEvent *)e; if ( me->state() & ( QMouseEvent::LeftButton | QMouseEvent::MidButton | QMouseEvent::RightButton ) ) { QWidget *cw = QApplication::widgetAt( me->globalPos(), TRUE ); // Fix for when we move mouse on to the deco widget if ( qt_qws_dnd_deco && cw == qt_qws_dnd_deco ) cw = dropWidget; if ( dropWidget != cw ) { if ( dropWidget ) { QDragLeaveEvent dle; QApplication::sendEvent( dropWidget, &dle ); willDrop = FALSE; updateCursor(); restoreCursor = TRUE; dropWidget = NULL; } if ( cw && cw->acceptDrops() ) { dropWidget = cw; QDragEnterEvent dee( me->pos() ); QApplication::sendEvent( dropWidget, &dee ); willDrop = dee.isAccepted(); updateCursor(); restoreCursor = TRUE; } } else if ( cw ) { QDragMoveEvent dme( me->pos() ); QApplication::sendEvent( cw, &dme ); updatePixmap(); } } return TRUE; // Eat all mouse events } case QEvent::MouseButtonRelease: { qApp->removeEventFilter( this ); if ( qt_qws_dnd_deco ) delete qt_qws_dnd_deco; qt_qws_dnd_deco = 0; if ( restoreCursor ) { willDrop = FALSE; myRestoreOverrideCursor(); restoreCursor = FALSE; } if ( dropWidget ) { QMouseEvent *me = (QMouseEvent *)e; QDropEvent de( me->pos() ); QApplication::sendEvent( dropWidget, &de ); dropWidget = NULL; } return TRUE; // Eat all mouse events } default: break; } return FALSE; }
void tx_task () { // Get the signal for UART RX //uart_rx_signal=nrk_uart_rx_signal_get(); // Register your task to wakeup on RX Data //if(uart_rx_signal==NRK_ERROR) nrk_kprintf( PSTR("Get Signal ERROR!\r\n") ); //nrk_signal_register(uart_rx_signal); //printf ("tx_task PID=%d\r\n", nrk_get_pid ()); // Wait until the tx_task starts up bmac // This should be called by all tasks using bmac that // do not call bmac_init()... bmac_init (26); bmac_encryption_set_key(aes_key,16); bmac_encryption_enable(); bmac_rx_pkt_set_buffer (rx_buf, RF_MAX_PAYLOAD_SIZE); //nrk_kprintf (PSTR ("bmac_started()\r\n")); bmac_set_cca_thresh (-45); check_period.secs = 0; check_period.nano_secs = 100 * NANOS_PER_MS; val = bmac_set_rx_check_rate (check_period); // Get and register the tx_done_signal if you want to // do non-blocking transmits tx_done_signal = bmac_get_tx_done_signal (); nrk_signal_register (tx_done_signal); rx_signal = bmac_get_rx_pkt_signal (); nrk_signal_register (rx_signal); cnt = 0; while (1) { nrk_kprintf(PSTR("\r\n*************************************************************\r\n")); nrk_kprintf(PSTR(" PHOENIX WIRELESS UPDATE SYSTEM \r\n")); nrk_kprintf(PSTR("*************************************************************\r\n")); nrk_kprintf(PSTR("Press 'p' : To PING Nodes in Vicinity \r\n")); nrk_kprintf(PSTR("Press 'u' : To Begin Node Update \r\n")); nrk_kprintf(PSTR(" \r\n")); nrk_kprintf(PSTR("*************************************************************\r\n")); printf("Enter Choice: "); //sm=nrk_event_wait(SIG(uart_rx_signal)); //if(sm != SIG(uart_rx_signal)) //{ // nrk_kprintf( PSTR("UART signal error\r\n") ); // while(1); //} // Wait for UART signal while(1) { if(nrk_uart_data_ready(NRK_DEFAULT_UART)!=0) { // Read Character c=getchar(); printf( "%c\r\n",c); break; } timeout.secs = 0; timeout.nano_secs = 20 * NANOS_PER_MS; nrk_wait(timeout); } // Choose mode switch(c){ case 'p': programState = PING; break; case 'u': getDestMac(); phoenix_init(); programState = UPDATE; break; default: programState = NONE; nrk_kprintf(PSTR("Invalid Command! Please Try Again\r\n")); } // Reset c c = 0; nrk_wait_until_next_period(); // Execute protocol switch(programState) { case PING: pingMode(); break; case UPDATE: updateMode(); break; case NONE:;// Do nothing break; default: nrk_kprintf(PSTR("Invalid Program State\r\n")); break; } nrk_wait_until_next_period (); } }
void Editor::stopThread() { updateMode(EXIT); }