cardwidget: Add a port class
The cardwidget should cache all the relevant data for the ports. This change introduces a new port class which holds the port info for the card.
This commit is contained in:
parent
abeb68dcf2
commit
1a23cdfe6d
|
@ -23,6 +23,16 @@
|
||||||
|
|
||||||
#include "pavucontrol.h"
|
#include "pavucontrol.h"
|
||||||
|
|
||||||
|
class PortInfo {
|
||||||
|
public:
|
||||||
|
Glib::ustring name;
|
||||||
|
Glib::ustring description;
|
||||||
|
uint32_t priority;
|
||||||
|
int available;
|
||||||
|
int direction;
|
||||||
|
int64_t latency_offset;
|
||||||
|
};
|
||||||
|
|
||||||
class CardWidget : public Gtk::VBox {
|
class CardWidget : public Gtk::VBox {
|
||||||
public:
|
public:
|
||||||
CardWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
|
CardWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
|
||||||
|
@ -36,6 +46,7 @@ public:
|
||||||
bool updating;
|
bool updating;
|
||||||
|
|
||||||
std::vector< std::pair<Glib::ustring,Glib::ustring> > profiles;
|
std::vector< std::pair<Glib::ustring,Glib::ustring> > profiles;
|
||||||
|
std::map<Glib::ustring, PortInfo> ports;
|
||||||
Glib::ustring activeProfile;
|
Glib::ustring activeProfile;
|
||||||
bool hasSinks;
|
bool hasSinks;
|
||||||
bool hasSources;
|
bool hasSources;
|
||||||
|
|
|
@ -290,6 +290,20 @@ void MainWindow::updateCard(const pa_card_info &info) {
|
||||||
|
|
||||||
w->activeProfile = info.active_profile ? info.active_profile->name : "";
|
w->activeProfile = info.active_profile ? info.active_profile->name : "";
|
||||||
|
|
||||||
|
w->ports.clear();
|
||||||
|
for (uint32_t i = 0; i < info.n_ports; ++i) {
|
||||||
|
PortInfo p;
|
||||||
|
|
||||||
|
p.name = info.ports[i]->name;
|
||||||
|
p.description = info.ports[i]->description;
|
||||||
|
p.priority = info.ports[i]->priority;
|
||||||
|
p.available = info.ports[i]->available;
|
||||||
|
p.direction = info.ports[i]->direction;
|
||||||
|
p.latency_offset = info.ports[i]->latency_offset;
|
||||||
|
|
||||||
|
w->ports[p.name] = p;
|
||||||
|
}
|
||||||
|
|
||||||
w->updating = false;
|
w->updating = false;
|
||||||
|
|
||||||
w->prepareMenu();
|
w->prepareMenu();
|
||||||
|
|
Loading…
Reference in New Issue