Add three-state repeat button
Add a new button to the controls that defines whether the media repeats at the end of the stream. The states are: - Disabled: Media does not repeat. This is existing behavior and the default state. - Always: Media always repeats. - Once: Media repeats once. Flag is reset when loading new media. Tested all three states with both audio and video. Added a `rustfmt.toml` to avoid reordering imports. They keep moving around in previous pull requests, best to just define what we want in the repository. Fixes: #39
This commit is contained in:
parent
7c9ec8b423
commit
de70009ed2
3 changed files with 60 additions and 3 deletions
|
|
@ -40,10 +40,23 @@ impl Default for Config {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub enum RepeatState {
|
||||
Disabled,
|
||||
Once,
|
||||
Always,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub struct PlayerState {
|
||||
pub repeat: RepeatState,
|
||||
}
|
||||
|
||||
#[derive(Clone, CosmicConfigEntry, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub struct ConfigState {
|
||||
pub recent_files: VecDeque<url::Url>,
|
||||
pub recent_projects: VecDeque<PathBuf>,
|
||||
pub player_state: PlayerState,
|
||||
}
|
||||
|
||||
impl Default for ConfigState {
|
||||
|
|
@ -51,6 +64,9 @@ impl Default for ConfigState {
|
|||
Self {
|
||||
recent_files: VecDeque::new(),
|
||||
recent_projects: VecDeque::new(),
|
||||
player_state: PlayerState {
|
||||
repeat: RepeatState::Disabled,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue