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(); }
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(Track,Track)), SLOT(onTrackStarted(Track,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() ); }
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() ); }
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())); }
MainWindow::MainWindow(QWidget *widget, Qt::WFlags fl) : QMainWindow(widget, fl) , Ui::MainWindow() { setupUi(this); Ui_MainWindow::mainToolBar->setIconSize(QSize(35, 35)); connect(actionVolumeUp, SIGNAL(triggered()), this, SLOT(onVolumeUp())); connect(actionVolumeDown, SIGNAL(triggered()), this, SLOT(onVolumeDown())); connect(actionMute, SIGNAL(triggered()), this, SLOT(onMute())); connect(actionSkip, SIGNAL(triggered()), this, SLOT(onSkip())); connect(actionStop, SIGNAL(triggered()), this, SLOT(onStop())); connect(actionPlay, SIGNAL(triggered()), this, SLOT(onUnpause())); connect(actionPause, SIGNAL(triggered()), this, SLOT(onPause())); actionPlay->setVisible(false); connect(actionLogoutAndQuit, SIGNAL(triggered()), qApp, SLOT(logoutAndQuit())); connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(logout())); connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutSpotfm())); m_settingsDlg = new SettingsDialog(this); connect(actionSettings, SIGNAL(triggered()), m_settingsDlg, SLOT(show())); Radio *radio = SpotFm::app()->radio(); connect(radio, SIGNAL(trackStarted(Track)), this, SLOT(onTrackStarted(Track))); connect(radio, SIGNAL(skipsLeft(int)), this, SLOT(enableSkipButton(int))); connect(radio, SIGNAL(trackProgress(int)), this, SLOT(onTrackProgress(int))); connect(radio, SIGNAL(error(int, QString)), this, SLOT(onRadioError(int, QString))); connect(volumeSlider, SIGNAL(valueChanged(int)), radio, SLOT(setVolume(int))); connect(stationWidget, SIGNAL(clicked()), this, SLOT(onNewStation())); stationWidget->setFocus(); QSettings *s = SpotFm::app()->settings(); volumeSlider->setValue(s->value("volume", 80).toInt()); radio->setVolume(volumeSlider->value()); m_lastVolume = volumeSlider->value(); defaultWindow(); setupTrayIcon(); loadExtensions(); }
void ScrobbleService::onTrackStarted( const Track& track ) { onTrackStarted( track, m_currentTrack ); emit trackStarted( track, m_currentTrack ); }
NowPlayingWidget::NowPlayingWidget(QWidget *parent) :QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 ); layout->addWidget( ui.stack = new QStackedWidget( this ) ); ui.stack->addWidget( ui.spinner = new QLabel() ); ui.spinner->setObjectName( "spinner" ); ui.spinner->setAlignment( Qt::AlignCenter ); m_movie = new QMovie( ":/loading_meta.gif", "GIF", this ); m_movie->setCacheMode( QMovie::CacheAll ); ui.spinner->setMovie ( m_movie ); ui.metadata = 0; connect( &ScrobbleService::instance(), SIGNAL(trackStarted(lastfm::Track,lastfm::Track)), SLOT(onTrackStarted(lastfm::Track,lastfm::Track)) ); connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(onStopped()) ); }