Skip to content

Commit

Permalink
Finally fix that stupid default checkbox, should have intuitive behav…
Browse files Browse the repository at this point in the history
…iour 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)
  • Loading branch information
zpiddock committed Mar 16, 2021
1 parent cd6317a commit 7d98151
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)<br>
[ ![CI Build](https://github.com/InnoxiumTech/CandorManager/workflows/Java%20CI%20with%20Gradle/badge.svg) ](https://github.com/InnoxiumTech/CandorManager) <br>
A new breed of mod manager

# Thanks
Expand All @@ -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?
Expand Down
12 changes: 2 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 '*'
Expand Down Expand Up @@ -247,7 +239,7 @@ publishing {
artifact javadocJar
groupId 'uk.co.innoxium.candor'
artifactId 'candor-api'
version '0.2.18'
version '0.2.20'
}
}
repositories {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/uk/co/innoxium/candor/CandorLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/uk/co/innoxium/candor/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/uk/co/innoxium/candor/window/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down
30 changes: 30 additions & 0 deletions src/main/java/uk/co/innoxium/candor/window/EntryScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;


/**
Expand All @@ -34,6 +36,7 @@ public class EntryScene extends JPanel {
public EntryScene() {

initComponents();
postCreate();
}

private void createUIComponents() {
Expand All @@ -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.
Expand All @@ -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();
Expand Down Expand Up @@ -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));
}
}
}

0 comments on commit 7d98151

Please sign in to comment.