19 : IndexedPulseObject(parent)
20 , d(
new CardPrivate(
this))
22 connect(Context::instance(), &Context::sinkAdded,
this, &Card::sinksChanged);
23 connect(Context::instance(), &Context::sinkRemoved,
this, &Card::sinksChanged);
25 connect(Context::instance(), &Context::sourceAdded,
this, &Card::sourcesChanged);
26 connect(Context::instance(), &Context::sourceRemoved,
this, &Card::sourcesChanged);
34CardPrivate::CardPrivate(Card *q)
39CardPrivate::~CardPrivate()
43void CardPrivate::update(
const pa_card_info *info)
45 q->IndexedPulseObject::d->updatePulseObject(info);
46 q->PulseObject::d->updateProperties(info);
51 for (
const Profile *profile : std::as_const(m_profiles)) {
52 existingProfiles << profile->name();
55 for (
auto **it = info->profiles2; it && *it !=
nullptr; ++it) {
59 if (existingProfiles.
contains(name)) {
60 profile = m_profiles[existingProfiles.
indexOf(name)];
63 m_profiles << profile;
65 profile->d->setInfo(*it);
72 if (!newProfiles.
contains(profile->name())) {
78 for (
Profile *profile : std::as_const(m_profiles)) {
79 if (info->active_profile2->name == profile->name()) {
80 m_activeProfileIndex = m_profiles.indexOf(profile);
84 Q_EMIT q->profilesChanged();
85 Q_EMIT q->activeProfileIndexChanged();
90 for (
const Port *port : std::as_const(m_ports)) {
91 existingPorts << port->name();
93 for (
auto **it = info->ports; it && *it !=
nullptr; ++it) {
98 port = m_ports[existingPorts.
indexOf(name)];
103 port->d->setInfo(*it);
106 for (
CardPort *port : std::as_const(m_ports)) {
107 if (!newPorts.
contains(port->name())) {
108 m_ports.removeOne(port);
113 Q_EMIT q->portsChanged();
118 return d->m_profiles;
121quint32 Card::activeProfileIndex()
const
123 return d->m_activeProfileIndex;
126void Card::setActiveProfileIndex(quint32 profileIndex)
129 Context::instance()->setCardProfile(index(), profile->name());
141 const auto allSinks = Context::instance()->sinks();
142 for (
Sink *sink : allSinks) {
143 if (sink->cardIndex() == IndexedPulseObject::d->m_index) {
155 const auto allSources = Context::instance()->sources();
156 for (
Source *source : allSources) {
157 if (source->cardIndex() == IndexedPulseObject::d->m_index) {