Added tooltip to filter bar

This commit is contained in:
0xboobface 2018-07-25 14:17:38 +02:00
parent 6136f095ec
commit fc4ce39381
1 changed files with 14 additions and 1 deletions

View File

@ -37,6 +37,7 @@ import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
@ -92,6 +93,8 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
gridLock.unlock();
}
});
search.setTooltip(new Tooltip("Filter the models by their name, stream description or #hashtags.\n\n"+""
+ "If the display of stream resolution is enabled, you can even filter by resolution. Try \"1080\" or \">720\""));
BorderPane.setMargin(search, new Insets(5));
scrollPane.setContent(grid);
@ -309,7 +312,17 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
//LOG.debug("{} -> {}", m.getName(), searchText);
boolean tokensMissing = false;
for (String token : tokens) {
if(!searchText.contains(token)) {
if(token.matches(">\\d+")) {
int res = Integer.parseInt(token.substring(1));
if(m.getStreamResolution() < res) {
tokensMissing = true;
}
} else if(token.matches("<\\d+")) {
int res = Integer.parseInt(token.substring(1));
if(m.getStreamResolution() > res) {
tokensMissing = true;
}
} else if(!searchText.contains(token)) {
tokensMissing = true;
}
}