Inceptum/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/LauncherSettingsWindow.java

50 lines
1.9 KiB
Java

package io.gitlab.jfronny.inceptum.gtk.window;
import io.gitlab.jfronny.inceptum.common.InceptumConfig;
import io.gitlab.jfronny.inceptum.common.model.inceptum.UpdateChannel;
import io.gitlab.jfronny.inceptum.gtk.control.IRow;
import org.gtk.gtk.*;
public class LauncherSettingsWindow extends Window {
public LauncherSettingsWindow(Application app) {
this.application = app;
var box = new Box(Orientation.VERTICAL, 8);
box.marginHorizontal = 24;
box.marginTop = 12;
this.child = box;
{
Frame frame = new Frame(null);
ListBox listBox = new ListBox();
listBox.selectionMode = SelectionMode.NONE;
frame.child = listBox;
box.append(frame);
{
IRow row = new IRow("settings.snapshots", "settings.snapshots.subtitle");
listBox.append(row);
row.setCheckbox("settings.snapshots", InceptumConfig.snapshots, b -> {
InceptumConfig.snapshots = b;
InceptumConfig.saveConfig();
});
}
{
IRow row = new IRow("settings.update-channel", "settings.update-channel.subtitle");
listBox.append(row);
row.setDropdown(new String[] {"Stable", "CI"}, InceptumConfig.channel == UpdateChannel.CI ? 1 : 0, state -> {
InceptumConfig.channel = state == 1 ? UpdateChannel.CI : UpdateChannel.Stable;
InceptumConfig.saveConfig();
});
}
{
IRow row = new IRow("settings.author-name", "settings.author-name.subtitle");
listBox.append(row);
row.setEntry(InceptumConfig.authorName, s -> {
InceptumConfig.authorName = s;
InceptumConfig.saveConfig();
});
}
}
}
}