diff options
author | Simon Rettberg | 2015-08-22 23:48:49 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-08-22 23:48:49 +0200 |
commit | 82f6c83e7a0d7ca78ca1097843f9a2fc37a64dcd (patch) | |
tree | 36d97969c8e7eff47042cc5d74fac52088e9bac6 /dozentenmodul/src/main/java/org/openslx/dozmod/App.java | |
parent | [client] Fix PersonLabel link color calculation, minor optimizations to Block... (diff) | |
download | tutor-module-82f6c83e7a0d7ca78ca1097843f9a2fc37a64dcd.tar.gz tutor-module-82f6c83e7a0d7ca78ca1097843f9a2fc37a64dcd.tar.xz tutor-module-82f6c83e7a0d7ca78ca1097843f9a2fc37a64dcd.zip |
[client] Make font scaling and proxy discovery configurable (no GUI yet)
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/App.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/App.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java index 29721387..62247967 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java @@ -25,6 +25,7 @@ import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; import org.apache.log4j.spi.LoggingEvent; +import org.openslx.dozmod.Config.ProxyMode; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.helper.MessageType; @@ -122,14 +123,16 @@ public class App { setupLogger(); - // Initialize the proxy settings - proxyThread = new Thread() { - @Override - public void run() { - ProxyConfigurator.init(); - } - }; - proxyThread.start(); + if (Config.getProxyMode() == ProxyMode.AUTO) { + // Initialize the proxy settings + proxyThread = new Thread() { + @Override + public void run() { + ProxyConfigurator.init(); + } + }; + proxyThread.start(); + } // Setup swing style System.setProperty("awt.useSystemAAFontSettings", "on"); @@ -143,9 +146,7 @@ public class App { } } // Adjust font size - if (System.getProperty("bigfont") != null) { - adjustFontSize(); - } + adjustFontSize(Config.getFontScaling()); // setup global thrift connection error handler before anything else // Set master server to use (TODO: make configurable via command line) @@ -185,7 +186,10 @@ public class App { Util.sleep(1000); } - private static void adjustFontSize() { + private static void adjustFontSize(int percent) { + if (percent == 100 || percent <= 0 || percent > 1000) + return; + final float scaling = 0.01f * (float)percent; int size = determineDefaultFontSize(UIManager.getLookAndFeelDefaults()); if (size == -1) { size = determineDefaultFontSize(UIManager.getDefaults()); @@ -193,7 +197,7 @@ public class App { if (size == -1) { size = 12; } - final int defaultSize = size; + final float defaultSize = size; Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { @@ -201,9 +205,9 @@ public class App { ContainerEvent containerEvent = (ContainerEvent) event; if (containerEvent.getID() == ContainerEvent.COMPONENT_ADDED) { Font font = containerEvent.getChild().getFont(); - if (font != null && font.getSize() <= defaultSize) { + if (font != null && font.getSize2D() <= defaultSize) { containerEvent.getChild().setFont( - new Font(font.getName(), font.getStyle(), font.getSize() * 2)); + new Font(font.getName(), font.getStyle(), Math.round(font.getSize2D() * scaling))); } } } |