Added svg logo and started work on the installer
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="2040" height="2040">
|
||||
<!-- Distant Horizons logo in svg format -->
|
||||
<!-- Converted svg made by coolGi -->
|
||||
<!-- Made by hand so there may be inaccuracies -->
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Colors used
|
||||
|
||||
Blue: "fill:#465AA8"
|
||||
Green: "fill:#5C7E3C"
|
||||
Wierd green: "fill:#DCD7AA"
|
||||
-->
|
||||
|
||||
|
||||
<!-- Big Blue -->
|
||||
<polygon points="1018.5,15 1434,255 1018.5,486 603,255" style="fill:#465AA8" />
|
||||
<polygon points="1460,270 1875.5,509.5 1460,750 1045,509" style="fill:#465AA8" />
|
||||
<polygon points="1889,531.5 1889,1012 1473,1252 1473,772" style="fill:#465AA8" />
|
||||
<!-- Big Green -->
|
||||
<polygon points="577,269 992,510 577,750 162,509.5" style="fill:#5C7E3C" />
|
||||
<polygon points="149,532 564,772 564,1252 149,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="1889,1041 1889,1522 1474,1762 1473,1281" style="fill:#5C7E3C" />
|
||||
<!-- Big Wierd Green -->
|
||||
<polygon points="149,1042 564,1282 564,1762 149,1522" style="fill:#DCD7AA" />
|
||||
<polygon points="590,1297 1006,1537 1006,2017 590,1777" style="fill:#DCD7AA" />
|
||||
<polygon points="1031,1537 1447,1297 1447,1777 1031,2017" style="fill:#DCD7AA" />
|
||||
|
||||
|
||||
<!-- Mid Blue -->
|
||||
<polygon points="1239.5,652 1434,764.5 1239.5,877 1045,764.5" style="fill:#465AA8" />
|
||||
<polygon points="1447,787 1447,1012 1252,1125 1252,899" style="fill:#465AA8" />
|
||||
<!-- Mid Green -->
|
||||
<polygon points="1018.5,525 1214,637 1018.5,749 824,637" style="fill:#5C7E3C" />
|
||||
<polygon points="798,652 992,764.5 798,877 603,764.5" style="fill:#5C7E3C" />
|
||||
<polygon points="590,787 785,899 785,1125 590,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="1447,1042 1447,1267 1252,1380 1252,1154" style="fill:#5C7E3C" />
|
||||
<polygon points="1226,1170 1226,1395 1031,1507 1031,1282" style="fill:#5C7E3C" />
|
||||
<!-- Mid Wierd Green -->
|
||||
<polygon points="590,1042 785,1154 785,1379 590,1267" style="fill:#DCD7AA" />
|
||||
<polygon points="811,1169 1006,1282 1006,1507 811,1395" style="fill:#DCD7AA" />
|
||||
|
||||
<!-- Out Small Blue -->
|
||||
<polygon points="1018.5,779.5 1103,828 1018.5,877 934,828" style="fill:#465AA8" />
|
||||
<polygon points="1129,843 1214,892 1129,941 1044,892" style="fill:#465AA8" />
|
||||
<polygon points="1226,914 1226,1012 1142,1061 1142,963" style="fill:#465AA8" />
|
||||
<polygon points="1226,1042 1226,1140 1142,1188 1142,1090" style="fill:#465AA8" />
|
||||
<polygon points="1116,1105 1116,1203 1031,1252 1031,1154" style="fill:#465AA8" />
|
||||
<!-- Out Small Green -->
|
||||
<polygon points="908,843 993,892 908,941 823,892" style="fill:#5C7E3C" />
|
||||
<polygon points="811,914 895,963 895,1061 811,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="921,1105 1006,1154 1006,1252 921,1203" style="fill:#5C7E3C" />
|
||||
<!-- Out Small Wierd Green -->
|
||||
<polygon points="811,1042 895,1090 895,1188 811,1140" style="fill:#DCD7AA" />
|
||||
|
||||
<!-- In Small Blue -->
|
||||
<polygon points="1116,978 1116,1076 1031,1125 1031,1027" style="fill:#465AA8" />
|
||||
<!-- In Small Green -->
|
||||
<polygon points="1018.5,907 1103,956 1018.5,1004 934,956" style="fill:#5C7E3C" />
|
||||
<polygon points="921,978 1006,1027 1006,1125 921,1076" style="fill:#5C7E3C" />
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -2,9 +2,12 @@ package com.seibel.lod.core;
|
||||
|
||||
import com.formdev.flatlaf.FlatDarkLaf;
|
||||
import com.formdev.flatlaf.FlatLightLaf;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||
import com.seibel.lod.core.jar.DarkModeDetector;
|
||||
import com.seibel.lod.core.jar.BaseJFrame;
|
||||
import com.seibel.lod.core.jar.JarDependencySetup;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -32,12 +35,49 @@ public class JarMain {
|
||||
|
||||
|
||||
JarDependencySetup.createInitialBindings();
|
||||
SingletonHandler.finishBinding();
|
||||
System.out.println("WARNING: The standalone jar still work in progress");
|
||||
JOptionPane.showMessageDialog(null, "The GUI for the standalone jar isn't made yet\nIf you want to use the mod then put it in your mods folder", "Distant Horizons", JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
/*
|
||||
To other devs
|
||||
|
||||
For now im just working on linux stuff (so i can use the linux file system when installing the mod)
|
||||
once i got it working ill fix it for windows/mac
|
||||
*/
|
||||
if (!getOperatingSystem().equals(OperatingSystem.LINUX)) {
|
||||
JOptionPane.showMessageDialog(null, "The GUI for the standalone jar isn't made yet\nIf you want to use the mod then put it in your mods folder", "Distant Horizons", JOptionPane.WARNING_MESSAGE);
|
||||
System.out.println("If you want the gui then please use linux for the time being.\nWindows and MacOS support will come later on");
|
||||
return;
|
||||
}
|
||||
|
||||
BaseJFrame frame = new BaseJFrame(false, false);
|
||||
String[] optionsToChoose = {"Apple", "Orange", "Banana", "Pineapple", "None of the listed"};
|
||||
JComboBox<String> jTest = new JComboBox<>(optionsToChoose);
|
||||
jTest.setBounds(80, 50, 140, 20);
|
||||
frame.add(jTest);
|
||||
|
||||
|
||||
frame.setLayout(null); // Remove the default layout
|
||||
|
||||
frame.validate(); // Update to add the widgets
|
||||
frame.setVisible(true); // Start the ui
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum OperatingSystem {WINDOWS, MACOS, LINUX, NONE}
|
||||
public static OperatingSystem getOperatingSystem() {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (os.contains("win")) {
|
||||
return OperatingSystem.WINDOWS;
|
||||
} else if (os.contains("mac")) {
|
||||
return OperatingSystem.MACOS;
|
||||
} else if (os.contains("nix") || os.contains("nux")) {
|
||||
return OperatingSystem.LINUX;
|
||||
} else {
|
||||
return OperatingSystem.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a file within the mods resources */
|
||||
public static InputStream accessFile(String resource) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.seibel.lod.core.jar;
|
||||
|
||||
import com.seibel.lod.core.JarMain;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
|
||||
public class BaseJFrame extends JFrame {
|
||||
public BaseJFrame() {
|
||||
init();
|
||||
}
|
||||
public BaseJFrame(boolean show, boolean resizable) {
|
||||
init();
|
||||
setVisible(show);
|
||||
setResizable(resizable);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setTitle(SingletonHandler.get(IConfigWrapper.class).getLang("lod.title"));
|
||||
try {
|
||||
setIconImage(ImageIO.read(JarMain.accessFile("icon.png")));
|
||||
} catch (Exception e) {e.printStackTrace();}
|
||||
setSize(1280,720);
|
||||
setLocationRelativeTo(null); // Puts the window at the middle of the screen
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.seibel.lod.core.jar;
|
||||
import java.io.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.seibel.lod.core.JarMain.getOperatingSystem;
|
||||
|
||||
/**
|
||||
* A fork of iris'is dark mode detector (https://github.com/IrisShaders/Iris-Installer/blob/master/src/main/java/net/hypercubemc/iris_installer/DarkModeDetector.java)
|
||||
* Which is a fork of HanSolo's dark mode detector (https://gist.github.com/HanSolo/7cf10b86efff8ca2845bf5ec2dd0fe1d)
|
||||
@@ -14,8 +16,6 @@ import java.util.regex.Pattern;
|
||||
* @author coolGi2007
|
||||
*/
|
||||
public class DarkModeDetector {
|
||||
public enum OperatingSystem {WINDOWS, MACOS, LINUX, SOLARIS, NONE}
|
||||
|
||||
private static final String REGQUERY_UTIL = "reg query ";
|
||||
private static final String REGDWORD_TOKEN = "REG_DWORD";
|
||||
private static final String DARK_THEME_CMD = REGQUERY_UTIL + "\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize\"" + " /v AppsUseLightTheme";
|
||||
@@ -28,7 +28,6 @@ public class DarkModeDetector {
|
||||
return isMacOsDarkMode();
|
||||
case LINUX:
|
||||
return checkLinuxDark();
|
||||
case SOLARIS: // Idk anyone who uses solaris so we skip them
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -63,7 +62,7 @@ public class DarkModeDetector {
|
||||
}
|
||||
|
||||
|
||||
// On linux there are 2 popilar formats for theming
|
||||
// On Linux there are 2 popular formats for theming
|
||||
// They are qt and gtk. We check the desktop environment and use that to pick which one to use (if none work then use GTK)
|
||||
public static boolean checkLinuxDark() {
|
||||
// Checks "/usr/bin" as "echo $XDG_CURRENT_DESKTOP" dosnt work in java and dosnt detect window managers
|
||||
@@ -80,7 +79,7 @@ public class DarkModeDetector {
|
||||
}
|
||||
|
||||
public static boolean GTKChecker() {
|
||||
// Checks if the return to "gsettings get org.gnome.desktop.interface color-scheme" in terminal is 'prefer-dark' or contains thw word dark in it
|
||||
// Checks if the return to "gsettings get org.gnome.desktop.interface color-scheme" in terminal is 'prefer-dark' or contains the word dark in it
|
||||
final Pattern darkThemeNamePattern = Pattern.compile(".*dark.*", Pattern.CASE_INSENSITIVE);
|
||||
return darkThemeNamePattern.matcher(query("gsettings get org.gnome.desktop.interface color-scheme")).matches();
|
||||
}
|
||||
@@ -90,14 +89,14 @@ public class DarkModeDetector {
|
||||
// With that you grayscale the rgb and check if it is over/under 128
|
||||
|
||||
// If there is a better way of doing this then please let me know
|
||||
// This seems like the best way as qt dosnt have a preference and just stores pure color values
|
||||
// This seems like the best way as qt dosnt have a dark/light preference and just stores pure color values
|
||||
|
||||
try {
|
||||
File themeFile = new File(System.getProperty("user.home") + "/.config/Trolltech.conf");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(themeFile));
|
||||
String themeLine = reader.readLine();
|
||||
while (themeLine != null) { // Go trough each line till you find "KWinPalette\activeBackground"
|
||||
while (themeLine != null) { // Go through each line till you find "KWinPalette\activeBackground"
|
||||
if (themeLine.contains("KWinPalette\\activeBackground"))
|
||||
break;
|
||||
themeLine = reader.readLine();
|
||||
@@ -118,46 +117,6 @@ public class DarkModeDetector {
|
||||
|
||||
|
||||
|
||||
|
||||
@Deprecated // I was going to do a check for each desktop before but decided to check the gtk and qt values instead
|
||||
public static boolean XfceChecker() {
|
||||
// Bit of a bad way of doing this but it checks "~/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml"
|
||||
// Then it checks for line <property name="ThemeName" type="string" value="THEME_THINGY"/> and checks if that line includes the word dark
|
||||
|
||||
|
||||
try { // Just wrap entire code in try/catch, fixes everything (TODO dont put everything in try/catch)
|
||||
File themeFile = new File(System.getProperty("user.home") + "/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(themeFile));
|
||||
String themeLine = reader.readLine();
|
||||
while (themeLine != null) { // Go trough each line till you find "KWinPalette\activeBackground"
|
||||
if (themeLine.contains("name=\"ThemeName\""))
|
||||
break;
|
||||
themeLine = reader.readLine();
|
||||
}
|
||||
reader.close();
|
||||
|
||||
return themeLine.toLowerCase().contains("dark");
|
||||
} catch (Exception e) { e.printStackTrace(); return false;}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static OperatingSystem getOperatingSystem() {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (os.contains("win")) {
|
||||
return OperatingSystem.WINDOWS;
|
||||
} else if (os.contains("mac")) {
|
||||
return OperatingSystem.MACOS;
|
||||
} else if (os.contains("nix") || os.contains("nux")) {
|
||||
return OperatingSystem.LINUX;
|
||||
} else if (os.contains("sunos")) {
|
||||
return OperatingSystem.SOLARIS;
|
||||
} else {
|
||||
return OperatingSystem.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/** Runs a command trough command line */
|
||||
private static String query(String cmd) {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="2040" height="2040">
|
||||
<!-- Distant Horizons logo in svg format -->
|
||||
<!-- Converted svg made by coolGi -->
|
||||
<!-- Made by hand so there may be inaccuracies -->
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Colors used
|
||||
|
||||
Blue: "fill:#465AA8"
|
||||
Green: "fill:#5C7E3C"
|
||||
Wierd green: "fill:#DCD7AA"
|
||||
-->
|
||||
|
||||
|
||||
<!-- Big Blue -->
|
||||
<polygon points="1018.5,15 1434,255 1018.5,486 603,255" style="fill:#465AA8" />
|
||||
<polygon points="1460,270 1875.5,509.5 1460,750 1045,509" style="fill:#465AA8" />
|
||||
<polygon points="1889,531.5 1889,1012 1473,1252 1473,772" style="fill:#465AA8" />
|
||||
<!-- Big Green -->
|
||||
<polygon points="577,269 992,510 577,750 162,509.5" style="fill:#5C7E3C" />
|
||||
<polygon points="149,532 564,772 564,1252 149,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="1889,1041 1889,1522 1474,1762 1473,1281" style="fill:#5C7E3C" />
|
||||
<!-- Big Wierd Green -->
|
||||
<polygon points="149,1042 564,1282 564,1762 149,1522" style="fill:#DCD7AA" />
|
||||
<polygon points="590,1297 1006,1537 1006,2017 590,1777" style="fill:#DCD7AA" />
|
||||
<polygon points="1031,1537 1447,1297 1447,1777 1031,2017" style="fill:#DCD7AA" />
|
||||
|
||||
|
||||
<!-- Mid Blue -->
|
||||
<polygon points="1239.5,652 1434,764.5 1239.5,877 1045,764.5" style="fill:#465AA8" />
|
||||
<polygon points="1447,787 1447,1012 1252,1125 1252,899" style="fill:#465AA8" />
|
||||
<!-- Mid Green -->
|
||||
<polygon points="1018.5,525 1214,637 1018.5,749 824,637" style="fill:#5C7E3C" />
|
||||
<polygon points="798,652 992,764.5 798,877 603,764.5" style="fill:#5C7E3C" />
|
||||
<polygon points="590,787 785,899 785,1125 590,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="1447,1042 1447,1267 1252,1380 1252,1154" style="fill:#5C7E3C" />
|
||||
<polygon points="1226,1170 1226,1395 1031,1507 1031,1282" style="fill:#5C7E3C" />
|
||||
<!-- Mid Wierd Green -->
|
||||
<polygon points="590,1042 785,1154 785,1379 590,1267" style="fill:#DCD7AA" />
|
||||
<polygon points="811,1169 1006,1282 1006,1507 811,1395" style="fill:#DCD7AA" />
|
||||
|
||||
<!-- Out Small Blue -->
|
||||
<polygon points="1018.5,779.5 1103,828 1018.5,877 934,828" style="fill:#465AA8" />
|
||||
<polygon points="1129,843 1214,892 1129,941 1044,892" style="fill:#465AA8" />
|
||||
<polygon points="1226,914 1226,1012 1142,1061 1142,963" style="fill:#465AA8" />
|
||||
<polygon points="1226,1042 1226,1140 1142,1188 1142,1090" style="fill:#465AA8" />
|
||||
<polygon points="1116,1105 1116,1203 1031,1252 1031,1154" style="fill:#465AA8" />
|
||||
<!-- Out Small Green -->
|
||||
<polygon points="908,843 993,892 908,941 823,892" style="fill:#5C7E3C" />
|
||||
<polygon points="811,914 895,963 895,1061 811,1012" style="fill:#5C7E3C" />
|
||||
<polygon points="921,1105 1006,1154 1006,1252 921,1203" style="fill:#5C7E3C" />
|
||||
<!-- Out Small Wierd Green -->
|
||||
<polygon points="811,1042 895,1090 895,1188 811,1140" style="fill:#DCD7AA" />
|
||||
|
||||
<!-- In Small Blue -->
|
||||
<polygon points="1116,978 1116,1076 1031,1125 1031,1027" style="fill:#465AA8" />
|
||||
<!-- In Small Green -->
|
||||
<polygon points="1018.5,907 1103,956 1018.5,1004 934,956" style="fill:#5C7E3C" />
|
||||
<polygon points="921,978 1006,1027 1006,1125 921,1076" style="fill:#5C7E3C" />
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user