devicewidget, streamwidget: Show only one volume slider when channels are locked
This commit is contained in:
parent
ed140c230c
commit
dd0ccda382
|
@ -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));
|
this->signal_button_press_event().connect(sigc::mem_fun(*this, &DeviceWidget::onContextTriggerEvent));
|
||||||
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onMuteToggleButton));
|
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));
|
defaultToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &DeviceWidget::onDefaultToggleButton));
|
||||||
|
|
||||||
rename.set_label(_("Rename Device..."));
|
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;
|
channelWidgets[m.channels-1]->last = true;
|
||||||
|
|
||||||
lockToggleButton->set_sensitive(m.channels > 1);
|
lockToggleButton->set_sensitive(m.channels > 1);
|
||||||
|
hideLockedChannels(lockToggleButton->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceWidget::setVolume(const pa_cvolume &v, bool force) {
|
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);
|
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() {
|
void DeviceWidget::onMuteToggleButton() {
|
||||||
|
|
||||||
lockToggleButton->set_sensitive(!muteToggleButton->get_active());
|
lockToggleButton->set_sensitive(!muteToggleButton->get_active());
|
||||||
|
@ -131,6 +140,10 @@ void DeviceWidget::onMuteToggleButton() {
|
||||||
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceWidget::onLockToggleButton() {
|
||||||
|
hideLockedChannels(lockToggleButton->get_active());
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceWidget::onDefaultToggleButton() {
|
void DeviceWidget::onDefaultToggleButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
void setVolume(const pa_cvolume &volume, bool force = false);
|
void setVolume(const pa_cvolume &volume, bool force = false);
|
||||||
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
||||||
|
|
||||||
|
void hideLockedChannels(bool hide = true);
|
||||||
|
|
||||||
Glib::ustring name;
|
Glib::ustring name;
|
||||||
Glib::ustring description;
|
Glib::ustring description;
|
||||||
uint32_t index, card_index;
|
uint32_t index, card_index;
|
||||||
|
@ -52,6 +54,7 @@ public:
|
||||||
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
|
virtual void onLockToggleButton();
|
||||||
virtual void onDefaultToggleButton();
|
virtual void onDefaultToggleButton();
|
||||||
virtual void setDefault(bool isDefault);
|
virtual void setDefault(bool isDefault);
|
||||||
virtual bool onContextTriggerEvent(GdkEventButton*);
|
virtual bool onContextTriggerEvent(GdkEventButton*);
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
bool updating;
|
bool updating;
|
||||||
|
|
||||||
virtual void onMuteToggleButton() = 0;
|
virtual void onMuteToggleButton() = 0;
|
||||||
|
virtual void onLockToggleButton() = 0;
|
||||||
virtual void updateChannelVolume(int channel, pa_volume_t v) = 0;
|
virtual void updateChannelVolume(int channel, pa_volume_t v) = 0;
|
||||||
|
|
||||||
bool volumeMeterEnabled;
|
bool volumeMeterEnabled;
|
||||||
|
|
|
@ -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));
|
this->signal_button_press_event().connect(sigc::mem_fun(*this, &StreamWidget::onContextTriggerEvent));
|
||||||
muteToggleButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onMuteToggleButton));
|
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));
|
deviceButton->signal_clicked().connect(sigc::mem_fun(*this, &StreamWidget::onDeviceChangePopup));
|
||||||
|
|
||||||
terminate.set_label(_("Terminate"));
|
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);
|
channelWidgets[m.channels-1]->setBaseVolume(PA_VOLUME_NORM);
|
||||||
|
|
||||||
lockToggleButton->set_sensitive(m.channels > 1);
|
lockToggleButton->set_sensitive(m.channels > 1);
|
||||||
|
hideLockedChannels(lockToggleButton->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamWidget::setVolume(const pa_cvolume &v, bool force) {
|
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);
|
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() {
|
void StreamWidget::onMuteToggleButton() {
|
||||||
|
|
||||||
lockToggleButton->set_sensitive(!muteToggleButton->get_active());
|
lockToggleButton->set_sensitive(!muteToggleButton->get_active());
|
||||||
|
@ -121,6 +130,10 @@ void StreamWidget::onMuteToggleButton() {
|
||||||
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StreamWidget::onLockToggleButton() {
|
||||||
|
hideLockedChannels(lockToggleButton->get_active());
|
||||||
|
}
|
||||||
|
|
||||||
bool StreamWidget::timeoutEvent() {
|
bool StreamWidget::timeoutEvent() {
|
||||||
executeVolumeUpdate();
|
executeVolumeUpdate();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
void setVolume(const pa_cvolume &volume, bool force = false);
|
void setVolume(const pa_cvolume &volume, bool force = false);
|
||||||
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
virtual void updateChannelVolume(int channel, pa_volume_t v);
|
||||||
|
|
||||||
|
void hideLockedChannels(bool hide = true);
|
||||||
|
|
||||||
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
Gtk::ToggleButton *lockToggleButton, *muteToggleButton;
|
||||||
Gtk::Label *directionLabel;
|
Gtk::Label *directionLabel;
|
||||||
Gtk::Button *deviceButton;
|
Gtk::Button *deviceButton;
|
||||||
|
@ -48,6 +50,7 @@ public:
|
||||||
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
|
virtual void onLockToggleButton();
|
||||||
virtual void onDeviceChangePopup();
|
virtual void onDeviceChangePopup();
|
||||||
virtual bool onContextTriggerEvent(GdkEventButton*);
|
virtual bool onContextTriggerEvent(GdkEventButton*);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue