mirror of
https://github.com/octopusYan/alist-gui.git
synced 2024-11-24 04:56:42 +08:00
feat: 代理测试
todo: 关于页
This commit is contained in:
parent
88a2f705ba
commit
a9dd63b251
@ -2,6 +2,7 @@ package cn.octopusyan.alistgui.base;
|
||||
|
||||
import cn.octopusyan.alistgui.Application;
|
||||
import cn.octopusyan.alistgui.config.Context;
|
||||
import cn.octopusyan.alistgui.manager.WindowsUtil;
|
||||
import cn.octopusyan.alistgui.util.FxmlUtil;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
@ -20,7 +21,6 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public abstract class BaseController<P extends Pane> implements Initializable {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private double xOffSet = 0, yOffSet = 0;
|
||||
|
||||
public BaseController() {
|
||||
//初始化时保存当前Controller实例
|
||||
@ -33,14 +33,7 @@ public abstract class BaseController<P extends Pane> implements Initializable {
|
||||
// 全局窗口拖拽
|
||||
if (dragWindow()) {
|
||||
// 窗口拖拽
|
||||
getRootPanel().setOnMousePressed(event -> {
|
||||
xOffSet = event.getSceneX();
|
||||
yOffSet = event.getSceneY();
|
||||
});
|
||||
getRootPanel().setOnMouseDragged(event -> {
|
||||
getWindow().setX(event.getScreenX() - xOffSet);
|
||||
getWindow().setY(event.getScreenY() - yOffSet);
|
||||
});
|
||||
WindowsUtil.bindDragged(getRootPanel());
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.octopusyan.alistgui.config;
|
||||
|
||||
import cn.octopusyan.alistgui.base.BaseController;
|
||||
import cn.octopusyan.alistgui.controller.AboutController;
|
||||
import cn.octopusyan.alistgui.controller.MainController;
|
||||
import cn.octopusyan.alistgui.controller.RootController;
|
||||
import cn.octopusyan.alistgui.controller.SetupController;
|
||||
@ -34,7 +35,7 @@ public class Context {
|
||||
private static final Logger log = LoggerFactory.getLogger(Context.class);
|
||||
private static Scene scene;
|
||||
private static final IntegerProperty currentViewIndexProperty = new SimpleIntegerProperty(0);
|
||||
// 获取控制器集合
|
||||
|
||||
/**
|
||||
* 控制器集合
|
||||
*/
|
||||
@ -51,7 +52,7 @@ public class Context {
|
||||
/**
|
||||
* 支持的语言集合,应与语言资源文件同步手动更新
|
||||
*/
|
||||
public static final List<Locale> SUPPORT_LANGUAGE_LIST = Arrays.asList(Locale.CHINESE, Locale.ENGLISH);
|
||||
public static final List<Locale> SUPPORT_LANGUAGE_LIST = Arrays.asList(Locale.SIMPLIFIED_CHINESE, Locale.ENGLISH);
|
||||
/**
|
||||
* 记录当前所选时区
|
||||
*/
|
||||
@ -70,6 +71,7 @@ public class Context {
|
||||
case RootController root -> root;
|
||||
case MainController main -> main;
|
||||
case SetupController setup -> setup;
|
||||
case AboutController about -> about;
|
||||
default -> throw new IllegalStateException(STR."Unexpected value: \{type}");
|
||||
};
|
||||
} catch (Exception e) {
|
||||
@ -107,6 +109,7 @@ public class Context {
|
||||
// 更新界面语言
|
||||
public static void setLanguage(Locale locale) {
|
||||
setCurrentLocale(locale);
|
||||
Locale.setDefault(locale);
|
||||
ConfigManager.language(locale);
|
||||
LANGUAGE_RESOURCE_FACTORY.setResourceBundle(ResourceBundle.getBundle(LANGUAGE_RESOURCE_NAME, locale));
|
||||
}
|
||||
@ -133,7 +136,7 @@ public class Context {
|
||||
* 初始化 语言
|
||||
*/
|
||||
private static void initI18n() {
|
||||
currentLocaleProperty().addListener((_, _, _) -> Platform.runLater(() -> {
|
||||
currentLocaleProperty().addListener((_, _, locale) -> Platform.runLater(() -> {
|
||||
try {
|
||||
loadScene();
|
||||
} catch (IOException e) {
|
||||
|
@ -0,0 +1,54 @@
|
||||
package cn.octopusyan.alistgui.controller;
|
||||
|
||||
import cn.octopusyan.alistgui.base.BaseController;
|
||||
import cn.octopusyan.alistgui.viewModel.AboutViewModule;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.VBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 关于
|
||||
*
|
||||
* @author octopus_yan
|
||||
*/
|
||||
public class AboutController extends BaseController<VBox> {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@FXML
|
||||
public VBox aboutView;
|
||||
|
||||
@FXML
|
||||
public Label aListVersion;
|
||||
@FXML
|
||||
public Button checkAppVersion;
|
||||
|
||||
private final AboutViewModule viewModule = new AboutViewModule();
|
||||
|
||||
@Override
|
||||
public VBox getRootPanel() {
|
||||
return aboutView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViewStyle() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViewAction() {
|
||||
aListVersion.textProperty().bindBidirectional(viewModule.aListVersionProperty());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void checkAListUpdate() {
|
||||
viewModule.checkAListUpdate();
|
||||
}
|
||||
}
|
@ -8,25 +8,29 @@ import cn.octopusyan.alistgui.viewModel.SetupViewModel;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 设置页面控制器
|
||||
*
|
||||
* @author octopus_yan
|
||||
*/
|
||||
public class SetupController extends BaseController<AnchorPane> implements Initializable {
|
||||
public class SetupController extends BaseController<VBox> implements Initializable {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@FXML
|
||||
public AnchorPane setupView;
|
||||
public VBox setupView;
|
||||
@FXML
|
||||
public CheckBox autoStartCheckBox;
|
||||
@FXML
|
||||
@ -43,15 +47,11 @@ public class SetupController extends BaseController<AnchorPane> implements Initi
|
||||
public TextField proxyHost;
|
||||
@FXML
|
||||
public TextField proxyPort;
|
||||
@FXML
|
||||
public Label aListVersion;
|
||||
@FXML
|
||||
public Button checkAppVersion;
|
||||
|
||||
private final SetupViewModel setupViewModel = new SetupViewModel();
|
||||
private final SetupViewModel viewModule = new SetupViewModel();
|
||||
|
||||
@Override
|
||||
public AnchorPane getRootPanel() {
|
||||
public VBox getRootPanel() {
|
||||
return setupView;
|
||||
}
|
||||
|
||||
@ -75,21 +75,19 @@ public class SetupController extends BaseController<AnchorPane> implements Initi
|
||||
|
||||
@Override
|
||||
public void initViewAction() {
|
||||
autoStartCheckBox.selectedProperty().bindBidirectional(setupViewModel.autoStartProperty());
|
||||
silentStartupCheckBox.selectedProperty().bindBidirectional(setupViewModel.silentStartupProperty());
|
||||
proxySetupComboBox.getSelectionModel().selectedItemProperty()
|
||||
.addListener((_, _, newValue) -> setupViewModel.proxySetupProperty().set(newValue));
|
||||
proxyHost.textProperty().bindBidirectional(setupViewModel.proxyHostProperty());
|
||||
proxyPort.textProperty().bindBidirectional(setupViewModel.proxyPortProperty());
|
||||
languageComboBox.getSelectionModel().selectedItemProperty().addListener((_, _, newValue) -> {
|
||||
setupViewModel.languageProperty().set(newValue);
|
||||
logger.info("language changed to {}", newValue);
|
||||
autoStartCheckBox.selectedProperty().bindBidirectional(viewModule.autoStartProperty());
|
||||
silentStartupCheckBox.selectedProperty().bindBidirectional(viewModule.silentStartupProperty());
|
||||
proxySetupComboBox.getSelectionModel().selectedItemProperty().addListener((_, _, newValue) -> viewModule.proxySetupProperty().set(newValue));
|
||||
proxyHost.textProperty().bindBidirectional(viewModule.proxyHostProperty());
|
||||
proxyPort.textProperty().bindBidirectional(viewModule.proxyPortProperty());
|
||||
languageComboBox.getSelectionModel().selectedItemProperty().subscribe(locale -> {
|
||||
viewModule.languageProperty().set(locale);
|
||||
logger.info("language changed to {}", locale);
|
||||
});
|
||||
aListVersion.textProperty().bindBidirectional(setupViewModel.aListVersionProperty());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void checkAListUpdate() {
|
||||
setupViewModel.checkAListUpdate();
|
||||
public void proxyTest() {
|
||||
viewModule.proxyTest();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import java.util.regex.Matcher;
|
||||
public class ConfigManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigManager.class);
|
||||
public static ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
|
||||
public static final Locale DEFAULT_LANGUAGE = Locale.CHINESE;
|
||||
public static final Locale DEFAULT_LANGUAGE = Locale.SIMPLIFIED_CHINESE;
|
||||
private static GuiConfig guiConfig;
|
||||
private static UpgradeConfig upgradeConfig;
|
||||
|
||||
@ -69,7 +69,7 @@ public class ConfigManager {
|
||||
&& Integer.parseInt(proxyInfo.getPort()) > 0;
|
||||
}
|
||||
|
||||
private static ProxyInfo getProxyInfo() {
|
||||
public static ProxyInfo getProxyInfo() {
|
||||
return guiConfig.getProxyInfo();
|
||||
}
|
||||
|
||||
@ -129,6 +129,14 @@ public class ConfigManager {
|
||||
return ProxySetup.valueOf(StringUtils.upperCase(guiConfig.getProxySetup()));
|
||||
}
|
||||
|
||||
public static void proxyTestUrl(String url) {
|
||||
guiConfig.setProxyTestUrl(url);
|
||||
}
|
||||
|
||||
public static String proxyTestUrl() {
|
||||
return guiConfig.getProxyTestUrl();
|
||||
}
|
||||
|
||||
public static void proxySetup(ProxySetup setup) {
|
||||
guiConfig.setProxySetup(setup.getName());
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package cn.octopusyan.alistgui.manager;
|
||||
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Window;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author octopus_yan
|
||||
*/
|
||||
public class WindowsUtil {
|
||||
public static final Map<Pane, Double> paneXOffset = new HashMap<>();
|
||||
public static final Map<Pane, Double> paneYOffset = new HashMap<>();
|
||||
|
||||
public static void bindDragged(Pane pane) {
|
||||
Window stage = getStage(pane);
|
||||
pane.setOnMousePressed(event -> {
|
||||
paneXOffset.put(pane, stage.getX() - event.getScreenX());
|
||||
paneYOffset.put(pane, stage.getY() - event.getScreenY());
|
||||
});
|
||||
pane.setOnMouseDragged(event -> {
|
||||
stage.setX(event.getScreenX() + paneXOffset.get(pane));
|
||||
stage.setY(event.getScreenY() + paneYOffset.get(pane));
|
||||
});
|
||||
}
|
||||
|
||||
public static Window getStage(Pane pane) {
|
||||
return pane.getScene().getWindow();
|
||||
}
|
||||
}
|
@ -20,4 +20,5 @@ public class GuiConfig {
|
||||
private ProxyInfo proxyInfo;
|
||||
private String proxySetup = ProxySetup.NO_PROXY.getName();
|
||||
private String language = ConfigManager.DEFAULT_LANGUAGE.toString();
|
||||
private String proxyTestUrl = "http://";
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.octopusyan.alistgui.task;
|
||||
|
||||
import cn.octopusyan.alistgui.base.BaseTask;
|
||||
import cn.octopusyan.alistgui.manager.http.HttpUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 代理检测任务
|
||||
*
|
||||
* @author octopus_yan
|
||||
*/
|
||||
@Slf4j
|
||||
public class ProxyCheckTask extends BaseTask {
|
||||
private final String checkUrl;
|
||||
|
||||
public ProxyCheckTask(String checkUrl) {
|
||||
this.checkUrl = checkUrl;
|
||||
this.updateProgress(0d, 1d);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void task() throws Exception {
|
||||
String response = HttpUtil.getInstance().get(checkUrl, null, null);
|
||||
log.debug(STR."Proxy check response result => \n\{response}");
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ import cn.octopusyan.alistgui.manager.http.HttpUtil;
|
||||
import cn.octopusyan.alistgui.model.UpgradeConfig;
|
||||
import cn.octopusyan.alistgui.model.upgrade.UpgradeApp;
|
||||
import cn.octopusyan.alistgui.util.JsonUtil;
|
||||
import cn.octopusyan.alistgui.viewModel.SetupViewModel;
|
||||
import cn.octopusyan.alistgui.viewModel.AboutViewModule;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@ -16,10 +16,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||
* @author octopus_yan
|
||||
*/
|
||||
public class UpgradeTask extends BaseTask {
|
||||
private final SetupViewModel vm;
|
||||
private final AboutViewModule vm;
|
||||
private final UpgradeApp app;
|
||||
|
||||
public UpgradeTask(SetupViewModel viewModel, UpgradeApp app) {
|
||||
public UpgradeTask(AboutViewModule viewModel, UpgradeApp app) {
|
||||
this.vm = viewModel;
|
||||
this.app = app;
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package cn.octopusyan.alistgui.viewModel;
|
||||
|
||||
import cn.octopusyan.alistgui.base.BaseTask;
|
||||
import cn.octopusyan.alistgui.config.Context;
|
||||
import cn.octopusyan.alistgui.manager.ConfigManager;
|
||||
import cn.octopusyan.alistgui.task.UpgradeTask;
|
||||
import cn.octopusyan.alistgui.util.alert.AlertUtil;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 关于
|
||||
*
|
||||
* @author octopus_yan
|
||||
*/
|
||||
@Slf4j
|
||||
public class AboutViewModule {
|
||||
private final StringProperty aListVersion = new SimpleStringProperty(ConfigManager.aListVersion());
|
||||
private final StringProperty aListNewVersion = new SimpleStringProperty("");
|
||||
private final BooleanProperty aListUpgrade = new SimpleBooleanProperty(false);
|
||||
|
||||
public AboutViewModule() {
|
||||
aListVersion.addListener((_, _, newValue) -> ConfigManager.aListVersion(newValue));
|
||||
}
|
||||
|
||||
public Property<String> aListVersionProperty() {
|
||||
return aListVersion;
|
||||
}
|
||||
|
||||
public BooleanProperty aListUpgradeProperty() {
|
||||
return aListUpgrade;
|
||||
}
|
||||
|
||||
public StringProperty aListNewVersionProperty() {
|
||||
return aListNewVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查alist更新
|
||||
*/
|
||||
public void checkAListUpdate() {
|
||||
var task = new UpgradeTask(this, ConfigManager.aList());
|
||||
task.onListen(new BaseTask.Listener() {
|
||||
@Override
|
||||
public void onSucceeded() {
|
||||
AlertUtil.confirm()
|
||||
.content(STR."""
|
||||
当前版本 : \{aListVersion.get()}
|
||||
最新版本 : \{aListNewVersion.get()}
|
||||
""")
|
||||
.title(Context.getLanguageBinding("about.alist.update").getValue())
|
||||
.show(new AlertUtil.OnChoseListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
log.info("========confirm==========");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOrClose(ButtonType buttonType) {
|
||||
log.info("========cancelOrClose==========");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
AlertUtil.exception(new Exception(throwable)).show();
|
||||
}
|
||||
});
|
||||
task.execute();
|
||||
}
|
||||
}
|
@ -1,13 +1,19 @@
|
||||
package cn.octopusyan.alistgui.viewModel;
|
||||
|
||||
import cn.hutool.core.net.NetUtil;
|
||||
import cn.octopusyan.alistgui.base.BaseTask;
|
||||
import cn.octopusyan.alistgui.config.Context;
|
||||
import cn.octopusyan.alistgui.enums.ProxySetup;
|
||||
import cn.octopusyan.alistgui.manager.ConfigManager;
|
||||
import cn.octopusyan.alistgui.task.UpgradeTask;
|
||||
import cn.octopusyan.alistgui.manager.http.HttpUtil;
|
||||
import cn.octopusyan.alistgui.task.ProxyCheckTask;
|
||||
import cn.octopusyan.alistgui.util.alert.AlertUtil;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -15,6 +21,7 @@ import java.util.Locale;
|
||||
*
|
||||
* @author octopus_yan
|
||||
*/
|
||||
@Slf4j
|
||||
public class SetupViewModel {
|
||||
private final BooleanProperty autoStart = new SimpleBooleanProperty(ConfigManager.autoStart());
|
||||
private final BooleanProperty silentStartup = new SimpleBooleanProperty(ConfigManager.silentStartup());
|
||||
@ -22,18 +29,22 @@ public class SetupViewModel {
|
||||
private final StringProperty proxyPort = new SimpleStringProperty(ConfigManager.proxyPort());
|
||||
private final ObjectProperty<Locale> language = new SimpleObjectProperty<>(ConfigManager.language());
|
||||
private final ObjectProperty<ProxySetup> proxySetup = new SimpleObjectProperty<>(ConfigManager.proxySetup());
|
||||
private final StringProperty aListVersion = new SimpleStringProperty(ConfigManager.aListVersion());
|
||||
private final StringProperty aListNewVersion = new SimpleStringProperty("");
|
||||
private final BooleanProperty aListUpgrade = new SimpleBooleanProperty(false);
|
||||
private final StringProperty proxyTestUrl = new SimpleStringProperty(ConfigManager.proxyTestUrl());
|
||||
|
||||
|
||||
public SetupViewModel() {
|
||||
aListVersion.addListener((_, _, newValue) -> ConfigManager.aListVersion(newValue));
|
||||
autoStart.addListener((_, _, newValue) -> ConfigManager.autoStart(newValue));
|
||||
silentStartup.addListener((_, _, newValue) -> ConfigManager.silentStartup(newValue));
|
||||
proxySetup.addListener((_, _, newValue) -> ConfigManager.proxySetup(newValue));
|
||||
proxyHost.addListener((_, _, newValue) -> ConfigManager.proxyHost(newValue));
|
||||
proxyPort.addListener((_, _, newValue) -> ConfigManager.proxyPort(newValue));
|
||||
proxyTestUrl.addListener((_, _, newValue) -> ConfigManager.proxyTestUrl(newValue));
|
||||
proxyHost.addListener((_, _, newValue) -> {
|
||||
ConfigManager.proxyHost(newValue);
|
||||
checkProxy();
|
||||
});
|
||||
proxyPort.addListener((_, _, newValue) -> {
|
||||
ConfigManager.proxyPort(newValue);
|
||||
checkProxy();
|
||||
});
|
||||
language.addListener((_, _, newValue) -> Context.setLanguage(newValue));
|
||||
}
|
||||
|
||||
@ -61,39 +72,54 @@ public class SetupViewModel {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
public Property<String> aListVersionProperty() {
|
||||
return aListVersion;
|
||||
public void proxyTest() {
|
||||
var checkUrl = AlertUtil.input("URL :", proxyTestUrl.getValue())
|
||||
.title(Context.getLanguageBinding("proxy.test.title").getValue())
|
||||
.header(Context.getLanguageBinding("proxy.test.header").getValue())
|
||||
.getInput();
|
||||
|
||||
if (StringUtils.isEmpty(checkUrl)) return;
|
||||
|
||||
proxyTestUrl.setValue(checkUrl);
|
||||
|
||||
getProxyCheckTask(checkUrl).execute();
|
||||
}
|
||||
|
||||
public BooleanProperty aListUpgradeProperty() {
|
||||
return aListUpgrade;
|
||||
private void checkProxy() {
|
||||
try {
|
||||
InetSocketAddress address = NetUtil.createAddress(proxyHost.get(), Integer.parseInt(proxyPort.getValue()));
|
||||
if (NetUtil.isOpen(address, 2000)) {
|
||||
HttpUtil.getInstance().proxy(proxySetup.get(), ConfigManager.getProxyInfo());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug(STR."host=\{proxyHost.get()},port=\{proxyPort.get()}");
|
||||
}
|
||||
}
|
||||
|
||||
public StringProperty aListNewVersionProperty() {
|
||||
return aListNewVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查alist更新
|
||||
*/
|
||||
public void checkAListUpdate() {
|
||||
var task = new UpgradeTask(this, ConfigManager.aList());
|
||||
private static ProxyCheckTask getProxyCheckTask(String checkUrl) {
|
||||
var task = new ProxyCheckTask(checkUrl);
|
||||
final var progress = AlertUtil.progress();
|
||||
progress.title(Context.getLanguageBinding("proxy.test.title").get());
|
||||
task.onListen(new BaseTask.Listener() {
|
||||
|
||||
@Override
|
||||
public void onRunning() {
|
||||
progress.onCancel(task::cancel).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSucceeded() {
|
||||
AlertUtil.info(STR."""
|
||||
当前版本 : \{aListVersion.get()}
|
||||
最新版本 : \{aListNewVersion.get()}
|
||||
""")
|
||||
.title("AList 更新提示")
|
||||
.show();
|
||||
Platform.runLater(progress::close);
|
||||
AlertUtil.info(Context.getLanguageBinding("proxy.test.result.success").getValue()).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
AlertUtil.exception(new Exception(throwable)).show();
|
||||
Platform.runLater(progress::close);
|
||||
final var tmp = Context.getLanguageBinding("proxy.test.result.failed").getValue();
|
||||
AlertUtil.error(tmp + throwable.getMessage()).show();
|
||||
}
|
||||
});
|
||||
task.execute();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
|
BIN
src/main/resources/assets/logo-about.png
Normal file
BIN
src/main/resources/assets/logo-about.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
src/main/resources/assets/logo.png
Normal file
BIN
src/main/resources/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
14
src/main/resources/assets/logo.svg
Normal file
14
src/main/resources/assets/logo.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<svg width="1252" height="1252" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<g>
|
||||
<g id="#70c6beff">
|
||||
<path id="svg_2"
|
||||
d="m634.37,138.38c11.88,-1.36 24.25,1.3 34.18,8.09c14.96,9.66 25.55,24.41 34.49,39.51c40.59,68.03 81.45,135.91 122.02,203.96c54.02,90.99 108.06,181.97 161.94,273.06c37.28,63 74.65,125.96 112.18,188.82c24.72,41.99 50.21,83.54 73.84,126.16c10.18,17.84 15.77,38.44 14.93,59.03c-0.59,15.92 -3.48,32.28 -11.84,46.08c-11.73,19.46 -31.39,33.2 -52.71,40.36c-11.37,4.09 -23.3,6.87 -35.43,6.89c-132.32,-0.05 -264.64,0.04 -396.95,0.03c-11.38,-0.29 -22.95,-1.6 -33.63,-5.72c-7.81,-3.33 -15.5,-7.43 -21.61,-13.42c-10.43,-10.32 -17.19,-24.96 -15.38,-39.83c0.94,-10.39 3.48,-20.64 7.76,-30.16c4.15,-9.77 9.99,-18.67 15.06,-27.97c22.13,-39.47 45.31,-78.35 69.42,-116.65c7.72,-12.05 14.44,-25.07 25.12,-34.87c11.35,-10.39 25.6,-18.54 41.21,-19.6c12.55,-0.52 24.89,3.82 35.35,10.55c11.8,6.92 21.09,18.44 24.2,31.88c4.49,17.01 -0.34,34.88 -7.55,50.42c-8.09,17.65 -19.62,33.67 -25.81,52.18c-1.13,4.21 -2.66,9.52 0.48,13.23c3.19,3 7.62,4.18 11.77,5.22c12,2.67 24.38,1.98 36.59,2.06c45,-0.01 90,0 135,0c8.91,-0.15 17.83,0.3 26.74,-0.22c6.43,-0.74 13.44,-1.79 18.44,-6.28c3.3,-2.92 3.71,-7.85 2.46,-11.85c-2.74,-8.86 -7.46,-16.93 -12.12,-24.89c-119.99,-204.91 -239.31,-410.22 -360.56,-614.4c-3.96,-6.56 -7.36,-13.68 -13.03,-18.98c-2.8,-2.69 -6.95,-4.22 -10.77,-3.11c-3.25,1.17 -5.45,4.03 -7.61,6.57c-5.34,6.81 -10.12,14.06 -14.51,21.52c-20.89,33.95 -40.88,68.44 -61.35,102.64c-117.9,198.43 -235.82,396.85 -353.71,595.29c-7.31,13.46 -15.09,26.67 -23.57,39.43c-7.45,10.96 -16.49,21.23 -28.14,27.83c-13.73,7.94 -30.69,11.09 -46.08,6.54c-11.23,-3.47 -22.09,-9.12 -30.13,-17.84c-10.18,-10.08 -14.69,-24.83 -14.17,-38.94c0.52,-14.86 5.49,-29.34 12.98,-42.1c71.58,-121.59 143.62,-242.92 215.93,-364.09c37.2,-62.8 74.23,-125.69 111.64,-188.36c37.84,-63.5 75.77,-126.94 113.44,-190.54c21.02,-35.82 42.19,-71.56 64.28,-106.74c6.79,-11.15 15.58,-21.15 26.16,-28.85c8.68,-5.92 18.42,-11 29.05,-11.94z"
|
||||
fill="#70c6be"/>
|
||||
</g>
|
||||
<g id="#1ba0d8ff">
|
||||
<path id="svg_3"
|
||||
d="m628.35,608.38c17.83,-2.87 36.72,1.39 51.5,11.78c11.22,8.66 19.01,21.64 21.26,35.65c1.53,10.68 0.49,21.75 -3.44,31.84c-3.02,8.73 -7.35,16.94 -12.17,24.81c-68.76,115.58 -137.5,231.17 -206.27,346.75c-8.8,14.47 -16.82,29.47 -26.96,43.07c-7.37,9.11 -16.58,16.85 -27.21,21.89c-22.47,11.97 -51.79,4.67 -68.88,-13.33c-8.66,-8.69 -13.74,-20.63 -14.4,-32.84c-0.98,-12.64 1.81,-25.42 7.53,-36.69c5.03,-10.96 10.98,-21.45 17.19,-31.77c30.22,-50.84 60.17,-101.84 90.3,-152.73c41.24,-69.98 83.16,-139.55 124.66,-209.37c4.41,-7.94 9.91,-15.26 16.09,-21.9c8.33,-8.46 18.9,-15.3 30.8,-17.16z"
|
||||
fill="#1ba0d8"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/main/resources/assets/logo_disabled.png
Normal file
BIN
src/main/resources/assets/logo_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 960 B |
22
src/main/resources/css/about-view.scss
Normal file
22
src/main/resources/css/about-view.scss
Normal file
@ -0,0 +1,22 @@
|
||||
/**************************************************
|
||||
* About View
|
||||
**************************************************/
|
||||
|
||||
|
||||
.shield {
|
||||
|
||||
.label {
|
||||
-fx-text-fill: white;
|
||||
-fx-label-padding: 3 5 3 5;
|
||||
}
|
||||
|
||||
.shield-name {
|
||||
-fx-background-color: #555555;
|
||||
-fx-background-radius: 5 0 0 5;
|
||||
}
|
||||
|
||||
.shield-version {
|
||||
-fx-background-color: #6969AA;
|
||||
-fx-background-radius: 0 5 5 0;
|
||||
}
|
||||
}
|
@ -23,23 +23,5 @@
|
||||
-fx-text-fill: #2c69e0;
|
||||
-fx-text-alignment: CENTER;
|
||||
}
|
||||
|
||||
.shield {
|
||||
|
||||
.label {
|
||||
-fx-text-fill: white;
|
||||
-fx-label-padding: 3 5 3 5;
|
||||
}
|
||||
|
||||
.shield-name {
|
||||
-fx-background-color: #555555;
|
||||
-fx-background-radius: 5 0 0 5;
|
||||
}
|
||||
|
||||
.shield-version {
|
||||
-fx-background-color: #6969AA;
|
||||
-fx-background-radius: 0 5 5 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
34
src/main/resources/fxml/about-view.fxml
Normal file
34
src/main/resources/fxml/about-view.fxml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox fx:id="aboutView" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
|
||||
prefHeight="700" prefWidth="720" spacing="30" alignment="CENTER"
|
||||
stylesheets="@../css/about-view.css"
|
||||
fx:controller="cn.octopusyan.alistgui.controller.AboutController">
|
||||
|
||||
<StackPane>
|
||||
<padding>
|
||||
<Insets bottom="10"/>
|
||||
</padding>
|
||||
<ImageView pickOnBounds="true" preserveRatio="true">
|
||||
<Image url="@../assets/logo-about.png" backgroundLoading="true"/>
|
||||
</ImageView>
|
||||
</StackPane>
|
||||
|
||||
<HBox alignment="CENTER" styleClass="shield">
|
||||
<Label styleClass="shield-name" text="%about.alist.version"/>
|
||||
<Label fx:id="aListVersion" styleClass="shield-version"/>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" styleClass="shield">
|
||||
<Label styleClass="shield-name" text="%about.app.version"/>
|
||||
<Label styleClass="shield-version" text="v${project.version}"/>
|
||||
</HBox>
|
||||
<Button fx:id="checkAppVersion" text="%about.app.update"/>
|
||||
<Button fx:id="checkAListVersion" onAction="#checkAListUpdate" text="%about.alist.update"/>
|
||||
</VBox>
|
@ -37,6 +37,13 @@
|
||||
<!-- 引入设置页 -->
|
||||
<fx:include fx:id="setupController" source="setup-view.fxml" prefWidth="Infinity" prefHeight="-Infinity"/>
|
||||
</Tab>
|
||||
<Tab text="%root.tab.about">
|
||||
<graphic>
|
||||
<FontIcon iconColor="white" iconLiteral="fa-info-circle"/>
|
||||
</graphic>
|
||||
<!-- 引入关于页 -->
|
||||
<fx:include fx:id="aboutController" source="about-view.fxml" prefWidth="Infinity" prefHeight="-Infinity"/>
|
||||
</Tab>
|
||||
</TabPane>
|
||||
<HBox fx:id="windowFooter" alignment="CENTER" prefWidth="Infinity" spacing="25.0">
|
||||
<padding>
|
||||
|
@ -3,48 +3,39 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<AnchorPane fx:id="setupView" prefHeight="700" prefWidth="720" stylesheets="@../css/setup-view.css"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="cn.octopusyan.alistgui.controller.SetupController">
|
||||
<VBox fx:id="setupView" stylesheets="@../css/setup-view.css"
|
||||
prefHeight="700" prefWidth="720" spacing="20"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="cn.octopusyan.alistgui.controller.SetupController">
|
||||
<padding>
|
||||
<Insets left="10.0" right="10.0" top="20.0"/>
|
||||
</padding>
|
||||
<VBox spacing="20" AnchorPane.topAnchor="0" AnchorPane.leftAnchor="0">
|
||||
<CheckBox fx:id="autoStartCheckBox" text="%setup.auto-start.label"/>
|
||||
<CheckBox fx:id="silentStartupCheckBox" text="%setup.silent-startup.label"/>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10">
|
||||
<Label text="%setup.language"/>
|
||||
<ComboBox fx:id="languageComboBox"/>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="20">
|
||||
<Label styleClass="proxy-label" text="%setup.proxy"/>
|
||||
<ComboBox fx:id="proxySetupComboBox"/>
|
||||
<Button fx:id="proxyCheck" text="%setup.proxy.test"/>
|
||||
</HBox>
|
||||
<VBox fx:id="proxySetupPane" spacing="10">
|
||||
<HBox alignment="CENTER_LEFT" spacing="20">
|
||||
<Label text="%setup.proxy.host"/>
|
||||
<TextField fx:id="proxyHost" promptText="127.0.0.1"/>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="20">
|
||||
<Label text="%setup.proxy.port"/>
|
||||
<TextField fx:id="proxyPort" promptText="8080"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</VBox>
|
||||
<AnchorPane AnchorPane.rightAnchor="0" AnchorPane.bottomAnchor="0">
|
||||
<VBox alignment="CENTER" spacing="10" AnchorPane.bottomAnchor="50" AnchorPane.rightAnchor="0"
|
||||
AnchorPane.topAnchor="0">
|
||||
<HBox alignment="CENTER" styleClass="shield">
|
||||
<Label styleClass="shield-name" text="%alist.version"/>
|
||||
<Label fx:id="aListVersion" styleClass="shield-version"/>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" styleClass="shield">
|
||||
<Label styleClass="shield-name" text="%app.version"/>
|
||||
<Label styleClass="shield-version" text="v${project.version}"/>
|
||||
</HBox>
|
||||
<Button fx:id="checkAppVersion" text="%app.update"/>
|
||||
<Button fx:id="checkAListVersion" onAction="#checkAListUpdate" text="%alist.update"/>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
</AnchorPane>
|
||||
<CheckBox fx:id="autoStartCheckBox" text="%setup.auto-start.label"/>
|
||||
<CheckBox fx:id="silentStartupCheckBox" text="%setup.silent-startup.label"/>
|
||||
<HBox alignment="CENTER_LEFT" spacing="10">
|
||||
<Label text="%setup.language"/>
|
||||
<ComboBox fx:id="languageComboBox"/>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT" spacing="20">
|
||||
<Label styleClass="proxy-label" text="%setup.proxy"/>
|
||||
<ComboBox fx:id="proxySetupComboBox"/>
|
||||
<Button fx:id="proxyCheck" onAction="#proxyTest" text="%setup.proxy.test"/>
|
||||
</HBox>
|
||||
<GridPane fx:id="proxySetupPane" vgap="10" hgap="10">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" percentWidth="10"/>
|
||||
<ColumnConstraints hgrow="SOMETIMES" percentWidth="40"/>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES"/>
|
||||
<RowConstraints vgrow="SOMETIMES"/>
|
||||
</rowConstraints>
|
||||
<padding>
|
||||
<Insets left="30"/>
|
||||
</padding>
|
||||
<Label text="%setup.proxy.host"/>
|
||||
<TextField fx:id="proxyHost" promptText="127.0.0.1" GridPane.columnIndex="1"/>
|
||||
<Label text="%setup.proxy.port" GridPane.rowIndex="1"/>
|
||||
<TextField fx:id="proxyPort" promptText="8080" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
</GridPane>
|
||||
</VBox>
|
||||
|
@ -1,8 +1,10 @@
|
||||
label.cancel=\u53D6\u6D88
|
||||
root.tab.main=\u4E3B\u9875
|
||||
root.tab.setup=\u8BBE\u7F6E
|
||||
root.tab.about=\u5173\u4E8E
|
||||
root.foot.doc=\u6587\u6863
|
||||
root.foot.github=GitHub
|
||||
root.foot.sponsor=\u8D5E\u52A9
|
||||
root.foot.sponsor=\u8D5E\u52A9 AList
|
||||
main.control.start=\u5F00\u59CB
|
||||
main.control.password=\u5BC6\u7801
|
||||
main.control.restart=\u91CD\u542F
|
||||
@ -15,14 +17,19 @@ setup.proxy=HTTP\u4EE3\u7406
|
||||
setup.auto-start.label=\u5F00\u673A\u81EA\u542F
|
||||
setup.silent-startup.label=\u9759\u9ED8\u542F\u52A8
|
||||
setup.language=\u8BED\u8A00
|
||||
alist.version=AList \u7248\u672C
|
||||
app.version=GUI \u7248\u672C
|
||||
alist.update=\u68C0\u67E5 AList \u7248\u672C
|
||||
app.update=\u68C0\u67E5 GUI \u7248\u672C
|
||||
setup.proxy.host=\u4E3B\u673A
|
||||
setup.proxy.port=\u7AEF\u53E3
|
||||
proxy.setup.label.no_proxy=\u4E0D\u4EE3\u7406
|
||||
proxy.setup.label.system=\u7CFB\u7EDF\u4EE3\u7406
|
||||
proxy.setup.label.manual=\u624B\u52A8\u8BBE\u7F6E
|
||||
setup.proxy.host=\u4E3B\u673A
|
||||
setup.proxy.port=\u7AEF\u53E3
|
||||
setup.proxy.test=\u6D4B\u8BD5
|
||||
proxy.test.header=\u8BF7\u8F93\u5165\u60A8\u8981\u68C0\u67E5\u7684\u4EFB\u4F55URL\uFF1A
|
||||
proxy.test.title=\u68C0\u67E5\u4EE3\u7406\u8BBE\u7F6E
|
||||
proxy.test.result.success=\u8FDE\u63A5\u6210\u529F
|
||||
proxy.test.result.failed=\u8FDE\u63A5\u95EE\u9898:
|
||||
about.alist.version=AList \u7248\u672C
|
||||
about.app.version=GUI \u7248\u672C
|
||||
about.alist.update=\u68C0\u67E5 AList \u7248\u672C
|
||||
about.app.update=\u68C0\u67E5 GUI \u7248\u672C
|
||||
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
label.cancel=Cancel
|
||||
root.tab.main=Home
|
||||
root.tab.setup=Setup
|
||||
root.tab.about=About
|
||||
root.foot.doc=Document
|
||||
root.foot.github=GitHub
|
||||
root.foot.sponsor=Sponsor
|
||||
root.foot.sponsor=Sponsor AList
|
||||
main.control.start=Start
|
||||
main.control.password=Password
|
||||
main.control.restart=Restart
|
||||
@ -15,14 +17,19 @@ setup.proxy=HTTP PROXY
|
||||
setup.auto-start.label=Auto start with PC
|
||||
setup.silent-startup.label=Silent startup
|
||||
setup.language=language
|
||||
alist.version=AList Version
|
||||
app.version=GUI Version
|
||||
alist.update=Check AList Version
|
||||
app.update=Check GUI Version
|
||||
setup.proxy.host=Host
|
||||
setup.proxy.port=Port
|
||||
proxy.setup.label.no_proxy=No Proxy
|
||||
proxy.setup.label.system=System Proxy
|
||||
proxy.setup.label.manual=Manual Config
|
||||
setup.proxy.host=Host
|
||||
setup.proxy.port=Port
|
||||
setup.proxy.test=Check connection
|
||||
proxy.test.header=Enter any URL to check connection to:
|
||||
proxy.test.title=Check Proxy Settings
|
||||
proxy.test.result.success=Connection successful
|
||||
proxy.test.result.failed=Problem with connection:
|
||||
about.alist.version=AList Version
|
||||
about.app.version=GUI Version
|
||||
about.alist.update=Check AList Version
|
||||
about.app.update=Check GUI Version
|
||||
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
label.cancel=\u53D6\u6D88
|
||||
root.tab.main=\u4E3B\u9875
|
||||
root.tab.setup=\u8BBE\u7F6E
|
||||
root.tab.about=\u5173\u4E8E
|
||||
root.foot.doc=\u6587\u6863
|
||||
root.foot.github=GitHub
|
||||
root.foot.sponsor=\u8D5E\u52A9
|
||||
root.foot.sponsor=\u8D5E\u52A9 AList
|
||||
main.control.start=\u5F00\u59CB
|
||||
main.control.password=\u5BC6\u7801
|
||||
main.control.restart=\u91CD\u542F
|
||||
@ -15,14 +17,19 @@ setup.proxy=HTTP\u4EE3\u7406
|
||||
setup.auto-start.label=\u5F00\u673A\u81EA\u542F
|
||||
setup.silent-startup.label=\u9759\u9ED8\u542F\u52A8
|
||||
setup.language=\u8BED\u8A00
|
||||
alist.version=AList \u7248\u672C
|
||||
app.version=GUI \u7248\u672C
|
||||
alist.update=\u68C0\u67E5 AList \u7248\u672C
|
||||
app.update=\u68C0\u67E5 GUI \u7248\u672C
|
||||
setup.proxy.host=\u4E3B\u673A
|
||||
setup.proxy.port=\u7AEF\u53E3
|
||||
proxy.setup.label.no_proxy=\u4E0D\u4EE3\u7406
|
||||
proxy.setup.label.system=\u7CFB\u7EDF\u4EE3\u7406
|
||||
proxy.setup.label.manual=\u624B\u52A8\u8BBE\u7F6E
|
||||
setup.proxy.host=\u4E3B\u673A
|
||||
setup.proxy.port=\u7AEF\u53E3
|
||||
setup.proxy.test=\u6D4B\u8BD5
|
||||
proxy.test.header=\u8BF7\u8F93\u5165\u60A8\u8981\u68C0\u67E5\u7684\u4EFB\u4F55URL\uFF1A
|
||||
proxy.test.title=\u68C0\u67E5\u4EE3\u7406\u8BBE\u7F6E
|
||||
proxy.test.result.success=\u8FDE\u63A5\u6210\u529F
|
||||
proxy.test.result.failed=\u8FDE\u63A5\u95EE\u9898:
|
||||
about.alist.version=AList \u7248\u672C
|
||||
about.app.version=GUI \u7248\u672C
|
||||
about.alist.update=\u68C0\u67E5 AList \u7248\u672C
|
||||
about.app.update=\u68C0\u67E5 GUI \u7248\u672C
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user