diff --git a/src/main/java/cn/octopusyan/alistgui/base/BaseController.java b/src/main/java/cn/octopusyan/alistgui/base/BaseController.java index 5aacb1a..87ec59d 100644 --- a/src/main/java/cn/octopusyan/alistgui/base/BaseController.java +++ b/src/main/java/cn/octopusyan/alistgui/base/BaseController.java @@ -4,7 +4,7 @@ import cn.octopusyan.alistgui.Application; import cn.octopusyan.alistgui.config.Context; import cn.octopusyan.alistgui.config.I18n; import cn.octopusyan.alistgui.util.FxmlUtil; -import cn.octopusyan.alistgui.util.WindowsUtil; +import cn.octopusyan.alistgui.util.ViewUtil; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Labeled; @@ -83,7 +83,7 @@ public abstract class BaseController implements Initia // 全局窗口拖拽 if (dragWindow() && getRootPanel() != null) { // 窗口拖拽 - WindowsUtil.bindDragged(getRootPanel()); + ViewUtil.bindDragged(getRootPanel()); } // 国际化绑定 diff --git a/src/main/java/cn/octopusyan/alistgui/controller/RootController.java b/src/main/java/cn/octopusyan/alistgui/controller/RootController.java index f9102d6..89f5b93 100644 --- a/src/main/java/cn/octopusyan/alistgui/controller/RootController.java +++ b/src/main/java/cn/octopusyan/alistgui/controller/RootController.java @@ -6,7 +6,7 @@ import cn.octopusyan.alistgui.config.Context; import cn.octopusyan.alistgui.config.I18n; import cn.octopusyan.alistgui.manager.ConfigManager; import cn.octopusyan.alistgui.manager.SystemTrayManager; -import cn.octopusyan.alistgui.util.WindowsUtil; +import cn.octopusyan.alistgui.util.ViewUtil; import cn.octopusyan.alistgui.viewModel.RootViewModel; import com.gluonhq.emoji.EmojiData; import com.gluonhq.emoji.util.EmojiImageUtils; @@ -129,7 +129,7 @@ public class RootController extends BaseController { getWindow().setAlwaysOnTop(newVal); }); - WindowsUtil.bindDragged(windowHeader); + ViewUtil.bindDragged(windowHeader); viewModel.currentViewIndexProperty().bind(tabPane.getSelectionModel().selectedIndexProperty()); } diff --git a/src/main/java/cn/octopusyan/alistgui/manager/SystemTrayManager.java b/src/main/java/cn/octopusyan/alistgui/manager/SystemTrayManager.java index ee805d0..8a1c939 100644 --- a/src/main/java/cn/octopusyan/alistgui/manager/SystemTrayManager.java +++ b/src/main/java/cn/octopusyan/alistgui/manager/SystemTrayManager.java @@ -3,7 +3,7 @@ package cn.octopusyan.alistgui.manager; import cn.octopusyan.alistgui.Application; import cn.octopusyan.alistgui.config.Constants; import cn.octopusyan.alistgui.config.Context; -import cn.octopusyan.alistgui.util.WindowsUtil; +import cn.octopusyan.alistgui.util.ViewUtil; import cn.octopusyan.alistgui.view.PopupMenu; import javafx.application.Platform; import javafx.beans.binding.StringBinding; @@ -48,7 +48,7 @@ public class SystemTrayManager { public static void icon(String path) { if (trayIcon == null) return; - icon(WindowsUtil.class.getResource(path)); + icon(ViewUtil.class.getResource(path)); } public static void icon(URL url) { @@ -100,7 +100,7 @@ public class SystemTrayManager { if (trayIcon != null) return; // 系统托盘图标 - URL resource = WindowsUtil.class.getResource(STR."/assets/logo\{running ? "" : "-disabled"}.png"); + URL resource = ViewUtil.class.getResource(STR."/assets/logo\{running ? "" : "-disabled"}.png"); Image image = Toolkit.getDefaultToolkit().getImage(resource); trayIcon = new TrayIcon(image); @@ -187,6 +187,6 @@ public class SystemTrayManager { } private static Stage stage() { - return WindowsUtil.getStage(); + return ViewUtil.getStage(); } } \ No newline at end of file diff --git a/src/main/java/cn/octopusyan/alistgui/util/WindowsUtil.java b/src/main/java/cn/octopusyan/alistgui/util/ViewUtil.java similarity index 98% rename from src/main/java/cn/octopusyan/alistgui/util/WindowsUtil.java rename to src/main/java/cn/octopusyan/alistgui/util/ViewUtil.java index 33c5479..18f9d92 100644 --- a/src/main/java/cn/octopusyan/alistgui/util/WindowsUtil.java +++ b/src/main/java/cn/octopusyan/alistgui/util/ViewUtil.java @@ -13,7 +13,7 @@ import java.util.Map; * * @author octopus_yan */ -public class WindowsUtil { +public class ViewUtil { // 获取系统缩放比 public static final double scaleX = Screen.getPrimary().getOutputScaleX(); public static final double scaleY = Screen.getPrimary().getOutputScaleY(); diff --git a/src/main/java/cn/octopusyan/alistgui/view/PopupMenu.java b/src/main/java/cn/octopusyan/alistgui/view/PopupMenu.java index 2eaaef3..9945079 100644 --- a/src/main/java/cn/octopusyan/alistgui/view/PopupMenu.java +++ b/src/main/java/cn/octopusyan/alistgui/view/PopupMenu.java @@ -2,7 +2,7 @@ package cn.octopusyan.alistgui.view; import atlantafx.base.controls.CaptionMenuItem; import cn.octopusyan.alistgui.config.Constants; -import cn.octopusyan.alistgui.util.WindowsUtil; +import cn.octopusyan.alistgui.util.ViewUtil; import javafx.application.Platform; import javafx.beans.binding.StringBinding; import javafx.event.ActionEvent; @@ -115,8 +115,8 @@ public class PopupMenu { root.hide(); root.show(utilityStage, - event.getX() / WindowsUtil.scaleX, - event.getY() / WindowsUtil.scaleY + event.getX() / ViewUtil.scaleX, + event.getY() / ViewUtil.scaleY ); // 获取焦点 (失去焦点隐藏自身) root.requestFocus(); diff --git a/src/main/java/cn/octopusyan/alistgui/view/alert/builder/DefaultBuilder.java b/src/main/java/cn/octopusyan/alistgui/view/alert/builder/DefaultBuilder.java index fcf4317..e1dacc0 100644 --- a/src/main/java/cn/octopusyan/alistgui/view/alert/builder/DefaultBuilder.java +++ b/src/main/java/cn/octopusyan/alistgui/view/alert/builder/DefaultBuilder.java @@ -2,7 +2,7 @@ package cn.octopusyan.alistgui.view.alert.builder; import cn.octopusyan.alistgui.base.BaseBuilder; import cn.octopusyan.alistgui.config.Context; -import cn.octopusyan.alistgui.util.WindowsUtil; +import cn.octopusyan.alistgui.util.ViewUtil; import javafx.scene.Node; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; @@ -26,9 +26,9 @@ public class DefaultBuilder extends BaseBuilder> { DialogPane dialogPane = dialog.getDialogPane(); dialogPane.getScene().setFill(Color.TRANSPARENT); - WindowsUtil.bindDragged(dialogPane); - WindowsUtil.bindShadow(dialogPane); - WindowsUtil.getStage(dialogPane).initStyle(StageStyle.TRANSPARENT); + ViewUtil.bindDragged(dialogPane); + ViewUtil.bindShadow(dialogPane); + ViewUtil.getStage(dialogPane).initStyle(StageStyle.TRANSPARENT); dialogPane.getButtonTypes().add(new ButtonType( Context.getLanguageBinding("label.cancel").get(),