Fix settings button placement

Fixes #94
This commit is contained in:
Leon Hofmeister 2020-10-22 16:09:09 +02:00
parent e79f60e95e
commit cd8971b6b4
Signed by: delvh
GPG Key ID: 3DECE05F6D9A647C
2 changed files with 19 additions and 29 deletions

View File

@ -107,9 +107,6 @@ public final class ChatScene implements EventListener, Restorable {
@FXML
private TextArea contactSearch;
@FXML
private VBox contactOperations;
@FXML
private TabPane tabPane;
@ -125,9 +122,6 @@ public final class ChatScene implements EventListener, Restorable {
@FXML
private HBox ownContactControl;
@FXML
private Region spaceBetweenUserAndSettingsButton;
private Chat currentChat;
private FilteredList<Chat> chats;
private Attachment pendingAttachment;
@ -175,7 +169,7 @@ public final class ChatScene implements EventListener, Restorable {
// Set the icons of buttons and image views
settingsButton.setGraphic(
new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
new ImageView(IconUtil.loadIconThemeSensitive("settings", 22)));
voiceButton.setGraphic(
new ImageView(IconUtil.loadIconThemeSensitive("microphone", DEFAULT_ICON_SIZE)));
attachmentButton.setGraphic(
@ -195,7 +189,6 @@ public final class ChatScene implements EventListener, Restorable {
chatList.setItems(chats = new FilteredList<>(localDB.getChats()));
// Set the design of the box in the upper-left corner
settingsButton.setAlignment(Pos.BOTTOM_RIGHT);
generateOwnStatusControl();
Platform.runLater(() -> {
@ -797,15 +790,15 @@ public final class ChatScene implements EventListener, Restorable {
private void generateOwnStatusControl() {
// Update the own user status if present
if (ownContactControl.getChildren().get(0) instanceof ContactControl)
((ContactControl) ownContactControl.getChildren().get(0)).replaceInfoLabel();
if (ownContactControl.getChildren().get(1) instanceof ContactControl)
((ContactControl) ownContactControl.getChildren().get(1)).replaceInfoLabel();
else {
// Else prepend it to the HBox children
final var ownUserControl = new ContactControl(localDB.getUser());
ownUserControl.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(ownUserControl, Priority.NEVER);
ownContactControl.getChildren().add(0, ownUserControl);
ownContactControl.getChildren().add(1, ownUserControl);
}
}

View File

@ -57,7 +57,7 @@
<content>
<AnchorPane minHeight="0.0" minWidth="0.0">
<children>
<VBox fx:id="contactOperations" prefHeight="3000.0"
<VBox prefHeight="3000.0"
prefWidth="316.0">
<children>
<VBox id="search-panel" maxHeight="-Infinity"
@ -146,7 +146,8 @@
<Insets right="1.0" />
</GridPane.margin>
</TabPane>
<HBox id="top-bar" alignment="CENTER_LEFT" prefHeight="100.0">
<HBox id="top-bar" alignment="CENTER_LEFT" prefHeight="100.0"
fx:id="ownContactControl">
<children>
<ImageView id="profile-pic" fx:id="clientProfilePic"
fitHeight="43.0" fitWidth="43.0" pickOnBounds="true"
@ -155,23 +156,19 @@
<Insets left="15.0" top="5.0" right="10.0" />
</HBox.margin>
</ImageView>
<HBox id="transparent-background" fx:id="ownContactControl">
<children>
<Region id="transparent-background" prefWidth="120"
fx:id="spaceBetweenUserAndSettingsButton" HBox.hgrow="ALWAYS" />
<Region id="transparent-background"
HBox.hgrow="ALWAYS" />
<Button fx:id="settingsButton" mnemonicParsing="false"
onAction="#settingsButtonClicked" prefHeight="30.0"
prefWidth="30.0" text="" alignment="CENTER">
prefWidth="30.0" alignment="CENTER_RIGHT">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
<HBox.margin>
<Insets bottom="35.0" left="5.0" top="35.0" />
<Insets bottom="35.0" left="5.0" top="35.0" right="10.0"/>
</HBox.margin>
</Button>
</children>
</HBox>
</children>
<GridPane.margin>
<Insets bottom="1.0" right="1.0" />
</GridPane.margin>