feat: add button on Setup Dialog to open Privacy Policy

This commit is contained in:
Ryan Dowling 2022-02-25 09:40:17 +11:00
parent 4a4064d64b
commit 47a4125d1a
No known key found for this signature in database
GPG key ID: 5539FCDB88950EFD
4 changed files with 20 additions and 4 deletions

2
.vscode/launch.json vendored
View file

@ -9,7 +9,7 @@
"projectName": "ATLauncher",
"cwd": "${workspaceFolder}/testLauncher",
"preLaunchTask": "createTestLauncherDir",
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update --config-override {\"platforms\":{\"modrinth\":{\"modpacksEnabled\":true}}}",
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update",
},
{
"type": "java",

View file

@ -6,6 +6,7 @@ This changelog only contains the changes that are unreleased. For changes for in
## 3.4.12.1
### New Features
- Add button on Setup Dialog to open Privacy Policy
### Fixes

View file

@ -34,4 +34,8 @@ public class UIConstants {
public static final Insets CHECKBOX_FIELD_INSETS = new Insets(SPACING_LARGE, -SPACING_SMALL, SPACING_LARGE, 0);
public static final Insets CHECKBOX_FIELD_INSETS_SMALL = new Insets(SPACING_SMALL, -SPACING_SMALL, SPACING_SMALL,
0);
// When using FlowLayout with a horizonal margin, we need to negate the first
// components margin added from the FlowLayout
public static final Insets FLOW_FIELD_INSETS = new Insets(SPACING_LARGE, (-SPACING_LARGE) - 3, SPACING_LARGE, 0);
}

View file

@ -42,6 +42,7 @@ import com.atlauncher.evnt.listener.RelocalizationListener;
import com.atlauncher.evnt.manager.RelocalizationManager;
import com.atlauncher.gui.components.JLabelWithHover;
import com.atlauncher.network.Analytics;
import com.atlauncher.utils.OS;
import com.atlauncher.utils.Utils;
import org.mini2Dx.gettext.GetText;
@ -63,7 +64,7 @@ public class SetupDialog extends JDialog implements RelocalizationListener {
// #. {0} is the name of the launcher (ATLauncher)
super(null, GetText.tr("{0} Setup", Constants.LAUNCHER_NAME), ModalityType.DOCUMENT_MODAL);
this.requestFocus();
this.setSize(400, 250);
this.setSize(500, 250);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
setIconImage(Utils.getImage("/assets/image/icon.png"));
@ -113,11 +114,21 @@ public class SetupDialog extends JDialog implements RelocalizationListener {
middle.add(enableAnalyticsLabel, gbc);
gbc.gridx++;
gbc.insets = UIConstants.FIELD_INSETS;
gbc.insets = UIConstants.FLOW_FIELD_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
JPanel enableAnalyticsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, UIConstants.SPACING_LARGE, 0));
enableAnalytics = new JCheckBox();
enableAnalytics.setSelected(!App.disableAnalytics);
middle.add(enableAnalytics, gbc);
enableAnalyticsPanel.add(enableAnalytics);
JButton privacyPolicyButton = new JButton(GetText.tr("Open Privacy Policy"));
privacyPolicyButton.addActionListener(e -> {
OS.openWebBrowser("https://atlauncher.com/privacy-policy");
});
enableAnalyticsPanel.add(privacyPolicyButton);
middle.add(enableAnalyticsPanel, gbc);
// Bottom Panel Stuff
JPanel bottom = new JPanel();