parent
60743ed251
commit
21eac9324f
5 changed files with 58 additions and 105 deletions
|
|
@ -315,7 +315,6 @@ enum Message {
|
|||
NotifyEvents(Vec<DebouncedEvent>),
|
||||
NotifyWatcher(WatcherWrapper),
|
||||
Open,
|
||||
Preview(PreviewKind, time::Duration),
|
||||
Save(bool),
|
||||
SearchActivate,
|
||||
SearchClear,
|
||||
|
|
@ -378,7 +377,6 @@ struct App {
|
|||
mounters: Mounters,
|
||||
mounter_items: HashMap<MounterKey, MounterItems>,
|
||||
nav_model: segmented_button::SingleSelectModel,
|
||||
preview_opt: Option<(PreviewKind, time::Instant)>,
|
||||
result_opt: Option<DialogResult>,
|
||||
search_active: bool,
|
||||
search_id: widget::Id,
|
||||
|
|
@ -683,6 +681,7 @@ impl Application for App {
|
|||
core.window.show_close = false;
|
||||
core.window.show_maximize = false;
|
||||
core.window.show_minimize = false;
|
||||
core.window.show_context = true;
|
||||
|
||||
let title = flags.kind.title();
|
||||
let accept_label = flags.kind.accept_label();
|
||||
|
|
@ -711,7 +710,7 @@ impl Application for App {
|
|||
title,
|
||||
accept_label,
|
||||
choices: Vec::new(),
|
||||
context_page: ContextPage::Settings,
|
||||
context_page: ContextPage::Preview(None, PreviewKind::Selected),
|
||||
dialog_pages: VecDeque::new(),
|
||||
dialog_text_input: widget::Id::unique(),
|
||||
filters: Vec::new(),
|
||||
|
|
@ -721,7 +720,6 @@ impl Application for App {
|
|||
mounters: mounters(),
|
||||
mounter_items: HashMap::new(),
|
||||
nav_model: segmented_button::ModelBuilder::default().build(),
|
||||
preview_opt: None,
|
||||
result_opt: None,
|
||||
search_active: false,
|
||||
search_id: widget::Id::unique(),
|
||||
|
|
@ -1233,17 +1231,6 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
Message::Preview(kind, timeout) => {
|
||||
if self
|
||||
.preview_opt
|
||||
.as_ref()
|
||||
.is_some_and(|(k, i)| *k == kind && i.elapsed() > timeout)
|
||||
{
|
||||
self.context_page = ContextPage::Preview(None, kind);
|
||||
self.set_show_context(true);
|
||||
self.set_context_title(self.context_page.title());
|
||||
}
|
||||
}
|
||||
Message::Save(replace) => {
|
||||
if let DialogKind::SaveFile { filename } = &self.flags.kind {
|
||||
if !filename.is_empty() {
|
||||
|
|
@ -1341,22 +1328,10 @@ impl Application for App {
|
|||
commands.push(self.update(Message::Open));
|
||||
}
|
||||
}
|
||||
tab::Command::Preview(kind, mut timeout) => {
|
||||
self.preview_opt = Some((kind.clone(), time::Instant::now()));
|
||||
if self.core.window.show_context {
|
||||
// If the context window is already open, immediately show the preview
|
||||
timeout = time::Duration::new(0, 0)
|
||||
};
|
||||
commands.push(Command::perform(
|
||||
async move {
|
||||
tokio::time::sleep(timeout).await;
|
||||
message::app(Message::Preview(kind, timeout))
|
||||
},
|
||||
|x| x,
|
||||
));
|
||||
}
|
||||
tab::Command::PreviewCancel => {
|
||||
self.preview_opt = None;
|
||||
tab::Command::Preview(kind) => {
|
||||
self.context_page = ContextPage::Preview(None, kind);
|
||||
self.set_show_context(true);
|
||||
self.set_context_title(self.context_page.title());
|
||||
}
|
||||
tab::Command::WindowDrag => {
|
||||
commands.push(window::drag(self.main_window_id()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue