Merge pull request #9 from rememberber/dev

Dev
This commit is contained in:
周波 2022-02-14 09:41:55 +08:00 committed by GitHub
commit 7241ec9a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 122 deletions

View File

@ -1,7 +1,7 @@
# MooInfo
![logo](assets/logo/MooInfo.svg)
A visual implementation of OSHI, to view information about the system and hardware.
V****isual implementation of OSHI, to view information about the system and hardware.
Such as OS, processes, memory, CPU, disks, devices, sensors, etc.
## Supported platforms
@ -11,9 +11,9 @@ Windows • Linux • macOS
![Overview](screenshot/overview_mac.png)
![CPU](screenshot/cpu_mac.png)
![Memory](screenshot/memory_mac.png)
![Detail](screenshot/detail_mac.png)
![Detail](screenshot/detail_mac.png)****
![Network](screenshot/network_mac.png)
![Power](screenshot/power_mac.png)
![Power](screenshot/power_mac.png)****
![Processes](screenshot/processes_mac.png)
![Storage](screenshot/storage_mac.png)
![Variables](screenshot/variables_mac.png)

65
pom.xml
View File

@ -26,11 +26,12 @@
<commons-lang3.version>3.12.0</commons-lang3.version>
<guava.version>31.0.1-jre</guava.version>
<okhttp.version>4.9.3</okhttp.version>
<flatlaf.version>2.0</flatlaf.version>
<flatlaf-extras.version>2.0</flatlaf-extras.version>
<flatlaf.version>2.0.1</flatlaf.version>
<flatlaf-extras.version>2.0.1</flatlaf-extras.version>
<flatlaf-intellij-themes.version>2.0.1</flatlaf-intellij-themes.version>
<hutool-all.version>5.7.16</hutool-all.version>
<fastjson.version>1.2.78</fastjson.version>
<oshi-core.version>6.0.0</oshi-core.version>
<oshi-core.version>6.1.1</oshi-core.version>
<jfreechart.version>1.5.3</jfreechart.version>
</properties>
@ -104,6 +105,12 @@
<version>${flatlaf-extras.version}</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf-intellij-themes</artifactId>
<version>${flatlaf-intellij-themes.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
@ -134,7 +141,7 @@
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.6.2</version>
<version>1.6.3</version>
<configuration>
<bundleJre>true</bundleJre>
<mainClass>com.luoboduner.moo.info.App</mainClass>
@ -160,7 +167,7 @@
<!-- setup generation properties -->
<setupMode>installForAllUsers</setupMode>
<createDesktopIconTask>true</createDesktopIconTask>
<createDesktopIconTask>true</createDesktopIconTask>
<disableDirPage>false</disableDirPage>
<disableFinishedPage>false</disableFinishedPage>
<setupLanguages>
@ -170,30 +177,30 @@
</winConfig>
</configuration>
</execution>
<!-- <execution>-->
<!-- <id>bundling-for-linux</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>package</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <platform>linux</platform>-->
<!-- <createTarball>true</createTarball>-->
<!--&lt;!&ndash; <jdkPath>X:\\path\to\linux\jdk</jdkPath>&ndash;&gt;-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>bundling-for-mac</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>package</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <platform>mac</platform>-->
<!-- <createTarball>true</createTarball>-->
<!-- &lt;!&ndash; <jdkPath>X:\\path\to\mac\jdk</jdkPath>&ndash;&gt;-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>bundling-for-linux</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>package</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <platform>linux</platform>-->
<!-- <createTarball>true</createTarball>-->
<!--&lt;!&ndash; <jdkPath>X:\\path\to\linux\jdk</jdkPath>&ndash;&gt;-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>bundling-for-mac</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>package</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <platform>mac</platform>-->
<!-- <createTarball>true</createTarball>-->
<!-- &lt;!&ndash; <jdkPath>X:\\path\to\mac\jdk</jdkPath>&ndash;&gt;-->
<!-- </configuration>-->
<!-- </execution>-->
</executions>
</plugin>
</plugins>

View File

@ -1,6 +1,8 @@
package com.luoboduner.moo.info;
import com.formdev.flatlaf.extras.FlatDesktop;
import com.formdev.flatlaf.extras.FlatInspector;
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
import com.formdev.flatlaf.util.SystemInfo;
import com.luoboduner.moo.info.ui.Init;
import com.luoboduner.moo.info.ui.dialog.AboutDialog;
@ -69,6 +71,11 @@ public class App {
}
Init.initTheme();
// install inspectors
FlatInspector.install( "ctrl shift alt X" );
FlatUIDefaultsInspector.install( "ctrl shift alt Y" );
mainFrame = new MainFrame();
mainFrame.init();
JPanel loadingPanel = new LoadingForm().getLoadingPanel();

View File

@ -3,9 +3,11 @@ package com.luoboduner.moo.info.ui;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.*;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.intellijthemes.FlatCyanLightIJTheme;
import com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme;
import com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme;
import com.luoboduner.moo.info.App;
import com.luoboduner.moo.info.ui.component.TopMenuBar;
import com.luoboduner.moo.info.ui.form.*;
@ -13,7 +15,6 @@ import com.luoboduner.moo.info.util.SystemUtil;
import com.luoboduner.moo.info.util.UIUtil;
import com.luoboduner.moo.info.util.UpgradeUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
@ -86,24 +87,6 @@ public class Init {
* init look and feel
*/
public static void initTheme() {
if (SystemUtil.isMacM1()) {
try {
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
logger.warn("FlatDarculaLaf theme set.");
} catch (Exception e) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e2) {
logger.error(ExceptionUtils.getStackTrace(e2));
}
logger.error(ExceptionUtils.getStackTrace(e));
}
return;
}
if (App.config.isUnifiedBackground()) {
UIManager.put("TitlePane.unifiedBackground", true);
}
try {
switch (App.config.getTheme()) {
@ -111,92 +94,43 @@ public class Init {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
break;
case "Flat Light":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
FlatLightLaf.install();
FlatLightLaf.setup();
break;
case "Flat IntelliJ":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatIntelliJLaf");
FlatIntelliJLaf.setup();
break;
case "Flat Dark":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarkLaf");
break;
case "Darcula":
case "Darcula(Recommended)":
case "Flat Darcula(Recommended)":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
UIManager.put("PopupMenu.background", UIManager.getColor("Panel.background"));
/**
If you don't like/want it, you can disable it with:
UIManager.put( "TitlePane.useWindowDecorations", false );
It is also possible to disable only the embedded menu bar (and keep the dark title pane) with:
UIManager.put( "TitlePane.menuBarEmbedded", false );
It is also possible to disable this on command line with following VM options:
-Dflatlaf.useWindowDecorations=false
-Dflatlaf.menuBarEmbedded=false
If you have following code in your app, you can remove it (no longer necessary):
// enable window decorations
JFrame.setDefaultLookAndFeelDecorated( true );
JDialog.setDefaultLookAndFeelDecorated( true );
**/
FlatDarkLaf.setup();
break;
case "Dark purple":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.setup(App.class.getResourceAsStream(
"/theme/DarkPurple.theme.json"));
FlatDarkPurpleIJTheme.setup();
break;
case "IntelliJ Cyan":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.setup(App.class.getResourceAsStream(
"/theme/Cyan.theme.json"));
FlatCyanLightIJTheme.setup();
break;
case "IntelliJ Light":
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
IntelliJTheme.setup(App.class.getResourceAsStream(
"/theme/Light.theme.json"));
FlatLightFlatIJTheme.setup();
break;
default:
if (SystemUtil.isJBR()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf");
FlatDarculaLaf.setup();
}
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();
}
// SwingUtilities.windowForComponent(App.mainFrame).repaint();
if (App.config.isUnifiedBackground()) {
UIManager.put("TitlePane.unifiedBackground", true);
}
// top menubar background
UIManager.put("PopupMenu.background", UIManager.getColor("Panel.background"));
// arrow type
UIManager.put("Component.arrowType", "chevron");
} catch (Exception e) {
logger.error(e);
}

View File

@ -56,7 +56,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="A visual implementation of OSHI, to view information about the system and hardware"/>
<text value="Visual implementation of OSHI, to view information about the system and hardware"/>
</properties>
</component>
<component id="2b99b" class="javax.swing.JLabel" binding="authorLabel">

View File

@ -375,7 +375,7 @@ public class AboutDialog extends JDialog {
panel1.add(panel2, new GridConstraints(1, 0, 1, 2, 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));
panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "MooInfo", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, 20, panel2.getFont()), new Color(-4425028)));
final JLabel label1 = new JLabel();
label1.setText("A visual implementation of OSHI, to view information about the system and hardware");
label1.setText("Visual implementation of OSHI, to view information about the system and hardware");
panel2.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
authorLabel = new JLabel();
authorLabel.setText("Proudly by RememBerBer 周波");