feat: 添加about页面

This commit is contained in:
octopus_yan 2024-11-15 17:03:48 +08:00
parent 1dc7a64833
commit 9edc015af0
6 changed files with 108 additions and 6 deletions

View File

@ -215,8 +215,11 @@ public class MainController extends BaseController<MainViewModel> {
ViewUtil.openDecorated("翻译设置", "setup/translate-view"); ViewUtil.openDecorated("翻译设置", "setup/translate-view");
} }
public void setFileName(String name) { /**
fileNameLabel.setText("PBO文件" + name); * 关于
*/
public void openAbout() {
ViewUtil.openDecorated("关于", "about-view");
} }
/** /**

View File

@ -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<AboutViewModel> {
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");
}
}

View File

@ -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<AboutController> {
}

View File

@ -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;
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="cn.octopusyan.dmt.controller.help.AboutController"
stylesheets="@../css/about-view.css"
fx:id="root" prefHeight="400.0" prefWidth="600.0">
<VBox id="titleBox" alignment="CENTER_LEFT" prefWidth="${root.width}" prefHeight="100">
<Label fx:id="title" text="title"/>
</VBox>
<VBox id="infoBox">
<Label fx:id="infoTitle" text="title"/>
<Label fx:id="version" text="版本vx.x.x(x64)"/>
<Label text="Copyright (C) 2024 octopus_yan"/>
<HBox spacing="20">
<Label text="下载地址"/>
<Hyperlink text="Gitee" onAction="#openGitee"/>
<Hyperlink text="Github" onAction="#openGithub"/>
</HBox>
</VBox>
</VBox>

View File

@ -34,10 +34,12 @@
</graphic> </graphic>
</MenuItem> </MenuItem>
</Menu> </Menu>
<Menu mnemonicParsing="false" text="关于"> <Menu mnemonicParsing="false" text="帮助">
<MenuItem text="关于" onAction="#openAbout">
<graphic> <graphic>
<FontIcon iconLiteral="fth-info"/> <FontIcon iconLiteral="fth-info"/>
</graphic> </graphic>
</MenuItem>
</Menu> </Menu>
</MenuBar> </MenuBar>
<StackPane fx:id="mainView" prefWidth="Infinity"> <StackPane fx:id="mainView" prefWidth="Infinity">