RadioWidget::RadioWidget(QWidget *parent) :QFrame( parent ), ui( new Ui::RadioWidget ) { ui->setupUi( this ); ui->lastStationLabel->setObjectName( "title" ); ui->personalLabel->setObjectName( "title" ); ui->networkLabel->setObjectName( "title" ); ui->recentLabel->setObjectName( "title" ); ui->splitter->setObjectName( "splitter" ); ui->splitter_2->setObjectName( "splitter" ); ui->splitter_3->setObjectName( "splitter" ); ui->splitter_4->setObjectName( "splitter" ); connect( ui->subscribe, SIGNAL(clicked()), SLOT(onSubscribeClicked()) ); connect( ui->listen, SIGNAL(clicked()), SLOT(onListenClicked()) ); // need to know when we are playing the radio so we can switch between now playing and last playing connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onTuningIn(RadioStation) ) ); connect( &RadioService::instance(), SIGNAL(stopped()), SLOT(onRadioStopped())); connect( &ScrobbleService::instance(), SIGNAL(trackStarted(Track,Track)), SLOT(onTrackStarted(Track,Track)) ); connect( aApp, SIGNAL(sessionChanged(unicorn::Session)), SLOT(onSessionChanged(unicorn::Session) ) ); m_movie = new QMovie( ":/loading_meta.gif", "GIF", this ); m_movie->setCacheMode( QMovie::CacheAll ); ui->spinner->setMovie( m_movie ); refresh( aApp->currentSession() ); }
NowPlayingStackedWidget::NowPlayingStackedWidget( QWidget* parent ) :unicorn::SlidingStackedWidget( parent ) { addWidget( ui.nothingPlaying = new NothingPlayingWidget( this ) ); addWidget( ui.nowPlaying = new NowPlayingWidget( this ) ); connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(showNowPlaying()) ); connect( &ScrobbleService::instance(), SIGNAL(trackStarted(Track,Track)), SLOT(showNowPlaying())); connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(showNothingPlaying())); }
NowPlayingWidget::NowPlayingWidget(QWidget *parent) :QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); layout->addWidget( ui.playbackControls = new PlaybackControlsWidget( this ) ); layout->addStretch( 1 ); connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onTuningIn(RadioStation)) ); connect( &ScrobbleService::instance(), SIGNAL(trackStarted(Track,Track)), SLOT(onTrackStarted(Track,Track)) ); connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(onStopped()) ); }
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())); }
PlayableItemWidget::PlayableItemWidget( const RadioStation& rs, const QString& title, const QString& description, QWidget* parent ) : QPushButton( parent ), m_rs(rs), m_description( description ), m_hovered( false ), m_style( DescriptionBottom ) { setStation( rs, title, description ); setAttribute( Qt::WA_LayoutUsesWidgetRect ); setAttribute( Qt::WA_Hover ); setAttribute( Qt::WA_MacNoClickThrough ); setCursor( Qt::PointingHandCursor ); connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onRadioChanged(RadioStation)) ); connect( &RadioService::instance(), SIGNAL(trackSpooled(Track)), SLOT(onRadioChanged())); }
void PlayableItemWidget::setStation(const RadioStation& rs, const QString& title, const QString& description) { // disconnect from recieving any previous signals disconnect( this, 0 ); m_rs = rs; m_rs.setTitle( title ); setText( title.isEmpty() ? tr( "A Radio Station" ) : title ); setToolTip( tr( "Play %1" ).arg( text() ) ); m_description = description; connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onRadioChanged(RadioStation)) ); connect( &RadioService::instance(), SIGNAL(trackSpooled(Track)), SLOT(onRadioChanged())); connect( this, SIGNAL(clicked()), SLOT(play())); update(); }