Esempio n. 1
0
void Player::handleTransportChange()
{
  if (m_player)
  {
#define AVTRANSPORT_UNCHANGED           0
#define AVTRANSPORT_STATE_CHANGED       1
#define AVTRANSPORT_PLAYMODE_CHANGED    2
#define AVTRANSPORT_SLEEPTIMER_CHANGED  4
    unsigned signalMask = AVTRANSPORT_UNCHANGED;

    SONOS::AVTProperty prop = m_player->GetTransportProperty();

    setCurrentMeta(prop);
    emit sourceChanged();

    if (prop.TransportState != m_AVTProperty.TransportState)
      signalMask |= AVTRANSPORT_STATE_CHANGED;

    if (prop.CurrentPlayMode != m_AVTProperty.CurrentPlayMode)
      signalMask |= AVTRANSPORT_PLAYMODE_CHANGED;

    if (prop.r_SleepTimerGeneration != m_AVTProperty.r_SleepTimerGeneration)
      signalMask |= AVTRANSPORT_SLEEPTIMER_CHANGED;

    // Set property before emit
    m_AVTProperty = prop;
    if (signalMask & AVTRANSPORT_STATE_CHANGED)
      emit playbackStateChanged();
    if (signalMask & AVTRANSPORT_PLAYMODE_CHANGED)
      emit playModeChanged();
    if (signalMask & AVTRANSPORT_SLEEPTIMER_CHANGED)
      emit sleepTimerChanged();
  }
}
Esempio n. 2
0
/*
 * ---------------------------------------------------------
 * Setups
 * ---------------------------------------------------------
 */
void MainWindow::createWindow() {


    QWidget *w = new QWidget;
    setCentralWidget(w);

    _playBox = new PlayBox(this);

    _tracklist = new Tracklist(this);
    _playlist = new Playlist(_tracklist, this);
    _colourMapDisplay = new ColourMapDisplay(this);


    _display = new GridDisplay(600, _tracklist, _dataGrid, this);

    QGridLayout *gridLayout = new QGridLayout;
    //fromRow, fromCol, rowSpan, colSpan
    gridLayout->addWidget(	_display,			0, 0, 4, 1);

    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(new QLabel(tr("Playlists")));
    vbox->addWidget(_playlist);
    vbox->addWidget(new QLabel(tr("Track list")));
    vbox->addWidget(_tracklist);
    vbox->addWidget(_colourMapDisplay);
    gridLayout->addLayout(vbox,1,1,1,1);

    connect(_display, SIGNAL(playingTrack(MusicTrack*)),
            this, SLOT(updateCurrentlyPlaying(MusicTrack*)));

    connect(this, SIGNAL(libraryUpdated()), _playlist, SLOT(updatePlaylist()));
    connect(this, SIGNAL(libraryUpdated()), _display, SLOT(reload()));
    connect(this, SIGNAL(openPredictGridFile(QString)), _display, SLOT(openPredictionGrid(QString)));
    connect(this, SIGNAL(savePredictGridFile(QString)), _display, SLOT(savePredictionGrid(QString)));
    connect(this, SIGNAL(playModeChanged()), _display, SLOT(playModeChanged()));
    connect(this, SIGNAL(cancelButtonSignal()), _display, SLOT(cancelButton()));
    connect(_display, SIGNAL(fullScreenMode(bool)), this, SLOT(fullScreenMode(bool)));
    connect(this, SIGNAL(fullScreenModeOff()), _display, SLOT(fullScreenMouse()));
    connect(_playlist, SIGNAL(SelectedPlaylist(QString)), _display, SLOT(playlistSelected(QString)));
    connect(_display, SIGNAL(updateColourMap(int *, int)), _colourMapDisplay, SLOT(updateSquare(int *, int)));
    connect(this, SIGNAL(resetGrid()), _display, SLOT(resetGrid()));

    w->setLayout(gridLayout);
    statusBar()->showMessage(tr("Ready"));
}
Esempio n. 3
0
	void PlaylistWidget::SetPlayModeButton ()
	{
		auto playButton = new QToolButton;
		playButton->setIcon (Core::Instance ().GetProxy ()->
					GetIconThemeManager ()->GetIcon ("view-media-playlist"));
		playButton->setPopupMode (QToolButton::InstantPopup);
		QMenu *playMode = new QMenu (tr ("Play mode"));
		playButton->setMenu (playMode);

		const std::vector<std::pair<Player::PlayMode, QString>> modes =
		{
			{ Player::PlayMode::Sequential, tr ("Sequential") },
			{ Player::PlayMode::Shuffle, tr ("Shuffle") },
			{ Player::PlayMode::ShuffleAlbums, tr ("Shuffle albums") },
			{ Player::PlayMode::ShuffleArtists, tr ("Shuffle artists") },
			{ Player::PlayMode::RepeatTrack, tr ("Repeat track") },
			{ Player::PlayMode::RepeatAlbum, tr ("Repeat album") },
			{ Player::PlayMode::RepeatWhole, tr ("Repeat whole") }
		};
		PlayModesGroup_ = new QActionGroup (this);
		bool hadChecked = false;
		for (const auto& pair : modes)
		{
			QAction *action = new QAction (pair.second, this);
			action->setProperty ("PlayMode", static_cast<int> (pair.first));
			action->setCheckable (true);
			action->setChecked (hadChecked ? false : hadChecked = true);
			action->setActionGroup (PlayModesGroup_);
			playMode->addAction (action);

			connect (action,
					SIGNAL (triggered ()),
					this,
					SLOT (handleChangePlayMode ()));
		}
		connect (Player_,
				SIGNAL (playModeChanged (Player::PlayMode)),
				this,
				SLOT (handlePlayModeChanged (Player::PlayMode)));
		const int resumeMode = XmlSettingsManager::Instance ()
				.Property ("PlayMode", static_cast<int> (Player::PlayMode::Sequential)).toInt ();
		Player_->SetPlayMode (static_cast<Player::PlayMode> (resumeMode));

		PlaylistToolbar_->addWidget (playButton);
	}
Esempio n. 4
0
PlayerAdaptor::PlayerAdaptor (FDOPropsAdaptor *fdo, Player *player)
    : QDBusAbstractAdaptor (player)
    , Props_ (fdo)
    , Player_ (player)
{
    setAutoRelaySignals (true);

    connect (Player_,
             SIGNAL (songChanged (MediaInfo)),
             this,
             SLOT (handleSongChanged ()));
    connect (Player_,
             SIGNAL (playModeChanged (Player::PlayMode)),
             this,
             SLOT (handlePlayModeChanged ()));
    connect (Player_->GetSourceObject (),
             SIGNAL (stateChanged (Phonon::State, Phonon::State)),
             this,
             SLOT (handleStateChanged ()));
    connect (Player_->GetAudioOutput (),
             SIGNAL (volumeChanged (qreal)),
             this,
             SLOT (handleVolumeChanged ()));
}
Esempio n. 5
0
void MainWindow::changedPlayMode()
{
    emit playModeChanged();
}