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
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}

View File

@ -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;

View File

@ -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()