Fix chat default pictures not being updated on theme change

This commit is contained in:
Leon Hofmeister 2020-11-22 12:26:08 +01:00
parent 0ff910ebde
commit b653652f6d
Signed by: delvh
GPG Key ID: 3DECE05F6D9A647C
2 changed files with 12 additions and 1 deletions

View File

@ -18,7 +18,7 @@ import envoy.client.util.IconUtil;
*/ */
public final class ChatControl extends HBox { public final class ChatControl extends HBox {
private static final Image userIcon = IconUtil.loadIconThemeSensitive("user_icon", 32), private static Image userIcon = IconUtil.loadIconThemeSensitive("user_icon", 32),
groupIcon = IconUtil.loadIconThemeSensitive("group_icon", 32); groupIcon = IconUtil.loadIconThemeSensitive("group_icon", 32);
/** /**
@ -60,4 +60,14 @@ public final class ChatControl extends HBox {
} }
getStyleClass().add("list-element"); getStyleClass().add("list-element");
} }
/**
* Reloads the default icons.
*
* @since Envoy Client v0.3-beta
*/
public static void reloadDefaultChatIcons() {
userIcon = IconUtil.loadIconThemeSensitive("user_icon", 32);
groupIcon = IconUtil.loadIconThemeSensitive("group_icon", 32);
}
} }

View File

@ -324,6 +324,7 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
@Event(eventType = ThemeChangeEvent.class) @Event(eventType = ThemeChangeEvent.class)
private void onThemeChange() { private void onThemeChange() {
ChatControl.reloadDefaultChatIcons();
settingsButton.setGraphic( settingsButton.setGraphic(
new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE))); new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
voiceButton.setGraphic( voiceButton.setGraphic(