Skip to content

Commit

Permalink
Show "Loading..." item in DataRecoveryView if the list wasn't loaded …
Browse files Browse the repository at this point in the history
…before we click the "Recover Files..." option
  • Loading branch information
dacap committed May 28, 2019
1 parent 5488301 commit df741c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions data/strings/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions src/app/crash/data_recovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 10 additions & 6 deletions src/app/ui/data_recovery_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -296,12 +301,11 @@ void DataRecoveryView::onDelete()

void DataRecoveryView::onRefresh()
{
clearList();
m_dataRecovery->launchSearch();

fillList();
onChangeSelection();
m_listBox.addChild(new ListItem("Loading..."));
layout();

m_dataRecovery->launchSearch();
}

void DataRecoveryView::onChangeSelection()
Expand Down

0 comments on commit df741c2

Please sign in to comment.