revert: RootPage UI
This commit is contained in:
@@ -56,7 +56,7 @@ public class AccountAdvancedListItem extends AdvancedListItem {
|
||||
} else {
|
||||
titleProperty().bind(Bindings.createStringBinding(account::getCharacter, account));
|
||||
setSubtitle(accountSubtitle(account));
|
||||
imageView.imageProperty().bind(TexturesLoader.fxAvatarBinding(account, 42));
|
||||
imageView.imageProperty().bind(TexturesLoader.fxAvatarBinding(account, 32));
|
||||
tooltip.setText(account.getCharacter() + " " + accountTooltip(account));
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class AccountAdvancedListItem extends AdvancedListItem {
|
||||
tooltip = new Tooltip();
|
||||
FXUtils.installFastTooltip(this, tooltip);
|
||||
|
||||
Pair<Node, ImageView> view = createImageView(null, 42, 42);
|
||||
Pair<Node, ImageView> view = createImageView(null);
|
||||
setLeftGraphic(view.getKey());
|
||||
imageView = view.getValue();
|
||||
|
||||
@@ -108,60 +108,4 @@ public class AccountAdvancedListItem extends AdvancedListItem {
|
||||
}
|
||||
}
|
||||
|
||||
// private static class AccountAdvancedListItemSkin extends SkinBase<AccountAdvancedListItemSkin> {
|
||||
// private final PseudoClass SELECTED = PseudoClass.getPseudoClass("selected");
|
||||
//
|
||||
// public AccountAdvancedListItemSkin(AccountAdvancedListItemSkin skinnable) {
|
||||
// super(skinnable);
|
||||
//
|
||||
// FXUtils.onChangeAndOperate(skinnable.activeProperty(), active -> {
|
||||
// skinnable.pseudoClassStateChanged(SELECTED, active);
|
||||
// });
|
||||
//
|
||||
// BorderPane root = new BorderPane();
|
||||
// root.getStyleClass().add("container");
|
||||
// root.setPickOnBounds(false);
|
||||
//
|
||||
// RipplerContainer container = new RipplerContainer(root);
|
||||
//
|
||||
// HBox left = new HBox();
|
||||
// left.setAlignment(Pos.CENTER_LEFT);
|
||||
// left.setMouseTransparent(true);
|
||||
//
|
||||
// TwoLineListItem item = new TwoLineListItem();
|
||||
// root.setCenter(item);
|
||||
// item.setMouseTransparent(true);
|
||||
// item.titleProperty().bind(skinnable.titleProperty());
|
||||
// item.subtitleProperty().bind(skinnable.subtitleProperty());
|
||||
//
|
||||
// FXUtils.onChangeAndOperate(skinnable.leftGraphicProperty(),
|
||||
// newGraphic -> {
|
||||
// if (newGraphic == null) {
|
||||
// left.getChildren().clear();
|
||||
// } else {
|
||||
// left.getChildren().setAll(newGraphic);
|
||||
// }
|
||||
// });
|
||||
// root.setLeft(left);
|
||||
//
|
||||
// HBox right = new HBox();
|
||||
// right.setAlignment(Pos.CENTER);
|
||||
// right.setMouseTransparent(true);
|
||||
// right.getStyleClass().add("toggle-icon4");
|
||||
// FXUtils.setLimitWidth(right, 40);
|
||||
// FXUtils.onChangeAndOperate(skinnable.rightGraphicProperty(),
|
||||
// newGraphic -> {
|
||||
// if (newGraphic == null) {
|
||||
// right.getChildren().clear();
|
||||
// } else {
|
||||
// right.getChildren().setAll(newGraphic);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// FXUtils.onChangeAndOperate(skinnable.actionButtonVisibleProperty(),
|
||||
// visible -> root.setRight(visible ? right : null));
|
||||
//
|
||||
// getChildren().setAll(container);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -85,10 +85,6 @@ public class AdvancedListBox extends ScrollPane {
|
||||
}
|
||||
}
|
||||
|
||||
public AdvancedListBox startCategory() {
|
||||
return add(new ClassTitle());
|
||||
}
|
||||
|
||||
public AdvancedListBox startCategory(String category) {
|
||||
return add(new ClassTitle(category));
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.ui.construct;
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
@@ -34,29 +32,20 @@ import org.jackhuang.hmcl.util.Lang;
|
||||
public class ClassTitle extends StackPane {
|
||||
private final Node content;
|
||||
|
||||
public ClassTitle() {
|
||||
this((Node) null);
|
||||
}
|
||||
|
||||
public ClassTitle(String text) {
|
||||
this(new Label(text));
|
||||
this(new Text(text));
|
||||
}
|
||||
|
||||
public ClassTitle(Node content) {
|
||||
this.content = content;
|
||||
|
||||
VBox vbox = new VBox();
|
||||
vbox.getChildren().addAll(content);
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.widthProperty().bind(vbox.widthProperty());
|
||||
rectangle.setHeight(1.0);
|
||||
rectangle.setFill(Color.GRAY);
|
||||
vbox.getChildren().add(rectangle);
|
||||
|
||||
if (content != null) {
|
||||
vbox.getChildren().addAll(content);
|
||||
VBox.setMargin(content, new Insets(16, 16, 0, 16));
|
||||
}
|
||||
|
||||
getChildren().setAll(vbox);
|
||||
getStyleClass().add("class-title");
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.jackhuang.hmcl.task.Schedulers;
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
import org.jackhuang.hmcl.ui.Controllers;
|
||||
import org.jackhuang.hmcl.ui.FXUtils;
|
||||
import org.jackhuang.hmcl.ui.SVG;
|
||||
import org.jackhuang.hmcl.ui.account.AccountAdvancedListItem;
|
||||
import org.jackhuang.hmcl.ui.account.AccountList;
|
||||
import org.jackhuang.hmcl.ui.account.AddAccountPane;
|
||||
@@ -56,8 +55,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.newImage;
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.runInFX;
|
||||
import static org.jackhuang.hmcl.ui.versions.VersionPage.wrap;
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public class RootPage extends DecoratorTabPage {
|
||||
@@ -191,23 +190,22 @@ public class RootPage extends DecoratorTabPage {
|
||||
|
||||
// third item in left sidebar
|
||||
AdvancedListItem gameItem = new AdvancedListItem();
|
||||
gameItem.getStyleClass().add("navigation-drawer-item");
|
||||
gameItem.setLeftGraphic(wrap(SVG.gamepad(null, 20, 20)));
|
||||
gameItem.setLeftGraphic(AdvancedListItem.createImageView(newImage("/assets/img/bookshelf.png")).getKey());
|
||||
gameItem.setTitle(i18n("version.manage"));
|
||||
gameItem.setOnAction(e -> Controllers.navigate(Controllers.getGameListPage()));
|
||||
|
||||
// fifth item in left sidebar
|
||||
AdvancedListItem launcherSettingsItem = new AdvancedListItem();
|
||||
launcherSettingsItem.getStyleClass().add("navigation-drawer-item");
|
||||
launcherSettingsItem.setLeftGraphic(wrap(SVG.gearOutline(null, 20, 20)));
|
||||
launcherSettingsItem.setLeftGraphic(AdvancedListItem.createImageView(newImage("/assets/img/command.png")).getKey());
|
||||
launcherSettingsItem.setActionButtonVisible(false);
|
||||
launcherSettingsItem.setTitle(i18n("settings.launcher"));
|
||||
launcherSettingsItem.setOnAction(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
||||
|
||||
// the left sidebar
|
||||
AdvancedListBox sideBar = new AdvancedListBox()
|
||||
.startCategory(i18n("account").toUpperCase())
|
||||
.add(accountListItem)
|
||||
.startCategory()
|
||||
.startCategory(i18n("version").toUpperCase())
|
||||
.add(gameListItem)
|
||||
.add(gameItem)
|
||||
.startCategory(i18n("launcher").toUpperCase())
|
||||
|
||||
@@ -17,32 +17,41 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.ui.versions;
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.image.ImageView;
|
||||
import org.jackhuang.hmcl.setting.Profiles;
|
||||
import org.jackhuang.hmcl.ui.FXUtils;
|
||||
import org.jackhuang.hmcl.ui.SVG;
|
||||
import org.jackhuang.hmcl.ui.construct.AdvancedListItem;
|
||||
import org.jackhuang.hmcl.util.Pair;
|
||||
|
||||
import static org.jackhuang.hmcl.ui.versions.VersionPage.wrap;
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.newImage;
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public class GameAdvancedListItem extends AdvancedListItem {
|
||||
private final Tooltip tooltip;
|
||||
private final ImageView imageView;
|
||||
|
||||
public GameAdvancedListItem() {
|
||||
tooltip = new Tooltip();
|
||||
|
||||
setLeftGraphic(wrap(SVG.wrenchOutline(null, 20, 20)));
|
||||
Pair<Node, ImageView> view = createImageView(null);
|
||||
setLeftGraphic(view.getKey());
|
||||
imageView = view.getValue();
|
||||
|
||||
FXUtils.onChangeAndOperate(Profiles.selectedVersionProperty(), version -> {
|
||||
if (version != null && Profiles.getSelectedProfile() != null &&
|
||||
Profiles.getSelectedProfile().getRepository().hasVersion(version)) {
|
||||
FXUtils.installFastTooltip(this, tooltip);
|
||||
setTitle(i18n("version.manage.manage"));
|
||||
setTitle(version);
|
||||
setSubtitle(null);
|
||||
imageView.setImage(Profiles.getSelectedProfile().getRepository().getVersionIconImage(version));
|
||||
tooltip.setText(version);
|
||||
} else {
|
||||
Tooltip.uninstall(this,tooltip);
|
||||
setTitle(i18n("version.empty"));
|
||||
setSubtitle(i18n("version.empty.add"));
|
||||
imageView.setImage(newImage("/assets/img/grass.png"));
|
||||
tooltip.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,8 +131,7 @@
|
||||
|
||||
.class-title {
|
||||
-fx-font-size: 12px;
|
||||
-fx-text-fill: gray;
|
||||
-fx-padding: 8 0 8 0;
|
||||
-fx-padding: 16 16 8 16;
|
||||
}
|
||||
|
||||
.advanced-list-box-item {
|
||||
|
||||
Reference in New Issue
Block a user