PlayerControl::PlayerControl(Player *player, PlayerHistory *history) : progress_(new Phonon::SeekSlider(player->media())), progress_text_(new QLabel), play_pause_(new QPushButton), next_(new QPushButton(tr("Next"))), previous_(new QPushButton(tr("Previous"))), stop_(new QPushButton(tr("Stop"))), volume_(new Phonon::VolumeSlider(player->audio())) { QVBoxLayout* vLayout = new QVBoxLayout; setLayout(vLayout); QHBoxLayout* hLayout1 = new QHBoxLayout; hLayout1->addWidget(previous_); hLayout1->addWidget(stop_); hLayout1->addWidget(play_pause_); hLayout1->addWidget(next_); hLayout1->addWidget(volume_); QHBoxLayout* hLayout2 = new QHBoxLayout; hLayout2->addWidget(progress_); hLayout2->addWidget(progress_text_); vLayout->addLayout(hLayout1); vLayout->addLayout(hLayout2); connect(next_, SIGNAL(clicked()), history, SLOT(Next())); connect(previous_, SIGNAL(clicked()), history, SLOT(Previous())); connect(play_pause_, SIGNAL(clicked()), player, SLOT(PlayPause())); connect(stop_, SIGNAL(clicked()), player, SLOT(Stop())); connect(player, SIGNAL(OnStatus(PlayerState)), this, SLOT(Status(PlayerState))); Status(PlayerState_Invalid); }
void TNotify::OnStatusFmt(const char *FmtStr, ...) { char Bf[10*1024]; va_list valist; va_start(valist, FmtStr); const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist); va_end(valist); if (RetVal!=-1) { OnStatus(TStr(Bf)); } }
bool HttpChannelChild::RecvOnStatus(const nsresult& status) { if (mEventQ.ShouldEnqueue()) { mEventQ.Enqueue(new StatusEvent(this, status)); } else { OnStatus(status); } return true; }
bool HttpChannelChild::RecvOnStatus(const nsresult& status, const nsString& statusArg) { if (ShouldEnqueue()) { EnqueueEvent(new StatusEvent(this, status, statusArg)); } else { OnStatus(status, statusArg); } return true; }
///////////////////////////////////////////////////////////////////// // Status Timer event handler ///////////////////////////////////////////////////////////////////// void MainWindow::OnTimer() { OnStatus(m_Status); if(++m_KeepAliveTimer>5) { m_KeepAliveTimer = 0; if( (CSdrInterface::RUNNING == m_Status) || ( CSdrInterface::CONNECTED == m_Status) ) m_pSdrInterface->KeepAlive(); } ui->frameMeter->SetdBmLevel( m_pSdrInterface->GetSMeterAve() ); if(DEMOD_WFM == m_DemodMode) //if in WFM mode manage stereo status display { bool update = false; if( m_FreqChanged ) { m_FreqChanged = false; m_RdsDecode.DecodeReset(m_USFm); ui->framePlot->m_RdsCall[0] = 0; ui->framePlot->m_RdsText[0] = 0; update = true; } else { tRDS_GROUPS RdsGroups; if( m_pSdrInterface->GetStereoLock(NULL) ) //if Stereo pilot state changed update = true; if( m_pSdrInterface->GetNextRdsGroupData(&RdsGroups) ) //if new data in RDS queue { if( 0 != RdsGroups.BlockA) { //if valid data in que then decode it m_RdsDecode.DecodeRdsGroup(&RdsGroups); if( m_RdsDecode.GetRdsString(ui->framePlot->m_RdsText) ) update = true; if( m_RdsDecode.GetRdsCallString(ui->framePlot->m_RdsCall) ) update = true; } else { //a zero data block means loss of signal so clear display and reset decoder m_RdsDecode.DecodeReset(m_USFm); ui->framePlot->m_RdsCall[0] = 0; ui->framePlot->m_RdsText[0] = 0; update = true; } } } if(update) ui->framePlot->UpdateOverlay(); } }
void Player::StatusChanged(Phonon::State newState, Phonon::State oldState) { LOG("Player") << "Status changed: " << oldState << " -> " << newState; if (newState == Phonon::ErrorState) LOG("Player") << "Error type: " << media_.errorType(); switch (newState) { case Phonon::PlayingState: OnStatus(PlayerState_Playing); break; case Phonon::PausedState: OnStatus(PlayerState_Paused); break; case Phonon::StoppedState: OnStatus(PlayerState_Stopped); break; case Phonon::LoadingState: case Phonon::BufferingState: break;//ignore intermediatary loading states for now default: OnStatus(PlayerState_Invalid); break; } }
get_next_ = callback; ResetCache(); if (init) { //Force filling out of the current item queue_end_++; Lookup(current_); } } //----------------------------------------------------------------------------- void PlayerHistory::SetPlayer(Player* player) { connect(this, SIGNAL(OnPlayFile(Media,bool)), player, SLOT(PlayFile(Media,bool))); connect(player, SIGNAL(OnStatus(PlayerState)), this, SLOT(Status(PlayerState))); connect(player, SIGNAL(OnSourceChanged()), this, SLOT(SourceChanged())); OnPlayFile(Lookup(current_),false);//force through the current item to the player } //----------------------------------------------------------------------------- void PlayerHistory::PlayFile(const Media& entry) { LOG("History") << "PlayFile"; if (entry == Lookup(current_)) { //There is a bit of a special case if the current item has been re-requested //Causes it to play if we are stopped but otherwise ignores it if (!current_played_) OnPlayFile(Lookup(current_), true);
//============================================================ // <T>响应服务器状态命令。</T> // // @param status 服务器的状态命令 // @return 处理结果 //============================================================ TResult FServer::DoStatus(TInt status){ MO_INFO("Server '%s' status event. (status=%d).", (TCharC*)_name, status); return OnStatus(status); }