mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-05-30 22:01:41 +00:00

1、删除项目中对libdframeworkdbus-dev库的依赖,通过使用xml2cpp的工具来自动生成dbus接口文件,在使用到dbus库的项目中包含生成文件的目录 2、修改相关服务中v20的接口(com.deepin...)为v23的接口(org.deepin...) Log: Influence: 打开控制中心,鼠标移动唤醒任务栏、加载插件等,观察相关功能是否正常 Task: https://pms.uniontech.com/task-view-182009.html Change-Id: I960c849d06ed271ebbb9f8e479d9879967523581
136 lines
2.6 KiB
C++
136 lines
2.6 KiB
C++
#ifndef VOLUMNMODEL_H
|
|
#define VOLUMNMODEL_H
|
|
|
|
#include "org_deepin_daemon_audio.h"
|
|
#include "org_deepin_daemon_audio_sink.h"
|
|
|
|
#include <QObject>
|
|
|
|
using DBusAudio = org::deepin::daemon::Audio1;
|
|
using DBusSink = org::deepin::daemon::audio1::Sink;
|
|
|
|
class QDBusMessage;
|
|
class AudioSink;
|
|
class AudioPorts;
|
|
|
|
class VolumeModel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit VolumeModel(QObject *parent);
|
|
~VolumeModel();
|
|
|
|
void setActivePort(AudioPorts *port);
|
|
|
|
QList<AudioSink *> sinks() const;
|
|
QList<AudioPorts *> ports() const;
|
|
|
|
AudioSink *defaultSink() const;
|
|
|
|
void setVolume(int volume);
|
|
void setMute(bool value);
|
|
|
|
int volume();
|
|
bool isMute();
|
|
bool existActiveOutputDevice();
|
|
|
|
Q_SIGNALS:
|
|
void defaultSinkChanged(AudioSink *);
|
|
void volumeChanged(int);
|
|
void muteChanged(bool);
|
|
void checkPortChanged();
|
|
|
|
private Q_SLOTS:
|
|
void onDefaultSinkChanged(const QDBusObjectPath & value);
|
|
|
|
private:
|
|
void reloadSinks();
|
|
void reloadPorts();
|
|
void clearSinks();
|
|
void clearPorts();
|
|
|
|
private:
|
|
QList<AudioSink *> m_sinks;
|
|
QList<AudioPorts *> m_ports;
|
|
|
|
DBusAudio *m_audio;
|
|
};
|
|
|
|
class AudioSink : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend class VolumeModel;
|
|
|
|
Q_SIGNALS:
|
|
void volumeChanged(int);
|
|
void muteChanged(bool);
|
|
|
|
public:
|
|
bool isDefault();
|
|
bool isHeadPhone();
|
|
|
|
void setBalance(double value, bool isPlay);
|
|
void setFade(double value);
|
|
void setMute(bool mute);
|
|
void setPort(QString name);
|
|
void setVolume(int value, bool isPlay);
|
|
|
|
bool isMute();
|
|
bool supportBalance();
|
|
bool suoportFade();
|
|
double balance();
|
|
double baseVolume();
|
|
double fade();
|
|
int volume();
|
|
QString description();
|
|
QString name();
|
|
uint cardId();
|
|
|
|
protected:
|
|
explicit AudioSink(QString path, bool isDefault, QObject *parent = nullptr);
|
|
~AudioSink();
|
|
void setDefault(bool isDefaultSink);
|
|
|
|
private:
|
|
QString m_devicePath;
|
|
DBusSink *m_sink;
|
|
bool m_isDefault;
|
|
};
|
|
|
|
class AudioPorts : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend class VolumeModel;
|
|
|
|
public:
|
|
uint cardId() const;
|
|
QString cardName() const;
|
|
QString name() const;
|
|
QString description() const;
|
|
int direction() const;
|
|
bool isChecked() const;
|
|
bool isHeadPhone() const;
|
|
|
|
protected:
|
|
AudioPorts(uint cardId, QString cardName);
|
|
~AudioPorts();
|
|
void setName(const QString &name);
|
|
void setDescription(const QString &desc);
|
|
void setDirection(int dir);
|
|
void setIsChecked(bool isChecked);
|
|
|
|
private:
|
|
uint m_cardId;
|
|
QString m_cardName;
|
|
QString m_portName;
|
|
QString m_description;
|
|
int m_direction;
|
|
bool m_isCheck;
|
|
bool m_isHeadPhone;
|
|
};
|
|
|
|
#endif // VOLUMNMODEL_H
|