diff --git a/pom.xml b/pom.xml index dac8cf9..9d41d4e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.luoboduner.moo.info MooInfo - 1.1.0 + 1.1.1 jar MooInfo @@ -26,11 +26,11 @@ 3.12.0 31.0.1-jre 4.9.3 - 2.0-rc1 - 2.0-rc1 + 2.0 + 2.0 5.7.16 1.2.78 - 5.8.6 + 6.0.0 1.5.3 diff --git a/src/main/java/com/luoboduner/moo/info/App.java b/src/main/java/com/luoboduner/moo/info/App.java index 4c3c66e..a0ad380 100644 --- a/src/main/java/com/luoboduner/moo/info/App.java +++ b/src/main/java/com/luoboduner/moo/info/App.java @@ -9,6 +9,7 @@ import com.luoboduner.moo.info.ui.form.MainWindow; import com.luoboduner.moo.info.ui.frame.MainFrame; import com.luoboduner.moo.info.util.ConfigUtil; +import com.luoboduner.moo.info.util.UIUtil; import com.luoboduner.moo.info.util.UpgradeUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -39,7 +40,9 @@ public static void main(String[] args) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("apple.awt.application.name", "MooInfo"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "MooInfo"); - System.setProperty("apple.awt.application.appearance", "system"); + if (UIUtil.isDarkLaf()) { + System.setProperty("apple.awt.application.appearance", "system"); + } FlatDesktop.setAboutHandler(() -> { try { @@ -90,7 +93,6 @@ public static void main(String[] args) { MainWindow.getInstance().init(); Init.initAllTab(); Init.initOthers(); - mainFrame.addListeners(); mainFrame.remove(loadingPanel); } } diff --git a/src/main/java/com/luoboduner/moo/info/ui/Init.java b/src/main/java/com/luoboduner/moo/info/ui/Init.java index c235683..cca00fa 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/Init.java +++ b/src/main/java/com/luoboduner/moo/info/ui/Init.java @@ -5,6 +5,7 @@ import cn.hutool.log.LogFactory; import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.IntelliJTheme; +import com.formdev.flatlaf.extras.FlatSVGIcon; import com.luoboduner.moo.info.App; import com.luoboduner.moo.info.ui.component.TopMenuBar; import com.luoboduner.moo.info.ui.form.*; @@ -190,6 +191,12 @@ If you have following code in your app, you can remove it (no longer necessary): } UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf"); } + if (UIUtil.isDarkLaf()) { +// FlatSVGIcon.ColorFilter.getInstance().setMapper(color -> color.brighter().brighter()); + } else { + FlatSVGIcon.ColorFilter.getInstance().setMapper(color -> color.darker().darker()); + } +// SwingUtilities.windowForComponent(App.mainFrame).repaint(); } catch (Exception e) { logger.error(e); } diff --git a/src/main/java/com/luoboduner/moo/info/ui/UiConsts.java b/src/main/java/com/luoboduner/moo/info/ui/UiConsts.java index 30d6b95..88f2268 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/UiConsts.java +++ b/src/main/java/com/luoboduner/moo/info/ui/UiConsts.java @@ -11,7 +11,7 @@ public class UiConsts { public static final String APP_NAME = "MooInfo"; - public static final String APP_VERSION = "1.1.0"; + public static final String APP_VERSION = "1.1.1"; public static final int TABLE_ROW_HEIGHT = 36; diff --git a/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.form b/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.form index a042495..7c3e5bb 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.form +++ b/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.form @@ -1,7 +1,7 @@
- + @@ -16,7 +16,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.java b/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.java index f07c0de..a3626b8 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.java +++ b/src/main/java/com/luoboduner/moo/info/ui/dialog/AboutDialog.java @@ -43,7 +43,7 @@ public class AboutDialog extends JDialog { public AboutDialog() { super(App.mainFrame, "About"); - ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.4, 0.64); + ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.64); setContentPane(contentPane); setModal(true); @@ -354,12 +354,12 @@ private void onOK() { */ private void $$$setupUI$$$() { contentPane = new JPanel(); - contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(20, 20, 20, 20), -1, -1)); scrollPane = new JScrollPane(); contentPane.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(9, 2, new Insets(40, 40, 40, 0), -1, -1)); + panel1.setLayout(new GridLayoutManager(9, 2, new Insets(0, 0, 0, 0), -1, -1)); scrollPane.setViewportView(panel1); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); logoLabel = new JLabel(); diff --git a/src/main/java/com/luoboduner/moo/info/ui/dialog/SystemInfoTestDialog.java b/src/main/java/com/luoboduner/moo/info/ui/dialog/SystemInfoTestDialog.java index e64229a..93daf75 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/dialog/SystemInfoTestDialog.java +++ b/src/main/java/com/luoboduner/moo/info/ui/dialog/SystemInfoTestDialog.java @@ -33,7 +33,7 @@ public class SystemInfoTestDialog extends JDialog { public SystemInfoTestDialog() { super(App.mainFrame, "System Info Test"); - ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.64); + ComponentUtil.setPreferSizeAndLocateToCenter(this, App.mainFrame.getWidth(), App.mainFrame.getHeight()); setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK); diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form index 61300e8..003a219 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.form @@ -1,7 +1,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java index 0ba1ab7..a8b9435 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DetailForm.java @@ -307,12 +307,12 @@ private static String getNetworkInfo() { */ private void $$$setupUI$$$() { mainPanel = new JPanel(); - mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); scrollPane = new JScrollPane(); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(12, 1, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setLayout(new GridLayoutManager(12, 1, new Insets(0, 0, 0, 0), -1, -1)); scrollPane.setViewportView(panel1); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.form index cc7c988..bb84116 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.form @@ -1,7 +1,7 @@ - + @@ -24,7 +24,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java index 4580ec3..a2314b4 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java @@ -128,7 +128,7 @@ private static void initInfo() { */ private void $$$setupUI$$$() { mainPanel = new JPanel(); - mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); mainPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); @@ -136,7 +136,7 @@ private static void initInfo() { panel1.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); diskListPanel = new JPanel(); - diskListPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 10, 0, 10), -1, -1)); + diskListPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); scrollPane.setViewportView(diskListPanel); } diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form index dfab81c..580afac 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.form @@ -1,7 +1,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java index 470f1e6..49d3426 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/OverviewForm.java @@ -334,12 +334,12 @@ private static String getFirmware(HardwareAbstractionLayer hardware) { */ private void $$$setupUI$$$() { mainPanel = new JPanel(); - mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); scrollPane = new JScrollPane(); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); scrollPane.setViewportView(panel1); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form index 28d833a..a8a9998 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form @@ -1,7 +1,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java index 8be0bed..e81e8ad 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java @@ -79,7 +79,9 @@ private static void initInfo() { powerNameBuilder.append(powerSource.getName()); powerNameBuilder.append(" ").append(powerSource.getManufacturer()); powerNameBuilder.append(" ").append(powerSource.getDeviceName()); - powerNameBuilder.append(" ").append(powerSource.getChemistry()); + if (!"unknown".equals(powerSource.getChemistry())) { + powerNameBuilder.append(" ").append(powerSource.getChemistry()); + } powerNameLabel.setText(powerNameBuilder.toString()); powerPanel.add(powerNameLabel, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); @@ -100,7 +102,8 @@ private static void initInfo() { capacityBuilder.append("Current ").append(powerSource.getCurrentCapacity()); capacityBuilder.append(" / ").append("Max ").append(powerSource.getMaxCapacity()); capacityBuilder.append(" / ").append("Design ").append(powerSource.getDesignCapacity()); - capacityBuilder.append(" (").append(powerSource.getCapacityUnits()).append(")"); + capacityBuilder.append(" (").append(powerSource.getCapacityUnits()).append(") "); + capacityBuilder.append((powerSource.getDesignCapacity() - powerSource.getMaxCapacity()) * 100 / powerSource.getDesignCapacity()).append("% wastage"); capacityLabel.setText(capacityBuilder.toString()); powerPanel.add(capacityLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); @@ -205,12 +208,12 @@ private static String formatTimeRemaining(double timeInSeconds) { */ private void $$$setupUI$$$() { mainPanel = new JPanel(); - mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); scrollPane = new JScrollPane(); mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); scrollPane.setViewportView(panel1); powerBasePanel = new JPanel(); powerBasePanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); diff --git a/src/main/java/com/luoboduner/moo/info/ui/frame/MainFrame.java b/src/main/java/com/luoboduner/moo/info/ui/frame/MainFrame.java index 8823764..1ff4afb 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/frame/MainFrame.java +++ b/src/main/java/com/luoboduner/moo/info/ui/frame/MainFrame.java @@ -1,6 +1,5 @@ package com.luoboduner.moo.info.ui.frame; -import cn.hutool.core.thread.ThreadUtil; import com.formdev.flatlaf.extras.FlatSVGUtils; import com.luoboduner.moo.info.ui.UiConsts; import com.luoboduner.moo.info.ui.component.TopMenuBar; @@ -26,12 +25,8 @@ public void init() { topMenuBar.init(); setJMenuBar(topMenuBar); ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.6, 0.8); - } - /** - * add event listeners - */ - public void addListeners() { - ThreadUtil.execute(FrameListener::addListeners); + FrameListener.addListeners(); } + } diff --git a/src/main/java/com/luoboduner/moo/info/util/UIUtil.java b/src/main/java/com/luoboduner/moo/info/util/UIUtil.java index 6f09989..cf8c3ca 100644 --- a/src/main/java/com/luoboduner/moo/info/util/UIUtil.java +++ b/src/main/java/com/luoboduner/moo/info/util/UIUtil.java @@ -59,6 +59,7 @@ public static boolean isDarkLaf() { || "Darcula(Recommended)".equals(App.config.getTheme()) || "Flat Dark".equals(App.config.getTheme()) || "Flat Darcula".equals(App.config.getTheme()) + || "Dark purple".equals(App.config.getTheme()) || "Flat Darcula(Recommended)".equals(App.config.getTheme()); } } diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json index ecc3d99..c8fa54e 100644 --- a/src/main/resources/version_summary.json +++ b/src/main/resources/version_summary.json @@ -1,9 +1,10 @@ { - "currentVersion": "1.1.0", + "currentVersion": "1.1.1", "versionIndex": { "0.0.0": "0", "1.0.0": "1", - "1.1.0": "2" + "1.1.0": "2", + "1.1.1": "3" }, "versionDetailList": [ { @@ -20,6 +21,11 @@ "version": "1.1.0", "title": "Some minor features and optimizations", "log": "● update oshi-core to 5.8.6\n● update flatlaf to 2.0-rc1(Support Windows 11 snap layouts menu, macOS screen menu optimization)\n● processes sort method added same as the oshi's demo\n● add cpu usage chart\n● make System Boot Time and Uptime readable\n● add System Info Test function menu same as oshi-core\n" + }, + { + "version": "1.1.1", + "title": "update flatlaf to 2.0", + "log": "● update flatlaf to 2.0\n● update oshi-core to 6.0.0\n● add battery wastage indicator\n● optimization of light theme\n" } ] } \ No newline at end of file