Show "Loading..." item in DataRecoveryView if the list wasn't loaded before we click the "Recover Files..." option

This commit is contained in:
David Capello 2019-05-27 17:53:22 -03:00
parent 54883012bb
commit df741c246b
3 changed files with 14 additions and 7 deletions

View File

@ -1208,6 +1208,7 @@ delete = Delete
refresh = Refresh refresh = Refresh
raw_images_as_frames = Raw Images as Frames raw_images_as_frames = Raw Images as Frames
raw_images_as_layers = Raw Images as Layers raw_images_as_layers = Raw Images as Layers
loading = Loading...
crash_sessions = Crashed Sessions crash_sessions = Crashed Sessions
old_sessions = Previous Sessions old_sessions = Previous Sessions
incompatible = [MIGHT BE INCOMPATIBLE v{1}] {0} incompatible = [MIGHT BE INCOMPATIBLE v{1}] {0}

View File

@ -33,6 +33,8 @@ namespace crash {
// Launches the thread to search for sessions. // Launches the thread to search for sessions.
void launchSearch(); void launchSearch();
bool isSearching() const { return m_searching; }
// Returns true if there is at least one sessions with sprites to // Returns true if there is at least one sessions with sprites to
// recover (i.e. a crashed session were changes weren't saved) // recover (i.e. a crashed session were changes weren't saved)
bool hasRecoverySessions() const; bool hasRecoverySessions() const;

View File

@ -130,8 +130,13 @@ void DataRecoveryView::clearList()
void DataRecoveryView::fillList() void DataRecoveryView::fillList()
{ {
clearList(); 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) void DataRecoveryView::fillListWith(const bool crashes)
@ -296,12 +301,11 @@ void DataRecoveryView::onDelete()
void DataRecoveryView::onRefresh() void DataRecoveryView::onRefresh()
{ {
clearList();
onChangeSelection();
m_listBox.addChild(new ListItem("Loading..."));
layout();
m_dataRecovery->launchSearch(); m_dataRecovery->launchSearch();
fillList();
onChangeSelection();
layout();
} }
void DataRecoveryView::onChangeSelection() void DataRecoveryView::onChangeSelection()