void
PlayerConnection::onStopped()
{
    m_track = Track();

    if (m_state == Stopped)
    {
        qWarning() << "Already stopped";
    }
    else
    {
        m_state = Stopped;
        m_elapsed = 0;
        emit stopped();
    }
}
void PlaceSoundModel::onChildSoundStopped(){
	SoundModel* senderSound = ((SoundModel*)QObject::sender());
	if( senderSound->type() != SoundModel::TYPE_ONE_SHOT ){
		--m_playingChildrenSounds;
		qDebug() << "Place : Sound Stopped : " << senderSound->name() << " (" << m_playingChildrenSounds << ")";

		if( senderSound == m_mainSound ){
			m_mainSound = NULL;
		}

		// Check for stopped signal
		if(m_playingChildrenSounds < 1){
			emit stopped();
		}
	}
}
/**
   Updates the gyro bias raw values
 */
void GyroBiasCalibrationModel::getSample(UAVObject *obj)
{
    QMutexLocker lock(&sensorsUpdateLock);

    switch (obj->getObjID()) {
    case GyroState::OBJID:
    {
        GyroState::DataFields gyroStateData = gyroState->getData();
        gyro_state_accum_x.append(gyroStateData.x);
        gyro_state_accum_y.append(gyroStateData.y);
        gyro_state_accum_z.append(gyroStateData.z);
        break;
    }
    case GyroSensor::OBJID:
    {
        GyroSensor::DataFields gyroSensorData = gyroSensor->getData();
        gyro_accum_x.append(gyroSensorData.x);
        gyro_accum_y.append(gyroSensorData.y);
        gyro_accum_z.append(gyroSensorData.z);
        break;
    }
    default:
        Q_ASSERT(0);
    }

    // Work out the progress based on whichever has less
    double p1 = (double)gyro_state_accum_x.size() / (double)LEVEL_SAMPLES;
    double p2 = (double)gyro_accum_y.size() / (double)LEVEL_SAMPLES;
    progressChanged(((p1 > p2) ? p1 : p2) * 100);

    if ((gyro_accum_y.size() >= LEVEL_SAMPLES || (gyro_accum_y.size() == 0 && gyro_state_accum_y.size() >= LEVEL_SAMPLES)) &&
        collectingData == true) {
        collectingData = false;
        m_dirty = true;

        disconnect(gyroSensor, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(getSample(UAVObject *)));
        disconnect(gyroState, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(getSample(UAVObject *)));

        gyroState->setMetadata(memento.gyroStateMetadata);
        gyroSensor->setMetadata(memento.gyroSensorMetadata);
        revoCalibration->setData(memento.revoCalibrationData);
        attitudeSettings->setData(memento.attitudeSettingsData);

        stopped();
        displayInstructions(tr("Gyroscope calibration completed successfully."), WizardModel::Success);
        displayVisualHelp(CALIBRATION_HELPER_IMAGE_EMPTY);
    }
PlaybackControlsWidget::PlaybackControlsWidget(QWidget *parent) :
    StylableWidget(parent),
    ui(new Ui::PlaybackControlsWidget),
    m_scrobbleTrack( false )
{
    ui->setupUi(this);

    ui->play->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->ban->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->love->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->skip->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->play->setAttribute( Qt::WA_MacNoClickThrough );
    ui->ban->setAttribute( Qt::WA_MacNoClickThrough );
    ui->love->setAttribute( Qt::WA_MacNoClickThrough );
    ui->skip->setAttribute( Qt::WA_MacNoClickThrough );

    // If the actions are triggered we should do something
    // love is dealt with by the application
    connect( aApp->banAction(), SIGNAL(triggered(bool)), SLOT(onBanClicked()) );
    connect( aApp->playAction(), SIGNAL(triggered(bool)), SLOT(onPlayClicked(bool)) );
    connect( aApp->skipAction(), SIGNAL(triggered(bool)), SLOT(onSkipClicked()) );

    m_playAction = new QAction( tr( "Play" ), aApp );
    connect( m_playAction, SIGNAL(triggered(bool)), aApp->playAction(), SLOT(trigger()) );
    connect( aApp->playAction(), SIGNAL(toggled(bool)), m_playAction, SLOT(setChecked(bool)) );

    // make sure this widget updates if the actions are changed elsewhere
    connect( aApp->loveAction(), SIGNAL(changed()), SLOT(onActionsChanged()) );
    connect( aApp->banAction(), SIGNAL(changed()), SLOT(onActionsChanged()) );
    connect( aApp->playAction(), SIGNAL(changed()), SLOT(onActionsChanged()) );
    connect( aApp->skipAction(), SIGNAL(changed()), SLOT(onActionsChanged()) );

    connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onTuningIn(RadioStation)));
    connect( &RadioService::instance(), SIGNAL(error(int,QVariant)), SLOT(onError(int, QVariant)));

    connect( &ScrobbleService::instance(), SIGNAL(trackStarted(Track,Track)), SLOT(onTrackStarted(Track,Track)) );
    connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(onStopped()));
    connect( &ScrobbleService::instance(), SIGNAL(scrobblingOnChanged(bool)), SLOT(update()));

    onActionsChanged();

    // if our buttons are pressed we should trigger the actions
    connect( ui->love, SIGNAL(clicked()), aApp->loveAction(), SLOT(trigger()));
    connect( ui->ban, SIGNAL(clicked()), aApp->banAction(), SLOT(trigger()));
    connect( ui->play, SIGNAL(clicked()), aApp->playAction(), SLOT(trigger()));
    connect( ui->skip, SIGNAL(clicked()), aApp->skipAction(), SLOT(trigger()));
}
Esempio n. 5
0
void Player::connectTransport(const TransportControllable* receiver)
{
    if (receiver == m_currentTransport) return;
    if (m_currentTransport)
        disconnect(m_currentTransport);
    m_currentTransport = receiver;
    connect(this, SIGNAL(played(double)), receiver, SLOT(play(double)));
    connect(this, SIGNAL(paused()), receiver, SLOT(pause()));
    connect(this, SIGNAL(stopped()), receiver, SLOT(stop()));
    connect(this, SIGNAL(seeked(int)), receiver, SLOT(seek(int)));
    connect(this, SIGNAL(rewound()), receiver, SLOT(rewind()));
    connect(this, SIGNAL(fastForwarded()), receiver, SLOT(fastForward()));
    connect(this, SIGNAL(previousSought(int)), receiver, SLOT(previous(int)));
    connect(this, SIGNAL(nextSought(int)), receiver, SLOT(next(int)));
    connect(this, SIGNAL(inChanged(int)), receiver, SLOT(setIn(int)));
    connect(this, SIGNAL(outChanged(int)), receiver, SLOT(setOut(int)));
}
Esempio n. 6
0
 // Signals the service stopped if the stopped condition is met.
 //
 void checkStopped (ScopedLock const& lock)
 {
     // We are stopped when all of the following are true:
     //
     //  1. A stop notification was received
     //  2. All Stoppable children have stopped
     //  3. There are no executing calls to processTask
     //  4. There are no remaining Jobs in the job set
     //
     if (isStopping() &&
         areChildrenStopped() &&
         (m_processCount == 0) &&
         m_jobSet.empty())
     {
         stopped();
     }
 }
Esempio n. 7
0
void SimpleDesk::initPlaybackSliders()
{
    qDebug() << Q_FUNC_INFO;
    for (uint i = 0; i < m_playbacksPerPage; i++)
    {
        PlaybackSlider* slider = new PlaybackSlider(m_playbackGroup);
        m_playbackGroup->layout()->addWidget(slider);
        slider->setLabel(QString::number(i + 1));
        slider->setProperty(PROP_PLAYBACK, uint(i));
        m_playbackSliders << slider;
        connect(slider, SIGNAL(selected()), this, SLOT(slotPlaybackSelected()));
        connect(slider, SIGNAL(started()), this, SLOT(slotPlaybackStarted()));
        connect(slider, SIGNAL(stopped()), this, SLOT(slotPlaybackStopped()));
        connect(slider, SIGNAL(flashing(bool)), this, SLOT(slotPlaybackFlashing(bool)));
        connect(slider, SIGNAL(valueChanged(uchar)), this, SLOT(slotPlaybackValueChanged(uchar)));
    }
}
bool VideoHttpBuffer::startBuffering()
{
    Q_ASSERT(!media);

    media = bcApp->mediaDownloadManager()->acquireMediaDownload(m_url);
    connect(media, SIGNAL(fileSizeChanged(uint)), SLOT(fileSizeChanged(uint)), Qt::DirectConnection);
    connect(media, SIGNAL(finished()), SIGNAL(bufferingFinished()));
    connect(media, SIGNAL(stopped()), SIGNAL(bufferingStopped()));
    connect(media, SIGNAL(error(QString)), SLOT(sendStreamError(QString)));

    media->start();

    qDebug("VideoHttpBuffer: started");
    emit bufferingStarted();

    return true;
}
Esempio n. 9
0
    void run ()
    {
        m_journal.debug << "Started";

        init ();

        while (! this->threadShouldExit())
        {
            this->wait ();
            if (! this->threadShouldExit())
            {
                doLedgerCleaner();
            }
        }

        stopped();
    }
Esempio n. 10
0
    void run ()
    {
        m_journal.debug << "started";

        init ();

        while (! this->threadshouldexit())
        {
            this->wait ();
            if (! this->threadshouldexit())
            {
                doledgercleaner();
            }
        }

        stopped();
    }
Esempio n. 11
0
void Gdb::parse(const QByteArray& inputs)
{
	foreach(const QByteArray& input, inputs.split('\n')) {
		qWarning() << "line" << input;
		if(input.startsWith("~")) { if(m_responder) { m_responder->writeDebugState(cString(input.data(), 1)); } }
		else if(input.startsWith("^error")) { if(m_responder) { m_responder->writeStderr(cString(input.data(), after(input.data(), "msg="))); } }
		else if(input.startsWith("^done,stack=")) stack(input.data());
		else if(input.startsWith("^done,stack-args=")) stackArgs(input.data());
		else if(input.startsWith("^done,locals=")) locals(input.data());
		else if(input.startsWith("^done,BreakpointTable=")) breakpointTable(input.data());
		else if(input.startsWith("^done,bkpt="));
		else if(input.startsWith("^done")) { if(m_responder) { m_responder->writeDebugState(cString(input.data(), after(input.data(), "reason="))); } }
		else if(input.startsWith("*stopped")) stopped(input.data());
		else if(input.startsWith("=shlibs-added")) m_libs += shlibsAdded(input.data());
	}
	if(m_responder) m_responder->update();
}
Esempio n. 12
0
    virtual void stop() {
        ThreadPool::stop();
        while (stopped() == false) {
            std::this_thread::yield();
            _in.advanceWritePos();
            _in.signalNonEmpty();
        }

        _stopManager = true;
        while (_managerStopped == false) {
            std::this_thread::yield();
            _in.advanceWritePos();
            _in.signalNonEmpty();
            _endSignaled++;
            _ended.notify_one();
        }
    }
Esempio n. 13
0
void
EIBNetIPRouter::start()
{
  struct sockaddr_in baddr;
  struct ip_mreq mcfg;
  TRACEPRINTF (t, 2, "Open");
  memset (&baddr, 0, sizeof (baddr));
#ifdef HAVE_SOCKADDR_IN_LEN
  baddr.sin_len = sizeof (baddr);
#endif
  baddr.sin_family = AF_INET;
  baddr.sin_port = htons (port);
  baddr.sin_addr.s_addr = htonl (INADDR_ANY);
  sock = new EIBNetIPSocket (baddr, 1, t);
  if (!sock->init ())
    goto err_out;
  sock->on_recv.set<EIBNetIPRouter,&EIBNetIPRouter::read_cb>(this);

  if (! sock->SetInterface(interface))
    {
      ERRORPRINTF (t, E_ERROR | 58, "interface %s not recognized", interface);
      goto err_out;
    }

  sock->recvall = 2;
  if (GetHostIP (t, &sock->sendaddr, multicastaddr) == 0)
    goto err_out;
  sock->sendaddr.sin_port = htons (port);
  if (!GetSourceAddress (t, &sock->sendaddr, &sock->localaddr))
    goto err_out;
  sock->localaddr.sin_port = sock->sendaddr.sin_port;

  mcfg.imr_multiaddr = sock->sendaddr.sin_addr;
  mcfg.imr_interface.s_addr = htonl (INADDR_ANY);
  if (!sock->SetMulticast (mcfg))
    goto err_out;
  TRACEPRINTF (t, 2, "Opened");
  BusDriver::start();
  return;

err_out:
  delete sock;
  sock = 0;
  stopped();
}
Esempio n. 14
0
void UserProgram::toggleState()
{
  QFileInfo robot("/mnt/user/bin/robot");
  
  if(m_userProgram.state() == QProcess::NotRunning) {
    if(robot.exists()) {
      m_userProgram.start("/mnt/kiss/usercode/run");
    }
    else {
      emit consoleOutput(QString("No program to run!\n"));
    }
  }
  else {
    emit consoleOutput(QString("Program Stopped!\n"));
    m_userProgram.terminate();
    emit stopped();
  }
}
Esempio n. 15
0
void Player::handleButtons()
{
	switch(mEngine->state())
	{
	case KMediaPlayer::Player::Play:
		emit playing();
		break;
	case KMediaPlayer::Player::Pause:
		emit paused();
		break;
	case KMediaPlayer::Player::Stop:
		emit stopped();
		break;
	case KMediaPlayer::Player::Empty:
		emit empty();
		break;
	}
}
Esempio n. 16
0
void CommandProc::slotProcessExited(KProcess*)
{
    kdDebug() << "CommandProc:slotProcessExited: Command process has exited." << endl;
    pluginState prevState = m_state;
    if (m_waitingStop)
    {
        m_waitingStop = false;
        m_state = psIdle;
        emit stopped();
    } else {
        m_state = psFinished;
        if (prevState == psSaying)
            emit sayFinished();
        else
            if (prevState == psSynthing)
                emit synthFinished();
    }
}
Esempio n. 17
0
void Shuffle::start(MasterTimer* timer)
{
	Q_ASSERT(timer != NULL);

	m_masterTimer = timer;

	/* No point running this shuffle if it has no steps */
	if (m_steps.count() == 0)
	{
		emit stopped(m_id);
		return;
	}

	/* Current position starts from invalid index because nextStep() is
	   called first in write(). */
	m_runTimePosition = -1;
	Function::start(timer);
}
Esempio n. 18
0
    void DisplayServer::finished() {
        // check flag
        if (!m_started)
            return;

        // reset flag
        m_started = false;

        // log message
        qDebug() << " DAEMON: Display server stopped.";

        // clean up
        process->deleteLater();
        process = nullptr;

        // emit signal
        emit stopped();
    }
Esempio n. 19
0
void Function::postRun(MasterTimer* timer, UniverseArray* universes)
{
    Q_UNUSED(timer);
    Q_UNUSED(universes);

    m_stopMutex.lock();
    resetElapsed();
    resetIntensity();
    m_stop = true;
    m_overrideFadeInSpeed = defaultSpeed();
    m_overrideFadeOutSpeed = defaultSpeed();
    m_overrideDuration = defaultSpeed();
    m_functionStopped.wakeAll();
    m_stopMutex.unlock();

    m_running = false;
    emit stopped(m_id);
}
Esempio n. 20
0
QWidget *TcpServerListener::requestGui(QWidget *parent)
{
    NetworkConfWidget *ncw = new(std::nothrow)NetworkConfWidget(NetworkConfWidget::TCP_SERVER,parent);
    if (ncw == NULL) {
        qFatal("Cannot allocate memory for NetworkConfWidget X{");
    }
    ncw->setPort(port);
    ncw->setIP(listeningAddress);
    ncw->enableDecodeEncodeOption(true);
    connect(ncw, SIGNAL(newIp(QHostAddress)), this, SLOT(setListeningAddress(QHostAddress)));
    connect(ncw, SIGNAL(newPort(quint16)), this, SLOT(setPort(quint16)));
    connect(ncw, SIGNAL(start()), this, SLOT(startListening()));
    connect(ncw, SIGNAL(stop()), this, SLOT(stopListening()));
    connect(ncw,SIGNAL(restart()), this, SLOT(restart()));
    connect(this, SIGNAL(started()), ncw, SLOT(onServerStarted()));
    connect(this, SIGNAL(stopped()), ncw, SLOT(onServerStopped()));
    return ncw;
}
Esempio n. 21
0
void EventHandler::libeventCallback(int fd, short events, void* arg) {
  EventHandler* handler = reinterpret_cast<EventHandler*>(arg);
  assert(fd == handler->event_.ev_fd);

  auto observer = handler->eventBase_->getExecutionObserver();
  if (observer) {
    observer->starting(reinterpret_cast<uintptr_t>(handler));
  }

  // this can't possibly fire if handler->eventBase_ is nullptr
  (void) handler->eventBase_->bumpHandlingTime();

  handler->handlerReady(events);

  if (observer) {
    observer->stopped(reinterpret_cast<uintptr_t>(handler));
  }
}
Esempio n. 22
0
int Function::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) {
        switch (_id) {
        case 0: changed((*reinterpret_cast< t_function_id(*)>(_a[1]))); break;
        case 1: flashing((*reinterpret_cast< t_function_id(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 2: running((*reinterpret_cast< t_function_id(*)>(_a[1]))); break;
        case 3: stopped((*reinterpret_cast< t_function_id(*)>(_a[1]))); break;
        case 4: slotFixtureRemoved((*reinterpret_cast< t_fixture_id(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Esempio n. 23
0
void HostedObject::requestQueryUpdate(const SpaceID& space, const ObjectReference& oref, const String& new_query) {
    if (stopped()) {
        HO_LOG(detailed,"Ignoring query update request after system stop.");
        return;
    }

    SpaceObjectReference sporef(space,oref);
    Mutex::scoped_lock lock(presenceDataMutex);
    PresenceDataMap::iterator pdmIter = mPresenceData.find(sporef);
    if (pdmIter != mPresenceData.end()) {
        pdmIter->second->query = new_query;
    }
    else {
        SILOG(cppoh,error,"Error in cppoh, requesting solid angle update for presence that doesn't exist in your presence map.");
    }

    mObjectHost->getQueryProcessor()->updateQuery(getSharedPtr(), sporef, new_query);
}
void
ScrobbleService::onStopped()
{
    // We can sometimes get a stopped before a play when the
    // media player is playing before the scrobbler is started
    if ( state == Unknown ) return;

    state = Stopped;

    Q_ASSERT(m_watch);
    Q_ASSERT(m_connection);
        
    delete m_watch;
    if( m_as )
        m_as->submit();

    emit stopped();
}
Esempio n. 25
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
{
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    setContextMenu( m_contextMenu );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );

#ifdef Q_WS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  this, SLOT( enablePlay() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    show();
}
Esempio n. 26
0
void Function::postRun(MasterTimer* timer, UniverseArray* universes)
{
    Q_UNUSED(timer);
    Q_UNUSED(universes);

    qDebug() << "Function postRun. ID: " << m_id;
    m_stopMutex.lock();
    resetElapsed();
    resetAttributes();
    m_stop = true;
    //m_overrideFadeInSpeed = defaultSpeed();
    //m_overrideFadeOutSpeed = defaultSpeed();
    //m_overrideDuration = defaultSpeed();
    m_functionStopped.wakeAll();
    m_stopMutex.unlock();

    m_running = false;
    emit stopped(m_id);
}
Esempio n. 27
0
void TcpServerListener::handlingClient(int socketDescriptor)
#endif
{
    TcpListener * listener = new(std::nothrow) TcpListener(socketDescriptor);
    if (listener != NULL) {
       // qDebug() << "Listener created" << listener;
        listener->setDecodeinput(decodeInput);
        listener->setEncodeOutput(encodeOutput);
        clients.append(listener);
        listener->moveToThread(workerThread);
        connect(listener, SIGNAL(blockReceived(Block)), SLOT(onClientReceivedBlock(Block)));
        connect(listener, SIGNAL(stopped()), SLOT(clientFinished()));
        connect(listener, SIGNAL(error(QString,QString)), SIGNAL(error(QString,QString)));
        connect(listener, SIGNAL(status(QString,QString)), SIGNAL(status(QString,QString)));
        QTimer::singleShot(0,listener,SLOT(startListening()));
    } else {
        qFatal("Cannot allocate memory for TcpListener X{");
    }
}
Esempio n. 28
0
SampleParams::SampleParams(Sample * sample, QWidget *parent) :
		QWidget(parent),
		ui(new Ui::SampleParams)
{
	ui->setupUi(this);
	mySample = sample;
	connect(mySample, SIGNAL(started()), SLOT(onSampleStarted()));
	connect(mySample, SIGNAL(stopped()), SLOT(onSampleStopped()));
	updateSampleInfo();
	connect(ui->volumeSlider, SIGNAL(sliderMoved(int)), mySample, SLOT(setVolume(int)));
	connect(ui->volumeSlider, SIGNAL(valueChanged(int)), mySample, SLOT(setVolume(int)));
	connect(ui->panDial, SIGNAL(sliderMoved(int)), mySample, SLOT(setPanning(int)));
	connect(ui->panDial, SIGNAL(valueChanged(int)), mySample, SLOT(setPanning(int)));
	connect(ui->keyCombo, SIGNAL(currentIndexChanged(int)), SLOT(onKeyComboChanged(int)));
	connect(ui->noLoopRadio, SIGNAL(toggled(bool)), SLOT(onRadioChanged(bool)));
	connect(ui->simpleLoopRadio, SIGNAL(toggled(bool)), SLOT(onRadioChanged(bool)));
	connect(ui->autoLoopRadio, SIGNAL(toggled(bool)), SLOT(onRadioChanged(bool)));
	connect(ui->muteButton, SIGNAL(toggled(bool)), mySample, SLOT(setMute(bool)));
}
Esempio n. 29
0
void AVPlayer::stop()
{
    if (!isPlaying())
        return;
    qDebug("AVPlayer::stop");        
    //blockSignals(true); //TODO: move emit stopped() before it. or connect avthread.finished() to tryEmitStop() {if (!called_by_stop) emit}
    struct avthreads_t {
        AVThread *thread;
        const char *name;
    } threads[] = {
        { audio_thread, "audio thread" },
        { video_thread, "video thread" },
        { 0, 0 }
    };
    for (int i = 0; threads[i].name; ++i) {
        AVThread *thread = threads[i].thread;
        if (!thread)
            continue;
        if (thread->isRunning()) {
            qDebug("stopping %s...", threads[i].name);
            //avoid emit stopped multiple times. AVThread.stopped() connects to AVDemuxThread.stopped().
            thread->blockSignals(true);
            thread->stop();
            if (!thread->wait(1000)) {
                qWarning("Timeout waiting for %s stopped. Terminate it.", threads[i].name);
                thread->terminate();
            }
            thread->blockSignals(false);
        }
    }
    //stop demux thread after avthread is better. otherwise demux thread may be terminated when waiting for avthread ?
    if (demuxer_thread->isRunning()) {
        qDebug("stopping demux thread...");
        demuxer_thread->stop();
        //wait for finish then we can safely set the vars, e.g. a/v decoders
        if (!demuxer_thread->wait(1000)) {
            qWarning("Timeout waiting for demux thread stopped. Terminate it.");
            demuxer_thread->terminate(); //Terminate() causes the wait condition destroyed without waking up
        }
    }
    qDebug("all threads [a|v|d] stopped...");
    emit stopped();
}
Esempio n. 30
0
    void onStop ()
    {
#if RIPPLE_USE_VALIDATORS
        m_journal.info << "Validators stopping";
#endif

        m_logic.stop ();

        if (this->Thread::isThreadRunning())
        {
            m_journal.debug << "Signaling thread exit";
            m_queue.dispatch (m_context.wrap (bind (
                &Thread::signalThreadShouldExit, this)));
        }
        else
        {
            stopped();
        }
    }