51 lines
1.5 KiB
Java
51 lines
1.5 KiB
Java
package envoy.client.ui.settings;
|
|
|
|
import java.util.List;
|
|
|
|
import javafx.scene.control.ComboBox;
|
|
|
|
import envoy.client.data.SettingsItem;
|
|
import envoy.client.event.ThemeChangeEvent;
|
|
import envoy.data.User.UserStatus;
|
|
import envoy.event.EventBus;
|
|
|
|
/**
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>GeneralSettingsPane.java</strong><br>
|
|
* Created: <strong>18.04.2020</strong><br>
|
|
*
|
|
* @author Kai S. K. Engelbart
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public class GeneralSettingsPane extends SettingsPane {
|
|
|
|
/**
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public GeneralSettingsPane() {
|
|
super("General");
|
|
|
|
// TODO: Support other value types
|
|
List.of("hideOnClose", "enterToSend")
|
|
.stream()
|
|
.map(settings.getItems()::get)
|
|
.map(i -> new SettingsCheckbox((SettingsItem<Boolean>) i))
|
|
.forEach(vbox.getChildren()::add);
|
|
|
|
final var combobox = new ComboBox<String>();
|
|
combobox.getItems().add("dark");
|
|
combobox.getItems().add("light");
|
|
combobox.setValue(settings.getCurrentTheme());
|
|
combobox.setOnAction(
|
|
e -> { settings.setCurrentTheme(combobox.getValue()); EventBus.getInstance().dispatch(new ThemeChangeEvent(combobox.getValue())); });
|
|
vbox.getChildren().add(combobox);
|
|
|
|
final var statusComboBox = new ComboBox<UserStatus>();
|
|
statusComboBox.getItems().setAll(UserStatus.values());
|
|
statusComboBox.setValue(UserStatus.ONLINE);
|
|
// TODO add action when value is changed
|
|
statusComboBox.setOnAction(e -> {});
|
|
vbox.getChildren().add(statusComboBox);
|
|
}
|
|
}
|