forked from j62/ctbrec
1
0
Fork 0

Show progress indicator and a label if nothing was found

This commit is contained in:
0xb00bface 2021-01-02 16:58:07 +01:00
parent 372fadf14e
commit 0df02b8c9d
2 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,7 @@
NEXT
========================
* Added config option to show the total number of models in the title bar
3.11.0
========================
* Added config option for faster scroll speed

View File

@ -125,6 +125,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
double imageAspectRatio = 3.0 / 4.0;
private final SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true);
ProgressIndicator progressIndicator;
Label noResultsFound = new Label("Nothing found!");
private ComboBox<Integer> thumbWidth;
@ -367,6 +368,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
try {
ObservableList<Node> nodes = grid.getChildren();
nodes.remove(progressIndicator);
nodes.remove(noResultsFound);
// first remove models, which are not in the updated list
removeModelsMissingInUpdate(nodes, models);
@ -380,6 +382,11 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
// move models, which are tracked by the recorder to the front
moveActiveRecordingsToFront();
// show "empty" label, if grid is still empty
if (grid.getChildren().isEmpty()) {
nodes.add(noResultsFound);
}
} finally {
gridLock.unlock();
}
@ -774,14 +781,16 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
// remove the ones from grid, which don't match
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next();
if (node instanceof ThumbCell) {
ThumbCell cell = (ThumbCell) node;
Model m = cell.getModel();
if(!matches(m, filter)) {
if (!matches(m, filter)) {
iterator.remove();
filteredThumbCells.add(cell);
cell.setSelected(false);
}
}
}
// add the ones, which might have been filtered before, but now match
for (Iterator<ThumbCell> iterator = filteredThumbCells.iterator(); iterator.hasNext();) {
@ -887,8 +896,12 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
@Override
public void selected() {
grid.getChildren().remove(noResultsFound);
if (grid.getChildren().isEmpty()) {
grid.getChildren().add(progressIndicator);
}
queue.clear();
if(updateService != null) {
if (updateService != null) {
State s = updateService.getState();
if (s != State.SCHEDULED && s != State.RUNNING) {
updateService.reset();
@ -907,7 +920,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next();
if(node instanceof ThumbCell) {
if (node instanceof ThumbCell) {
ThumbCell thumbCell = (ThumbCell) node;
thumbCell.releaseResources();
iterator.remove();