void PlayableItemWidget::onRadioChanged( const RadioStation& station ) { if ( station == m_rs ) { // This is the current radio station if ( !station.title().isEmpty() ) setText( station.title() ); } else { // this is not the current radio station } }
void PlaybackControlsWidget::onTuningIn( const RadioStation& station ) { setScrobbleTrack( false ); ui->status->setText( tr("Tuning...") ); ui->device->setText( station.title() ); ui->play->setChecked( true ); aApp->playAction()->setChecked( true ); if ( !m_movie ) { m_movie = new QMovie( ":/loading_radio.gif", "GIF", this ); m_movie->setCacheMode( QMovie::CacheAll ); } ui->icon->setMovie( m_movie ); m_movie->start(); ui->progressBar->setTrack( Track() ); aApp->playAction()->setEnabled( true ); aApp->loveAction()->setEnabled( false ); aApp->banAction()->setEnabled( false ); aApp->skipAction()->setEnabled( false ); aApp->tagAction()->setEnabled( false ); aApp->shareAction()->setEnabled( false ); ui->controls->show(); }
void PlaybackControlsWidget::setIconForRadio( const RadioStation& station ) { QString url = station.url(); if ( url.startsWith("lastfm://user") ) { if ( url.contains( "/friends" ) || url.contains( "/neighbours" ) || url.startsWith( "lastfm://users") ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_friends.png" ) ); if ( url.contains( "/library" ) || url.contains( "/personal") ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_library.png" ) ); else if ( url.contains( "/mix" ) ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_mix.png" ) ); else if ( url.contains( "/recommended" ) ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_rec.png" ) ); } else if ( url.startsWith("lastfm://artist") ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_artist.png" ) ); else if ( url.startsWith("lastfm://tag") || url.startsWith( "lastfm://globaltags" ) ) ui->icon->setPixmap( QPixmap( ":/control_bar_radio_tag.png" ) ); else ui->icon->setPixmap( QPixmap( ":/control_bar_radio_library.png" ) ); }
RadioStation PlayableItemWidget::getMultiStation() const { QList<User> users; int endPos = m_rs.url().indexOf( "/", 14 ); if ( endPos == -1 ) endPos = m_rs.url().length(); users << User( m_rs.url().mid( 14, endPos - 14 ) ); users << User(); RadioStation station = RadioStation::library( users ); station.setTitle( tr( "Multi-Library Radio" ) ); return station; }
void RadioTuner::retune( const RadioStation& station ) { d->m_playlist.clear(); d->m_retuneStation = station; qDebug() << station.url(); }
Tuner::Tuner( const RadioStation& station ) : m_retry_counter( 0 ) { WsReply* reply = WsRequestBuilder( "radio.tune" ) .add( "station", station.url() ) .post(); connect( reply, SIGNAL(finished( WsReply* )), SLOT(onTuneReturn( WsReply* )) ); }
RadioTuner::RadioTuner( const RadioStation& station ) : m_retry_counter( 0 ) { QMap<QString, QString> map; map["method"] = "radio.tune"; map["station"] = station.url(); QNetworkReply* reply = ws::post(map); connect( reply, SIGNAL(finished()), SLOT(onTuneReturn()) ); }
RadioTuner::RadioTuner( const RadioStation& station ) :d( new RadioTunerPrivate( this, station ) ) { qDebug() << station.url(); //Empty RadioStation implies that the radio //should tune to the previous station. if( station.url().isEmpty() ) { d->fetchFiveMoreTracks(); } else { QMap<QString, QString> map; map["method"] = "radio.tune"; map["station"] = station.url(); map["additional_info"] = "1"; connect( ws::post(map), SIGNAL(finished()), SLOT(onTuneReturn()) ); } }
RadioStation helper( RadioStation s, const QString& title ) { s.setTitle( title ); return s; }