Apply Saving Replay dialog when pressing Enter (closes #424)

This commit is contained in:
Jonas Herzig
2020-11-22 14:55:07 +01:00
parent 4739d2278b
commit f895a13b61

View File

@@ -83,10 +83,7 @@ public class GuiSavingReplay {
GuiButton applyButton = new GuiButton()
.setSize(150, 20)
.setI18nLabel("replaymod.gui.done")
.onClick(() -> {
apply.forEach(Runnable::run);
close();
});
.onClick(this::apply);
panel.addElements(new VerticalLayout.Data(0.5), applyButton);
}
@@ -98,6 +95,7 @@ public class GuiSavingReplay {
.setText(originalName)
.setI18nHint("replaymod.gui.delete")
.setTextColorDisabled(Colors.RED)
.onEnter(this::apply)
.setTooltip(createTooltip(path, metaData));
GuiButton clearButton = new GuiButton()
.setSize(20, 20)
@@ -133,6 +131,11 @@ public class GuiSavingReplay {
}).addElements(null, tooltip, entry);
}
private void apply() {
apply.forEach(Runnable::run);
close();
}
private void applyOutput(Path path, String newName) {
if (newName.isEmpty()) {
try {