Transport::Transport(Ui::CommAudioClass* gui, QWidget* parent) : QObject(parent), ui(gui), playingState(STOPPED) { connect(ui->playPushButton, SIGNAL(clicked()), this, SLOT(onPlayClicked())); connect(ui->stopPushButton, SIGNAL(clicked()), this, SLOT(onStopClicked())); connect(ui->previousPushButton, SIGNAL(clicked()), this, SLOT(onPreviousClicked())); connect(ui->nextPushButton, SIGNAL(clicked()), this, SLOT(onNextClicked())); connect(ui->shufflePushButton, SIGNAL(clicked()), this, SLOT(onShuffleClicked())); connect(ui->loopPushButton, SIGNAL(clicked()), this, SLOT(onLoopClicked())); connect(this, SIGNAL(songChanged()), parent, SLOT(changeDisplayedSong())); connect(this, SIGNAL(songStopped()), parent, SLOT(clearDisplayedSong())); QSettings settings; loop = !settings.value("loop", false).toBool(); onLoopClicked(); shuffle = !settings.value("shuffle", false).toBool(); onShuffleClicked(); }
AudioControls::AudioControls( QWidget* parent ) : QWidget( parent ) , ui( new Ui::AudioControls ) , m_repeatMode( PlaylistInterface::NoRepeat ) , m_shuffled( false ) { ui->setupUi( this ); ui->buttonAreaLayout->setSpacing( 2 ); QFont font( ui->artistTrackLabel->font() ); font.setPixelSize( 12 ); #ifdef Q_WS_MAC font.setPointSize( font.pointSize() - 2 ); #endif ui->artistTrackLabel->setFont( font ); ui->artistTrackLabel->setElideMode( Qt::ElideMiddle ); ui->artistTrackLabel->setType( QueryLabel::ArtistAndTrack ); ui->albumLabel->setFont( font ); ui->albumLabel->setType( QueryLabel::Album ); ui->timeLabel->setFont( font ); ui->timeLeftLabel->setFont( font ); font.setPixelSize( 9 ); ui->ownerLabel->setFont( font ); ui->prevButton->setPixmap( RESPATH "images/back-rest.png" ); ui->prevButton->setPixmap( RESPATH "images/back-pressed.png", QIcon::Off, QIcon::Active ); ui->playPauseButton->setPixmap( RESPATH "images/play-rest.png" ); ui->playPauseButton->setPixmap( RESPATH "images/play-pressed.png", QIcon::Off, QIcon::Active ); ui->pauseButton->setPixmap( RESPATH "images/pause-rest.png" ); ui->pauseButton->setPixmap( RESPATH "images/pause-pressed.png", QIcon::Off, QIcon::Active ); ui->nextButton->setPixmap( RESPATH "images/skip-rest.png" ); ui->nextButton->setPixmap( RESPATH "images/skip-pressed.png", QIcon::Off, QIcon::Active ); ui->shuffleButton->setPixmap( RESPATH "images/shuffle-off-rest.png" ); ui->shuffleButton->setPixmap( RESPATH "images/shuffle-off-pressed.png", QIcon::Off, QIcon::Active ); ui->repeatButton->setPixmap( RESPATH "images/repeat-off-rest.png" ); ui->repeatButton->setPixmap( RESPATH "images/repeat-off-pressed.png", QIcon::Off, QIcon::Active ); ui->volumeLowButton->setPixmap( RESPATH "images/volume-icon-muted.png" ); ui->volumeHighButton->setPixmap( RESPATH "images/volume-icon-full.png" ); ui->ownerLabel->setForegroundRole( QPalette::Dark ); ui->metaDataArea->setStyleSheet( "QWidget#metaDataArea {\nborder-width: 4px;\nborder-image: url(" RESPATH "images/now-playing-panel.png) 4 4 4 4 stretch stretch; }" ); ui->seekSlider->setFixedHeight( 20 ); ui->seekSlider->setEnabled( false ); ui->seekSlider->setStyleSheet( "QSlider::groove::horizontal {" "margin: 5px; border-width: 3px;" "border-image: url(" RESPATH "images/seek-slider-bkg.png) 3 3 3 3 stretch stretch;" "}" "QSlider::handle::horizontal {" "margin-left: 5px; margin-right: -5px; " "width: 0px;" //"margin-bottom: -7px; margin-top: -7px;" //"height: 17px; width: 16px;" //"background-image: url(" RESPATH "images/seek-and-volume-knob-rest.png);" //"background-repeat: no-repeat;" "}" "QSlider::sub-page:horizontal {" "margin: 5px; border-width: 3px;" "border-image: url(" RESPATH "images/seek-slider-level.png) 3 3 3 3 stretch stretch;" "}" ); ui->volumeSlider->setFixedHeight( 20 ); ui->volumeSlider->setRange( 0, 100 ); ui->volumeSlider->setValue( AudioEngine::instance()->volume() ); ui->volumeSlider->setStyleSheet( "QSlider::groove::horizontal {" "margin: 5px; border-width: 3px;" "border-image: url(" RESPATH "images/volume-slider-bkg.png) 3 3 3 3 stretch stretch;" "}" "QSlider::sub-page:horizontal {" "margin: 5px; border-width: 3px;" "border-image: url(" RESPATH "images/seek-slider-level.png) 3 3 3 3 stretch stretch;" "}" "QSlider::handle::horizontal {" "margin-bottom: -7px; margin-top: -7px;" "height: 17px; width: 16px;" "background-image: url(" RESPATH "images/seek-and-volume-knob-rest.png);" "background-repeat: no-repeat;" "}" ); /* m_playAction = new QAction( this ); m_pauseAction = new QAction( this ); m_prevAction = new QAction( this ); m_nextAction = new QAction( this ); connect( m_playAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( play() ) ); connect( m_pauseAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( pause() ) ); connect( m_prevAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( previous() ) ); connect( m_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); */ connect( ui->volumeSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( setVolume( int ) ) ); connect( ui->prevButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( previous() ) ); connect( ui->playPauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( play() ) ); connect( ui->pauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( pause() ) ); connect( ui->nextButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( next() ) ); connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) ); connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) ); connect( ui->playPauseButton, SIGNAL( clicked() ), this, SIGNAL( playPressed() ) ); connect( ui->pauseButton, SIGNAL( clicked() ), this, SIGNAL( pausePressed() ) ); connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) ); connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) ); connect( ui->artistTrackLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) ); connect( ui->artistTrackLabel, SIGNAL( clickedTrack() ), SLOT( onTrackClicked() ) ); connect( ui->albumLabel, SIGNAL( clickedAlbum() ), SLOT( onAlbumClicked() ) ); // <From AudioEngine> connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackLoading( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) ); connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onPlaybackResumed() ) ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ) ); connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( onPlaybackTimer( unsigned int ) ) ); connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) ); m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" ) .scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); connect( TomahawkApp::instance()->infoSystem(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomDataHash ) ), SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomDataHash ) ) ); connect( TomahawkApp::instance()->infoSystem(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); onPlaybackStopped(); // initial state }