forked from j62/ctbrec
Move site activation checkbox to their config ui
This commit is contained in:
parent
90e033d2ac
commit
b100f107d4
|
@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Hmac;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.Settings.DirectoryStructure;
|
||||
import ctbrec.StringUtil;
|
||||
import ctbrec.sites.ConfigUI;
|
||||
|
@ -83,7 +82,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
private ComboBox<String> startTab;
|
||||
private List<Site> sites;
|
||||
private Label restartLabel;
|
||||
private Accordion credentialsAccordion = new Accordion();
|
||||
private Accordion siteConfigAccordion = new Accordion();
|
||||
|
||||
public SettingsTab(List<Site> sites) {
|
||||
this.sites = sites;
|
||||
|
@ -127,8 +126,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
leftSide.getChildren().add(createRecordLocationPanel());
|
||||
|
||||
//right side
|
||||
rightSide.getChildren().add(createSiteSelectionPanel());
|
||||
rightSide.getChildren().add(credentialsAccordion);
|
||||
rightSide.getChildren().add(siteConfigAccordion);
|
||||
proxySettingsPane = new ProxySettingsPane(this);
|
||||
rightSide.getChildren().add(proxySettingsPane);
|
||||
for (int i = 0; i < sites.size(); i++) {
|
||||
|
@ -136,39 +134,10 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
|||
ConfigUI siteConfig = SiteUiFactory.getUi(site).getConfigUI();
|
||||
if(siteConfig != null) {
|
||||
TitledPane pane = new TitledPane(site.getName(), siteConfig.createConfigPanel());
|
||||
credentialsAccordion.getPanes().add(pane);
|
||||
siteConfigAccordion.getPanes().add(pane);
|
||||
}
|
||||
}
|
||||
credentialsAccordion.setExpandedPane(credentialsAccordion.getPanes().get(0));
|
||||
}
|
||||
|
||||
private Node createSiteSelectionPanel() {
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
GridPane layout = createGridLayout();
|
||||
|
||||
int row = 0;
|
||||
for (Site site : sites) {
|
||||
Label l = new Label(site.getName());
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(site.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(site.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(site.getName());
|
||||
}
|
||||
saveConfig();
|
||||
showRestartRequired();
|
||||
});
|
||||
GridPane.setMargin(l, new Insets(CHECKBOX_MARGIN, 0, 0, 0));
|
||||
GridPane.setMargin(enabled, new Insets(CHECKBOX_MARGIN, 0, 0, CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
}
|
||||
|
||||
TitledPane siteSelection = new TitledPane("Enabled Sites", layout);
|
||||
siteSelection.setCollapsible(false);
|
||||
return siteSelection;
|
||||
siteConfigAccordion.setExpandedPane(siteConfigAccordion.getPanes().get(0));
|
||||
}
|
||||
|
||||
private Node createRecordLocationPanel() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.sites.bonga;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.sites.bonga.BongaCams;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.SettingsTab;
|
||||
|
@ -8,6 +9,7 @@ import ctbrec.ui.sites.AbstractConfigUI;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -24,32 +26,50 @@ public class BongaCamsConfigUI extends AbstractConfigUI {
|
|||
@Override
|
||||
public Parent createConfigPanel() {
|
||||
GridPane layout = SettingsTab.createGridLayout();
|
||||
layout.add(new Label("BongaCams User"), 0, 0);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().bongaUsername);
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
|
||||
int row = 0;
|
||||
Label l = new Label("Active");
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(bongaCams.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(bongaCams.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(bongaCams.getName());
|
||||
}
|
||||
save();
|
||||
});
|
||||
GridPane.setMargin(enabled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
|
||||
layout.add(new Label("BongaCams User"), 0, row);
|
||||
TextField username = new TextField(settings.bongaUsername);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().bongaUsername = username.getText();
|
||||
settings.bongaUsername = username.getText();
|
||||
save();
|
||||
});
|
||||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(username, 2);
|
||||
layout.add(username, 1, 0);
|
||||
layout.add(username, 1, row++);
|
||||
|
||||
layout.add(new Label("BongaCams Password"), 0, 1);
|
||||
layout.add(new Label("BongaCams Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().bongaPassword);
|
||||
password.setText(settings.bongaPassword);
|
||||
password.focusedProperty().addListener((e) -> {
|
||||
Config.getInstance().getSettings().bongaPassword = password.getText();
|
||||
settings.bongaPassword = password.getText();
|
||||
save();
|
||||
});
|
||||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(password, 2);
|
||||
layout.add(password, 1, 1);
|
||||
layout.add(password, 1, row++);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction((e) -> DesktopIntegration.open(bongaCams.getAffiliateLink()));
|
||||
layout.add(createAccount, 1, 2);
|
||||
layout.add(createAccount, 1, row++);
|
||||
GridPane.setColumnSpan(createAccount, 2);
|
||||
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.sites.cam4;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.sites.cam4.Cam4;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.SettingsTab;
|
||||
|
@ -8,6 +9,7 @@ import ctbrec.ui.sites.AbstractConfigUI;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -15,10 +17,34 @@ import javafx.scene.layout.GridPane;
|
|||
import javafx.scene.layout.Priority;
|
||||
|
||||
public class Cam4ConfigUI extends AbstractConfigUI {
|
||||
private Cam4 cam4;
|
||||
|
||||
public Cam4ConfigUI(Cam4 cam4) {
|
||||
this.cam4 = cam4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parent createConfigPanel() {
|
||||
GridPane layout = SettingsTab.createGridLayout();
|
||||
layout.add(new Label("Cam4 User"), 0, 0);
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
|
||||
int row = 0;
|
||||
Label l = new Label("Active");
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(cam4.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(cam4.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(cam4.getName());
|
||||
}
|
||||
save();
|
||||
});
|
||||
GridPane.setMargin(enabled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
|
||||
layout.add(new Label("Cam4 User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().cam4Username);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().cam4Username = username.getText();
|
||||
|
@ -27,9 +53,9 @@ public class Cam4ConfigUI extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(username, 2);
|
||||
layout.add(username, 1, 0);
|
||||
layout.add(username, 1, row++);
|
||||
|
||||
layout.add(new Label("Cam4 Password"), 0, 1);
|
||||
layout.add(new Label("Cam4 Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().cam4Password);
|
||||
password.focusedProperty().addListener((e) -> {
|
||||
|
@ -39,11 +65,11 @@ public class Cam4ConfigUI extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(password, 2);
|
||||
layout.add(password, 1, 1);
|
||||
layout.add(password, 1, row++);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction((e) -> DesktopIntegration.open(Cam4.AFFILIATE_LINK));
|
||||
layout.add(createAccount, 1, 2);
|
||||
layout.add(createAccount, 1, row++);
|
||||
GridPane.setColumnSpan(createAccount, 2);
|
||||
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
|
|
|
@ -30,7 +30,7 @@ public class Cam4SiteUi implements SiteUI {
|
|||
public Cam4SiteUi(Cam4 cam4) {
|
||||
this.cam4 = cam4;
|
||||
tabProvider = new Cam4TabProvider(cam4);
|
||||
configUI = new Cam4ConfigUI();
|
||||
configUI = new Cam4ConfigUI(cam4);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.sites.camsoda;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.sites.camsoda.Camsoda;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.SettingsTab;
|
||||
|
@ -8,6 +9,7 @@ import ctbrec.ui.sites.AbstractConfigUI;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -24,7 +26,25 @@ public class CamsodaConfigUI extends AbstractConfigUI {
|
|||
@Override
|
||||
public Parent createConfigPanel() {
|
||||
GridPane layout = SettingsTab.createGridLayout();
|
||||
layout.add(new Label("CamSoda User"), 0, 0);
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
|
||||
int row = 0;
|
||||
Label l = new Label("Active");
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(camsoda.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(camsoda.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(camsoda.getName());
|
||||
}
|
||||
save();
|
||||
});
|
||||
GridPane.setMargin(enabled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
|
||||
layout.add(new Label("CamSoda User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().camsodaUsername);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().camsodaUsername = username.getText();
|
||||
|
@ -33,9 +53,9 @@ public class CamsodaConfigUI extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(username, 2);
|
||||
layout.add(username, 1, 0);
|
||||
layout.add(username, 1, row++);
|
||||
|
||||
layout.add(new Label("CamSoda Password"), 0, 1);
|
||||
layout.add(new Label("CamSoda Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().camsodaPassword);
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
|
@ -45,11 +65,11 @@ public class CamsodaConfigUI extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(password, 2);
|
||||
layout.add(password, 1, 1);
|
||||
layout.add(password, 1, row++);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction((e) -> DesktopIntegration.open(camsoda.getAffiliateLink()));
|
||||
layout.add(createAccount, 1, 2);
|
||||
layout.add(createAccount, 1, row++);
|
||||
GridPane.setColumnSpan(createAccount, 2);
|
||||
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.sites.chaturbate;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.sites.chaturbate.Chaturbate;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.SettingsTab;
|
||||
|
@ -8,6 +9,7 @@ import ctbrec.ui.sites.AbstractConfigUI;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -15,11 +17,34 @@ import javafx.scene.layout.GridPane;
|
|||
import javafx.scene.layout.Priority;
|
||||
|
||||
public class ChaturbateConfigUi extends AbstractConfigUI {
|
||||
private Chaturbate chaturbate;
|
||||
|
||||
public ChaturbateConfigUi(Chaturbate chaturbate) {
|
||||
this.chaturbate = chaturbate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parent createConfigPanel() {
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
GridPane layout = SettingsTab.createGridLayout();
|
||||
|
||||
layout.add(new Label("Chaturbate User"), 0, 0);
|
||||
int row = 0;
|
||||
Label l = new Label("Active");
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(chaturbate.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(chaturbate.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(chaturbate.getName());
|
||||
}
|
||||
save();
|
||||
});
|
||||
GridPane.setMargin(enabled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
|
||||
layout.add(new Label("Chaturbate User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().username);
|
||||
username.textProperty().addListener((ob, o, n) -> {
|
||||
Config.getInstance().getSettings().username = username.getText();
|
||||
|
@ -28,9 +53,9 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(username, true);
|
||||
GridPane.setHgrow(username, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(username, 2);
|
||||
layout.add(username, 1, 0);
|
||||
layout.add(username, 1, row++);
|
||||
|
||||
layout.add(new Label("Chaturbate Password"), 0, 1);
|
||||
layout.add(new Label("Chaturbate Password"), 0, row);
|
||||
PasswordField password = new PasswordField();
|
||||
password.setText(Config.getInstance().getSettings().password);
|
||||
password.textProperty().addListener((ob, o, n) -> {
|
||||
|
@ -40,9 +65,9 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(password, true);
|
||||
GridPane.setHgrow(password, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(password, 2);
|
||||
layout.add(password, 1, 1);
|
||||
layout.add(password, 1, row++);
|
||||
|
||||
layout.add(new Label("Chaturbate Base URL"), 0, 2);
|
||||
layout.add(new Label("Chaturbate Base URL"), 0, row);
|
||||
TextField baseUrl = new TextField();
|
||||
baseUrl.setText(Config.getInstance().getSettings().chaturbateBaseUrl);
|
||||
baseUrl.textProperty().addListener((ob, o, n) -> {
|
||||
|
@ -52,11 +77,11 @@ public class ChaturbateConfigUi extends AbstractConfigUI {
|
|||
GridPane.setFillWidth(baseUrl, true);
|
||||
GridPane.setHgrow(baseUrl, Priority.ALWAYS);
|
||||
GridPane.setColumnSpan(baseUrl, 2);
|
||||
layout.add(baseUrl, 1, 2);
|
||||
layout.add(baseUrl, 1, row++);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction((e) -> DesktopIntegration.open(Chaturbate.REGISTRATION_LINK));
|
||||
layout.add(createAccount, 1, 3);
|
||||
layout.add(createAccount, 1, row++);
|
||||
GridPane.setColumnSpan(createAccount, 2);
|
||||
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ChaturbateSiteUi implements SiteUI {
|
|||
public ChaturbateSiteUi(Chaturbate chaturbate) {
|
||||
this.chaturbate = chaturbate;
|
||||
tabProvider = new ChaturbateTabProvider(chaturbate);
|
||||
configUi = new ChaturbateConfigUi();
|
||||
configUi = new ChaturbateConfigUi(chaturbate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui.sites.myfreecams;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Settings;
|
||||
import ctbrec.sites.mfc.MyFreeCams;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import ctbrec.ui.SettingsTab;
|
||||
|
@ -26,6 +27,23 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
|
|||
public Parent createConfigPanel() {
|
||||
int row = 0;
|
||||
GridPane layout = SettingsTab.createGridLayout();
|
||||
Settings settings = Config.getInstance().getSettings();
|
||||
|
||||
Label l = new Label("Active");
|
||||
layout.add(l, 0, row);
|
||||
CheckBox enabled = new CheckBox();
|
||||
enabled.setSelected(!settings.disabledSites.contains(myFreeCams.getName()));
|
||||
enabled.setOnAction((e) -> {
|
||||
if(enabled.isSelected()) {
|
||||
settings.disabledSites.remove(myFreeCams.getName());
|
||||
} else {
|
||||
settings.disabledSites.add(myFreeCams.getName());
|
||||
}
|
||||
save();
|
||||
});
|
||||
GridPane.setMargin(enabled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
layout.add(enabled, 1, row++);
|
||||
|
||||
layout.add(new Label("MyFreeCams User"), 0, row);
|
||||
TextField username = new TextField(Config.getInstance().getSettings().mfcUsername);
|
||||
username.setPrefWidth(300);
|
||||
|
|
Loading…
Reference in New Issue