[pulseaudio-commits] 2 commits - src/devicewidget.cc src/devicewidget.h src/mainwindow.cc src/minimalstreamwidget.h src/streamwidget.cc src/streamwidget.h

Peter Meerwald pmeerw at kemper.freedesktop.org
Wed Mar 4 13:52:23 PST 2015


 src/devicewidget.cc       |   13 +++++++++++++
 src/devicewidget.h        |    3 +++
 src/mainwindow.cc         |   36 ++++++++++++++++++++++++++++++++++++
 src/minimalstreamwidget.h |    1 +
 src/streamwidget.cc       |   13 +++++++++++++
 src/streamwidget.h        |    3 +++
 6 files changed, 69 insertions(+)

New commits:
commit 762cca55198b2376ab32ac3a8c0e9801c0c9e4f0
Author: Steven Dwy <yoplitein+git at gmail.com>
Date:   Mon Feb 2 05:32:08 2015 -0800

    mainwindow: Remember device visibility selections
    
    stores the type of devices that are shown for Playback,
    Recording, Output Devices, Input Devices, resp.

diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 1b15dfb..b45ab59 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -125,6 +125,38 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
         get_default_size(default_width, default_height);
         if (width >= default_width && height >= default_height)
             resize(width, height);
+
+        int sinkInputTypeSelection = g_key_file_get_integer(config, "window", "sinkInputType", &err);
+        if (err == NULL)
+            sinkInputTypeComboBox->set_active(sinkInputTypeSelection);
+        else {
+            g_error_free(err);
+            err = NULL;
+        }
+
+        int sourceOutputTypeSelection = g_key_file_get_integer(config, "window", "sourceOutputType", &err);
+        if (err == NULL)
+            sourceOutputTypeComboBox->set_active(sourceOutputTypeSelection);
+        else {
+            g_error_free(err);
+            err = NULL;
+        }
+
+        int sinkTypeSelection = g_key_file_get_integer(config, "window", "sinkType", &err);
+        if (err == NULL)
+            sinkTypeComboBox->set_active(sinkTypeSelection);
+        else {
+            g_error_free(err);
+            err = NULL;
+        }
+
+        int sourceTypeSelection = g_key_file_get_integer(config, "window", "sourceType", &err);
+        if (err == NULL)
+            sourceTypeComboBox->set_active(sourceTypeSelection);
+        else {
+            g_error_free(err);
+            err = NULL;
+        }
     } else {
         g_debug(_("Error reading config file %s: %s"), m_config_filename, err->message);
         g_error_free(err);
@@ -202,6 +234,10 @@ MainWindow::~MainWindow() {
     get_size(width, height);
     g_key_file_set_integer(config, "window", "width", width);
     g_key_file_set_integer(config, "window", "height", height);
+    g_key_file_set_integer(config, "window", "sinkInputType", sinkInputTypeComboBox->get_active_row_number());
+    g_key_file_set_integer(config, "window", "sourceOutputType", sourceOutputTypeComboBox->get_active_row_number());
+    g_key_file_set_integer(config, "window", "sinkType", sinkTypeComboBox->get_active_row_number());
+    g_key_file_set_integer(config, "window", "sourceType", sourceTypeComboBox->get_active_row_number());
 
     gsize filelen;
     GError *err = NULL;

commit dd0ccda382fa34cc624c2f85a11f9579d921531b
Author: Ivan Ivanov <ivanradanov at yahoo.co.uk>
Date:   Sun Nov 9 00:55:51 2014 +0200

    devicewidget, streamwidget: Show only one volume slider when channels are locked

diff --git a/src/devicewidget.cc b/src/devicewidget.cc
index 813780f..5831f21 100644
--- a/src/devicewidget.cc
+++ b/src/devicewidget.cc
@@ -46,6 +46,7 @@ DeviceWidget::DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
 
     this->signal_button_press_event().connect(sigc::mem_fun(*this, &DeviceWidget::onContextTriggerEvent));
     muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onMuteToggleButton));
+    lockToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onLockToggleButton));
     defaultToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onDefaultToggleButton));
 
     rename.set_label(_("Rename Device..."));
@@ -94,6 +95,7 @@ void DeviceWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
     channelWidgets[m.channels-1]->last = true;
 
     lockToggleButton->set_sensitive(m.channels > 1);
+    hideLockedChannels(lockToggleButton->get_active());
 }
 
 void DeviceWidget::setVolume(const pa_cvolume &v, bool force) {
@@ -123,6 +125,13 @@ void DeviceWidget::updateChannelVolume(int channel, pa_volume_t v) {
         timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &DeviceWidget::timeoutEvent), 100);
 }
 
+void DeviceWidget::hideLockedChannels(bool hide) {
+    for (int i = 0; i < channelMap.channels - 1; i++)
+        channelWidgets[i]->set_visible(!hide);
+
+    channelWidgets[channelMap.channels - 1]->channelLabel->set_visible(!hide);
+}
+
 void DeviceWidget::onMuteToggleButton() {
 
     lockToggleButton->set_sensitive(!muteToggleButton->get_active());
@@ -131,6 +140,10 @@ void DeviceWidget::onMuteToggleButton() {
         channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
 }
 
+void DeviceWidget::onLockToggleButton() {
+    hideLockedChannels(lockToggleButton->get_active());
+}
+
 void DeviceWidget::onDefaultToggleButton() {
 }
 
diff --git a/src/devicewidget.h b/src/devicewidget.h
index 586c2cf..3bff264 100644
--- a/src/devicewidget.h
+++ b/src/devicewidget.h
@@ -37,6 +37,8 @@ public:
     void setVolume(const pa_cvolume &volume, bool force = false);
     virtual void updateChannelVolume(int channel, pa_volume_t v);
 
+    void hideLockedChannels(bool hide = true);
+
     Glib::ustring name;
     Glib::ustring description;
     uint32_t index, card_index;
@@ -52,6 +54,7 @@ public:
     ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
 
     virtual void onMuteToggleButton();
+    virtual void onLockToggleButton();
     virtual void onDefaultToggleButton();
     virtual void setDefault(bool isDefault);
     virtual bool onContextTriggerEvent(GdkEventButton*);
diff --git a/src/minimalstreamwidget.h b/src/minimalstreamwidget.h
index 7d5ee24..c020667 100644
--- a/src/minimalstreamwidget.h
+++ b/src/minimalstreamwidget.h
@@ -36,6 +36,7 @@ public:
     bool updating;
 
     virtual void onMuteToggleButton() = 0;
+    virtual void onLockToggleButton() = 0;
     virtual void updateChannelVolume(int channel, pa_volume_t v) = 0;
 
     bool volumeMeterEnabled;
diff --git a/src/streamwidget.cc b/src/streamwidget.cc
index e602cce..1f21afc 100644
--- a/src/streamwidget.cc
+++ b/src/streamwidget.cc
@@ -41,6 +41,7 @@ StreamWidget::StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Buil
 
     this->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onContextTriggerEvent));
     muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onMuteToggleButton));
+    lockToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onLockToggleButton));
     deviceButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onDeviceChangePopup));
 
     terminate.set_label(_("Terminate"));
@@ -83,6 +84,7 @@ void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
     channelWidgets[m.channels-1]->setBaseVolume(PA_VOLUME_NORM);
 
     lockToggleButton->set_sensitive(m.channels > 1);
+    hideLockedChannels(lockToggleButton->get_active());
 }
 
 void StreamWidget::setVolume(const pa_cvolume &v, bool force) {
@@ -113,6 +115,13 @@ void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) {
         timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &StreamWidget::timeoutEvent), 100);
 }
 
+void StreamWidget::hideLockedChannels(bool hide) {
+    for (int i = 0; i < channelMap.channels - 1; i++)
+        channelWidgets[i]->set_visible(!hide);
+
+    channelWidgets[channelMap.channels - 1]->channelLabel->set_visible(!hide);
+}
+
 void StreamWidget::onMuteToggleButton() {
 
     lockToggleButton->set_sensitive(!muteToggleButton->get_active());
@@ -121,6 +130,10 @@ void StreamWidget::onMuteToggleButton() {
         channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
 }
 
+void StreamWidget::onLockToggleButton() {
+    hideLockedChannels(lockToggleButton->get_active());
+}
+
 bool StreamWidget::timeoutEvent() {
     executeVolumeUpdate();
     return false;
diff --git a/src/streamwidget.h b/src/streamwidget.h
index b797ec5..c769920 100644
--- a/src/streamwidget.h
+++ b/src/streamwidget.h
@@ -37,6 +37,8 @@ public:
     void setVolume(const pa_cvolume &volume, bool force = false);
     virtual void updateChannelVolume(int channel, pa_volume_t v);
 
+    void hideLockedChannels(bool hide = true);
+
     Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
     Gtk::Label *directionLabel;
     Gtk::Button *deviceButton;
@@ -48,6 +50,7 @@ public:
     ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
 
     virtual void onMuteToggleButton();
+    virtual void onLockToggleButton();
     virtual void onDeviceChangePopup();
     virtual bool onContextTriggerEvent(GdkEventButton*);
 



More information about the pulseaudio-commits mailing list