Add 1.72 & 2x speeds

This commit is contained in:
Zander Brown 2019-03-07 13:00:51 +00:00 committed by Zander
parent 1e816f65a5
commit 5e50ba6cb3
2 changed files with 57 additions and 3 deletions

View File

@ -339,6 +339,42 @@ Tobias Bernard
<property name="margin_bottom">6</property> <property name="margin_bottom">6</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child>
<object class="GtkRadioButton" id="rate_2_00">
<property name="label" translatable="yes">2.00×</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">2 speed rate</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="draw_indicator">True</property>
<property name="group">normal_rate</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rate_1_75">
<property name="label" translatable="yes">1.75×</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">1.75 speed rate</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="draw_indicator">True</property>
<property name="group">normal_rate</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkRadioButton" id="rate_1_50"> <object class="GtkRadioButton" id="rate_1_50">
<property name="label" translatable="yes">1.50×</property> <property name="label" translatable="yes">1.50×</property>
@ -354,7 +390,7 @@ Tobias Bernard
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -372,7 +408,7 @@ Tobias Bernard
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -390,7 +426,7 @@ Tobias Bernard
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -175,6 +175,8 @@ fn format_duration(seconds: u32) -> String {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct PlayerRate { struct PlayerRate {
radio200: gtk::RadioButton,
radio175: gtk::RadioButton,
radio150: gtk::RadioButton, radio150: gtk::RadioButton,
radio125: gtk::RadioButton, radio125: gtk::RadioButton,
radio_normal: gtk::RadioButton, radio_normal: gtk::RadioButton,
@ -275,6 +277,8 @@ impl Default for PlayerWidget {
episode_id: RefCell::new(None), episode_id: RefCell::new(None),
}; };
let radio200 = builder.get_object("rate_2_00").unwrap();
let radio175 = builder.get_object("rate_1_75").unwrap();
let radio150 = builder.get_object("rate_1_50").unwrap(); let radio150 = builder.get_object("rate_1_50").unwrap();
let radio125 = builder.get_object("rate_1_25").unwrap(); let radio125 = builder.get_object("rate_1_25").unwrap();
let radio_normal = builder.get_object("normal_rate").unwrap(); let radio_normal = builder.get_object("normal_rate").unwrap();
@ -282,6 +286,8 @@ impl Default for PlayerWidget {
let btn = builder.get_object("rate_button").unwrap(); let btn = builder.get_object("rate_button").unwrap();
let label = builder.get_object("rate_label").unwrap(); let label = builder.get_object("rate_label").unwrap();
let rate = PlayerRate { let rate = PlayerRate {
radio200,
radio175,
radio150, radio150,
radio125, radio125,
radio_normal, radio_normal,
@ -581,6 +587,18 @@ impl PlayerWrapper {
.connect_toggled(clone!(weak => move |_| { .connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(1.50)); weak.upgrade().map(|p| p.on_rate_changed(1.50));
})); }));
self.rate
.radio175
.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(1.75));
}));
self.rate
.radio200
.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(2.00));
}));
} }
fn connect_mpris_buttons(&self, sender: &Sender<Action>) { fn connect_mpris_buttons(&self, sender: &Sender<Action>) {