From df741c246b4bdfb948848d34b450f16e9698a5c9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 27 May 2019 17:53:22 -0300 Subject: [PATCH] Show "Loading..." item in DataRecoveryView if the list wasn't loaded before we click the "Recover Files..." option --- data/strings/en.ini | 1 + src/app/crash/data_recovery.h | 2 ++ src/app/ui/data_recovery_view.cpp | 18 +++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/data/strings/en.ini b/data/strings/en.ini index ced97c029..246e2b187 100644 --- a/data/strings/en.ini +++ b/data/strings/en.ini @@ -1208,6 +1208,7 @@ delete = Delete refresh = Refresh raw_images_as_frames = Raw Images as Frames raw_images_as_layers = Raw Images as Layers +loading = Loading... crash_sessions = Crashed Sessions old_sessions = Previous Sessions incompatible = [MIGHT BE INCOMPATIBLE v{1}] {0} diff --git a/src/app/crash/data_recovery.h b/src/app/crash/data_recovery.h index cb29a255e..acf67f4a7 100644 --- a/src/app/crash/data_recovery.h +++ b/src/app/crash/data_recovery.h @@ -33,6 +33,8 @@ namespace crash { // Launches the thread to search for sessions. void launchSearch(); + bool isSearching() const { return m_searching; } + // Returns true if there is at least one sessions with sprites to // recover (i.e. a crashed session were changes weren't saved) bool hasRecoverySessions() const; diff --git a/src/app/ui/data_recovery_view.cpp b/src/app/ui/data_recovery_view.cpp index 589d115ca..9186f4484 100644 --- a/src/app/ui/data_recovery_view.cpp +++ b/src/app/ui/data_recovery_view.cpp @@ -130,8 +130,13 @@ void DataRecoveryView::clearList() void DataRecoveryView::fillList() { clearList(); - fillListWith(true); - fillListWith(false); + + if (m_dataRecovery->isSearching()) + m_listBox.addChild(new ListItem(Strings::recover_files_loading())); + else { + fillListWith(true); + fillListWith(false); + } } void DataRecoveryView::fillListWith(const bool crashes) @@ -296,12 +301,11 @@ void DataRecoveryView::onDelete() void DataRecoveryView::onRefresh() { - clearList(); - onChangeSelection(); - m_listBox.addChild(new ListItem("Loading...")); - layout(); - m_dataRecovery->launchSearch(); + + fillList(); + onChangeSelection(); + layout(); } void DataRecoveryView::onChangeSelection()