mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
Update sound DBus Interface
Change-Id: I71e7db4876c11e5323a657e5fbf28fe5e43dad02
This commit is contained in:
parent
79aa6a17e2
commit
49c12eb451
Notes:
Deepin Code Review
2016-12-30 15:05:50 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+1: 石博文 <sbw@sbw.so> Verified+1: <zhaofangfang@linuxdeepin.com> Code-Review+2: Hualet Wang <mr.asianwang@gmail.com> Submitted-by: Hualet Wang <mr.asianwang@gmail.com> Submitted-at: Fri, 30 Dec 2016 15:05:49 +0800 Reviewed-on: https://cr.deepin.io/18619 Project: dde/dde-dock Branch: refs/heads/master
@ -41,7 +41,7 @@ class DBusAudio: public QDBusAbstractInterface
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,46 +56,26 @@ public:
|
||||
~DBusAudio();
|
||||
|
||||
Q_PROPERTY(QString Cards READ cards NOTIFY CardsChanged)
|
||||
inline QString cards() const
|
||||
inline QString cards()
|
||||
{ return qvariant_cast< QString >(property("Cards")); }
|
||||
|
||||
Q_PROPERTY(QString DefaultSink READ defaultSink NOTIFY DefaultSinkChanged)
|
||||
inline QString defaultSink() const
|
||||
{ return qvariant_cast< QString >(property("DefaultSink")); }
|
||||
Q_PROPERTY(QDBusObjectPath DefaultSink READ defaultSink NOTIFY DefaultSinkChanged)
|
||||
inline QDBusObjectPath defaultSink()
|
||||
{ return qvariant_cast< QDBusObjectPath >(property("DefaultSink")); }
|
||||
|
||||
Q_PROPERTY(QString DefaultSource READ defaultSource NOTIFY DefaultSourceChanged)
|
||||
inline QString defaultSource() const
|
||||
{ return qvariant_cast< QString >(property("DefaultSource")); }
|
||||
Q_PROPERTY(QDBusObjectPath DefaultSource READ defaultSource NOTIFY DefaultSourceChanged)
|
||||
inline QDBusObjectPath defaultSource()
|
||||
{ return qvariant_cast< QDBusObjectPath >(property("DefaultSource")); }
|
||||
|
||||
Q_PROPERTY(double MaxUIVolume READ maxUIVolume NOTIFY MaxUIVolumeChanged)
|
||||
inline double maxUIVolume() const
|
||||
inline double maxUIVolume()
|
||||
{ return qvariant_cast< double >(property("MaxUIVolume")); }
|
||||
|
||||
Q_PROPERTY(QList<QDBusObjectPath> SinkInputs READ sinkInputs NOTIFY SinkInputsChanged)
|
||||
inline QList<QDBusObjectPath> sinkInputs() const
|
||||
inline QList<QDBusObjectPath> sinkInputs()
|
||||
{ return qvariant_cast< QList<QDBusObjectPath> >(property("SinkInputs")); }
|
||||
|
||||
Q_PROPERTY(QList<QDBusObjectPath> Sinks READ sinks NOTIFY SinksChanged)
|
||||
inline QList<QDBusObjectPath> sinks() const
|
||||
{ return qvariant_cast< QList<QDBusObjectPath> >(property("Sinks")); }
|
||||
|
||||
Q_PROPERTY(QList<QDBusObjectPath> Sources READ sources NOTIFY SourcesChanged)
|
||||
inline QList<QDBusObjectPath> sources() const
|
||||
{ return qvariant_cast< QList<QDBusObjectPath> >(property("Sources")); }
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<QDBusObjectPath> GetDefaultSink()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetDefaultSink"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QDBusObjectPath> GetDefaultSource()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetDefaultSource"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Reset()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
@ -116,22 +96,20 @@ public Q_SLOTS: // METHODS
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetDefaultSource"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetProfile(uint in0, const QString &in1)
|
||||
inline QDBusPendingReply<> SetPort(uint in0, const QString &in1, int in2)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetProfile"), argumentList);
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1) << QVariant::fromValue(in2);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetPort"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
// begin property changed signals
|
||||
void CardsChanged();
|
||||
void DefaultSinkChanged();
|
||||
void DefaultSourceChanged();
|
||||
void MaxUIVolumeChanged();
|
||||
void SinkInputsChanged();
|
||||
void SinksChanged();
|
||||
void SourcesChanged();
|
||||
void CardsChanged() const;
|
||||
void DefaultSinkChanged() const;
|
||||
void DefaultSourceChanged() const;
|
||||
void MaxUIVolumeChanged() const;
|
||||
void SinkInputsChanged() const;
|
||||
};
|
||||
|
||||
namespace com {
|
||||
|
@ -41,7 +41,7 @@ class DBusSink: public QDBusAbstractInterface
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class DBusSinkInput: public QDBusAbstractInterface
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void SoundApplet::defaultSinkChanged()
|
||||
{
|
||||
delete m_defSinkInter;
|
||||
|
||||
const QDBusObjectPath defSinkPath = m_audioInter->GetDefaultSink();
|
||||
const QDBusObjectPath defSinkPath = m_audioInter->defaultSink();
|
||||
m_defSinkInter = new DBusSink(defSinkPath.path(), this);
|
||||
|
||||
connect(m_defSinkInter, &DBusSink::VolumeChanged, this, &SoundApplet::onVolumeChanged);
|
||||
|
Loading…
x
Reference in New Issue
Block a user