summaryrefslogtreecommitdiffstats
path: root/ServerInfo.hh
blob: bba87b3e7a667eade69ed40d148db20db2313415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef fooserverinfohhfoo
#define fooserverinfohhfoo

#include <gtkmm.h>
#include <map>

#include <polyp/polyplib.h>

class SinkInfo;
class SourceInfo;
class ServerInfo;
class ClientInfo;
class ModuleInfo;

#include "SinkWindow.hh"
#include "SourceWindow.hh"
#include "ClientWindow.hh"
#include "ModuleWindow.hh"
#include "MainWindow.hh"
 
class SinkInfo {
public:

    SinkInfo(const struct pa_sink_info &i);
    ~SinkInfo();
    
    void update(const struct pa_sink_info &i);
    void showWindow();
    
    Glib::ustring name, description;
    uint32_t index;
    struct pa_sample_spec sample_spec;
    uint32_t monitor_source;
    uint32_t owner_module;
    uint32_t volume;
    uint32_t latency;

    Gtk::TreeRowReference treeRef;

    SinkWindow *window;
};

class SourceInfo {
public:
    SourceInfo(const struct pa_source_info &i);
    ~SourceInfo();

    void update(const struct pa_source_info &i);
    void showWindow();
    
    Glib::ustring name, description;
    uint32_t index;
    struct pa_sample_spec sample_spec;
    uint32_t owner_module;
    uint32_t monitor_of_sink;

    Gtk::TreeRowReference treeRef;
    SourceWindow *window;
};

class ModuleInfo {
public:
    ModuleInfo(const struct pa_module_info &i);
    ~ModuleInfo();

    void update(const struct pa_module_info &i);
    void showWindow();
    
    uint32_t index;
    Glib::ustring name, argument;
    bool autoloaded;
    uint32_t used;

    Gtk::TreeRowReference treeRef;
    ModuleWindow *window;
};

class ClientInfo {
public:
    ClientInfo(const struct pa_client_info &i);
    ~ClientInfo();

    void update(const struct pa_client_info &i);
    void showWindow();
    
    uint32_t index;
    Glib::ustring name, protocol_name;
    uint32_t owner_module;

    Gtk::TreeRowReference treeRef;
    ClientWindow *window;
};

class ServerInfoManager {
public:
    ServerInfoManager(struct pa_context &c);
    ~ServerInfoManager();

    void updateInfo(const struct pa_sink_info &i);
    void updateInfo(const struct pa_source_info &i);
    void updateInfo(const struct pa_client_info &i);
    void updateInfo(const struct pa_module_info &i);

    void showSinkWindow(uint32_t index);
    void showSourceWindow(uint32_t index);
    void showClientWindow(uint32_t index);
    void showModuleWindow(uint32_t index);

    SourceInfo* getSourceInfo(uint32_t index);
    SinkInfo* getSinkInfo(uint32_t index);
    ClientInfo* getClientInfo(uint32_t index);
    ModuleInfo* getModuleInfo(uint32_t index);

    void removeSinkInfo(uint32_t index);
    void removeSourceInfo(uint32_t index);
    void removeClientInfo(uint32_t index);
    void removeModuleInfo(uint32_t index);
    
protected:
    std::map<int, SinkInfo*> sinks;
    std::map<int, SourceInfo*> sources;
    std::map<int, ClientInfo*> clients;
    std::map<int, ModuleInfo*> modules;

    struct pa_context &context;
};

#endif