diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountPage.java index e2805b61d..9befda845 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountPage.java @@ -38,6 +38,7 @@ import org.jackhuang.hmcl.game.AccountHelper; import org.jackhuang.hmcl.setting.Accounts; import org.jackhuang.hmcl.setting.Theme; import org.jackhuang.hmcl.task.Schedulers; +import org.jackhuang.hmcl.ui.construct.AdvancedListItem; import org.jackhuang.hmcl.ui.construct.ComponentList; import org.jackhuang.hmcl.ui.wizard.DecoratorPage; @@ -49,7 +50,7 @@ import java.util.Optional; public class AccountPage extends StackPane implements DecoratorPage { private final StringProperty title; private final ObjectProperty onDelete = new SimpleObjectProperty<>(this, "onDelete"); - private final VersionListItem item; + private final AdvancedListItem item; private final Account account; @FXML @@ -73,7 +74,7 @@ public class AccountPage extends StackPane implements DecoratorPage { @FXML private JFXProgressBar progressBar; - public AccountPage(Account account, VersionListItem item) { + public AccountPage(Account account, AdvancedListItem item) { this.account = account; this.item = item; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java index 3b6febb0d..cf7cbbadd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java @@ -49,11 +49,7 @@ import org.jackhuang.hmcl.setting.*; import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.task.TaskExecutor; -import org.jackhuang.hmcl.ui.construct.AdvancedListBox; -import org.jackhuang.hmcl.ui.construct.ClassTitle; -import org.jackhuang.hmcl.ui.construct.DialogCloseEvent; -import org.jackhuang.hmcl.ui.construct.IconedItem; -import org.jackhuang.hmcl.ui.construct.RipplerContainer; +import org.jackhuang.hmcl.ui.construct.*; import org.jackhuang.hmcl.upgrade.UpdateChecker; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.MappedObservableList; @@ -127,7 +123,7 @@ public final class LeftPaneController { // ==== Accounts ==== // Missing account item - VersionListItem missingAccountItem = new VersionListItem(i18n("account.missing"), i18n("message.unknown")); + AdvancedListItem missingAccountItem = new AdvancedListItem(i18n("account.missing"), i18n("message.unknown")); RipplerContainer missingAccountRippler = new RipplerContainer(missingAccountItem); missingAccountItem.setOnSettingsButtonClicked(e -> addNewAccount()); missingAccountRippler.setOnMouseClicked(e -> addNewAccount()); @@ -162,7 +158,7 @@ public final class LeftPaneController { } private RipplerContainer createAccountItem(Account account) { - VersionListItem item = new VersionListItem(account.getCharacter(), accountSubtitle(account)); + AdvancedListItem item = new AdvancedListItem(account.getCharacter(), accountSubtitle(account)); RipplerContainer rippler = new RipplerContainer(item); item.setOnSettingsButtonClicked(e -> { AccountPage accountPage = new AccountPage(account, item); @@ -219,7 +215,7 @@ public final class LeftPaneController { if (node instanceof RipplerContainer && node.getProperties().get("profile") instanceof String) { boolean current = Objects.equals(node.getProperties().get("profile"), profile.getName()); ((RipplerContainer) node).setSelected(current); - ((VersionListItem) ((RipplerContainer) node).getContainer()).setGameVersion(current ? i18n("profile.selected") : ""); + ((AdvancedListItem) ((RipplerContainer) node).getContainer()).setSubtitle(current ? i18n("profile.selected") : ""); } } }); @@ -228,7 +224,7 @@ public final class LeftPaneController { private void onProfilesLoading() { LinkedList list = new LinkedList<>(); for (Profile profile : Settings.instance().getProfiles()) { - VersionListItem item = new VersionListItem(Profiles.getProfileDisplayName(profile)); + AdvancedListItem item = new AdvancedListItem(Profiles.getProfileDisplayName(profile)); RipplerContainer ripplerContainer = new RipplerContainer(item); item.setOnSettingsButtonClicked(e -> Controllers.getDecorator().showPage(new ProfilePage(profile))); ripplerContainer.setOnMouseClicked(e -> Settings.instance().setSelectedProfile(profile)); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java similarity index 70% rename from HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java rename to HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java index 140c64fd2..e740fbce9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListItem.java @@ -15,7 +15,7 @@ * 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; +package org.jackhuang.hmcl.ui.construct; import com.jfoenix.controls.JFXButton; import javafx.event.EventHandler; @@ -26,27 +26,28 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.StackPane; +import org.jackhuang.hmcl.ui.FXUtils; -public final class VersionListItem extends StackPane { +public final class AdvancedListItem extends StackPane { @FXML private StackPane imageViewContainer; @FXML - private Label lblVersionName; + private Label lblTitle; @FXML - private Label lblGameVersion; + private Label lblSubtitle; @FXML private ImageView imageView; @FXML private JFXButton btnSettings; - public VersionListItem(String versionName) { - this(versionName, ""); + public AdvancedListItem(String title) { + this(title, ""); } - public VersionListItem(String versionName, String gameVersion) { - FXUtils.loadFXML(this, "/assets/fxml/version-list-item.fxml"); + public AdvancedListItem(String title, String subtitle) { + FXUtils.loadFXML(this, "/assets/fxml/advanced-list-item.fxml"); - lblVersionName.setText(versionName); - lblGameVersion.setText(gameVersion); + lblTitle.setText(title); + lblSubtitle.setText(subtitle); FXUtils.limitSize(imageView, 32, 32); } @@ -55,12 +56,12 @@ public final class VersionListItem extends StackPane { btnSettings.setOnMouseClicked(handler); } - public void setVersionName(String versionName) { - lblVersionName.setText(versionName); + public void setTitle(String title) { + lblTitle.setText(title); } - public void setGameVersion(String gameVersion) { - lblGameVersion.setText(gameVersion); + public void setSubtitle(String subtitle) { + lblSubtitle.setText(subtitle); } public void setImage(Image image, Rectangle2D viewport) { diff --git a/HMCL/src/main/resources/assets/fxml/version-list-item.fxml b/HMCL/src/main/resources/assets/fxml/advanced-list-item.fxml similarity index 86% rename from HMCL/src/main/resources/assets/fxml/version-list-item.fxml rename to HMCL/src/main/resources/assets/fxml/advanced-list-item.fxml index 34109b66b..7f71c65f5 100644 --- a/HMCL/src/main/resources/assets/fxml/version-list-item.fxml +++ b/HMCL/src/main/resources/assets/fxml/advanced-list-item.fxml @@ -21,10 +21,10 @@ - -