dev: enabled debug main menu by default in developer builds (example: test render dialog)

This commit is contained in:
Oleg Agafonov 2023-05-09 00:49:46 +04:00
parent 5c705a92a3
commit bc79b5f5d1
4 changed files with 13 additions and 5 deletions

View file

@ -98,7 +98,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private static final String PASSWORD_ARG = "-pw"; private static final String PASSWORD_ARG = "-pw";
private static final String SERVER_ARG = "-server"; private static final String SERVER_ARG = "-server";
private static final String PORT_ARG = "-port"; private static final String PORT_ARG = "-port";
private static final String DEBUG_ARG = "-debug"; private static final String DEBUG_ARG = "-debug"; // enable debug button in main menu
private static final String NOT_CONNECTED_TEXT = "<not connected>"; private static final String NOT_CONNECTED_TEXT = "<not connected>";
private static final String NOT_CONNECTED_BUTTON = "CONNECT TO SERVER"; private static final String NOT_CONNECTED_BUTTON = "CONNECT TO SERVER";
@ -1327,6 +1327,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
debugMode = true; debugMode = true;
} }
} }
// enable debug menu by default for developer build (if you run it from source code)
debugMode |= VERSION.isDeveloperBuild();
if (!liteMode) { if (!liteMode) {
final SplashScreen splash = SplashScreen.getSplashScreen(); final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null) { if (splash != null) {

View file

@ -87,4 +87,8 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
// all fine // all fine
return 0; return 0;
} }
public boolean isDeveloperBuild() {
return this.buildTime.contains(JarVersion.JAR_BUILD_TIME_FROM_CLASSES);
}
} }

View file

@ -72,7 +72,7 @@ public final class Main {
// - cheat commands; // - cheat commands;
// - no deck validation; // - no deck validation;
// - simplified registration and login (no password check); // - simplified registration and login (no password check);
// - debug main menu for GUI and rendering testing; // - debug main menu for GUI and rendering testing (must use -debug arg for client app);
private static boolean testMode; private static boolean testMode;
private static boolean fastDbMode; private static boolean fastDbMode;
@ -88,12 +88,12 @@ public final class Main {
String adminPassword = ""; String adminPassword = "";
for (String arg : args) { for (String arg : args) {
if (arg.startsWith(testModeArg)) { if (arg.startsWith(testModeArg)) {
testMode = Boolean.valueOf(arg.replace(testModeArg, "")); testMode = Boolean.parseBoolean(arg.replace(testModeArg, ""));
} else if (arg.startsWith(adminPasswordArg)) { } else if (arg.startsWith(adminPasswordArg)) {
adminPassword = arg.replace(adminPasswordArg, ""); adminPassword = arg.replace(adminPasswordArg, "");
adminPassword = SystemUtil.sanitize(adminPassword); adminPassword = SystemUtil.sanitize(adminPassword);
} else if (arg.startsWith(fastDBModeArg)) { } else if (arg.startsWith(fastDBModeArg)) {
fastDbMode = Boolean.valueOf(arg.replace(fastDBModeArg, "")); fastDbMode = Boolean.parseBoolean(arg.replace(fastDBModeArg, ""));
} }
} }

View file

@ -15,7 +15,7 @@ import java.util.jar.Manifest;
public class JarVersion { public class JarVersion {
private static final Logger logger = Logger.getLogger(JarVersion.class); private static final Logger logger = Logger.getLogger(JarVersion.class);
private static final String JAR_BUILD_TIME_FROM_CLASSES = "runtime"; public static final String JAR_BUILD_TIME_FROM_CLASSES = "runtime";
private static final String JAR_BUILD_TIME_ERROR = "n/a"; private static final String JAR_BUILD_TIME_ERROR = "n/a";
public static String getBuildTime(Class clazz) { public static String getBuildTime(Class clazz) {