mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
service/pipewire: add registry and node ready properties
This commit is contained in:
parent
8b6aa624a2
commit
6d8022b709
8 changed files with 137 additions and 8 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qlist.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
|
@ -87,6 +88,16 @@ Pipewire::Pipewire(QObject* parent): QObject(parent) {
|
|||
this,
|
||||
&Pipewire::defaultConfiguredAudioSourceChanged
|
||||
);
|
||||
|
||||
if (!connection->registry.isInitialized()) {
|
||||
QObject::connect(
|
||||
&connection->registry,
|
||||
&PwRegistry::initialized,
|
||||
this,
|
||||
&Pipewire::readyChanged,
|
||||
Qt::SingleShotConnection
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectModel<PwNodeIface>* Pipewire::nodes() { return &this->mNodes; }
|
||||
|
|
@ -156,6 +167,8 @@ void Pipewire::setDefaultConfiguredAudioSource(PwNodeIface* node) {
|
|||
PwConnection::instance()->defaults.changeConfiguredSource(node ? node->node() : nullptr);
|
||||
}
|
||||
|
||||
bool Pipewire::isReady() { return PwConnection::instance()->registry.isInitialized(); }
|
||||
|
||||
PwNodeIface* PwNodeLinkTracker::node() const { return this->mNode; }
|
||||
|
||||
void PwNodeLinkTracker::setNode(PwNodeIface* node) {
|
||||
|
|
@ -298,6 +311,7 @@ void PwNodeAudioIface::setVolumes(const QVector<float>& volumes) {
|
|||
|
||||
PwNodeIface::PwNodeIface(PwNode* node): PwObjectIface(node), mNode(node) {
|
||||
QObject::connect(node, &PwNode::propertiesChanged, this, &PwNodeIface::propertiesChanged);
|
||||
QObject::connect(node, &PwNode::readyChanged, this, &PwNodeIface::readyChanged);
|
||||
|
||||
if (auto* audioBoundData = dynamic_cast<PwNodeBoundAudio*>(node->boundData)) {
|
||||
this->audioIface = new PwNodeAudioIface(audioBoundData, this);
|
||||
|
|
@ -318,6 +332,8 @@ bool PwNodeIface::isSink() const { return this->mNode->isSink; }
|
|||
|
||||
bool PwNodeIface::isStream() const { return this->mNode->isStream; }
|
||||
|
||||
bool PwNodeIface::isReady() const { return this->mNode->ready; }
|
||||
|
||||
QVariantMap PwNodeIface::properties() const {
|
||||
auto map = QVariantMap();
|
||||
for (auto [k, v]: this->mNode->properties.asKeyValueRange()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue