summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2009-03-16 19:57:31 +0000
committerColin Guthrie <cguthrie@mandriva.org>2009-06-17 08:54:10 +0100
commit7b7a12f1d2e6e02b11b7649b394d2122eec57813 (patch)
treec38d0ec7b57c096d1be5e5010ad9ae7fb54b3a3a
parente509205be255da3779377f12858598755581691b (diff)
Adapt to new UI
The actual wiring up of events and clearing out of old, unused elements is not complete yet, so this is completely non-functional at present.
-rw-r--r--src/cardwidget.h1
-rw-r--r--src/channelwidget.cc6
-rw-r--r--src/channelwidget.h4
-rw-r--r--src/devicewidget.cc3
-rw-r--r--src/mainwindow.cc53
-rw-r--r--src/mainwindow.h19
-rw-r--r--src/minimalstreamwidget.cc15
-rw-r--r--src/minimalstreamwidget.h9
-rw-r--r--src/pavucontrol.glade4
-rw-r--r--src/rolewidget.cc5
-rw-r--r--src/rolewidget.h1
-rw-r--r--src/sinkinputwidget.cc5
-rw-r--r--src/sinkinputwidget.h1
-rw-r--r--src/sourceoutputwidget.cc7
-rw-r--r--src/sourceoutputwidget.h5
-rw-r--r--src/streamwidget.cc10
-rw-r--r--src/streamwidget.h7
17 files changed, 129 insertions, 26 deletions
diff --git a/src/cardwidget.h b/src/cardwidget.h
index 1f99b2b..ca90273 100644
--- a/src/cardwidget.h
+++ b/src/cardwidget.h
@@ -29,7 +29,6 @@ public:
static CardWidget* create();
Gtk::Label *nameLabel;
- Gtk::ToggleButton *streamToggleButton;
Gtk::Menu menu;
Gtk::Image *iconImage;
Glib::ustring name;
diff --git a/src/channelwidget.cc b/src/channelwidget.cc
index eac41ad..7914f6b 100644
--- a/src/channelwidget.cc
+++ b/src/channelwidget.cc
@@ -23,7 +23,7 @@
#endif
#include "channelwidget.h"
-#include "streamwidget.h"
+#include "minimalstreamwidget.h"
#include "i18n.h"
@@ -83,11 +83,11 @@ void ChannelWidget::onVolumeScaleValueChanged() {
if (!volumeScaleEnabled)
return;
- if (streamWidget->updating)
+ if (minimalStreamWidget->updating)
return;
pa_volume_t volume = (pa_volume_t) ((volumeScale->get_value() * PA_VOLUME_NORM) / 100);
- streamWidget->updateChannelVolume(channel, volume);
+ minimalStreamWidget->updateChannelVolume(channel, volume);
if (beepDevice != "") {
ca_context_change_device(ca_gtk_context_get(), beepDevice.c_str());
diff --git a/src/channelwidget.h b/src/channelwidget.h
index 1de22d0..af823dc 100644
--- a/src/channelwidget.h
+++ b/src/channelwidget.h
@@ -25,7 +25,7 @@
#include <canberra-gtk.h>
-class StreamWidget;
+class MinimalStreamWidget;
class ChannelWidget : public Gtk::EventBox {
public:
@@ -39,7 +39,7 @@ public:
Gtk::HScale *volumeScale;
int channel;
- StreamWidget *streamWidget;
+ MinimalStreamWidget *minimalStreamWidget;
void onVolumeScaleValueChanged();
diff --git a/src/devicewidget.cc b/src/devicewidget.cc
index 8d7ade2..a235baf 100644
--- a/src/devicewidget.cc
+++ b/src/devicewidget.cc
@@ -19,6 +19,7 @@
***/
#include "devicewidget.h"
+#include "channelwidget.h"
/*** DeviceWidget ***/
DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
@@ -41,7 +42,7 @@ void DeviceWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
cw->beepDevice = beepDevice;
cw->channel = i;
cw->can_decibel = can_decibel;
- cw->streamWidget = this;
+ cw->minimalStreamWidget = this;
char text[64];
snprintf(text, sizeof(text), "<b>%s</b>", pa_channel_position_to_pretty_string(m.map[i]));
cw->channelLabel->set_markup(text);
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 4b56b61..1dcabb4 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -86,6 +86,9 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
sourceOutputTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceOutputTypeComboBoxChanged));
sinkTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSinkTypeComboBoxChanged));
sourceTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceTypeComboBoxChanged));
+
+ sinkTree = Gtk::ListStore::create(deviceColumns);
+ sourceTree = Gtk::ListStore::create(deviceColumns);
}
MainWindow* MainWindow::create() {
@@ -176,6 +179,29 @@ void MainWindow::updateCard(const pa_card_info &info) {
updateDeviceVisibility();
}
+void MainWindow::rebuildSinkCombo() {
+ //int active_idx = -1;
+ Gtk::TreeModel::Row row;
+
+ // Update our sinkTree
+ sinkTree->clear();
+ row = *(sinkTree->append());
+ row[deviceColumns.index] = -1;
+ row[deviceColumns.name] = "Default Output";
+
+ for (std::map<uint32_t, SinkWidget*>::iterator i = sinkWidgets.begin(); i != sinkWidgets.end(); ++i) {
+ Gtk::TreeModel::Row row = *(sinkTree->append());
+ row[deviceColumns.index] = i->first;
+ row[deviceColumns.name] = i->second->description.c_str();
+ /*if (i->first == activeProfile)
+ active_idx = idx;
+ idx++;*/
+ }
+
+ /*if (active_idx >= 0)
+ sinkTree->set_active(active_idx);*/
+}
+
void MainWindow::updateSink(const pa_sink_info &info) {
SinkWidget *w;
bool is_new = false;
@@ -218,6 +244,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->updating = false;
+ rebuildSinkCombo();
if (is_new)
updateDeviceVisibility();
}
@@ -323,6 +350,29 @@ void MainWindow::createMonitorStreamForSinkInput(uint32_t sink_input_idx, uint32
}
}
+void MainWindow::rebuildSourceCombo() {
+ //int active_idx = -1;
+ Gtk::TreeModel::Row row;
+
+ // Update our sinkTree
+ sourceTree->clear();
+ row = *(sourceTree->append());
+ row[deviceColumns.index] = -1;
+ row[deviceColumns.name] = "Default Input";
+
+ for (std::map<uint32_t, SourceWidget*>::iterator i = sourceWidgets.begin(); i != sourceWidgets.end(); ++i) {
+ Gtk::TreeModel::Row row = *(sourceTree->append());
+ row[deviceColumns.index] = i->first;
+ row[deviceColumns.name] = i->second->description.c_str();
+ /*if (i->first == activeProfile)
+ active_idx = idx;
+ idx++;*/
+ }
+
+ /*if (active_idx >= 0)
+ sourceTree->set_active(active_idx);*/
+}
+
void MainWindow::updateSource(const pa_source_info &info) {
SourceWidget *w;
bool is_new = false;
@@ -366,6 +416,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->updating = false;
+ rebuildSourceCombo();
if (is_new)
updateDeviceVisibility();
}
@@ -784,6 +835,7 @@ void MainWindow::removeSink(uint32_t index) {
delete sinkWidgets[index];
sinkWidgets.erase(index);
+ rebuildSinkCombo();
updateDeviceVisibility();
}
@@ -793,6 +845,7 @@ void MainWindow::removeSource(uint32_t index) {
delete sourceWidgets[index];
sourceWidgets.erase(index);
+ rebuildSourceCombo();
updateDeviceVisibility();
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index a9f0f64..50a5956 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -91,8 +91,27 @@ public:
Glib::ustring defaultSinkName, defaultSourceName;
+ class DeviceColumns : public Gtk::TreeModel::ColumnRecord
+ {
+ public:
+
+ DeviceColumns()
+ { add(index); add(name); }
+
+ Gtk::TreeModelColumn<uint32_t> index;
+ Gtk::TreeModelColumn<Glib::ustring> name;
+ };
+
+ DeviceColumns deviceColumns;
+ Glib::RefPtr<Gtk::ListStore> sinkTree;
+ Glib::RefPtr<Gtk::ListStore> sourceTree;
+
protected:
virtual void on_realize();
+
+private:
+ void rebuildSinkCombo();
+ void rebuildSourceCombo();
};
diff --git a/src/minimalstreamwidget.cc b/src/minimalstreamwidget.cc
index 1044d7a..b38bb47 100644
--- a/src/minimalstreamwidget.cc
+++ b/src/minimalstreamwidget.cc
@@ -35,15 +35,12 @@ MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject, const Glib::Re
x->get_widget("channelsVBox", channelsVBox);
x->get_widget("nameLabel", nameLabel);
x->get_widget("boldNameLabel", boldNameLabel);
- x->get_widget("streamToggle", streamToggleButton);
x->get_widget("iconImage", iconImage);
peakProgressBar.set_size_request(-1, 10);
channelsVBox->pack_end(peakProgressBar, false, false);
- streamToggleButton->set_active(false);
- streamToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &MinimalStreamWidget::onStreamToggleButton));
- menu.signal_deactivate().connect(sigc::mem_fun(*this, &MinimalStreamWidget::onMenuDeactivated));
+ //menu.signal_deactivate().connect(sigc::mem_fun(*this, &MinimalStreamWidget::onMenuDeactivated));
peakProgressBar.hide();
}
@@ -52,30 +49,34 @@ void MinimalStreamWidget::prepareMenu(void) {
}
void MinimalStreamWidget::onMenuDeactivated(void) {
- streamToggleButton->set_active(false);
+ //streamToggleButton->set_active(false);
}
void MinimalStreamWidget::popupMenuPosition(int& x, int& y, bool& push_in G_GNUC_UNUSED) {
+/*
Gtk::Requisition r;
streamToggleButton->get_window()->get_origin(x, y);
r = menu.size_request();
- /* Align the right side of the menu with the right side of the togglebutton */
+ // Align the right side of the menu with the right side of the togglebutton
x += streamToggleButton->get_allocation().get_x();
x += streamToggleButton->get_allocation().get_width();
x -= r.width;
- /* Align the top of the menu with the buttom of the togglebutton */
+ // Align the top of the menu with the buttom of the togglebutton
y += streamToggleButton->get_allocation().get_y();
y += streamToggleButton->get_allocation().get_height();
+*/
}
void MinimalStreamWidget::onStreamToggleButton(void) {
+/*
if (streamToggleButton->get_active()) {
prepareMenu();
menu.popup(sigc::mem_fun(*this, &MinimalStreamWidget::popupMenuPosition), 0, gtk_get_current_event_time());
}
+*/
}
bool MinimalStreamWidget::on_button_press_event (GdkEventButton* event) {
diff --git a/src/minimalstreamwidget.h b/src/minimalstreamwidget.h
index af5c9b5..0fcae59 100644
--- a/src/minimalstreamwidget.h
+++ b/src/minimalstreamwidget.h
@@ -29,7 +29,6 @@ public:
Gtk::VBox *channelsVBox;
Gtk::Label *nameLabel, *boldNameLabel;
- Gtk::ToggleButton *streamToggleButton;
Gtk::Menu menu;
Gtk::Image *iconImage;
Gtk::ProgressBar peakProgressBar;
@@ -37,10 +36,12 @@ public:
bool updating;
- void onStreamToggleButton();
- void onMenuDeactivated();
- void popupMenuPosition(int& x, int& y, bool& push_in);
+ /**/void onStreamToggleButton();
+ /**/void onMenuDeactivated();
+ /**/void popupMenuPosition(int& x, int& y, bool& push_in);
+ virtual void onMuteToggleButton() = 0;
+ virtual void updateChannelVolume(int channel, pa_volume_t v) = 0;
virtual void prepareMenu(void);
bool volumeMeterEnabled;
diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade
index 05c98cf..657ab3f 100644
--- a/src/pavucontrol.glade
+++ b/src/pavucontrol.glade
@@ -613,13 +613,13 @@ Monitors</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <widget class="GtkHBox" id="streamControlHBox">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="directionLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;i&gt;Playing on &lt;/i&gt;</property>
+ <property name="label" translatable="yes">direction</property>
<property name="use_markup">True</property>
</widget>
<packing>
diff --git a/src/rolewidget.cc b/src/rolewidget.cc
index e86ba3d..54c64d5 100644
--- a/src/rolewidget.cc
+++ b/src/rolewidget.cc
@@ -32,7 +32,7 @@ RoleWidget::RoleWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
StreamWidget(cobject, x) {
lockToggleButton->hide();
- streamToggleButton->hide();
+ streamControlHBox->hide();
}
RoleWidget* RoleWidget::create() {
@@ -48,6 +48,9 @@ void RoleWidget::onMuteToggleButton() {
executeVolumeUpdate();
}
+void RoleWidget::onDeviceChange() {
+}
+
void RoleWidget::executeVolumeUpdate() {
pa_ext_stream_restore_info info;
diff --git a/src/rolewidget.h b/src/rolewidget.h
index bbd39d6..955364c 100644
--- a/src/rolewidget.h
+++ b/src/rolewidget.h
@@ -33,6 +33,7 @@ public:
Glib::ustring role;
Glib::ustring device;
+ virtual void onDeviceChange();
virtual void onMuteToggleButton();
virtual void executeVolumeUpdate();
};
diff --git a/src/sinkinputwidget.cc b/src/sinkinputwidget.cc
index e5443f1..0c9054f 100644
--- a/src/sinkinputwidget.cc
+++ b/src/sinkinputwidget.cc
@@ -34,6 +34,8 @@ SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gno
titleMenuItem(_("_Move Stream..."), true),
killMenuItem(_("_Terminate Stream"), true) {
+ directionLabel->set_label(_("<i>Playing on </i> "));
+
add_events(Gdk::BUTTON_PRESS_MASK);
menu.append(titleMenuItem);
@@ -114,6 +116,9 @@ void SinkInputWidget::onKill() {
pa_operation_unref(o);
}
+void SinkInputWidget::onDeviceChange() {
+}
+
void SinkInputWidget::SinkMenuItem::onToggle() {
if (widget->updating)
diff --git a/src/sinkinputwidget.h b/src/sinkinputwidget.h
index 6db504b..f7b5101 100644
--- a/src/sinkinputwidget.h
+++ b/src/sinkinputwidget.h
@@ -37,6 +37,7 @@ public:
uint32_t index, clientIndex, sinkIndex;
virtual void executeVolumeUpdate();
+ virtual void onDeviceChange();
virtual void onMuteToggleButton();
virtual void onKill();
virtual void prepareMenu();
diff --git a/src/sourceoutputwidget.cc b/src/sourceoutputwidget.cc
index eafe620..54940f3 100644
--- a/src/sourceoutputwidget.cc
+++ b/src/sourceoutputwidget.cc
@@ -29,11 +29,13 @@
#include "i18n.h"
SourceOutputWidget::SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
- MinimalStreamWidget(cobject, x),
+ StreamWidget(cobject, x),
mainWindow(NULL),
titleMenuItem(_("_Move Stream..."), true),
killMenuItem(_("_Terminate Stream"), true) {
+ directionLabel->set_label(_("<i>Recording from </i> "));
+
add_events(Gdk::BUTTON_PRESS_MASK);
menu.append(titleMenuItem);
@@ -88,6 +90,9 @@ void SourceOutputWidget::prepareMenu(void) {
buildMenu();
}
+void SourceOutputWidget::onDeviceChange() {
+}
+
void SourceOutputWidget::SourceMenuItem::onToggle() {
if (widget->updating)
diff --git a/src/sourceoutputwidget.h b/src/sourceoutputwidget.h
index cdaf28a..281a897 100644
--- a/src/sourceoutputwidget.h
+++ b/src/sourceoutputwidget.h
@@ -23,11 +23,11 @@
#include "pavucontrol.h"
-#include "minimalstreamwidget.h"
+#include "streamwidget.h"
class MainWindow;
-class SourceOutputWidget : public MinimalStreamWidget {
+class SourceOutputWidget : public StreamWidget {
public:
SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x);
static SourceOutputWidget* create();
@@ -36,6 +36,7 @@ public:
SourceOutputType type;
uint32_t index, clientIndex, sourceIndex;
+ virtual void onDeviceChange();
virtual void onKill();
MainWindow *mainWindow;
diff --git a/src/streamwidget.cc b/src/streamwidget.cc
index fae605f..322308d 100644
--- a/src/streamwidget.cc
+++ b/src/streamwidget.cc
@@ -26,12 +26,18 @@
#include "channelwidget.h"
/*** StreamWidget ***/
-
StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
MinimalStreamWidget(cobject, x) {
x->get_widget("lockToggleButton", lockToggleButton);
x->get_widget("muteToggleButton", muteToggleButton);
+ x->get_widget("deviceCombo", deviceCombo);
+ x->get_widget("terminateButton", terminateButton);
+ x->get_widget("directionLabel", directionLabel);
+ x->get_widget("streamControlHBox", streamControlHBox);
+
+ //deviceCombo->set_active(false);
+ //deviceCombo->signal_clicked().connect(sigc::mem_fun(*this, &MinimalStreamWidget::onDeviceChange));
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onMuteToggleButton));
@@ -47,7 +53,7 @@ void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
cw->beepDevice = beepDevice;
cw->channel = i;
cw->can_decibel = can_decibel;
- cw->streamWidget = this;
+ cw->minimalStreamWidget = this;
char text[64];
snprintf(text, sizeof(text), "<b>%s</b>", pa_channel_position_to_pretty_string(m.map[i]));
cw->channelLabel->set_markup(text);
diff --git a/src/streamwidget.h b/src/streamwidget.h
index af5f0b9..3b4566d 100644
--- a/src/streamwidget.h
+++ b/src/streamwidget.h
@@ -36,12 +36,16 @@ public:
virtual void updateChannelVolume(int channel, pa_volume_t v);
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
+ Gtk::Button *terminateButton;
+ Gtk::Label *directionLabel;
+ Gtk::HBox *streamControlHBox;
pa_channel_map channelMap;
pa_cvolume volume;
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
+ virtual void onDeviceChange() = 0;
virtual void onMuteToggleButton();
sigc::connection timeoutConnection;
@@ -51,6 +55,9 @@ public:
virtual void executeVolumeUpdate();
virtual void setBaseVolume(pa_volume_t v);
virtual void setSteps(unsigned n);
+
+protected:
+ Gtk::ComboBox *deviceCombo;
};
#endif