//! A new node has connected to the network. void ThymioVPLStandalone::nodeConnected(unsigned node) { // only allow a single node connected at a given time if (vpl) { QMessageBox::critical( this, tr("Thymio VPL Error"), tr("This application only supports a single robot at a time.") ); close(); return; } // save node information id = node; // create the VPL widget and add it vpl = new ThymioVisualProgramming(new ThymioVPLStandaloneInterface(this), false, debugLog, execFeedback); vplLayout->addWidget(vpl); // connect callbacks connect(vpl, SIGNAL(modifiedStatusChanged(bool)), SLOT(updateWindowTitle(bool))); connect(vpl, SIGNAL(compilationOutcome(bool)), editor, SLOT(setEnabled(bool))); // reload data if (!savedContent.isNull()) vpl->loadFromDom(savedContent, false); // reset sizes resetSizes(); // do a first compilation editorContentChanged(); // read variables once to get PID target->getVariables(id, 0, allocatedVariablesCount); // stop timer if any if (getDescriptionTimer) { killTimer(getDescriptionTimer); getDescriptionTimer = 0; } }
void View::timerEvent( QTimerEvent * timerEvent ) { if ( timerId_ == timerEvent->timerId() ) { killTimer(timerId_); viewport()->updateGL(); update(); repaint(); scene()->update(); timerId_ = startTimer(interval_); } else { QGraphicsView::timerEvent(timerEvent); } }
void DialupImpl::phoneCallStateChanged( const QPhoneCall& call) { if ( (int)call.state() >= (int) QPhoneCall::HangupLocal && !pppdProcessBlocked ) { //if the call hangs up/aborts w/o being stopped manually by the user we need to cleanup //in order to prevent that pppdProcessBlocked blocks the interface forever if ( tidStateUpdate ) { killTimer( tidStateUpdate ); tidStateUpdate = 0; state = Initialize; logIndex = 0; } pppIface = QString(); netSpace->setAttribute( "NetDevice", QString() ); ifaceStatus = QtopiaNetworkInterface::Down; status(); } qLog(Network) << "Call state: " << call.state(); }
void OddcastWnd::timerCallback(int id) { switch (id) { case myThirdTimer: if (reconnectServer()) { killTimer(myThirdTimer); } break; case myTimer: invalidate(); break; default: ODDCASTWND_PARENT::timerCallback(id); break; }; }
BOOL USplashWindow::filterMessage(UINT uMessage, WPARAM wParam, LPARAM lParam) { if ((uMessage == WM_KEYDOWN || uMessage == WM_SYSKEYDOWN || uMessage == WM_LBUTTONDOWN || uMessage == WM_RBUTTONDOWN || uMessage == WM_MBUTTONDOWN || uMessage == WM_NCLBUTTONDOWN || uMessage == WM_NCRBUTTONDOWN || uMessage == WM_NCMBUTTONDOWN)) { this->killFlash(); killTimer(ID_SPLASH_TIMER); return TRUE; } return UBaseWindow::filterMessage(uMessage, wParam, lParam); }
void timerEvent(QTimerEvent *timerEvent) { timerEventRecursed = inTimerEvent; if (timerEventRecursed) { // bug detected! return; } inTimerEvent = true; QEventLoop eventLoop; QTimer::singleShot(qMax(100, interval * 2), &eventLoop, SLOT(quit())); eventLoop.exec(); inTimerEvent = false; killTimer(timerEvent->timerId()); }
void StratumClient::readyRead() { if (m_responseTimerId != -1) { killTimer(m_responseTimerId); m_responseTimerId = -1; } QTextStream dataStream(m_socket); for (QString line = dataStream.readLine(); !line.isEmpty(); line = dataStream.readLine()) { qDebug() << "<<<< " << line; QJsonParseError parseError; QJsonObject dataObject = QJsonDocument::fromJson(line.toUtf8(), &parseError).object(); if (parseError.error == QJsonParseError::NoError) { processData(dataObject); } else { qDebug() << "Json parse error: " << parseError.errorString(); } } }
void Simulation::playPause(bool play) { if (timer) { killTimer(timer); } if (play) { fps = 0; fpsTimer.start(); timer = startTimer(frameInterval); modify(); } else { timer = 0; } }
/** * @brief setChildShow 设置子窗口是否显示 * @param isshow */ void WMouseInOutWidget::setChildShow(bool isshow) { if(m_timeId != 0) { killTimer(m_timeId); m_timeId=0; } m_childWidget->setVisible(isshow); if(m_isAudoHide && isshow) m_timeId = startTimer(m_timeout); if(isshow) emit mouseInWidget(); else emit mouseOutWidget(); }
void MainWindow::timerEvent(QTimerEvent *event) { if(m_time_timerID == event->timerId()){ QTime t = QTime(0, 0, 0); m_time ++; showTimeLabel->setText(t.addSecs(m_time).toString("hh:mm:ss")); } if(m_auto_conn_timerID == event->timerId()){ on_actionLink_triggered(); killTimer(m_auto_conn_timerID); m_auto_conn_timerID = 0; if(m_auto_conn_timerID == 0){ m_auto_conn_timerID = startTimer(30*1000); } } }
void MediaServerControlTask::timerEvent(QTimerEvent *e) { if (e->timerId() == d->qssTimerId) { if (!d->soundserver) { d->soundserver = new QProcess(this); d->soundserver->setProcessChannelMode(QProcess::ForwardedChannels); d->soundserver->closeWriteChannel(); connect(d->soundserver, SIGNAL(finished(int)), this, SLOT(soundServerExited())); } d->soundserver->start(Qtopia::qtopiaDir() + "bin/mediaserver"); killTimer(d->qssTimerId); d->qssTimerId = 0; }
/** * \fn UPNPScanner::RemoveServer(const QString&) */ void UPNPScanner::RemoveServer(const QString &usn) { m_lock.lock(); if (m_servers.contains(usn)) { LOG(VB_GENERAL, LOG_INFO, LOC + QString("Removing: %1").arg(usn)); MediaServer* old = m_servers[usn]; if (old->m_renewalTimerId) killTimer(old->m_renewalTimerId); m_servers.remove(usn); delete old; if (m_subscription) m_subscription->Remove(usn); } m_lock.unlock(); Debug(); }
/*! Mouse release event handler \param event Mouse event */ void QwtSlider::mouseReleaseEvent( QMouseEvent *event ) { if ( d_data->repeatTimerId > 0 ) { killTimer( d_data->repeatTimerId ); d_data->repeatTimerId = 0; d_data->timerTick = false; d_data->stepsIncrement = 0; } if ( d_data->pendingValueChange ) { d_data->pendingValueChange = false; Q_EMIT valueChanged( value() ); } QwtAbstractSlider::mouseReleaseEvent( event ); }
// TODO: Device shouldn't be responsible for doing this // TODO: Connect setting provider's signal to a battery provider slot that will load settings void Wallaby::Device::settingsChanged() { const int type = m_settingsProvider->value("battery_type", 0).toInt(); const float thresh = m_settingsProvider->value("battery_warning_thresh", 0.1f).toFloat(); const bool enabled = m_settingsProvider->value("battery_warning_enabled", true).toBool(); Wallaby::BatteryLevelProvider *wblProvider = (Wallaby::BatteryLevelProvider *)m_batteryLevelProvider; wblProvider->setBatteryType(type); wblProvider->setWarningThresh(thresh); if(m_timerId > 0 && !enabled) { killTimer(m_timerId); m_timerId = 0; } else if(m_timerId <= 0 && enabled) m_timerId = startTimer(1000); }
void Game2D:: init (){ state_=0; score_=0; time_=0; direction_=0; movable_=0; delay_=DEFAULT_SPEED_DELAY; if (!bg_.isLoad ()){ bg_.loadImage ("bg.png"); } killTimer (timer_id_); timer_id_=startTimer (delay_); }
void QVideo::play() { m_status = Running; if(m_play_timer) { m_total_runtime += m_run_time.restart(); killTimer(m_play_timer); } else { m_run_time.start(); } m_play_timer = startTimer(1); //m_video_decoder->decode(); // start decoding again emit movieStateChanged(QMovie::Running); }
void OverviewErrorsWidget::SetVisible(bool pVisible) { CONF.SetVisibilityErrorsWidget(pVisible); if (pVisible) { move(mWinPos); show(); LOGGER.RegisterLogSink(this); mTimerId = startTimer(VIEW_ERROR_LOG_UPDATE_PERIOD); }else { if (mTimerId != -1) killTimer(mTimerId); mWinPos = pos(); hide(); LOGGER.UnregisterLogSink(this); } }
void QLEDMatrix::timerEvent(QTimerEvent *ev) { if(m_updateTimer == ev->timerId()) { QByteArray buff; if(m_row > 5) { m_updates --; m_row = 0; if(m_updates<=0) { buff.append(0x01); killTimer(m_updateTimer); m_updateTimer = -1; m_updates = 0; std::cout << "LEDMATRIX: Send swap" << std::endl; } else return; } else { do { buff.clear(); buff.append(0x10); buff.append(m_row); for(int y=0;y<8;y++) for(int x=0;x<96;x++) { buff.append(qGray(m_realBuff[y+m_row*8][x])); } m_row++; }while(buff == m_sendBuff[m_row-1] && m_row <= 5); std::cout << "LEDMATRIX: write line" << std::endl; m_sendBuff[m_row-1] = buff; } if(buff.size()) m_sock->write(buff); } }
int UIProgressDialog::run(int cRefreshInterval) { if (m_progress.isOk()) { /* Start refresh timer */ int id = startTimer(cRefreshInterval); /* Set busy cursor. * We don't do this on the Mac, cause regarding the design rules of * Apple there is no busy window behavior. A window should always be * responsive and it is in our case (We show the progress dialog bar). */ #ifndef Q_WS_MAC if (m_fCancelEnabled) QApplication::setOverrideCursor(QCursor(Qt::BusyCursor)); else QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #endif /* Q_WS_MAC */ /* Create a local event-loop: */ { /* Guard ourself for the case * we destroyed ourself in our event-loop: */ QPointer<UIProgressDialog> guard = this; /* Holds the modal loop, but don't show the window immediately: */ exec(false); /* Are we still valid? */ if (guard.isNull()) return Rejected; } /* Kill refresh timer */ killTimer(id); #ifndef Q_WS_MAC /* Reset the busy cursor */ QApplication::restoreOverrideCursor(); #endif /* Q_WS_MAC */ return result(); } return Rejected; }
void RangeSensorWidget::setRobot(const QString& _robot) { QString error; bool ok = true; // build the lookup string for the naming service CosNaming::Name name; name.length(1); name[0].id = CORBA::string_dup(_robot.latin1()); // try binding the robots naming context try { CosNaming::NamingContext_var namingContext = client_.resolveName<CosNaming::NamingContext>(name); } catch(const CORBA::Exception& e) { std::ostringstream sstr; sstr << "Robot " << _robot << endl << "Communication Failed." << endl << "CORBA exception: " << e << flush; error = sstr.str().c_str(); ok = false; } if (ok) { if (timer_) { killTimer(timer_); timer_ = 0; } menuFile_->setItemEnabled(groupIndex_, false); robotName_ = _robot; sensor_ = Miro::RangeSensor::_nil(); scan_ = NULL; scanDescription_ = NULL; setSensor(sensorName_); } else { calcCaption(); QMessageBox::warning(this, "Couln't set robot:", error); } }
void showsaving::timerEvent(QTimerEvent *event) { char tmp[64]; sprintf(tmp,"%d",step); QString t =tmp; QString s = path1 +t+ ".jpg"; //还有这里 QString s2 = path2 +t+ ".jpg"; //第二张图的路径 QImage* img=new QImage; QImage* img2 = new QImage; if(img->load(s)){ ui->label->setPixmap(QPixmap::fromImage(*img)); img2->load(s2); ui->label_4->setPixmap(QPixmap::fromImage(*img2)); val += jmp; ui -> progressBar -> setValue(val); step++; } else killTimer(id); }
void SceniXQGLSceneRendererWidget::setContinuousUpdate( bool onOff ) { if( onOff != m_continuousUpdate ) { m_continuousUpdate = onOff; if( onOff ) { // arg of 0 means signal every time there are no more window events to process m_timerID = startTimer(0); } else { DP_ASSERT( m_timerID != -1 ); killTimer( m_timerID ); m_timerID = -1; } } }
void QSpotifySession::processSpotifyEvents() { qDebug() << "QSpotifySession::processSpotifyEvents"; if (m_timerID) killTimer(m_timerID); int nextTimeout = 0; if (!m_aboutToQuit) QSpotifyCacheManager::instance().clean(); do { assert(isValid()); qDebug() << "Processing events..."; sp_session_process_events(m_sp_session, &nextTimeout); } while (nextTimeout == 0); m_timerID = startTimer(nextTimeout); }
void CTeris_1View::XMXXCheck() { if(XMXXOver()==TRUE){ killTimer(); CBox *b=(CBox *)GetDocument()->box.GetAt(0); int i,j; int count=0; for(i=1;i<11;i++) for(j=8;j<=17;j++){ if(b->LOCAL[i][j].canSee==XXSEE){ count++; } } xmxxscore=-count; GetDocument()->score+=GetXXOverScore(count); DrawXX(GetDC()); //this->Invalidate(); if(GetDocument()->score>=XMXXSCORE()){ GetDocument()->Num++; MessageBox("Congratulation!"); this->OnNewgame(); }else{ if(GetDocument()->score>topNum) { SetRecord(); } } } }
void CTeris_1View::OnNewgame() { // TODO: Add your command handler code here killTimer(); GetDocument()->tick=0; this->readRecord(); switch(GetDocument()->mode){ case NORMAL: this->StartNormal(); break; case GK: this->StartGk(); break; case QPZ: this->StartQPZ(); break; case CXY: // //GetDocument()->Num=2; this->StartCXY(); break; case REVERSE: this->StartReverse(); break; case LIFE: this->StartLife(); break; case XMXX: this->StartXmxx(); break; } }
void QVideo::stop() { if(m_video_decoder && m_video_loaded) { //m_video_decoder->restart(); m_video_decoder->flushBuffers(); seek(0, AVSEEK_FLAG_BACKWARD); } m_status = NotRunning; killTimer(m_play_timer); m_play_timer = 0; // Since there is no stop() or pause(), we dont need to touch m_run_time right now - it will be reset in play() m_total_runtime = 0; emit movieStateChanged(QMovie::NotRunning); }
void IMUThread::finishThread() { if (m_timer != -1) killTimer(m_timer); m_timer = -1; if (m_imu != NULL) delete m_imu; m_imu = NULL; if (m_pressure != NULL) delete m_pressure; m_pressure = NULL; delete m_settings; }
//Implemented from QObject void CpuRetryDialog::timerEvent(QTimerEvent* event) { (void)(event); // unused --m_seconds; if (nullptr != m_pText) { QString text; text.sprintf(FORMATSTRING, m_seconds); m_pText->setText(text); } if (0 == m_seconds) { killTimer(m_timerId); m_timerId = 0; accept(); } }
void QColorTabBar::timerEvent(QTimerEvent *evt) { if( evt->timerId() == m_nTimerBlink ) { m_bBlinkFalg = !m_bBlinkFalg; if( m_nBlinkIndex < 0) { killTimer( m_nTimerBlink ); m_nTimerBlink = 0; m_bBlinkFalg = false; } QRect rcTab( tabRect( m_nBlinkIndex ) ); update( rcTab ); } QTabBar::timerEvent(evt); }
void TreeCanvas::timerEvent(QTimerEvent* e) { if (e->timerId() == layoutDoneTimerId) { if (!smoothScrollAndZoom) { scaleTree(targetScale); } else { zoomTimeLine.stop(); int zoomCurrent = static_cast<int>(scale*100); int targetZoom = targetScale; targetZoom = std::min(std::max(targetZoom, LayoutConfig::minScale), LayoutConfig::maxAutoZoomScale); zoomTimeLine.setFrameRange(zoomCurrent,targetZoom); zoomTimeLine.start(); } QWidget::update(); killTimer(layoutDoneTimerId); layoutDoneTimerId = 0; } }