Merge branch 'javafx' of https://github.com/huanghongxun/HMCL into javafx
This commit is contained in:
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui.account;
|
|||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXDialogLayout;
|
import com.jfoenix.controls.JFXDialogLayout;
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@@ -29,6 +30,7 @@ import org.jackhuang.hmcl.task.Schedulers;
|
|||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
|
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
|
||||||
import org.jackhuang.hmcl.ui.animation.TransitionHandler;
|
import org.jackhuang.hmcl.ui.animation.TransitionHandler;
|
||||||
|
import org.jackhuang.hmcl.ui.construct.DialogAware;
|
||||||
import org.jackhuang.hmcl.ui.construct.DialogCloseEvent;
|
import org.jackhuang.hmcl.ui.construct.DialogCloseEvent;
|
||||||
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
||||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
@@ -37,9 +39,10 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
|
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
|
||||||
import static org.jackhuang.hmcl.ui.FXUtils.loadFXML;
|
import static org.jackhuang.hmcl.ui.FXUtils.loadFXML;
|
||||||
|
import static org.jackhuang.hmcl.util.Lang.thread;
|
||||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||||
|
|
||||||
public class AddAuthlibInjectorServerPane extends StackPane {
|
public class AddAuthlibInjectorServerPane extends StackPane implements DialogAware {
|
||||||
|
|
||||||
@FXML private StackPane addServerContainer;
|
@FXML private StackPane addServerContainer;
|
||||||
@FXML private Label lblServerUrl;
|
@FXML private Label lblServerUrl;
|
||||||
@@ -70,6 +73,14 @@ public class AddAuthlibInjectorServerPane extends StackPane {
|
|||||||
btnAddNext.disableProperty().bind(
|
btnAddNext.disableProperty().bind(
|
||||||
Bindings.createBooleanBinding(txtServerUrl::validate, txtServerUrl.textProperty()).not());
|
Bindings.createBooleanBinding(txtServerUrl::validate, txtServerUrl.textProperty()).not());
|
||||||
nextPane.hideSpinner();
|
nextPane.hideSpinner();
|
||||||
|
|
||||||
|
txtServerUrl.setText("https://");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDialogShown() {
|
||||||
|
txtServerUrl.requestFocus();
|
||||||
|
txtServerUrl.selectEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fixInputUrl(String url) {
|
private String fixInputUrl(String url) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2017 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.ui.construct;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.ui.Controllers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yushijinhun
|
||||||
|
* @see Controllers#dialog(javafx.scene.layout.Region)
|
||||||
|
*/
|
||||||
|
public interface DialogAware {
|
||||||
|
|
||||||
|
default void onDialogShown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@ import javafx.animation.KeyValue;
|
|||||||
import javafx.animation.Timeline;
|
import javafx.animation.Timeline;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.Cursor;
|
import javafx.scene.Cursor;
|
||||||
@@ -303,6 +305,23 @@ public class DecoratorController {
|
|||||||
EventHandler<DialogCloseEvent> handler = event -> closeDialog(node);
|
EventHandler<DialogCloseEvent> handler = event -> closeDialog(node);
|
||||||
node.getProperties().put(PROPERTY_DIALOG_CLOSE_HANDLER, handler);
|
node.getProperties().put(PROPERTY_DIALOG_CLOSE_HANDLER, handler);
|
||||||
node.addEventHandler(DialogCloseEvent.CLOSE, handler);
|
node.addEventHandler(DialogCloseEvent.CLOSE, handler);
|
||||||
|
|
||||||
|
if (node instanceof DialogAware) {
|
||||||
|
DialogAware dialogAware = (DialogAware) node;
|
||||||
|
if (dialog.isVisible()) {
|
||||||
|
dialogAware.onDialogShown();
|
||||||
|
} else {
|
||||||
|
dialog.visibleProperty().addListener(new ChangeListener<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
|
||||||
|
if (newValue) {
|
||||||
|
dialogAware.onDialogShown();
|
||||||
|
observable.removeListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ account.failed.invalid_credentials=Incorrect password, or you are forbidden to l
|
|||||||
account.failed.invalid_password=Invalid password
|
account.failed.invalid_password=Invalid password
|
||||||
account.failed.invalid_token=Please log out and re-input your password to login.
|
account.failed.invalid_token=Please log out and re-input your password to login.
|
||||||
account.failed.no_character=No character in this account.
|
account.failed.no_character=No character in this account.
|
||||||
account.failed.server_response_malformed=Invalid server response. Is this a valid authentication server?
|
account.failed.server_response_malformed=Invalid server response. The authentication server may have a failure.
|
||||||
account.injector.add=Add an authentication server
|
account.injector.add=Add an authentication server
|
||||||
account.injector.manage=Manage authentication servers
|
account.injector.manage=Manage authentication servers
|
||||||
account.injector.manage.title=Authentication servers
|
account.injector.manage.title=Authentication servers
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ account.failed.invalid_credentials=您的使用者名稱或密碼錯誤,或者
|
|||||||
account.failed.invalid_password=無效的密碼
|
account.failed.invalid_password=無效的密碼
|
||||||
account.failed.invalid_token=請嘗試登出並重新輸入密碼登入
|
account.failed.invalid_token=請嘗試登出並重新輸入密碼登入
|
||||||
account.failed.no_character=該帳號沒有角色
|
account.failed.no_character=該帳號沒有角色
|
||||||
account.failed.server_response_malformed=這個伺服器不是合法的登入驗證伺服器
|
account.failed.server_response_malformed=無法解析認證伺服器響應,可能是伺服器故障
|
||||||
account.injector.add=新增認證伺服器
|
account.injector.add=新增認證伺服器
|
||||||
account.injector.manage=管理認證伺服器
|
account.injector.manage=管理認證伺服器
|
||||||
account.injector.manage.title=認證伺服器
|
account.injector.manage.title=認證伺服器
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ account.character=角色
|
|||||||
account.choose=选择一个角色
|
account.choose=选择一个角色
|
||||||
account.create=新建账户
|
account.create=新建账户
|
||||||
account.email=邮箱
|
account.email=邮箱
|
||||||
account.failed.connect_authentication_server=无法连接认证服务器,可能是网络问题
|
account.failed.connect_authentication_server=无法连接认证服务器,可能是网络问题
|
||||||
account.failed.connect_injector_server=无法连接认证服务器,可能是网络故障或 URL 输入错误
|
account.failed.connect_injector_server=无法连接认证服务器,可能是网络故障或 URL 输入错误
|
||||||
account.failed.invalid_credentials=您的用户名或密码错误,或者登录次数过多被暂时禁止登录,请稍后再试
|
account.failed.invalid_credentials=您的用户名或密码错误,或者登录次数过多被暂时禁止登录,请稍后再试
|
||||||
account.failed.invalid_password=无效的密码
|
account.failed.invalid_password=无效的密码
|
||||||
account.failed.invalid_token=请尝试登出并重新输入密码登录
|
account.failed.invalid_token=请尝试登出并重新输入密码登录
|
||||||
account.failed.no_character=该帐号没有角色
|
account.failed.no_character=该帐号没有角色
|
||||||
account.failed.server_response_malformed=这个服务器不是合法的登录验证服务器
|
account.failed.server_response_malformed=无法解析认证服务器响应,可能是服务器故障
|
||||||
account.injector.add=添加认证服务器
|
account.injector.add=添加认证服务器
|
||||||
account.injector.manage=管理认证服务器
|
account.injector.manage=管理认证服务器
|
||||||
account.injector.manage.title=认证服务器
|
account.injector.manage.title=认证服务器
|
||||||
|
|||||||
Reference in New Issue
Block a user