mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 22:25:26 +01:00
(gui) Notification message wraps and can now be copied
Notification message should be readable especially when an error occurs. The message can be copied for easier issue reporting.
This commit is contained in:
parent
c248c2cdc3
commit
e136014128
4 changed files with 49 additions and 29 deletions
|
@ -113,7 +113,7 @@
|
|||
-fx-text-fill: rgb(220, 220, 220);
|
||||
}
|
||||
.notification-pane .label.notification-message {
|
||||
-fx-font-size: 18px;
|
||||
-fx-font-size: 16px;
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
.button.notification-close {
|
||||
|
@ -132,6 +132,20 @@
|
|||
-fx-background-color: #353535;
|
||||
}
|
||||
|
||||
.button.notification-copy {
|
||||
-fx-background-color: transparent;
|
||||
-fx-border-color: transparent;
|
||||
-fx-padding: 0;
|
||||
-fx-text-fill: rgb(220, 220, 220);
|
||||
-fx-underline: true;
|
||||
-fx-cursor: hand;
|
||||
-fx-font-size: 12px;
|
||||
}
|
||||
.button.notification-copy:hover,
|
||||
.button.notification-copy:pressed {
|
||||
-fx-text-fill: rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
/* ------------- Activity tab -------------- */
|
||||
|
||||
.activities-tab.tab-pane > *.tab-header-area {
|
||||
|
|
|
@ -1,43 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.String?>
|
||||
<?import java.net.URL?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import java.lang.String?>
|
||||
<?import java.net.URL?>
|
||||
<GridPane fx:id="rootPane" minWidth="300.0" prefWidth="300.0" maxWidth="300.0"
|
||||
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
opacity="0" onMouseEntered="#handleMouseEnter" onMouseExited="#handleMouseExit">
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
|
||||
<GridPane fx:id="rootPane" maxWidth="300.0" minWidth="300.0" onMouseEntered="#handleMouseEnter" onMouseExited="#handleMouseExit" prefWidth="300.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="25.0" prefWidth="25.0"/>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="220.0"/>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="30.0" minWidth="5.0" prefWidth="20.0"/>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="25.0" prefWidth="25.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="220.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="30.0" minWidth="5.0" prefWidth="20.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="SOMETIMES"/>
|
||||
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="ALWAYS"/>
|
||||
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="ALWAYS" />
|
||||
<RowConstraints minHeight="8.0" valignment="TOP" vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="titleLabel" styleClass="notification-title" text="Eclair Notification" GridPane.columnIndex="1"/>
|
||||
<ImageView fx:id="icon" fitWidth="25.0" pickOnBounds="true" preserveRatio="true" GridPane.rowSpan="2">
|
||||
<image>
|
||||
<Image url="@../commons/images/eclair-square.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<Button fx:id="closeButton" maxHeight="18.0" maxWidth="18.0" minHeight="18.0" minWidth="18.0"
|
||||
mnemonicParsing="false"
|
||||
styleClass="notification-close" text="" GridPane.columnIndex="2"/>
|
||||
<Label fx:id="messageLabel" styleClass="notification-message" text="N/A" wrapText="false"
|
||||
GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1"/>
|
||||
</children>
|
||||
<styleClass>
|
||||
<String fx:value="grid"/>
|
||||
<String fx:value="notification-pane"/>
|
||||
<String fx:value="grid" />
|
||||
<String fx:value="notification-pane" />
|
||||
</styleClass>
|
||||
<stylesheets>
|
||||
<URL value="@../commons/globals.css"/>
|
||||
<URL value="@main.css"/>
|
||||
<URL value="@../commons/globals.css" />
|
||||
<URL value="@main.css" />
|
||||
</stylesheets>
|
||||
<Label fx:id="titleLabel" styleClass="notification-title" text="Eclair Notification" GridPane.columnIndex="1" />
|
||||
<ImageView fx:id="icon" fitWidth="25.0" pickOnBounds="true" preserveRatio="true" GridPane.rowSpan="2">
|
||||
<Image url="@../commons/images/eclair-square.png" />
|
||||
</ImageView>
|
||||
<Button fx:id="closeButton" maxHeight="18.0" maxWidth="18.0" minHeight="18.0" minWidth="18.0" mnemonicParsing="false" styleClass="notification-close" text="" GridPane.columnIndex="2" />
|
||||
<Label fx:id="messageLabel" styleClass="notification-message" wrapText="true" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
||||
<Button fx:id="copyButton" mnemonicParsing="false" styleClass="notification-copy" text="Copy Message" GridPane.rowIndex="2" GridPane.columnIndex="1" />
|
||||
</GridPane>
|
||||
|
|
|
@ -16,6 +16,7 @@ class NotificationPaneController {
|
|||
@FXML var messageLabel: Label = _
|
||||
@FXML var icon: ImageView = _
|
||||
@FXML var closeButton: Button = _
|
||||
@FXML var copyButton: Button = _
|
||||
|
||||
@FXML def handleMouseEnter(event: MouseEvent) = {
|
||||
rootPane.setOpacity(1)
|
||||
|
|
|
@ -9,6 +9,7 @@ import javafx.scene.image.Image
|
|||
import javafx.scene.layout.{GridPane, VBox}
|
||||
import javafx.util.Duration
|
||||
|
||||
import fr.acinq.eclair.gui.utils.ContextMenuUtils
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
sealed trait NotificationType
|
||||
|
@ -74,6 +75,14 @@ class NotificationsController extends Logging {
|
|||
dismissAnimation.setOnFinished(new EventHandler[ActionEvent] {
|
||||
override def handle(event: ActionEvent) = notifsVBox.getChildren.remove(root)
|
||||
})
|
||||
notifPaneController.copyButton.setOnAction(new EventHandler[ActionEvent] {
|
||||
override def handle(event: ActionEvent) = {
|
||||
dismissAnimation.stop // automatic dismiss is cancelled
|
||||
ContextMenuUtils.copyToClipboard(message)
|
||||
notifPaneController.copyButton.setOnAction(null)
|
||||
notifPaneController.copyButton.setText("Copied!")
|
||||
}
|
||||
})
|
||||
notifPaneController.closeButton.setOnAction(new EventHandler[ActionEvent] {
|
||||
override def handle(event: ActionEvent) = {
|
||||
dismissAnimation.stop
|
||||
|
|
Loading…
Add table
Reference in a new issue