From 7d98151d68cfe55541a207f7524f06478d29043d Mon Sep 17 00:00:00 2001 From: Zach Piddock Date: Tue, 16 Mar 2021 20:29:03 +0000 Subject: [PATCH] Finally fix that stupid default checkbox, should have intuitive behaviour now this is tagged as 0.2.20, this is the last build of the 0.2.x range (modules may be updated for this version) --- README.md | 5 ++-- build.gradle | 12 ++------ .../uk/co/innoxium/candor/CandorLauncher.java | 6 +++- .../java/uk/co/innoxium/candor/game/Game.java | 1 + .../innoxium/candor/window/AboutDialog.java | 8 +++++ .../co/innoxium/candor/window/EntryScene.java | 30 +++++++++++++++++++ 6 files changed, 48 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 90b9a8a..95a0c26 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # CandorManager -[ ![CI Build](https://github.com/InnoxiumTech/CandorManager/workflows/Java%20CI%20with%20Gradle/badge.svg) ](https://github.com/InnoxiumTech/CandorManager) -[ ![Download](https://api.bintray.com/packages/candor/candor-alpha/candor-api/images/download.svg) ](https://bintray.com/candor/candor-alpha/candor-api/_latestVersion)
+[ ![CI Build](https://github.com/InnoxiumTech/CandorManager/workflows/Java%20CI%20with%20Gradle/badge.svg) ](https://github.com/InnoxiumTech/CandorManager)
A new breed of mod manager # Thanks @@ -21,7 +20,7 @@ it will also be able to uninstal them without leaving any traces Candor will achieve this by having modules that be added or removed at any time. Each module should only support one game. Modules _could_ support more than one game, but only if those games have the same mod installation method. -Each module will be a JAR file that can be loaded from the "modules" folder in the Candor instal location. +Each module will be a JAR file that can be loaded from the "modules" folder in the Candor install location. Candor will provide a robust API for developers to create new modules, via maven # What isn't Candor? diff --git a/build.gradle b/build.gradle index b51d01d..bd9e91f 100644 --- a/build.gradle +++ b/build.gradle @@ -187,18 +187,10 @@ task copyScripts(type: Copy) { into "$buildDir/packaged" } -task copyGenericModule(type: Copy) { - - dependsOn 'copyScripts' - - from "$projectDir/test" - into "$buildDir/packaged/CandorManager/module" -} - task zipCandor(type: Zip) { - dependsOn 'copyGenericModule' + dependsOn 'copyScripts' from "$buildDir/packaged" // include '*' @@ -247,7 +239,7 @@ publishing { artifact javadocJar groupId 'uk.co.innoxium.candor' artifactId 'candor-api' - version '0.2.18' + version '0.2.20' } } repositories { diff --git a/src/main/java/uk/co/innoxium/candor/CandorLauncher.java b/src/main/java/uk/co/innoxium/candor/CandorLauncher.java index ff1f4d4..a61fb61 100644 --- a/src/main/java/uk/co/innoxium/candor/CandorLauncher.java +++ b/src/main/java/uk/co/innoxium/candor/CandorLauncher.java @@ -32,8 +32,10 @@ public static void main(String[] args) { if(Platform.get() == Platform.MACOSX) { + // This is due to LWJGL being a bit finicky on OSX // We want to restart the application here with the -XstartOnFirstThread JVM argument // This is slightly more difficult for us as we have the java agent to deal with + // TODO: this will be in the candor launcher as part of the launch rather than here } // Get a plash screen instance, currently, we don't do any manipulation, this may be increased in the future. @@ -62,7 +64,7 @@ public static void main(String[] args) { try { // Check if the generic module exists, if not download it. - ModuleSelector.checkGenericModule(); +// ModuleSelector.checkGenericModule(); // Load modules from disk. ModuleSelector.initModules(); // Load the lists of user set up games. @@ -97,6 +99,7 @@ public static void main(String[] args) { private static void setThemeCustomizations() { // The following only works on Windows 10 currently, due it only being implemented on that platform + // TODO: move our menubar in to the JFrame menubar JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); @@ -111,6 +114,7 @@ public void run() { try { + // TODO: move to a new safeExit method which is called before a System.exit call // Write the games and tools list to file GamesList.writeToFile(); ToolsList.writeToJson(); diff --git a/src/main/java/uk/co/innoxium/candor/game/Game.java b/src/main/java/uk/co/innoxium/candor/game/Game.java index 4e518d1..f79be73 100644 --- a/src/main/java/uk/co/innoxium/candor/game/Game.java +++ b/src/main/java/uk/co/innoxium/candor/game/Game.java @@ -15,6 +15,7 @@ /** * An object to represent a "game". + * TODO: remove to/fromJson and have gson handle it, it's rather good */ public class Game { diff --git a/src/main/java/uk/co/innoxium/candor/window/AboutDialog.java b/src/main/java/uk/co/innoxium/candor/window/AboutDialog.java index a9ec09c..b1c92b8 100644 --- a/src/main/java/uk/co/innoxium/candor/window/AboutDialog.java +++ b/src/main/java/uk/co/innoxium/candor/window/AboutDialog.java @@ -53,15 +53,23 @@ private void createUIComponents() { discordLink = new JHyperlink("Discord", "discord.gg/CMG9ZtS"); discordLink.setFont(linkFont); + discordLink.setColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); + discordLink.setHighlightedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); // requires update to SwingExt to function correctly, will be in 0.3.x discordLink.setClickedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb))); githubLink = new JHyperlink("Github", "github.com/InnoxiumTech/CandorManager"); githubLink.setFont(linkFont); + discordLink.setColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); + discordLink.setHighlightedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); discordLink.setClickedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb))); websiteLink = new JHyperlink("Website", "innoxium.co.uk"); websiteLink.setFont(linkFont); + discordLink.setColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); + discordLink.setHighlightedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); discordLink.setClickedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb))); twitterLink = new JHyperlink("Twitter", "twitter.com/InnoxiumTech"); twitterLink.setFont(linkFont); + discordLink.setColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); + discordLink.setHighlightedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb)).darker()); discordLink.setClickedColour(Color.decode(String.valueOf(FlatIconColors.ACTIONS_GREY_DARK.rgb))); } diff --git a/src/main/java/uk/co/innoxium/candor/window/EntryScene.java b/src/main/java/uk/co/innoxium/candor/window/EntryScene.java index a65d651..0e51bbe 100644 --- a/src/main/java/uk/co/innoxium/candor/window/EntryScene.java +++ b/src/main/java/uk/co/innoxium/candor/window/EntryScene.java @@ -15,6 +15,8 @@ import javax.swing.*; import java.awt.event.ActionEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** @@ -34,6 +36,7 @@ public class EntryScene extends JPanel { public EntryScene() { initComponents(); + postCreate(); } private void createUIComponents() { @@ -43,6 +46,11 @@ private void createUIComponents() { gamesList = new JComboBox<>(Utils.getVectorArrayFromList(GamesList.getGamesList())); } + private void postCreate() { + + gamesList.addItemListener(new ChangeListener(defaultCheck)); + } + private void newGameClicked(ActionEvent e) { // Show the game selection scene. @@ -62,6 +70,10 @@ private void loadGameClicked(ActionEvent e) { Settings.defaultGameUuid = game.getUUID().toString(); + } else { + + // Empty it, the user may want to launch the entry screen on next load rather than go to the previous default game + Settings.defaultGameUuid = ""; } // The last game we loaded is now this one. Settings.lastGameUuid = game.getUUID().toString(); @@ -124,4 +136,22 @@ private void initComponents() { add(loadGameButton, "cell 0 2,alignx center,growx 0"); // JFormDesigner - End of component initialization //GEN-END:initComponents } + + class ChangeListener implements ItemListener { + + final JCheckBox defaultCheckbox; + + public ChangeListener(JCheckBox defaultCheckbox) { + + this.defaultCheckbox = defaultCheckbox; + } + + @Override + public void itemStateChanged(ItemEvent e) { + + Game game = (Game)e.getItem(); + + defaultCheckbox.setSelected(game.getUUID().toString().equals(Settings.defaultGameUuid)); + } + } }