void BattleInput::receiveData(QByteArray inf) { if (inf.isEmpty()) { if (paused()) { delayedCommands.push_back(inf); return; } /* An empty array means raw Command */ if (commands.size() > 0) { AbstractCommand *command = *commands.begin(); commands.pop_front(); command->apply(); delete command; return; } } if (paused() && inf[0] != char(BC::BattleChat) && inf[0] != char(BC::SpectatorChat) && inf[0] != char(BC::ClockStart) && inf[0] != char(BC::ClockStop) && inf[0] != char(BC::Spectating)) { delayedCommands.push_back(inf); return; } DataStream in (&inf, QIODevice::ReadOnly); uchar command; qint8 player; in >> command >> player; dealWithCommandInfo(in, command, player); }
KSB_MediaWidget::KSB_MediaWidget(QWidget *parent):KSB_MediaWidget_skel(parent) { player = new Player(this); empty(); QFont labelFont = time->font(); labelFont.setPointSize(18); labelFont.setBold(true); time->setFont(labelFont); connect(Play, SIGNAL(clicked()), player, SLOT(play())); connect(Pause, SIGNAL(clicked()), player, SLOT(pause())); connect(Stop, SIGNAL(clicked()), player, SLOT(stop())); connect(player, SIGNAL(timeout()), this, SLOT(playerTimeout())); connect(player, SIGNAL(finished()), this, SLOT(playerFinished())); connect(player, SIGNAL(playing()), this, SLOT(playing())); connect(player, SIGNAL(paused()), this, SLOT(paused())); connect(player, SIGNAL(stopped()), this, SLOT(stopped())); connect(player, SIGNAL(empty()), this, SLOT(empty())); connect(Position, SIGNAL(userChanged(int)), this, SLOT(skipToWrapper(int))); connect(this, SIGNAL(skipTo(unsigned long)), player, SLOT(skipTo(unsigned long))); setAcceptDrops(true); pretty=""; needLengthUpdate=false; QToolTip::add(Play,i18n("Play")); QToolTip::add(Pause,i18n("Pause")); QToolTip::add(Stop,i18n("Stop")); }
void ScrobbleService::setConnection(PlayerConnection*c) { if( m_connection ) { // disconnect from all the objects that we connect to below disconnect( m_connection, 0, this, 0); if(m_watch) m_connection->setElapsed(m_watch->elapsed()); } // connect(c, SIGNAL(trackStarted(Track, Track)), SLOT(onTrackStarted(Track, Track))); connect(c, SIGNAL(paused()), SLOT(onPaused())); connect(c, SIGNAL(resumed()), SLOT(onResumed())); connect(c, SIGNAL(stopped()), SLOT(onStopped())); connect(c, SIGNAL(trackStarted(Track, Track)), SIGNAL(trackStarted(Track, Track))); connect(c, SIGNAL(resumed()), SIGNAL(resumed())); connect(c, SIGNAL(paused()), SIGNAL(paused())); connect(c, SIGNAL(stopped()), SIGNAL(stopped())); connect(c, SIGNAL(bootstrapReady(QString)), SIGNAL( bootstrapReady(QString))); m_connection = c; if(c->state() == Playing || c->state() == Paused) c->forceTrackStarted(Track()); if( c->state() == Paused ) c->forcePaused(); }
Amarok::OSD::OSD() : OSDWidget( 0 ) { s_instance = this; EngineController* const engine = The::engineController(); if( engine->isPlaying() ) trackPlaying( engine->currentTrack() ); connect( engine, SIGNAL( trackPlaying( Meta::TrackPtr ) ), this, SLOT( trackPlaying( Meta::TrackPtr ) ) ); connect( engine, SIGNAL( stopped( qint64, qint64 ) ), this, SLOT( stopped() ) ); connect( engine, SIGNAL( paused() ), this, SLOT( paused() ) ); connect( engine, SIGNAL( trackMetadataChanged( Meta::TrackPtr ) ), this, SLOT( metadataChanged() ) ); connect( engine, SIGNAL( albumMetadataChanged( Meta::AlbumPtr ) ), this, SLOT( metadataChanged() ) ); connect( engine, SIGNAL( volumeChanged( int ) ), this, SLOT( volumeChanged( int ) ) ); connect( engine, SIGNAL( muteStateChanged( bool ) ), this, SLOT( muteStateChanged( bool ) ) ); }
void ForgettableWatcherBase::connectForwardedInterface() { Q_D(ForgettableWatcherBase); connect(d, SIGNAL(started()), this, SIGNAL(started())); connect(d, SIGNAL(finished()), this, SLOT(deleteObject())); connect(d, SIGNAL(canceled()), this, SIGNAL(canceled())); connect(d, SIGNAL(paused()), this, SIGNAL(paused())); connect(d, SIGNAL(resumed()), this, SIGNAL(resumed())); connect(d, SIGNAL(resultReadyAt(int)), this, SIGNAL(resultReadyAt(int))); connect(d, SIGNAL(resultsReadyAt(int, int)), this, SIGNAL(resultsReadyAt(int, int))); connect(d, SIGNAL(progressRangeChanged(int, int)), this, SIGNAL(progressRangeChanged(int, int))); connect(d, SIGNAL(progressValueChanged(int)), this, SIGNAL(progressValueChanged(int))); connect(d, SIGNAL(progressTextChanged(const QString&)), this, SIGNAL(progressTextChanged(const QString&))); }
void FsRadProgressDlg::OnPause() { paused() = !paused(); if (paused()) { pauseButton.SetWindowText(L"Resume"); runtimeText.SetWindowText(L"Paused"); RedrawWindow(); } else { pauseButton.SetWindowText(L"Pause"); } }
double AnimationBase::timeToNextService() { // Returns the time at which next service is required. -1 means no service is required. 0 means // service is required now, and > 0 means service is required that many seconds in the future. if (paused() || isNew() || m_animationState == AnimationState::FillingForwards) return -1; if (m_animationState == AnimationState::StartWaitTimer) { #if ENABLE(CSS_ANIMATIONS_LEVEL_2) if (m_animation->trigger()->isScrollAnimationTrigger()) { if (m_object) { float currentScrollOffset = m_object->view().frameView().scrollOffsetForFixedPosition().height().toFloat(); ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger().get()); if (currentScrollOffset >= scrollTrigger.startValue().value() && (!scrollTrigger.hasEndValue() || currentScrollOffset <= scrollTrigger.endValue().value())) return 0; } return -1; } #endif double timeFromNow = m_animation->delay() - (beginAnimationUpdateTime() - m_requestedStartTime); return std::max(timeFromNow, 0.0); } fireAnimationEventsIfNeeded(); // In all other cases, we need service right away. return 0; }
void Application::onResize() { m_resized = true; sf::Vector2f size = static_cast<sf::Vector2f>(m_window.getSize()); // Minimum size if(size.x < 800) size.x = 800; if(size.y < 600) size.y = 600; // Apply possible size changes m_window.setSize(static_cast<sf::Vector2u>(size)); // Reset static (1:1) view m_staticView = sf::View(sf::FloatRect(0.f, 0.f, size.x, size.y)); m_window.setView(m_staticView); // Resize widgets // The sidebar should be 180px wide const float width = 180.f; //m_desktop.UpdateViewRect(sf::FloatRect(0.f, 0.f, size.x, size.y)); // m_sideBar->SetAllocation(sf::FloatRect(0.f, 0.f, width, size.y)); // Resize & update the fractal m_fractal.resize(static_cast<sf::Vector2u>(size), 4); paused(); m_fractal.update(sf::Vector2i(0, 0), static_cast<sf::Vector2i>(size)); }
Application::Application() : m_window(sf::VideoMode(1000, 765), "Fractal - Mandelbrot"),//, sf::Style::Titlebar | sf::Style::Close), m_fractal(sf::Vector2u(1000, 765), 4), m_down(-1, -1), m_resized(true) { m_window.setFramerateLimit(60); // Init select frame m_select.setFillColor(sf::Color(0, 0, 0, 0)); m_select.setOutlineColor(sf::Color(255, 255, 255, 255)); m_select.setOutlineThickness(-2.f); m_font.loadFromFile("DejaVuSans.ttf"); m_precision.setFont(m_font); m_precision.setPosition(10.f, 10.f); m_precision.setCharacterSize(20.f); std::stringstream ss; ss << std::fixed << static_cast<int>(m_fractal.precision()); m_precision.setString(ss.str()); // Init fractal paused(true); m_fractal.update(sf::Vector2i(0, 0), static_cast<sf::Vector2i>(m_window.getSize())); }
void AnimationPlayer::preCommit(bool startOnCompositor) { if (m_compositorState && m_compositorState->pendingAction == Start) { // Still waiting for a start time. return; } bool softChange = m_compositorState && (paused() || m_compositorState->playbackRate != m_playbackRate); bool hardChange = m_compositorState && (m_compositorState->sourceChanged || (m_compositorState->startTime != m_startTime && !std::isnan(m_compositorState->startTime) && !std::isnan(m_startTime))); // FIXME: softChange && !hardChange should generate a Pause/ThenStart, // not a Cancel, but we can't communicate these to the compositor yet. bool changed = softChange || hardChange; bool shouldCancel = (!playing() && m_compositorState) || changed; bool shouldStart = playing() && (!m_compositorState || changed); if (shouldCancel) { cancelAnimationOnCompositor(); m_compositorState = nullptr; } if (!shouldStart) { m_currentTimePending = false; } if (shouldStart && startOnCompositor && maybeStartAnimationOnCompositor()) { m_compositorState = adoptPtr(new CompositorState(*this)); } }
void running_machine::toggle_pause() { if (paused()) resume(); else pause(); }
void RepeatedTask::update(){ if(this->state != CPPIE_TASKSTATE_WAITING) return; if(paused()) return; if(delay == CPPIE_TASK_NEXT_LOOP){ if(startCount != system->loopCount){ this->state = CPPIE_TASKSTATE_RUNNING; task(); run(delay); } } else{ if(getTicks() - startTick >= delay){ this->state = CPPIE_TASKSTATE_RUNNING; task(); run(delay); } } }
double AnimationBase::getElapsedTime() const { #if ENABLE(CSS_ANIMATIONS_LEVEL_2) if (m_animation->trigger() && m_animation->trigger()->isScrollAnimationTrigger()) { ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger().get()); if (scrollTrigger.hasEndValue() && m_object) { float offset = m_compositeAnimation->animationController().scrollPosition(); float startValue = scrollTrigger.startValue().value(); if (offset < startValue) return 0; float endValue = scrollTrigger.endValue().value(); if (offset > endValue) return m_animation->duration(); return m_animation->duration() * (offset - startValue) / (endValue - startValue); } } #endif if (paused()) return m_pauseTime - m_startTime; if (m_startTime <= 0) return 0; if (postActive() || fillingForwards()) return m_totalDuration; return beginAnimationUpdateTime() - m_startTime; }
Scrobbler::Scrobbler( QObject* parent ) : QObject( parent ) , m_reachedScrobblePoint( false ) { connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); connect( AudioEngine::instance(), SIGNAL( started( const Tomahawk::result_ptr& ) ), SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection ); connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( trackPaused() ), Qt::QueuedConnection ); connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( trackResumed() ), Qt::QueuedConnection ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( trackStopped() ), Qt::QueuedConnection ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); }
int MPlayerProcess::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QProcess::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: mediaPosition((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: volumeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: durationChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: volumeLevelChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: fileNameChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 5: paused(); break; case 6: sizeChanged(); break; case 7: openStream((*reinterpret_cast< QString(*)>(_a[1]))); break; case 8: togglePlayPause(); break; case 9: setMediaPosition((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: setVolume((*reinterpret_cast< int(*)>(_a[1]))); break; case 11: setLoop((*reinterpret_cast< bool(*)>(_a[1]))); break; case 12: setSpeed((*reinterpret_cast< int(*)>(_a[1]))); break; case 13: setAudioDelay((*reinterpret_cast< int(*)>(_a[1]))); break; case 14: readStandardOutput(); break; default: ; } _id -= 15; } return _id; }
void parseCommandLine( int argc, char** argv ) { try { TCLAP::CmdLine cmd("TDSmoke"); // Directory to save png movie frames too TCLAP::ValueArg<std::string> movie("m", "movie", "Directory to save png movie too", false, "", "string", cmd); // Frequency (in simulation time) at which to save frames TCLAP::ValueArg<scalar> moviefreq("f", "moviefrequency", "Frequency (in simulation time) at which to save frames", false, -1.0, "scalar", cmd); // Begin the scene paused or running TCLAP::ValueArg<bool> paused("p", "paused", "Begin the simulation paused if 1, running if 0", false, true, "boolean", cmd); // Run the simulation with rendering enabled or disabled TCLAP::ValueArg<bool> display("d", "display", "Run the simulation with display enabled if 1, without if 0", false, true, "boolean", cmd); // Xml scene file TCLAP::ValueArg<std::string> scene("s", "scene", "Xml scene file", false, "", "string", cmd); // // Save svgs to a movie directory // TCLAP::ValueArg<std::string> movie("m", "moviedir", "Directory to output svg screenshot to", false, "", "string", cmd); cmd.parse(argc, argv); if (scene.isSet()) { g_xml_scene_file = scene.getValue(); g_xml_scene = true; } g_paused = paused.getValue(); g_opengl_rendering_enabled = display.getValue(); if( movie.isSet() ) { g_movie_dir = movie.getValue(); scalar fps = 1.0/g_dt; if( moviefreq.isSet() ) { fps = moviefreq.getValue(); } assert( fps > 0.0 ); assert( fps*g_dt <= 1.0 ); if( !mathutils::approxEqual(fmod(1.0/g_dt,fps),0.0,1.0e-9) ) { std::cerr << outputmod::startred << "TDSmoke WARNING: " << outputmod::endred << "Time between frames and timestep not integer multiple." << std::endl; } g_steps_per_movie_frame = mathutils::round(1.0/(fps*g_dt)); } } catch( TCLAP::ArgException& e ) { std::cerr << outputmod::startred << "TDSmoke ERROR: " << outputmod::endred << " Parse error from TCLAP: " << e.what() << std::endl; exit(1); } }
uint32_t getPauseInitiatorCoreId() { decaf_check(paused()); decaf_check(sPauseInitiatorCoreId < 3); return sPauseInitiatorCoreId; }
void startRetry() { connect(zhttpRequest, SIGNAL(error()), SLOT(zhttpRequest_error())); connect(zhttpRequest, SIGNAL(paused()), SLOT(zhttpRequest_paused())); state = WaitingForResponse; bool isHttps = (requestData.uri.scheme() == "https"); QString host = requestData.uri.host(); QByteArray encPath = requestData.uri.path(QUrl::FullyEncoded).toUtf8(); // look up the route route = domainMap->entry(DomainMap::Http, isHttps, host, encPath); if(route.isNull()) { log_warning("requestsession: %p %s has 0 routes", q, qPrintable(host)); state = WaitingForResponse; respondError(502, "Bad Gateway", QString("No route for host: %1").arg(host)); return; } log_debug("proxysession: %p %s has %d routes", q, qPrintable(host), route.targets.count()); }
template<class W> void Analyzer::Base<W>::drawFrame() { EngineBase *engine = EngineController::engine(); switch( engine->state() ) { case Engine::Playing: { const Engine::Scope &thescope = engine->scope(); static Analyzer::Scope scope( 512 ); for( uint x = 0; (int)x < m_fht->size(); ++x ) scope[x] = double(thescope[x]) / (1<<15); transform( scope ); analyze( scope ); scope.resize( m_fht->size() ); break; } case Engine::Paused: paused(); break; default: demo(); } }
void VPlayer::play() { if(mp){ if(state==Stop){ libvlc_media_track_info_t *info; libvlc_media_parse(m); int i=libvlc_media_get_tracks_info(m,&info); for(--i;i>=0;--i){ if(info[i].i_type==libvlc_track_video){ srcSize.setWidth (info[i].u.video.i_width); srcSize.setHeight(info[i].u.video.i_height); } } free(info); dstSize=srcSize; avpicture_alloc(&srcFrame,PIX_FMT_RGB32,srcSize.width(),srcSize.height()); avpicture_alloc(&dstFrame,PIX_FMT_RGB32,dstSize.width(),dstSize.height()); valid=true; libvlc_video_set_format(mp,"RV32",srcSize.width(),srcSize.height(),srcSize.width()*4); libvlc_video_set_callbacks(mp,lock,NULL,display,this); Utils::delayExec(50,[this](){libvlc_media_player_play(mp);}); } else{ libvlc_media_player_pause(mp); if(state==Play){ state=Pause; emit paused(); } else{ state=Play; } } } }
void FsRadProgressDlg::resetStopped() { stopRequested() = false; if (paused()) OnPause(); stopButton.EnableWindow(TRUE); pauseButton.EnableWindow(TRUE); }
ClipRenderer::ClipRenderer() : GenericRenderer(), m_clipLoaded( false ), m_vlcMedia( NULL ), m_selectedClip( NULL ), m_begin( 0 ), m_end( -1 ), m_mediaChanged( false ) { connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) ); connect( m_mediaPlayer, SIGNAL( paused() ), this, SIGNAL( paused() ) ); connect( m_mediaPlayer, SIGNAL( playing() ), this, SIGNAL( playing() ) ); connect( m_mediaPlayer, SIGNAL( volumeChanged() ), this, SIGNAL( volumeChanged() ) ); connect( m_mediaPlayer, SIGNAL( timeChanged( qint64 ) ),this, SLOT( __timeChanged( qint64 ) ) ); connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( __endReached() ) ); }
ScrobblesListWidget::ScrobblesListWidget( QWidget* parent ) :QListWidget( parent ), m_trackItem( 0 ) { setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); #ifdef Q_OS_MAC connect( verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(scroll()) ); #endif setAttribute( Qt::WA_MacNoClickThrough ); setAttribute( Qt::WA_MacShowFocusRect, false ); setUniformItemSizes( false ); setSortingEnabled( false ); setSelectionMode( QAbstractItemView::NoSelection ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); connect( qApp, SIGNAL( sessionChanged(unicorn::Session)), SLOT(onSessionChanged(unicorn::Session))); connect( &ScrobbleService::instance(), SIGNAL(scrobblesCached(QList<lastfm::Track>)), SLOT(onScrobblesSubmitted(QList<lastfm::Track>) ) ); connect( &ScrobbleService::instance(), SIGNAL(scrobblesSubmitted(QList<lastfm::Track>)), SLOT(onScrobblesSubmitted(QList<lastfm::Track>) ) ); connect( &ScrobbleService::instance(), SIGNAL(trackStarted(lastfm::Track,lastfm::Track)), SLOT(onTrackStarted(lastfm::Track,lastfm::Track))); connect( &ScrobbleService::instance(), SIGNAL(paused()), SLOT(onPaused())); connect( &ScrobbleService::instance(), SIGNAL(resumed()), SLOT(onResumed())); connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(onStopped())); onSessionChanged( aApp->currentSession() ); }
void Player::pauseForTesting() { RELEASE_ASSERT(!paused()); if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(currentTime()); m_isPausedForTesting = true; setPausedImpl(true); }
void StopWatch::resume() { // Only resume if we are already running if ( m_timeline->state() == QTimeLine::Paused ) m_timeline->resume(); emit paused( false ); }
void AVClock::pause(bool p) { if (clock_type != ExternalClock) return; if (p) { #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) timer.invalidate(); #else timer.stop(); #endif //QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) emit paused(); } else { timer.start(); emit resumed(); } emit paused(p); }
void AnimationPlayer::pauseForTesting(double pauseTime) { RELEASE_ASSERT(!paused()); setCurrentTimeInternal(pauseTime, TimingUpdateOnDemand); if (hasActiveAnimationsOnCompositor()) toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(currentTimeInternal()); m_isPausedForTesting = true; pause(); }
void parseCommandLine( int argc, char** argv ) { try { TCLAP::CmdLine cmd("Forty One Sixty Seven Sim"); // XML scene file to load TCLAP::ValueArg<std::string> scene("s", "scene", "Simulation to run; an xml scene file", true, "", "string", cmd); // Begin the scene paused or running TCLAP::ValueArg<bool> paused("p", "paused", "Begin the simulation paused if 1, running if 0", false, true, "boolean", cmd); // Run the simulation with rendering enabled or disabled TCLAP::ValueArg<bool> display("d", "display", "Run the simulation with display enabled if 1, without if 0", false, true, "boolean", cmd); // These cannot be set at the same time // File to save output to TCLAP::ValueArg<std::string> output("o", "outputfile", "Binary file to save simulation state to", false, "", "string", cmd); // File to load for comparisons TCLAP::ValueArg<std::string> input("i", "inputfile", "Binary file to load simulation state from for comparison", false, "", "string", cmd); // Save svgs to a movie directory TCLAP::ValueArg<std::string> movie("m", "moviedir", "Directory to output svg screenshot to", false, "", "string", cmd); cmd.parse(argc, argv); if( output.isSet() && input.isSet() ) throw TCLAP::ArgException( "arguments i and o specified simultaneously", "arguments i and o", "invalid argument combination" ); assert( scene.isSet() ); g_xml_scene_file = scene.getValue(); g_paused = paused.getValue(); g_rendering_enabled = display.getValue(); if( output.isSet() ) { g_save_to_binary = true; g_binary_file_name = output.getValue(); } if( input.isSet() ) { g_simulate_comparison = true; g_comparison_file_name = input.getValue(); } if( movie.isSet() ) { g_svg_enabled = true; g_movie_dir = movie.getValue(); } } catch (TCLAP::ArgException& e) { std::cerr << "error: " << e.what() << std::endl; exit(1); } }
void AnimationPlayer::pauseForTesting(double pauseTime) { RELEASE_ASSERT(!paused()); updateTimingState(pauseTime); if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(currentTime()); m_isPausedForTesting = true; pause(); }
void workerService_t::onPause(void) { m_log->info("Received pause request, pausing service."); setState(QSERVICE_PAUSED); reportStatus(SERVICE_PAUSED); emit paused(); return; }