forked from OpenGamers/abaddon
use new volume meter for other users
This commit is contained in:
@@ -17,6 +17,10 @@ void VolumeMeter::SetTick(double fraction) {
|
|||||||
queue_draw();
|
queue_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VolumeMeter::SetShowTick(bool show) {
|
||||||
|
m_show_tick = show;
|
||||||
|
}
|
||||||
|
|
||||||
Gtk::SizeRequestMode VolumeMeter::get_request_mode_vfunc() const {
|
Gtk::SizeRequestMode VolumeMeter::get_request_mode_vfunc() const {
|
||||||
return Gtk::Widget::get_request_mode_vfunc();
|
return Gtk::Widget::get_request_mode_vfunc();
|
||||||
}
|
}
|
||||||
@@ -109,11 +113,13 @@ bool VolumeMeter::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) {
|
|||||||
cr->rectangle(0.0, 0.0, draw_low, height);
|
cr->rectangle(0.0, 0.0, draw_low, height);
|
||||||
cr->fill();
|
cr->fill();
|
||||||
|
|
||||||
const double tick_base = width * m_tick;
|
if (m_show_tick) {
|
||||||
|
const double tick_base = width * m_tick;
|
||||||
|
|
||||||
cr->set_source_rgb(0.8, 0.8, 0.8);
|
cr->set_source_rgb(0.8, 0.8, 0.8);
|
||||||
cr->rectangle(tick_base, 0, 4, height);
|
cr->rectangle(tick_base, 0, 4, height);
|
||||||
cr->fill();
|
cr->fill();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public:
|
|||||||
|
|
||||||
void SetVolume(double fraction);
|
void SetVolume(double fraction);
|
||||||
void SetTick(double fraction);
|
void SetTick(double fraction);
|
||||||
|
void SetShowTick(bool show);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gtk::SizeRequestMode get_request_mode_vfunc() const override;
|
Gtk::SizeRequestMode get_request_mode_vfunc() const override;
|
||||||
@@ -26,4 +27,5 @@ private:
|
|||||||
|
|
||||||
double m_fraction = 0.0;
|
double m_fraction = 0.0;
|
||||||
double m_tick = 0.0;
|
double m_tick = 0.0;
|
||||||
|
bool m_show_tick = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetVolumeMeter(double frac) {
|
void SetVolumeMeter(double frac) {
|
||||||
m_meter.set_fraction(frac);
|
m_meter.SetVolume(frac);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -60,7 +60,7 @@ private:
|
|||||||
Gtk::Label m_name;
|
Gtk::Label m_name;
|
||||||
Gtk::CheckButton m_mute;
|
Gtk::CheckButton m_mute;
|
||||||
Gtk::Scale m_volume;
|
Gtk::Scale m_volume;
|
||||||
Gtk::ProgressBar m_meter;
|
VolumeMeter m_meter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using type_signal_mute_cs = sigc::signal<void(bool)>;
|
using type_signal_mute_cs = sigc::signal<void(bool)>;
|
||||||
@@ -101,6 +101,8 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
|
|||||||
m_scroll.set_hexpand(true);
|
m_scroll.set_hexpand(true);
|
||||||
m_scroll.set_vexpand(true);
|
m_scroll.set_vexpand(true);
|
||||||
|
|
||||||
|
m_capture_volume.SetShowTick(true);
|
||||||
|
|
||||||
m_capture_gate.set_range(0.0, 100.0);
|
m_capture_gate.set_range(0.0, 100.0);
|
||||||
m_capture_gate.set_value_pos(Gtk::POS_LEFT);
|
m_capture_gate.set_value_pos(Gtk::POS_LEFT);
|
||||||
m_capture_gate.set_value(0.0);
|
m_capture_gate.set_value(0.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user