Display Current User Status and Unread Message Amount in Status Tray Icon #103

Merged
kske merged 8 commits from f/enhanced-status-tray-icon into develop 2020-10-23 17:19:46 +02:00
2 changed files with 19 additions and 29 deletions
Showing only changes of commit cd8971b6b4 - Show all commits

View File

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

View File

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