added edit panel and fixed bug where Modify* command would be decoded as Add* command by the server

This commit is contained in:
Mark
2023-08-27 21:53:00 +02:00
parent 55590a1549
commit 0e5e33367d
11 changed files with 661 additions and 15 deletions

View File

@@ -367,6 +367,8 @@ pub enum GuiAction {
OpenMain,
SetIdle(bool),
OpenSettings(bool),
OpenEditPanel(GuiElem),
CloseEditPanel,
/// Build the GuiAction(s) later, when we have access to the Database (can turn an AlbumId into a QueueContent::Folder, etc)
Build(Box<dyn FnOnce(&mut Database) -> Vec<Self>>),
SendToServer(Command),
@@ -739,6 +741,38 @@ impl Gui {
}
}
}
GuiAction::OpenEditPanel(p) => {
if let Some(gui) = self
.gui
.inner
.any_mut()
.downcast_mut::<WithFocusHotkey<GuiScreen>>()
{
if gui.inner.idle.0 {
gui.inner.idle = (false, Some(Instant::now()));
}
if gui.inner.settings.0 {
gui.inner.settings = (false, Some(Instant::now()));
}
gui.inner.open_edit(p);
}
}
GuiAction::CloseEditPanel => {
if let Some(gui) = self
.gui
.inner
.any_mut()
.downcast_mut::<WithFocusHotkey<GuiScreen>>()
{
if gui.inner.idle.0 {
gui.inner.idle = (false, Some(Instant::now()));
}
if gui.inner.settings.0 {
gui.inner.settings = (false, Some(Instant::now()));
}
gui.inner.close_edit();
}
}
}
}
}