Fix the layout of task executor pane

This commit is contained in:
huangyuhui 2018-02-04 21:26:25 +08:00
parent c7589e4e3c
commit 1516802a8d
6 changed files with 34 additions and 19 deletions

View File

@ -123,7 +123,7 @@ public final class Controllers {
} }
public static void dialog(String text, String title, int type, Runnable onAccept) { public static void dialog(String text, String title, int type, Runnable onAccept) {
dialog(new MessageDialogPane(text, title, decorator.getDialog(), MessageBox.INFORMATION_MESSAGE, onAccept)); dialog(new MessageDialogPane(text, title, decorator.getDialog(), type, onAccept));
} }
public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCacnel) { public static void confirmDialog(String text, String title, Runnable onAccept, Runnable onCacnel) {

View File

@ -68,7 +68,7 @@ public final class LeftPaneController {
iconedItem.prefWidthProperty().bind(leftPane.widthProperty()); iconedItem.prefWidthProperty().bind(leftPane.widthProperty());
iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage())); iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
})) }))
.startCategory(Main.i18n("profile")) .startCategory(Main.i18n("profile").toUpperCase())
.add(profilePane); .add(profilePane);
EventBus.EVENT_BUS.channel(ProfileLoadingEvent.class).register(this::onProfilesLoading); EventBus.EVENT_BUS.channel(ProfileLoadingEvent.class).register(this::onProfilesLoading);

View File

@ -64,7 +64,7 @@ public final class MessageDialogPane extends StackPane {
Optional.ofNullable(onAccept).ifPresent(Runnable::run); Optional.ofNullable(onAccept).ifPresent(Runnable::run);
}); });
actions.getChildren().remove(cancelButton); //actions.getChildren().remove(cancelButton);
switch (type) { switch (type) {
case MessageBox.INFORMATION_MESSAGE: case MessageBox.INFORMATION_MESSAGE:
@ -79,11 +79,14 @@ public final class MessageDialogPane extends StackPane {
case MessageBox.WARNING_MESSAGE: case MessageBox.WARNING_MESSAGE:
graphic.setGraphic(SVG.alert("black", 40, 40)); graphic.setGraphic(SVG.alert("black", 40, 40));
break; break;
case MessageBox.QUESTION_MESSAGE:
graphic.setGraphic(SVG.help_circle("black", 40, 40));
break;
} }
} }
public MessageDialogPane(String text, String title, JFXDialog dialog, Runnable onAccept, Runnable onCancel) { public MessageDialogPane(String text, String title, JFXDialog dialog, Runnable onAccept, Runnable onCancel) {
this(text, title, dialog, -1, onAccept); this(text, title, dialog, MessageBox.QUESTION_MESSAGE, onAccept);
cancelButton.setVisible(true); cancelButton.setVisible(true);
cancelButton.setOnMouseClicked(e -> { cancelButton.setOnMouseClicked(e -> {
@ -95,9 +98,7 @@ public final class MessageDialogPane extends StackPane {
acceptButton.setText(Main.i18n("button.yes")); acceptButton.setText(Main.i18n("button.yes"));
cancelButton.setText(Main.i18n("button.no")); cancelButton.setText(Main.i18n("button.no"));
actions.getChildren().add(cancelButton); //actions.getChildren().add(cancelButton);
graphic.setGraphic(SVG.help_circle("black", 40, 40));
} }
public void disableClosingDialog() { public void disableClosingDialog() {

View File

@ -7,16 +7,30 @@
<?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.JFXButton?>
<?import org.jackhuang.hmcl.ui.construct.TaskListPane?> <?import org.jackhuang.hmcl.ui.construct.TaskListPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.control.ScrollPane?>
<fx:root xmlns="http://javafx.com/javafx" <fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
type="StackPane"> type="StackPane">
<JFXProgressBar fx:id="progressBar" StackPane.alignment="TOP_CENTER" /> <BorderPane>
<VBox alignment="TOP_CENTER" style="-fx-padding: 16px;"> <top>
<Label fx:id="lblTitle" style="-fx-font-size: 20px;" /> <JFXProgressBar fx:id="progressBar" StackPane.alignment="TOP_CENTER" />
<Label fx:id="lblSubtitle" style="-fx-font-size: 14px;" /> </top>
<TaskListPane fx:id="taskListPane" /> <center>
</VBox> <VBox alignment="TOP_CENTER" style="-fx-padding: 16px;">
<StackPane pickOnBounds="false" style="-fx-padding: 8px;"> <Label fx:id="lblTitle" style="-fx-font-size: 20px;" />
<JFXButton StackPane.alignment="BOTTOM_RIGHT" fx:id="btnCancel" text="%button.cancel" /> <Label fx:id="lblSubtitle" style="-fx-font-size: 14px;" />
</StackPane>
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
<TaskListPane fx:id="taskListPane" />
</ScrollPane>
</VBox>
</center>
<bottom>
<HBox alignment="CENTER_RIGHT" style="-fx-padding: 8px;">
<JFXButton fx:id="btnCancel" text="%button.cancel" />
</HBox>
</bottom>
</BorderPane>
</fx:root> </fx:root>

View File

@ -152,7 +152,7 @@ launch.failed.downloading_libraries=Did not finish downloading libraries, contin
launch.failed.executable_permission=Unable to add permission to the launch script launch.failed.executable_permission=Unable to add permission to the launch script
launch.failed.exited_abnormally=Game exited abnormally, please visit the log, or ask someone for help. launch.failed.exited_abnormally=Game exited abnormally, please visit the log, or ask someone for help.
launch.failed.prelaunch_command=Prelaunch command fail. launch.failed.prelaunch_command=Prelaunch command fail.
launch.state.dependencies=Decompressing natives launch.state.dependencies=Dependencies
launch.state.done=Done launch.state.done=Done
launch.state.logging_in=Logging In launch.state.logging_in=Logging In
launch.state.modpack=Preparing for modpack launch.state.modpack=Preparing for modpack

View File

@ -198,11 +198,11 @@ public class FileDownloadTask extends Task {
if (!FileUtils.makeDirectory(file.getAbsoluteFile().getParentFile())) if (!FileUtils.makeDirectory(file.getAbsoluteFile().getParentFile()))
throw new IOException("Unable to make parent directory " + file); throw new IOException("Unable to make parent directory " + file);
if (!temp.renameTo(file)) if (!temp.renameTo(file))
throw new IOException("Unable move temp file to " + file); throw new IOException("Unable to move temp file from " + temp + " to " + file);
} }
if (downloaded != contentLength) if (downloaded != contentLength)
throw new IllegalStateException("Unexptected file size: " + downloaded + ", expected: " + contentLength); throw new IllegalStateException("Unexpected file size: " + downloaded + ", expected: " + contentLength);
// Check hash code // Check hash code
if (hash != null) { if (hash != null) {