Changeset View
Changeset View
Standalone View
Standalone View
src/card.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | void Card::update(const pa_card_info *info) | 35 | void Card::update(const pa_card_info *info) | ||
36 | { | 36 | { | ||
37 | updatePulseObject(info); | 37 | updatePulseObject(info); | ||
38 | 38 | | |||
39 | QString infoName = QString::fromUtf8(info->name); | 39 | QString infoName = QString::fromUtf8(info->name); | ||
40 | if (m_name != infoName) { | 40 | if (m_name != infoName) { | ||
41 | m_name = infoName; | 41 | m_name = infoName; | ||
42 | emit nameChanged(); | 42 | Q_EMIT nameChanged(); | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | qDeleteAll(m_profiles); | 45 | qDeleteAll(m_profiles); | ||
46 | m_profiles.clear(); | 46 | m_profiles.clear(); | ||
47 | for (auto **it = info->profiles2; it && *it != nullptr; ++it) { | 47 | for (auto **it = info->profiles2; it && *it != nullptr; ++it) { | ||
48 | Profile *profile = new Profile(this); | 48 | Profile *profile = new Profile(this); | ||
49 | profile->setInfo(*it); | 49 | profile->setInfo(*it); | ||
50 | m_profiles.append(profile); | 50 | m_profiles.append(profile); | ||
51 | if (info->active_profile2 == *it) { | 51 | if (info->active_profile2 == *it) { | ||
52 | m_activeProfileIndex = m_profiles.length() - 1; | 52 | m_activeProfileIndex = m_profiles.length() - 1; | ||
53 | } | 53 | } | ||
54 | } | 54 | } | ||
55 | emit profilesChanged(); | 55 | Q_EMIT profilesChanged(); | ||
56 | emit activeProfileIndexChanged(); | 56 | Q_EMIT activeProfileIndexChanged(); | ||
57 | 57 | | |||
58 | qDeleteAll(m_ports); | 58 | qDeleteAll(m_ports); | ||
59 | m_ports.clear(); | 59 | m_ports.clear(); | ||
60 | for (auto **it = info->ports; it && *it != nullptr; ++it) { | 60 | for (auto **it = info->ports; it && *it != nullptr; ++it) { | ||
61 | CardPort *port = new CardPort(this); | 61 | CardPort *port = new CardPort(this); | ||
62 | port->update(*it); | 62 | port->update(*it); | ||
63 | m_ports.append(port); | 63 | m_ports.append(port); | ||
64 | } | 64 | } | ||
65 | emit portsChanged(); | 65 | Q_EMIT portsChanged(); | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | QString Card::name() const | 68 | QString Card::name() const | ||
69 | { | 69 | { | ||
70 | return m_name; | 70 | return m_name; | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | QList<QObject *> Card::profiles() const | 73 | QList<QObject *> Card::profiles() const | ||
Show All 21 Lines |