void AMLoopAction3::internalDoNextAction() { // did an action just finish completing? if(currentSubActionIndex_ >= 0) { internalDisconnectAction(currentSubAction_); // delete it later (since we might still be executing inside the action's functions). currentSubAction_->scheduleForDeletion(); //currentSubAction_->deleteLater(); } // Check if we are stopping now. if (skipAfterCurrentAction_) setSkipped(); // do we have a next action in this loop? [This will also trigger the start of the very first action] else if(currentSubActionIndex_ < subActionCount()-1) { emit currentSubActionChanged(++currentSubActionIndex_); currentSubAction_ = subActions_.at(currentSubActionIndex_)->createCopy(); internalConnectAction(currentSubAction_); if(state() == AMAction3::Pausing) setPaused(); else if(state() == AMAction3::Running) currentSubAction_->start(); } else { // done this loop. emit currentIterationChanged(++currentIteration_); if(generateScanActionMessages_){ AMAgnosticDataAPILoopIncrementMessage loopIncrementedMessage(info()->shortDescription(), currentIteration_); AMAgnosticDataAPISupport::handlerFromLookupKey("ScanActions")->postMessage(loopIncrementedMessage); } // Are we stopping now that we are at the end of this iteration? if (skipAfterCurrentIteration_) setSkipped(); // Is there a next one? else if(currentIteration_ < loopCount()) { setStatusText(QString("Loop %1 of %2.").arg(currentIteration_+1).arg(loopCount())); emit currentSubActionChanged(currentSubActionIndex_ = 0); currentSubAction_ = subActions_.at(currentSubActionIndex_)->createCopy(); internalConnectAction(currentSubAction_); if(state() == AMAction3::Pausing) setPaused(); else if(state() == AMAction3::Running) currentSubAction_->start(); } // Nope, that's the end. else { setSucceeded(); } } }
void LinVideoDisplayForm::pausePlaying() { if (!runningElement) return; if (paused) { gst_element_set_state(runningElement, GST_STATE_PLAYING); setPaused(false); } else { gst_element_set_state(runningElement, GST_STATE_PAUSED); setPaused(true); } }
bool watchdog::run() { getmilliseconds(); if (last_fire + this->major_threshold < clock_tick) { CStat::globalStat(CStat::E_WATCHDOG_MAJOR); last_trigger = clock_tick; WARNING("The major watchdog timer %dms has been tripped (%d), %d trips remaining.", major_threshold, clock_tick - last_fire, major_maxtriggers - major_triggers); if ((this->major_maxtriggers != -1) && (++major_triggers > this->major_maxtriggers)) { REPORT_ERROR("The watchdog timer has tripped the major threshold of %dms too many times (%d out of %d allowed) (%d out of %d minor %dms timeouts tripped)\n", major_threshold, major_triggers, major_maxtriggers, minor_threshold, minor_triggers, minor_maxtriggers); } } else if (last_fire + this->minor_threshold < clock_tick) { last_trigger = clock_tick; CStat::globalStat(CStat::E_WATCHDOG_MINOR); WARNING("The minor watchdog timer %dms has been tripped (%d), %d trips remaining.", minor_threshold, clock_tick - last_fire, minor_maxtriggers - minor_triggers); if ((this->minor_maxtriggers != -1) && (++minor_triggers > this->minor_maxtriggers)) { REPORT_ERROR("The watchdog timer has tripped the minor threshold of %dms too many times (%d out of %d allowed) (%d out of %d major %dms timeouts tripped)\n", minor_threshold, minor_triggers, minor_maxtriggers, major_threshold, major_triggers, major_maxtriggers); } } if (reset_interval && (major_triggers || minor_triggers) && (last_trigger + reset_interval < clock_tick)) { WARNING("Resetting watchdog timer trigger counts, as it has not been triggered in over %dms.", clock_tick - last_trigger); major_triggers = minor_triggers = 0; } last_fire = clock_tick; setPaused(); return true; }
void LVL_Npc::Activate() { if(is_activity) activationTimeout = setup->deactivetionDelay; else activationTimeout = 150; if(isActivated) return; setPaused(false); deActivatable = ((setup->deactivation)||(!setup->activity)); //!< Allow deactivation of this NPC when it going offscreen wasDeactivated=false; animator.start(); isActivated=true; if(!data.event_activate.isEmpty()) LvlSceneP::s->events.triggerEvent(data.event_activate); if(isLuaNPC){ try{ lua_onActivated(); } catch (luabind::error& e) { LvlSceneP::s->getLuaEngine()->postLateShutdownError(e); } } }
void LVL_Npc::deActivate() { if(!wasDeactivated) wasDeactivated = true; if(!isActivated) return; isActivated = false; if(!is_shared_animation) animator.stop(); if(!keep_position_on_despawn) { if(!reSpawnable) unregister(); else { if(data.id != _npc_id) { transformTo_x(data.id); //Transform NPC back into initial form } setDefaults(); setPos(data.x, data.y); setDirection(data.direct); setPaused(true); m_momentum.saveOld(); } } }
void AMWaitAction::pauseImplementation() { waitTimer_.stop(); progressTimer_.stop(); elapsedTime_ += waitTime_.elapsed()/1000.0; setPaused(); }
Window::Window(QWidget *parent) : QMainWindow(parent) { setWindowTitle(tr("CPSC589 - 3d Modelling with Kinect")); renderView = new RenderView(); mainLayout = new QGridLayout; controlLayout = new QVBoxLayout(); pause_button = new QPushButton("Pause"); pause_button->setCheckable(true); connect(pause_button, SIGNAL(toggled(bool)), renderView, SLOT(pause(bool))); connect(renderView, SIGNAL(pausePlease()), this, SLOT(setPaused())); exportObj_button = new QPushButton("Export .obj"); connect(exportObj_button, SIGNAL(clicked()), renderView, SLOT(exportObj())); exportPly_button = new QPushButton("Export .ply"); connect(exportPly_button, SIGNAL(clicked()), renderView, SLOT(exportPly())); exportXyz_button = new QPushButton("Export .xyz"); connect(exportXyz_button, SIGNAL(clicked()), renderView, SLOT(exportXyz())); exportPcd_button = new QPushButton("Export .pcd"); connect(exportPcd_button, SIGNAL(clicked()), renderView, SLOT(exportPcd())); dump_button = new QPushButton("Dump data"); connect(dump_button, SIGNAL(clicked()), renderView, SLOT(dump())); /* front and rear depth buffer cutoffs */ QSlider *rearCutoffPlane = createCutoffSlider(); connect(rearCutoffPlane, SIGNAL(valueChanged(int)), renderView, SLOT(setRearCutoff(int))); QSlider *frontCutoffPlane = createCutoffSlider(); connect(frontCutoffPlane, SIGNAL(valueChanged(int)), renderView, SLOT(setFrontCutoff(int))); controlLayout->addWidget(pause_button); controlLayout->addWidget(exportObj_button); controlLayout->addWidget(exportPly_button); controlLayout->addWidget(exportXyz_button); controlLayout->addWidget(exportPcd_button); controlLayout->addWidget(new QLabel(tr("Rear Cutoff Plane"))); controlLayout->addWidget(rearCutoffPlane); controlLayout->addWidget(new QLabel(tr("Front Cutoff Plane"))); controlLayout->addWidget(frontCutoffPlane); controlLayout->addWidget(dump_button); mainLayout->addWidget(renderView, 0, 1, 2, 2); mainLayout->addLayout(controlLayout, 0, 3, 1, 2); centralWidget = new QWidget; setCentralWidget(centralWidget); centralWidget->setLayout(mainLayout); rearCutoffPlane->setValue(10*100); frontCutoffPlane->setValue(0); renderView->setStatusBar(statusBar()); }
void QDeclarativeVideo::pause() { if (m_playerControl == 0) return; setPaused(true); setPlaying(true); }
void Amarok::OSD::paused() { setImage( QImage( KIconLoader::global()->iconPath( "amarok", -KIconLoader::SizeHuge ) ) ); setRating( 0 ); // otherwise stars from last rating change are visible OSDWidget::show( i18n( "Paused" ) ); setPaused(true); }
void Amarok::OSD::trackPlaying( Meta::TrackPtr track ) { m_currentTrack = track; setPaused(false); show( m_currentTrack ); }
void QDeclarativeVideo::stop() { if (m_playerControl == 0) return; setPlaying(false); setPaused(false); }
void AMScanAction::pauseImplementation() { if (controller_->pause()){ setStatusText("Paused"); setPaused(); } }
void QDeclarativeVideo::stop() { if (!m_complete) return; setPlaying(false); setPaused(false); }
void QDeclarativeAudio::play() { if (!m_complete) return; setPaused(false); setPlaying(true); }
void QDeclarativeVideo::pause() { if (!m_complete) return; setPaused(true); setPlaying(true); }
void ofxOMXPlayerEngine::stepFrameForward() { if (!isPaused()) { setPaused(true); } clock.OMXStep(1); }
void InternalLink::setPauseItem(DesuraId id, bool state) { auto itemHandle = GetUserCore()->getItemManager()->findItemHandle(id); if (itemHandle) itemHandle->setPaused(state); else if (state == false) launchItem(id, LinkArgs()); //if we paused and restarted desura we wont have a valid install form }
void sim::Init() { sta::Init(); gm::Init(); setStarted(false); setPaused(false); }
bool ofxCvInputManager::update(){ if(!bPlay && !bChangeSettings){ return false; } bNewFrame = false; ofxCvInputSource * input = inputs[inputIdx]; if(input->type == TYPE_VideoPlayer){ ofxCvVideoInput * videoInput = (ofxCvVideoInput*)input; videoInput->update(); if(eNextFrame){ bPlay = false; setPaused(true); videoInput->nextFrame(); bNewFrame = true; eNextFrame = false; }else if(ePrevFrame){ bPlay = false; setPaused(true); videoInput->prevFrame(); bNewFrame = true; ePrevFrame = false; } bNewFrame = videoInput->useFrame() || bNewFrame; }else if(input->type == TYPE_LiveVideo){ input->update(); bNewFrame = input->useFrame() || bNewFrame; }else if(input->type == TYPE_Image){ } return bNewFrame || bChangeSettings; }
void ofxCvInputManager::keyPressed(ofKeyEventArgs & e){ switch (e.key) { case OF_KEY_LEFT: ePrevFrame = true; bPlay = true; break; case OF_KEY_RIGHT: eNextFrame = true; bPlay = true; break; case OF_KEY_UP: setPaused(true); inputIdx = (inputIdx + 1) % inputs.size(); setPaused(false); break; case 'p': togglePaused(); break; case 'o': bChangeSettings = !bChangeSettings; break; case 'r': if(inputs[inputIdx]->type == TYPE_VideoPlayer){ ((ofxCvVideoInput*)inputs[inputIdx])->firstFrame(); } setPaused(false); break; case 'i': bStopable = !bStopable; break; default: break; } //TODO draw/explain interface }
void LVL_Npc::deActivate() { if(!wasDeactivated) { wasDeactivated=true; } if(!isActivated) return; isActivated=false; if(!is_shared_animation) { setDefaults(); setPos(data.x, data.y); animator.stop(); setPaused(true); if(!reSpawnable) unregister(); } }
void LinVideoDisplayForm::stopPlaying() { if (!runningElement) return; gst_element_set_state(runningElement, GST_STATE_NULL); gst_object_unref(GST_OBJECT(runningElement)); runningElement = 0; gstreamerInUse = false; ui->playButton->setEnabled(false); setSeeking(false); checkedSeeking = false; if (!paused) setPaused(true); ui->seekSlider->setValue(0); dataDialog->reset(); }
void LVL_Npc::Activate() { if(is_activity) activationTimeout = setup->setup.deactivationDelay; else activationTimeout = 150; if(isActivated) return; setPaused(false); deActivatable = ((setup->setup.deactivation) || (!setup->setup.activity)); //!< Allow deactivation of this NPC when it going offscreen wasDeactivated = false; if(m_spawnedGeneratorType != LevelScene::GENERATOR_PROJECTILE) setSpeed(0.0, 0.0); animator.start(); isActivated = true; if(!data.event_activate.isEmpty()) m_scene->events.triggerEvent(data.event_activate); if(isLuaNPC) { try { lua_onActivated(); } catch(luabind::error &e) { m_scene->getLuaEngine()->postLateShutdownError(e); } } lua_activate_neighbours();//Also activate neighours }
void TimelineWidget::realTime() { m_timeRate = 1.0; setPaused(false); }
void TimelineWidget::togglePaused() { setPaused(!isPaused()); }
inline void pause() { setPaused(true); }
inline void resume() { setPaused(false); }
// 初始化播放器 void MyWidget::initPlayer() { // 设置主界面标题、图标和大小 setWindowTitle(tr("MyPlayer音乐播放器")); setWindowIcon(QIcon(":/images/icon.png")); setMinimumSize(320, 160); setMaximumSize(320, 160); // 创建媒体图 mediaObject = new Phonon::MediaObject(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(mediaObject, audioOutput); // 关联媒体对象的tick()信号来更新播放时间的显示 connect(mediaObject, SIGNAL(tick(qint64)), this, SLOT(updateTime(qint64))); // 创建顶部标签,用于显示一些信息 topLabel = new QLabel(tr("<a href = \" http://www.yafeilinux.com \"> www.yafeilinux.com </a>")); topLabel->setTextFormat(Qt::RichText); topLabel->setOpenExternalLinks(true); topLabel->setAlignment(Qt::AlignCenter); // 创建控制播放进度的滑块 Phonon::SeekSlider *seekSlider = new Phonon::SeekSlider(mediaObject, this); // 创建包含播放列表图标、显示时间标签和桌面歌词图标的工具栏 QToolBar *widgetBar = new QToolBar(this); // 显示播放时间的标签 timeLabel = new QLabel(tr("00:00 / 00:00"), this); timeLabel->setToolTip(tr("当前时间 / 总时间")); timeLabel->setAlignment(Qt::AlignCenter); timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // 创建图标,用于控制是否显示播放列表 QAction *PLAction = new QAction(tr("PL"), this); PLAction->setShortcut(QKeySequence("F4")); PLAction->setToolTip(tr("播放列表(F4)")); connect(PLAction, SIGNAL(triggered()), this, SLOT(setPlaylistShown())); // 创建图标,用于控制是否显示桌面歌词 QAction *LRCAction = new QAction(tr("LRC"), this); LRCAction->setShortcut(QKeySequence("F2")); LRCAction->setToolTip(tr("桌面歌词(F2)")); connect(LRCAction, SIGNAL(triggered()), this, SLOT(setLrcShown())); // 添加到工具栏 widgetBar->addAction(PLAction); widgetBar->addSeparator(); widgetBar->addWidget(timeLabel); widgetBar->addSeparator(); widgetBar->addAction(LRCAction); // 创建播放控制动作工具栏 QToolBar *toolBar = new QToolBar(this); // 播放动作 playAction = new QAction(this); playAction->setIcon(QIcon(":/images/play.png")); playAction->setText(tr("播放(F5)")); playAction->setShortcut(QKeySequence(tr("F5"))); connect(playAction, SIGNAL(triggered()), this, SLOT(setPaused())); // 停止动作 stopAction = new QAction(this); stopAction->setIcon(QIcon(":/images/stop.png")); stopAction->setText(tr("停止(F6)")); stopAction->setShortcut(QKeySequence(tr("F6"))); connect(stopAction, SIGNAL(triggered()), mediaObject, SLOT(stop())); // 跳转到上一首动作 skipBackwardAction = new QAction(this); skipBackwardAction->setIcon(QIcon(":/images/skipBackward.png")); skipBackwardAction->setText(tr("上一首(Ctrl+Left)")); skipBackwardAction->setShortcut(QKeySequence(tr("Ctrl+Left"))); connect(skipBackwardAction, SIGNAL(triggered()), this, SLOT(skipBackward())); // 跳转到下一首动作 skipForwardAction = new QAction(this); skipForwardAction->setIcon(QIcon(":/images/skipForward.png")); skipForwardAction->setText(tr("下一首(Ctrl+Right)")); skipForwardAction->setShortcut(QKeySequence(tr("Ctrl+Right"))); connect(skipForwardAction, SIGNAL(triggered()), this, SLOT(skipForward())); // 打开文件动作 QAction *openAction = new QAction(this); openAction->setIcon(QIcon(":/images/open.png")); openAction->setText(tr("播放文件(Ctrl+O)")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); // 音量控制部件 Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider(audioOutput, this); volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); // 添加到工具栏 toolBar->addAction(playAction); toolBar->addSeparator(); toolBar->addAction(stopAction); toolBar->addSeparator(); toolBar->addAction(skipBackwardAction); toolBar->addSeparator(); toolBar->addAction(skipForwardAction); toolBar->addSeparator(); toolBar->addWidget(volumeSlider); toolBar->addSeparator(); toolBar->addAction(openAction); // 创建主界面布局管理器 QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(topLabel); mainLayout->addWidget(seekSlider); mainLayout->addWidget(widgetBar); mainLayout->addWidget(toolBar); setLayout(mainLayout); // 在3-2中添加的代码 connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); // 以下是在3-3中添加的代码 // 创建播放列表 playlist = new MyPlaylist(this); connect(playlist, SIGNAL(cellClicked(int, int)), this, SLOT(tableClicked(int))); connect(playlist, SIGNAL(playlistClean()), this, SLOT(clearSources())); // 创建用来解析媒体的信息的元信息解析器 metaInformationResolver = new Phonon::MediaObject(this); // 需要与AudioOutput连接后才能使用metaInformationResolver来获取歌曲的总时间 Phonon::AudioOutput *metaInformationAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); Phonon::createPath(metaInformationResolver, metaInformationAudioOutput); connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(metaStateChanged(Phonon::State, Phonon::State))); connect(mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(sourceChanged(Phonon::MediaSource))); connect(mediaObject, SIGNAL(aboutToFinish()), this, SLOT(aboutToFinish())); // 初始化动作图标的状态 playAction->setEnabled(false); stopAction->setEnabled(false); skipBackwardAction->setEnabled(false); skipForwardAction->setEnabled(false); topLabel->setFocus(); }
bool watchdog::run() { getmilliseconds(); unsigned expected_major_trigger_time = last_fire + this->major_threshold; unsigned expected_minor_trigger_time = last_fire + this->minor_threshold; bool major_watchdog_tripped = clock_tick > expected_major_trigger_time; bool minor_watchdog_tripped = clock_tick > expected_minor_trigger_time; // Check if either watchdog has taken longer than expected to run, // and if so, warn that we are overloaded. if (major_watchdog_tripped) { major_triggers++; CStat::globalStat(CStat::E_WATCHDOG_MAJOR); last_trigger = clock_tick; WARNING("Overload warning: the major watchdog timer %dms has been tripped (%d), %d trips remaining.", major_threshold, clock_tick - last_fire, major_maxtriggers - major_triggers); } else if (minor_watchdog_tripped) { minor_triggers++; last_trigger = clock_tick; CStat::globalStat(CStat::E_WATCHDOG_MINOR); WARNING("Overload warning: the minor watchdog timer %dms has been tripped (%d), %d trips remaining.", minor_threshold, clock_tick - last_fire, minor_maxtriggers - minor_triggers); } bool major_watchdog_failure = ((this->major_maxtriggers != -1) && (major_triggers > this->major_maxtriggers)); bool minor_watchdog_failure = ((this->minor_maxtriggers != -1) && (minor_triggers > this->minor_maxtriggers)); // If the watchdogs have tripped too many times, end the SIPp run. if (major_watchdog_failure) { ERROR("Overload error: the watchdog timer has tripped the major threshold of %dms too many times (%d out of %d allowed) (%d out of %d minor %dms timeouts tripped)\n", major_threshold, major_triggers, major_maxtriggers, minor_triggers, minor_maxtriggers, minor_threshold); } else if (minor_watchdog_failure) { ERROR("Overload error: the watchdog timer has tripped the minor threshold of %dms too many times (%d out of %d allowed) (%d out of %d major %dms timeouts tripped)\n", minor_threshold, minor_triggers, minor_maxtriggers, major_triggers, major_maxtriggers, major_threshold); } if ((reset_interval > 0) && (major_triggers || minor_triggers) && (clock_tick > (last_trigger + reset_interval))) { WARNING("Resetting watchdog timer trigger counts, as it has not been triggered in over %dms.", clock_tick - last_trigger); major_triggers = minor_triggers = 0; } last_fire = clock_tick; setPaused(); // Return this task to a paused state return true; }
int GStreamerPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 13) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = getBrightness(); break; case 1: *reinterpret_cast< int*>(_v) = getContrast(); break; case 2: *reinterpret_cast< int*>(_v) = getHue(); break; case 3: *reinterpret_cast< int*>(_v) = getSaturation(); break; case 4: *reinterpret_cast< bool*>(_v) = getPlaying(); break; case 5: *reinterpret_cast< bool*>(_v) = getPaused(); break; case 6: *reinterpret_cast< bool*>(_v) = getStopped(); break; default: break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBrightness(*reinterpret_cast< int*>(_v)); break; case 1: setContrast(*reinterpret_cast< int*>(_v)); break; case 2: setHue(*reinterpret_cast< int*>(_v)); break; case 3: setSaturation(*reinterpret_cast< int*>(_v)); break; case 4: setPlaying(*reinterpret_cast< bool*>(_v)); break; case 5: setPaused(*reinterpret_cast< bool*>(_v)); break; case 6: setStopped(*reinterpret_cast< bool*>(_v)); break; default: break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 7) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }