forked from j62/ctbrec
Added menu entry to ignore models
Ignored models are not displayed in the thumb overview tab. This is useful, if you don't like a model and want to get rid of it for good
This commit is contained in:
parent
458e05d2b4
commit
601669fdd6
|
@ -22,6 +22,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -349,10 +350,17 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
if(updatesSuspended) {
|
||||
return;
|
||||
}
|
||||
List<Model> models = updateService.getValue();
|
||||
List<Model> models = filterIgnoredModels(updateService.getValue());
|
||||
updateGrid(models);
|
||||
}
|
||||
|
||||
private List<Model> filterIgnoredModels(List<Model> models) {
|
||||
List<Model> ignored = Config.getInstance().getSettings().modelsIgnored;
|
||||
return models.stream()
|
||||
.filter(m -> !ignored.contains(m))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
protected void updateGrid(List<? extends Model> models) {
|
||||
gridLock.lock();
|
||||
try {
|
||||
|
@ -465,6 +473,9 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
clipboard.setContent(content);
|
||||
});
|
||||
|
||||
MenuItem ignore = new MenuItem("Ignore");
|
||||
ignore.setOnAction((e) -> ignore(getSelectedThumbCells(cell)));
|
||||
|
||||
MenuItem sendTip = new MenuItem("Send Tip");
|
||||
sendTip.setOnAction((e) -> {
|
||||
TipDialog tipDialog = new TipDialog(site, cell.getModel());
|
||||
|
@ -521,7 +532,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
if(site.supportsTips()) {
|
||||
contextMenu.getItems().add(sendTip);
|
||||
}
|
||||
contextMenu.getItems().addAll(copyUrl);
|
||||
contextMenu.getItems().addAll(copyUrl, ignore);
|
||||
if(cell.getModel() instanceof MyFreeCamsModel && Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
|
||||
MenuItem debug = new MenuItem("debug");
|
||||
debug.setOnAction((e) -> {
|
||||
|
@ -553,6 +564,14 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
|
|||
}
|
||||
}
|
||||
|
||||
protected void ignore(List<ThumbCell> selection) {
|
||||
for (ThumbCell thumbCell : selection) {
|
||||
Model model = thumbCell.getModel();
|
||||
Config.getInstance().getSettings().modelsIgnored.add(model);
|
||||
grid.getChildren().remove(thumbCell);
|
||||
}
|
||||
}
|
||||
|
||||
private void showAddToFollowedAnimation(ThumbCell thumbCell) {
|
||||
Platform.runLater(() -> {
|
||||
Transform tx = thumbCell.getLocalToParentTransform();
|
||||
|
|
|
@ -77,6 +77,7 @@ public class Settings {
|
|||
public String lastDownloadDir = "";
|
||||
|
||||
public List<Model> models = new ArrayList<>();
|
||||
public List<Model> modelsIgnored = new ArrayList<>();
|
||||
public List<EventHandlerConfiguration> eventHandlers = new ArrayList<>();
|
||||
public boolean determineResolution = false;
|
||||
public boolean livePreviews = false;
|
||||
|
|
Loading…
Reference in New Issue