basis for ensuring keybindings turn off when editing things
This commit is contained in:
parent
ab88791d80
commit
3d1d0f84ba
24
src/main.rs
24
src/main.rs
|
@ -264,14 +264,6 @@ impl cosmic::Application for App {
|
|||
nav = nav.max_width(280);
|
||||
}
|
||||
|
||||
// let dnd = DndDestination::new(
|
||||
// nav,
|
||||
// vec!["application/service-item".to_string().into()],
|
||||
// )
|
||||
// .data_received_for(|item| {
|
||||
// cosmic::app::Message::App(Message::DndDrop(item))
|
||||
// });
|
||||
|
||||
let column = column![
|
||||
text::heading("Service List").center().width(280),
|
||||
nav
|
||||
|
@ -361,14 +353,14 @@ impl cosmic::Application for App {
|
|||
// debug!(?event);
|
||||
match event {
|
||||
iced::Event::Keyboard(event) => match event {
|
||||
iced::keyboard::Event::KeyPressed {
|
||||
iced::keyboard::Event::KeyReleased {
|
||||
key,
|
||||
modifiers,
|
||||
..
|
||||
} => Some(Message::Key(key, modifiers)),
|
||||
_ => None,
|
||||
},
|
||||
iced::Event::Mouse(event) => None,
|
||||
iced::Event::Mouse(_event) => None,
|
||||
iced::Event::Window(window_event) => {
|
||||
match window_event {
|
||||
window::Event::CloseRequested => {
|
||||
|
@ -388,10 +380,10 @@ impl cosmic::Application for App {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
iced::Event::Touch(event) => None,
|
||||
iced::Event::A11y(id, action_request) => None,
|
||||
iced::Event::Dnd(dnd_event) => None,
|
||||
iced::Event::PlatformSpecific(platform_specific) => {
|
||||
iced::Event::Touch(_touch) => None,
|
||||
iced::Event::A11y(_id, _action_request) => None,
|
||||
iced::Event::Dnd(_dnd_event) => None,
|
||||
iced::Event::PlatformSpecific(_platform_specific) => {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -755,7 +747,11 @@ where
|
|||
presenter::Message::PrevSlide,
|
||||
)),
|
||||
(Key::Character(k), _) if k == *"q" => {
|
||||
if !self.song_editor.editing() {
|
||||
self.update(Message::Quit)
|
||||
} else {
|
||||
Task::none()
|
||||
}
|
||||
}
|
||||
_ => Task::none(),
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ pub enum Message {
|
|||
ChangeTitle(String),
|
||||
ChangeVerseOrder(String),
|
||||
ChangeLyrics(text_editor::Action),
|
||||
Edit(bool),
|
||||
}
|
||||
|
||||
impl SongEditor {
|
||||
|
@ -84,6 +85,7 @@ impl SongEditor {
|
|||
Task::none()
|
||||
}
|
||||
Message::ChangeTitle(title) => {
|
||||
debug!(title);
|
||||
self.title = title;
|
||||
Task::none()
|
||||
}
|
||||
|
@ -95,6 +97,11 @@ impl SongEditor {
|
|||
self.lyrics.perform(action);
|
||||
Task::none()
|
||||
}
|
||||
Message::Edit(edit) => {
|
||||
debug!(edit);
|
||||
self.editing = edit;
|
||||
Task::none()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +126,7 @@ impl SongEditor {
|
|||
let title_input = text_input("song", &self.title)
|
||||
.on_input(Message::ChangeTitle)
|
||||
.label("Song Title");
|
||||
|
||||
let verse_input = text_input(
|
||||
"Verse
|
||||
order",
|
||||
|
@ -147,4 +155,8 @@ order",
|
|||
]);
|
||||
column.into()
|
||||
}
|
||||
|
||||
pub fn editing(&self) -> bool {
|
||||
self.editing
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue