From 9edc015af064b0bb0fa6a3a65c2558068fc33780 Mon Sep 17 00:00:00 2001 From: octopus_yan Date: Fri, 15 Nov 2024 17:03:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0about=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dmt/controller/MainController.java | 7 ++- .../dmt/controller/help/AboutController.java | 46 +++++++++++++++++++ .../dmt/viewModel/AboutViewModel.java | 12 +++++ src/main/resources/css/about-view.css | 14 ++++++ src/main/resources/fxml/about-view.fxml | 25 ++++++++++ src/main/resources/fxml/main-view.fxml | 10 ++-- 6 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 src/main/java/cn/octopusyan/dmt/controller/help/AboutController.java create mode 100644 src/main/java/cn/octopusyan/dmt/viewModel/AboutViewModel.java create mode 100644 src/main/resources/css/about-view.css create mode 100644 src/main/resources/fxml/about-view.fxml diff --git a/src/main/java/cn/octopusyan/dmt/controller/MainController.java b/src/main/java/cn/octopusyan/dmt/controller/MainController.java index f9ff226..1ddeab4 100644 --- a/src/main/java/cn/octopusyan/dmt/controller/MainController.java +++ b/src/main/java/cn/octopusyan/dmt/controller/MainController.java @@ -215,8 +215,11 @@ public class MainController extends BaseController { ViewUtil.openDecorated("翻译设置", "setup/translate-view"); } - public void setFileName(String name) { - fileNameLabel.setText("PBO文件:" + name); + /** + * 关于 + */ + public void openAbout() { + ViewUtil.openDecorated("关于", "about-view"); } /** diff --git a/src/main/java/cn/octopusyan/dmt/controller/help/AboutController.java b/src/main/java/cn/octopusyan/dmt/controller/help/AboutController.java new file mode 100644 index 0000000..22fada3 --- /dev/null +++ b/src/main/java/cn/octopusyan/dmt/controller/help/AboutController.java @@ -0,0 +1,46 @@ +package cn.octopusyan.dmt.controller.help; + +import cn.octopusyan.dmt.common.base.BaseController; +import cn.octopusyan.dmt.common.config.Constants; +import cn.octopusyan.dmt.common.config.Context; +import cn.octopusyan.dmt.viewModel.AboutViewModel; +import javafx.scene.control.Label; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; + +/** + * 关于 + * + * @author octopus_yan + */ +public class AboutController extends BaseController { + public VBox root; + public Label title; + public Label infoTitle; + public Label version; + + @Override + public Pane getRootPanel() { + return root; + } + + @Override + public void initData() { + title.setText(Constants.APP_TITLE); + infoTitle.setText(Constants.APP_TITLE); + version.setText(STR."版本:\{Constants.APP_VERSION}(x64)"); + } + + @Override + public void initViewAction() { + + } + + public void openGitee() { + Context.openUrl("https://gitee.com/octopus_yan/dayz-mod-translator"); + } + + public void openGithub() { + Context.openUrl("https://github.com/octopusYan/dayz-mod-translator"); + } +} diff --git a/src/main/java/cn/octopusyan/dmt/viewModel/AboutViewModel.java b/src/main/java/cn/octopusyan/dmt/viewModel/AboutViewModel.java new file mode 100644 index 0000000..4298828 --- /dev/null +++ b/src/main/java/cn/octopusyan/dmt/viewModel/AboutViewModel.java @@ -0,0 +1,12 @@ +package cn.octopusyan.dmt.viewModel; + +import cn.octopusyan.dmt.common.base.BaseViewModel; +import cn.octopusyan.dmt.controller.help.AboutController; + +/** + * 关于 + * + * @author octopus_yan + */ +public class AboutViewModel extends BaseViewModel { +} diff --git a/src/main/resources/css/about-view.css b/src/main/resources/css/about-view.css new file mode 100644 index 0000000..bdb0c09 --- /dev/null +++ b/src/main/resources/css/about-view.css @@ -0,0 +1,14 @@ +#root #titleBox { + -fx-padding: 0 0 0 120; + -fx-background-color: -color-neutral-muted; +} + +#root #titleBox #title { + -fx-text-fill: -color-fg-default; + -fx-font-size: 25; +} + +#root #infoBox { + -fx-spacing: 25; + -fx-padding: 50 0 0 120; +} \ No newline at end of file diff --git a/src/main/resources/fxml/about-view.fxml b/src/main/resources/fxml/about-view.fxml new file mode 100644 index 0000000..979e951 --- /dev/null +++ b/src/main/resources/fxml/about-view.fxml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/main-view.fxml b/src/main/resources/fxml/main-view.fxml index 895dfed..58c0108 100644 --- a/src/main/resources/fxml/main-view.fxml +++ b/src/main/resources/fxml/main-view.fxml @@ -34,10 +34,12 @@ - - - - + + + + + +