Commit 7d98cf3d authored by Michael Pyne's avatar Michael Pyne
Browse files

clazy: Fix warnings about Qt property notify/constant decls.

parent 49577d61
......@@ -110,4 +110,3 @@ QStringList MediaPlayer2::SupportedMimeTypes() const
return mimeTable;
}
......@@ -29,18 +29,18 @@ class MediaPlayer2 : public QDBusAbstractAdaptor
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2") // Docs: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html
Q_PROPERTY(bool CanRaise READ CanRaise)
Q_PROPERTY(bool CanQuit READ CanQuit)
Q_PROPERTY(bool CanSetFullscreen READ CanSetFullscreen)
Q_PROPERTY(bool Fullscreen READ Fullscreen)
Q_PROPERTY(bool CanRaise READ CanRaise CONSTANT)
Q_PROPERTY(bool CanQuit READ CanQuit CONSTANT)
Q_PROPERTY(bool CanSetFullscreen READ CanSetFullscreen CONSTANT)
Q_PROPERTY(bool Fullscreen READ Fullscreen CONSTANT)
Q_PROPERTY(bool HasTrackList READ HasTrackList)
Q_PROPERTY(bool HasTrackList READ HasTrackList CONSTANT)
Q_PROPERTY(QString Identity READ Identity)
Q_PROPERTY(QString DesktopEntry READ DesktopEntry)
Q_PROPERTY(QString Identity READ Identity CONSTANT)
Q_PROPERTY(QString DesktopEntry READ DesktopEntry CONSTANT)
Q_PROPERTY(QStringList SupportedUriSchemes READ SupportedUriSchemes)
Q_PROPERTY(QStringList SupportedMimeTypes READ SupportedMimeTypes)
Q_PROPERTY(QStringList SupportedUriSchemes READ SupportedUriSchemes CONSTANT)
Q_PROPERTY(QStringList SupportedMimeTypes READ SupportedMimeTypes CONSTANT)
public:
explicit MediaPlayer2(QObject* parent);
......
......@@ -45,15 +45,33 @@ MediaPlayer2Player::MediaPlayer2Player(QObject* parent)
: QDBusAbstractAdaptor(parent)
, m_player(JuK::JuKInstance()->playerManager())
{
//FIXME: Workaround for GCC 4.8, remove .data() in 2019
connect(m_player.data(), &PlayerManager::signalItemChanged, this, &MediaPlayer2Player::currentSourceChanged);
connect(m_player.data(), &PlayerManager::signalPlay, this, &MediaPlayer2Player::stateUpdated);
connect(m_player.data(), &PlayerManager::signalPause, this, &MediaPlayer2Player::stateUpdated);
connect(m_player.data(), &PlayerManager::signalStop, this, &MediaPlayer2Player::stateUpdated);
connect(m_player.data(), &PlayerManager::totalTimeChanged, this, &MediaPlayer2Player::totalTimeChanged);
connect(m_player.data(), &PlayerManager::seekableChanged, this, &MediaPlayer2Player::seekableChanged);
connect(m_player.data(), &PlayerManager::volumeChanged, this, &MediaPlayer2Player::volumeChanged);
connect(m_player.data(), &PlayerManager::seeked, this, &MediaPlayer2Player::seeked);
// The duplication here permits Qt to fulfill its QML notify magic by
// forwarding the relevant signals from PlayerManager straight to our
// notification signals. Doing this from within our slots would force them
// to be non-const (if we keep clazy happy), though maybe that's
// preferable?
connect(m_player, &PlayerManager::signalItemChanged, this, &MediaPlayer2Player::currentSourceChanged);
connect(m_player, &PlayerManager::signalItemChanged, this, &MediaPlayer2Player::metadataChanged);
connect(m_player, &PlayerManager::signalPlay, this, &MediaPlayer2Player::stateUpdated);
connect(m_player, &PlayerManager::signalPause, this, &MediaPlayer2Player::stateUpdated);
connect(m_player, &PlayerManager::signalStop, this, &MediaPlayer2Player::stateUpdated);
connect(m_player, &PlayerManager::signalPlay, this, &MediaPlayer2Player::playbackStatusChanged);
connect(m_player, &PlayerManager::signalPause, this, &MediaPlayer2Player::playbackStatusChanged);
connect(m_player, &PlayerManager::signalStop, this, &MediaPlayer2Player::playbackStatusChanged);
connect(m_player, &PlayerManager::totalTimeChanged, this, &MediaPlayer2Player::totalTimeChanged);
connect(m_player, &PlayerManager::totalTimeChanged, this, &MediaPlayer2Player::metadataChanged);
connect(m_player, &PlayerManager::seekableChanged, this, &MediaPlayer2Player::seekableChanged);
connect(m_player, &PlayerManager::seekableChanged, this, &MediaPlayer2Player::canSeekChanged);
connect(m_player, &PlayerManager::volumeChanged, this, &MediaPlayer2Player::volumeChanged);
connect(m_player, &PlayerManager::volumeChanged, this, &MediaPlayer2Player::signalVolumeChanged);
connect(m_player, &PlayerManager::seeked, this, &MediaPlayer2Player::slotSeeked);
connect(m_player, &PlayerManager::seeked, this, &MediaPlayer2Player::Seeked);
}
MediaPlayer2Player::~MediaPlayer2Player()
......@@ -317,7 +335,7 @@ void MediaPlayer2Player::volumeChanged(float newVol) const
signalPropertiesChange(properties);
}
void MediaPlayer2Player::seeked(int newPos) const
void MediaPlayer2Player::slotSeeked(int newPos)
{
// casts int to uint64
emit Seeked(newPos);
......
......@@ -34,21 +34,25 @@ class MediaPlayer2Player : public QDBusAbstractAdaptor
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2.Player") // Docs: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus)
Q_PROPERTY(QString LoopStatus READ LoopStatus WRITE setLoopStatus)
Q_PROPERTY(double Rate READ Rate WRITE setRate)
Q_PROPERTY(bool Shuffle READ Shuffle WRITE setShuffle)
Q_PROPERTY(QVariantMap Metadata READ Metadata)
Q_PROPERTY(double Volume READ Volume WRITE setVolume)
Q_PROPERTY(qlonglong Position READ Position)
Q_PROPERTY(double MinimumRate READ MinimumRate)
Q_PROPERTY(double MaximumRate READ MaximumRate)
Q_PROPERTY(bool CanGoNext READ CanGoNext)
Q_PROPERTY(bool CanGoPrevious READ CanGoPrevious)
Q_PROPERTY(bool CanPlay READ CanPlay)
Q_PROPERTY(bool CanPause READ CanPause)
Q_PROPERTY(bool CanSeek READ CanSeek)
Q_PROPERTY(bool CanControl READ CanControl)
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus NOTIFY playbackStatusChanged)
Q_PROPERTY(QString LoopStatus READ LoopStatus CONSTANT)
// These NOTIFYs are a lie for now, we don't support changes, but MPRIS
// spec says this is a read/write property
Q_PROPERTY(double Rate READ Rate WRITE setRate NOTIFY metadataChanged)
Q_PROPERTY(bool Shuffle READ Shuffle WRITE setShuffle NOTIFY metadataChanged)
Q_PROPERTY(QVariantMap Metadata READ Metadata NOTIFY metadataChanged)
Q_PROPERTY(double Volume READ Volume WRITE setVolume NOTIFY signalVolumeChanged)
Q_PROPERTY(qlonglong Position READ Position NOTIFY Seeked)
Q_PROPERTY(double MinimumRate READ MinimumRate CONSTANT)
Q_PROPERTY(double MaximumRate READ MaximumRate CONSTANT)
Q_PROPERTY(bool CanGoNext READ CanGoNext CONSTANT)
Q_PROPERTY(bool CanGoPrevious READ CanGoPrevious CONSTANT)
Q_PROPERTY(bool CanPlay READ CanPlay CONSTANT)
Q_PROPERTY(bool CanPause READ CanPause CONSTANT)
Q_PROPERTY(bool CanSeek READ CanSeek NOTIFY canSeekChanged)
Q_PROPERTY(bool CanControl READ CanControl CONSTANT)
public:
explicit MediaPlayer2Player(QObject* parent);
......@@ -75,7 +79,11 @@ class MediaPlayer2Player : public QDBusAbstractAdaptor
bool CanControl() const;
signals:
void Seeked(qlonglong Position) const;
void Seeked(qlonglong Position);
void playbackStatusChanged();
void metadataChanged();
void signalVolumeChanged();
void canSeekChanged();
public slots:
Q_NOREPLY void Next() const;
......@@ -94,7 +102,7 @@ class MediaPlayer2Player : public QDBusAbstractAdaptor
void totalTimeChanged() const;
void seekableChanged(bool seekable) const;
void volumeChanged(float newVol) const;
void seeked(int newPos) const;
void slotSeeked(int newPos);
private:
void signalPropertiesChange(const QVariantMap& properties) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment