summaryrefslogtreecommitdiffstats
path: root/src/MainWindow.hh
blob: 681cd65baabdd26b4489e32e3727dc5eb54a3ecb (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#ifndef foomainwindowhhfoo
#define foomainwindowhhfoo

/* $Id$ */

/***
  This file is part of paman.
 
  paman is free software; you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.
 
  paman is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  General Public License for more details.
 
  You should have received a copy of the GNU Lesser General Public License
  along with paman; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  USA.
***/

#include <gtkmm.h>
#include <libglademm.h>
#include <polyp/polypaudio.h>

class MainWinow;

#include "ServerInfoManager.hh"

class MainWindow : public Gtk::Window {
public:
    MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
    virtual ~MainWindow();
    static MainWindow* create();

    Gtk::Label *statusLabel,
        *serverNameLabel,
        *serverVersionLabel,
        *defaultSampleTypeLabel,
        *userNameLabel,
        *hostNameLabel,
        *linkLibraryVersionLabel,
        *compiledLibraryVersionLabel,
        *titleLabel,
        *defaultSinkLabel,
        *defaultSourceLabel;

    Gtk::Button *deviceOpenButton,
        *clientOpenButton,
        *moduleOpenButton,
        *sampleOpenButton,
        *samplePlayButton,
        *connectButton,
        *disconnectButton,
        *statButton;

    Gtk::TreeView *deviceTreeView,
        *clientTreeView,
        *moduleTreeView,
        *sampleTreeView;

    Gtk::EventBox *titleEventBox;

    Gtk::ComboBox *sinkComboBox;

protected:

    class DeviceTreeModelColumns : public Gtk::TreeModel::ColumnRecord {
    public:
        
        DeviceTreeModelColumns() {
            add(name);
            add(description);
            add(index);
            add(type);
        }

        Gtk::TreeModelColumn<Glib::ustring> name;
        Gtk::TreeModelColumn<Glib::ustring> description;
        Gtk::TreeModelColumn<uint32_t> index;
        Gtk::TreeModelColumn<int> type;
    };

    DeviceTreeModelColumns deviceTreeModelColumns;
    Glib::RefPtr<Gtk::TreeStore> deviceTreeStore;
    Gtk::TreeRowReference sinkRef, sourceRef;

    class ClientTreeModelColumns : public Gtk::TreeModel::ColumnRecord {
    public:
        ClientTreeModelColumns() {
            add(name);
            add(index);
        }

        Gtk::TreeModelColumn<Glib::ustring> name;
        Gtk::TreeModelColumn<uint32_t> index;
    };
    
    ClientTreeModelColumns clientTreeModelColumns;
    Glib::RefPtr<Gtk::TreeStore> clientTreeStore;

    class ModuleTreeModelColumns : public Gtk::TreeModel::ColumnRecord {
    public:
        ModuleTreeModelColumns() {
            add(name);
            add(argument);
            add(index);
        }

        Gtk::TreeModelColumn<Glib::ustring> name;
        Gtk::TreeModelColumn<Glib::ustring> argument;
        Gtk::TreeModelColumn<uint32_t> index;
    };
    
    ModuleTreeModelColumns moduleTreeModelColumns;
    Glib::RefPtr<Gtk::TreeStore> moduleTreeStore;

    class SampleTreeModelColumns : public Gtk::TreeModel::ColumnRecord {
    public:
        SampleTreeModelColumns() {
            add(name);
            add(index);
        }

        Gtk::TreeModelColumn<Glib::ustring> name;
        Gtk::TreeModelColumn<uint32_t> index;
    };
    
    SampleTreeModelColumns sampleTreeModelColumns;
    Glib::RefPtr<Gtk::TreeStore> sampleTreeStore;

    class SinkTreeModelColumns  : public Gtk::TreeModel::ColumnRecord {
    public:
        SinkTreeModelColumns() {
            add(name);
            add(index);
        }

        Gtk::TreeModelColumn<Glib::ustring> name;
        Gtk::TreeModelColumn<uint32_t> index;
    };
    
    SinkTreeModelColumns sinkTreeModelColumns;
    Glib::RefPtr<Gtk::ListStore> sinkListStore;
    
public:
    virtual void updateInfo(const struct pa_server_info &i);
    virtual void updateInfo(SinkInfo &i);
    virtual void updateInfo(SourceInfo &i);
    virtual void updateInfo(ClientInfo &i);
    virtual void updateInfo(ModuleInfo &i);
    virtual void updateInfo(SinkInputInfo &i);
    virtual void updateInfo(SourceOutputInfo &i);
    virtual void updateInfo(SampleInfo &i);

    virtual void removeInfo(SinkInfo &i);
    virtual void removeInfo(SourceInfo &i);
    virtual void removeInfo(ClientInfo &i);
    virtual void removeInfo(ModuleInfo &i);
    virtual void removeInfo(SinkInputInfo &i);
    virtual void removeInfo(SourceOutputInfo &i);
    virtual void removeInfo(SampleInfo &i);
    
    virtual void onDeviceTreeViewCursorChanged();
    virtual void onDeviceTreeViewRowActivated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */);
    virtual void onClientTreeViewRowActivated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */);
    virtual void onModuleTreeViewRowActivated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */);
    virtual void onSampleTreeViewRowActivated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */);

    virtual void showSuccess(const char *t);
    virtual void showFailure(const char *t);
    virtual void clearAllData();

    virtual void onDeviceOpenButton();
    virtual void onClientOpenButton();
    virtual void onModuleOpenButton();
    virtual void onSampleOpenButton();
    virtual void onSamplePlayButton();
    virtual void onConnectButton();
    virtual void onDisconnectButton();
    virtual void onStatButton();

    virtual void showDeviceWindow(const Gtk::TreePath &p);
    virtual void showClientWindow(const Gtk::TreePath &p);
    virtual void showModuleWindow(const Gtk::TreePath &p);
    virtual void showSampleWindow(const Gtk::TreePath &p);
};

#endif