XC optional tabs

This commit is contained in:
Jafea7 2025-04-13 22:07:58 +10:00
parent 96c93e7678
commit a998f64e07
2 changed files with 17 additions and 4 deletions

View File

@ -119,6 +119,11 @@ public class XloveCamConfigUI extends AbstractConfigUI {
trans.setOnAction(e -> toggleTab("5", trans.isSelected())); trans.setOnAction(e -> toggleTab("5", trans.isSelected()));
checkboxGrid.add(trans, 2, 1); checkboxGrid.add(trans, 2, 1);
CheckBox all = new CheckBox("All");
all.setSelected(tabs.contains("all"));
all.setOnAction(e -> toggleTab("all", all.isSelected()));
checkboxGrid.add(all, 3, 1);
layout.add(checkboxGrid, 1, row, 4, 2); layout.add(checkboxGrid, 1, row, 4, 2);
row += 2; row += 2;

View File

@ -32,11 +32,11 @@ public class XloveCamTabProvider extends AbstractTabProvider {
List<Tab> tabs = new ArrayList<>(); List<Tab> tabs = new ArrayList<>();
// all // all
var updateService = new XloveCamUpdateService(xloveCam, Collections.emptyMap()); // var updateService = new XloveCamUpdateService(xloveCam, Collections.emptyMap());
tabs.add(createTab("All", updateService)); // tabs.add(createTab("All", updateService));
// new // new
updateService = new XloveCamUpdateService(xloveCam, Map.of(FILTER_PARAM_NEW, "3")); var updateService = new XloveCamUpdateService(xloveCam, Map.of(FILTER_PARAM_NEW, "3"));
tabs.add(createTab("New", updateService)); tabs.add(createTab("New", updateService));
Map<String, String> tabMap = new HashMap<>(); Map<String, String> tabMap = new HashMap<>();
@ -47,10 +47,18 @@ public class XloveCamTabProvider extends AbstractTabProvider {
tabMap.put("3", "Lesbian"); tabMap.put("3", "Lesbian");
tabMap.put("7", "Male"); tabMap.put("7", "Male");
tabMap.put("5", "Trans"); tabMap.put("5", "Trans");
tabMap.put("all", "All");
List<String> enabledTabs = getEnabledTabs(); List<String> enabledTabs = getEnabledTabs();
for (String tab : enabledTabs) { for (String tab : enabledTabs) {
String title = tabMap.getOrDefault(tab, tab); String title = tabMap.getOrDefault(tab, tab);
updateService = new XloveCamUpdateService(xloveCam, Map.of(FILTER_PARAM, tab)); switch (tab) {
case "all":
updateService = new XloveCamUpdateService(xloveCam, Collections.emptyMap());
break;
default:
updateService = new XloveCamUpdateService(xloveCam, Map.of(FILTER_PARAM, tab));
break;
}
tabs.add(createTab(title, updateService)); tabs.add(createTab(title, updateService));
} }