Add tab options for BC
This commit is contained in:
parent
95fd03b3c9
commit
e7aad970be
|
@ -5,6 +5,8 @@ import ctbrec.sites.bonga.BongaCams;
|
|||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.settings.SettingsTab;
|
||||
import ctbrec.ui.sites.AbstractConfigUI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
|
@ -13,6 +15,7 @@ import javafx.scene.control.Label;
|
|||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
|
||||
public class BongaCamsConfigUI extends AbstractConfigUI {
|
||||
|
@ -85,6 +88,36 @@ public class BongaCamsConfigUI extends AbstractConfigUI {
|
|||
GridPane.setColumnSpan(baseUrl, 2);
|
||||
layout.add(baseUrl, 1, row++);
|
||||
|
||||
Label tabsLabel = new Label("Tabs");
|
||||
layout.add(tabsLabel, 0, row);
|
||||
List<String> bcTabs = getBongaTabs();
|
||||
|
||||
HBox checkboxContainer = new HBox(10);
|
||||
|
||||
CheckBox bcFemale = new CheckBox("Female");
|
||||
bcFemale.setSelected(bcTabs.contains("female"));
|
||||
bcFemale.setOnAction(e -> toggleTabs("female", bcFemale.isSelected()));
|
||||
HBox.setMargin(bcFemale, new Insets(0, 0, 0, 7));
|
||||
checkboxContainer.getChildren().add(bcFemale);
|
||||
|
||||
CheckBox bcMale = new CheckBox("Male");
|
||||
bcMale.setSelected(bcTabs.contains("male"));
|
||||
bcMale.setOnAction(e -> toggleTabs("male", bcMale.isSelected()));
|
||||
checkboxContainer.getChildren().add(bcMale);
|
||||
|
||||
CheckBox bcCouples = new CheckBox("Couples");
|
||||
bcCouples.setSelected(bcTabs.contains("couples"));
|
||||
bcCouples.setOnAction(e -> toggleTabs("couples", bcCouples.isSelected()));
|
||||
checkboxContainer.getChildren().add(bcCouples);
|
||||
|
||||
CheckBox bcTrans = new CheckBox("Trans");
|
||||
bcTrans.setSelected(bcTabs.contains("trans"));
|
||||
bcTrans.setOnAction(e -> toggleTabs("trans", bcTrans.isSelected()));
|
||||
checkboxContainer.getChildren().add(bcTrans);
|
||||
|
||||
layout.add(checkboxContainer, 1, row, 4, 1);
|
||||
row++;
|
||||
|
||||
var createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction(e -> DesktopIntegration.open(bongaCams.getAffiliateLink()));
|
||||
layout.add(createAccount, 1, row++);
|
||||
|
@ -103,4 +136,17 @@ public class BongaCamsConfigUI extends AbstractConfigUI {
|
|||
return layout;
|
||||
}
|
||||
|
||||
private void toggleTabs(String tab, boolean selected) {
|
||||
var settings = Config.getInstance().getSettings();
|
||||
if (selected) {
|
||||
settings.bongaTabs.add(tab);
|
||||
} else {
|
||||
settings.bongaTabs.remove(tab);
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
private List<String> getBongaTabs() {
|
||||
return new ArrayList<>(Config.getInstance().getSettings().bongaTabs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ctbrec.ui.sites.bonga;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.sites.bonga.BongaCams;
|
||||
import ctbrec.ui.sites.AbstractTabProvider;
|
||||
import ctbrec.ui.tabs.PaginatedScheduledService;
|
||||
|
@ -8,10 +9,14 @@ 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 BongaCamsTabProvider extends AbstractTabProvider {
|
||||
|
||||
private String url;
|
||||
private PaginatedScheduledService updateService;
|
||||
private BongaCamsFriendsTab friendsTab;
|
||||
|
||||
public BongaCamsTabProvider(BongaCams bongaCams) {
|
||||
|
@ -22,25 +27,18 @@ public class BongaCamsTabProvider extends AbstractTabProvider {
|
|||
protected List<Tab> getSiteTabs(Scene scene) {
|
||||
List<Tab> tabs = new ArrayList<>();
|
||||
|
||||
// female
|
||||
String url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=female&online_only=true&is_mobile=true&limit=72&offset=";
|
||||
var updateService = new BongaCamsUpdateService((BongaCams) site, url);
|
||||
tabs.add(createTab("Female", updateService));
|
||||
|
||||
// male
|
||||
url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=male&online_only=true&is_mobile=true&limit=72&offset=";
|
||||
updateService = new BongaCamsUpdateService((BongaCams) site, url);
|
||||
tabs.add(createTab("Male", updateService));
|
||||
|
||||
// couples
|
||||
url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=couples&online_only=true&is_mobile=true&limit=72&offset=";
|
||||
updateService = new BongaCamsUpdateService((BongaCams) site, url);
|
||||
tabs.add(createTab("Couples", updateService));
|
||||
|
||||
// trans
|
||||
url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=transsexual&online_only=true&is_mobile=true&limit=72&offset=";
|
||||
updateService = new BongaCamsUpdateService((BongaCams) site, url);
|
||||
tabs.add(createTab("Transsexual", updateService));
|
||||
Map<String, String> tabMap = new HashMap<>();
|
||||
tabMap.put("female", "Female");
|
||||
tabMap.put("male", "Male");
|
||||
tabMap.put("couple", "Couple");
|
||||
tabMap.put("trans", "Trans");
|
||||
List<String> enabledTabs = getBongaTabs();
|
||||
for (String tab : enabledTabs) {
|
||||
String url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=" + tab + "&online_only=true&is_mobile=true&limit=72&offset=";
|
||||
updateService = new BongaCamsUpdateService((BongaCams) site, url);
|
||||
String title = tabMap.getOrDefault(tab, tab);
|
||||
tabs.add(createTab(title, updateService));
|
||||
}
|
||||
|
||||
// mobile
|
||||
url = site.getBaseUrl() + "/tools/listing_v3.php?livetab=all&online_only=true&tag=mobile-live&limit=72&offset=";
|
||||
|
@ -73,4 +71,8 @@ public class BongaCamsTabProvider extends AbstractTabProvider {
|
|||
return tab;
|
||||
}
|
||||
|
||||
private List<String> getBongaTabs() {
|
||||
return new ArrayList<>(Config.getInstance().getSettings().bongaTabs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public class Settings {
|
|||
public String bongacamsBaseUrl = "https://bongacams.com";
|
||||
public String bongaPassword = "";
|
||||
public String bongaUsername = "";
|
||||
public Set<String> bongaTabs = new HashSet<>();
|
||||
public String cam4Password = "";
|
||||
public String cam4Username = "";
|
||||
public String camsodaPassword = "";
|
||||
|
|
Loading…
Reference in New Issue