Add region options to CB
This commit is contained in:
parent
e7aad970be
commit
be2df15d2e
|
@ -1,5 +1,8 @@
|
|||
package ctbrec.ui.sites.chaturbate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.sites.chaturbate.Chaturbate;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
|
@ -9,6 +12,7 @@ import javafx.geometry.Insets;
|
|||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
|
||||
public class ChaturbateConfigUi extends AbstractConfigUI {
|
||||
|
@ -100,6 +104,36 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
GridPane.setColumnSpan(requestThrottle, 2);
|
||||
layout.add(requestThrottle, 1, row++);
|
||||
|
||||
Label regionsLabel = new Label("Region Tabs");
|
||||
layout.add(regionsLabel, 0, row);
|
||||
List<String> regions = getChaturbateRegions();
|
||||
|
||||
HBox checkboxContainer = new HBox(10);
|
||||
|
||||
CheckBox asiaOther = new CheckBox("Asia/Oth");
|
||||
asiaOther.setSelected(regions.contains("AS,O"));
|
||||
asiaOther.setOnAction(e -> toggleRegion("AS,O", asiaOther.isSelected()));
|
||||
HBox.setMargin(asiaOther, new Insets(0, 0, 0, 7));
|
||||
checkboxContainer.getChildren().add(asiaOther);
|
||||
|
||||
CheckBox euRu = new CheckBox("Eu/Ru");
|
||||
euRu.setSelected(regions.contains("ER"));
|
||||
euRu.setOnAction(e -> toggleRegion("ER", euRu.isSelected()));
|
||||
checkboxContainer.getChildren().add(euRu);
|
||||
|
||||
CheckBox nthAm = new CheckBox("Nth Am");
|
||||
nthAm.setSelected(regions.contains("NA"));
|
||||
nthAm.setOnAction(e -> toggleRegion("NA", nthAm.isSelected()));
|
||||
checkboxContainer.getChildren().add(nthAm);
|
||||
|
||||
CheckBox sthAm = new CheckBox("Sth Am");
|
||||
sthAm.setSelected(regions.contains("SA"));
|
||||
sthAm.setOnAction(e -> toggleRegion("SA", sthAm.isSelected()));
|
||||
checkboxContainer.getChildren().add(sthAm);
|
||||
|
||||
layout.add(checkboxContainer, 1, row, 4, 1);
|
||||
row++;
|
||||
|
||||
var createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction(e -> DesktopIntegration.open(Chaturbate.REGISTRATION_LINK));
|
||||
layout.add(createAccount, 1, row++);
|
||||
|
@ -121,4 +155,17 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
|
||||
return layout;
|
||||
}
|
||||
private void toggleRegion(String region, boolean selected) {
|
||||
var settings = Config.getInstance().getSettings();
|
||||
if (selected) {
|
||||
settings.chaturbateRegions.add(region);
|
||||
} else {
|
||||
settings.chaturbateRegions.remove(region);
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
private List<String> getChaturbateRegions() {
|
||||
return new ArrayList<>(Config.getInstance().getSettings().chaturbateRegions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ctbrec.ui.sites.chaturbate;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.sites.chaturbate.Chaturbate;
|
||||
import ctbrec.ui.sites.AbstractTabProvider;
|
||||
import ctbrec.ui.tabs.PaginatedScheduledService;
|
||||
|
@ -8,7 +9,9 @@ import javafx.scene.Scene;
|
|||
import javafx.scene.control.Tab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChaturbateTabProvider extends AbstractTabProvider {
|
||||
|
||||
|
@ -33,13 +36,24 @@ public class ChaturbateTabProvider extends AbstractTabProvider {
|
|||
tabs.add(createTab("Trans", apiUrl + "/roomlist/room-list/?enable_recommendations=false&genders=t"));
|
||||
tabs.add(createTab("Private", apiUrl + "/roomlist/room-list/?enable_recommendations=false&private=true"));
|
||||
tabs.add(createTab("Hidden", apiUrl + "/roomlist/room-list/?enable_recommendations=false&hidden=true"));
|
||||
tabs.add(createTab("Gaming", apiUrl + "/roomlist/room-list/?enable_recommendations=false&gaming=true"));
|
||||
// tabs.add(createTab("Gaming", apiUrl + "/roomlist/room-list/?enable_recommendations=false&gaming=true"));
|
||||
Map<String, String> regionMap = new HashMap<>();
|
||||
regionMap.put("AS,O", "Asia/Oth");
|
||||
regionMap.put("ER", "Eu/Ru");
|
||||
regionMap.put("NA", "Nth Amer");
|
||||
regionMap.put("SA", "Sth Amer");
|
||||
List<String> enabledRegions = getChaturbateRegions();
|
||||
for (String region : enabledRegions) {
|
||||
String url = apiUrl + "/roomlist/room-list/?regions=" + region;
|
||||
String title = regionMap.getOrDefault(region, region);
|
||||
tabs.add(createTab(title, url));
|
||||
}
|
||||
followedTab.setScene(scene);
|
||||
followedTab.setRecorder(recorder);
|
||||
followedTab.setImageAspectRatio(9.0 / 16.0);
|
||||
tabs.add(followedTab);
|
||||
tabs.add(createApiTab("Top Rated", apiUrl + "/discover/carousels/top-rated/"));
|
||||
tabs.add(createApiTab("Trending", apiUrl + "/discover/carousels/trending/"));
|
||||
// tabs.add(createApiTab("Top Rated", apiUrl + "/discover/carousels/top-rated/"));
|
||||
// tabs.add(createApiTab("Trending", apiUrl + "/discover/carousels/trending/"));
|
||||
return tabs;
|
||||
}
|
||||
|
||||
|
@ -60,8 +74,12 @@ public class ChaturbateTabProvider extends AbstractTabProvider {
|
|||
return tab;
|
||||
}
|
||||
|
||||
private Tab createApiTab(String title, String apiUrl) {
|
||||
var updateService = new ChaturbateApiUpdateService(apiUrl, (Chaturbate) site);
|
||||
return createTab(title, updateService);
|
||||
// private Tab createApiTab(String title, String apiUrl) {
|
||||
// var updateService = new ChaturbateApiUpdateService(apiUrl, (Chaturbate) site);
|
||||
// return createTab(title, updateService);
|
||||
// }
|
||||
|
||||
private List<String> getChaturbateRegions() {
|
||||
return new ArrayList<>(Config.getInstance().getSettings().chaturbateRegions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ public class Settings {
|
|||
public String xlovecamPassword = "";
|
||||
public boolean stripchatVR = true;
|
||||
public boolean streamrayRecordGoalShows = false;
|
||||
public boolean checkForUpdates = true;
|
||||
public boolean checkForUpdates = false;
|
||||
public int thumbCacheSize = 16;
|
||||
public boolean dreamcamVR = true;
|
||||
public String filterBlacklist = "";
|
||||
|
|
Loading…
Reference in New Issue