mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-12 05:16:13 -04:00
Add an explicit entry to game list page
This commit is contained in:
parent
83516ba679
commit
030b577dee
@ -40,7 +40,7 @@ import org.jackhuang.hmcl.ui.construct.DialogCloseEvent;
|
||||
import org.jackhuang.hmcl.ui.construct.IconedItem;
|
||||
import org.jackhuang.hmcl.ui.profile.ProfileAdvancedListItem;
|
||||
import org.jackhuang.hmcl.ui.versions.GameAdvancedListItem;
|
||||
import org.jackhuang.hmcl.upgrade.UpdateChecker;
|
||||
import org.jackhuang.hmcl.ui.versions.Versions;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@ -55,12 +55,17 @@ public final class LeftPaneController extends AdvancedListBox {
|
||||
accountListItem.setOnAction(e -> Controllers.navigate(Controllers.getAccountListPage()));
|
||||
accountListItem.accountProperty().bind(Accounts.selectedAccountProperty());
|
||||
GameAdvancedListItem gameListItem = new GameAdvancedListItem();
|
||||
gameListItem.setOnAction(e -> Controllers.navigate(Controllers.getGameListPage()));
|
||||
gameListItem.actionButtonVisibleProperty().bind(Profiles.selectedVersionProperty().isNotNull());
|
||||
gameListItem.setOnAction(e -> Versions.modifyGameSettings(Profiles.getSelectedProfile(), Profiles.getSelectedVersion()));
|
||||
ProfileAdvancedListItem profileListItem = new ProfileAdvancedListItem();
|
||||
profileListItem.setOnAction(e -> Controllers.navigate(Controllers.getProfileListPage()));
|
||||
profileListItem.profileProperty().bind(Profiles.selectedProfileProperty());
|
||||
|
||||
IconedItem launcherSettingsItem = new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), "iconed-item");
|
||||
IconedItem gameItem = new IconedItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 20, 20), 32, 20), "iconed-item");
|
||||
gameItem.getLabel().setText(i18n("version.manage"));
|
||||
gameItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getGameListPage()));
|
||||
|
||||
IconedItem launcherSettingsItem = new IconedItem(FXUtils.limitingSize(SVG.gear(Theme.blackFillBinding(), 20, 20), 32, 20), "iconed-item");
|
||||
launcherSettingsItem.getLabel().setText(i18n("settings.launcher"));
|
||||
|
||||
launcherSettingsItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
||||
@ -70,6 +75,7 @@ public final class LeftPaneController extends AdvancedListBox {
|
||||
.add(accountListItem)
|
||||
.startCategory(i18n("version").toUpperCase())
|
||||
.add(gameListItem)
|
||||
.add(gameItem)
|
||||
.startCategory(i18n("profile.title").toUpperCase())
|
||||
.add(profileListItem)
|
||||
.startCategory(i18n("launcher").toUpperCase())
|
||||
|
@ -17,10 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.ui.construct;
|
||||
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Rectangle2D;
|
||||
@ -29,9 +26,10 @@ import javafx.scene.control.Skin;
|
||||
import javafx.scene.image.Image;
|
||||
|
||||
public class AdvancedListItem extends Control {
|
||||
private final ObjectProperty<Image> image = new SimpleObjectProperty<>();
|
||||
private final StringProperty title = new SimpleStringProperty();
|
||||
private final StringProperty subtitle = new SimpleStringProperty();
|
||||
private final ObjectProperty<Image> image = new SimpleObjectProperty<>(this, "image");
|
||||
private final StringProperty title = new SimpleStringProperty(this, "title");
|
||||
private final StringProperty subtitle = new SimpleStringProperty(this, "subtitle");
|
||||
private final BooleanProperty actionButtonVisible = new SimpleBooleanProperty(this, "actionButtonVisible", true);
|
||||
|
||||
public ObjectProperty<Image> imageProperty() {
|
||||
return image;
|
||||
@ -45,6 +43,10 @@ public class AdvancedListItem extends Control {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
public BooleanProperty actionButtonVisibleProperty() {
|
||||
return actionButtonVisible;
|
||||
}
|
||||
|
||||
public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty() {
|
||||
return onAction;
|
||||
}
|
||||
|
@ -93,6 +93,11 @@ public class AdvancedListItemSkin extends SkinBase<AdvancedListItem> {
|
||||
right.getChildren().setAll(settings);
|
||||
root.setRight(right);
|
||||
|
||||
FXUtils.onChangeAndOperate(skinnable.actionButtonVisibleProperty(), newValue -> {
|
||||
if (newValue) root.setRight(right);
|
||||
else root.setRight(null);
|
||||
});
|
||||
|
||||
stackPane.setStyle("-fx-padding: 10 16 10 16;");
|
||||
stackPane.getStyleClass().setAll("transparent");
|
||||
stackPane.setPickOnBounds(false);
|
||||
|
@ -361,7 +361,7 @@ update.tooltip=Update
|
||||
version=Games
|
||||
version.cannot_read=Unable to gather the game version. Cannot continue auto-installing.
|
||||
version.empty=No game
|
||||
version.empty.add=Click btn right to install game
|
||||
version.empty.add=Install game in game list
|
||||
version.empty.launch=No game to launch, please install new game via game list page.
|
||||
version.forbidden_name=Forbidden name, do not use this.
|
||||
version.game.old=Old
|
||||
|
@ -361,7 +361,7 @@ update.tooltip=更新
|
||||
version=遊戲
|
||||
version.cannot_read=讀取遊戲版本失敗,無法進行自動安裝
|
||||
version.empty=無遊戲版本
|
||||
version.empty.add=點擊右側按鈕安裝
|
||||
version.empty.add=進入遊戲列表安裝
|
||||
version.empty.launch=沒有可啟動的遊戲,你可以點擊左側遊戲欄內的設置按鈕進入遊戲列表安裝遊戲
|
||||
version.forbidden_name=此版本名稱不受支援,請換一個名字
|
||||
version.game.old=老舊版本
|
||||
|
@ -361,7 +361,7 @@ update.tooltip=更新
|
||||
version=游戏
|
||||
version.cannot_read=读取游戏版本失败,无法进行自动安装
|
||||
version.empty=没有游戏版本
|
||||
version.empty.add=点击右侧按钮安装
|
||||
version.empty.add=进入游戏列表安装
|
||||
version.empty.launch=没有可启动的游戏,你可以点击左侧游戏栏内的设置按钮进入游戏列表安装游戏
|
||||
version.forbidden_name=此版本名称不受支持,请换一个名字
|
||||
version.game.old=远古版
|
||||
|
Loading…
x
Reference in New Issue
Block a user