From a2d2feab7d72660eba7d763afb7a34caafeee3d1 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 1 May 2019 09:52:13 +0200 Subject: [PATCH 1/2] Add missing parameter --- .../bisq/monitor/metric/P2PNetworkLoad.java | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/monitor/src/main/java/bisq/monitor/metric/P2PNetworkLoad.java b/monitor/src/main/java/bisq/monitor/metric/P2PNetworkLoad.java index 32475bd0765..7e08d0793f4 100644 --- a/monitor/src/main/java/bisq/monitor/metric/P2PNetworkLoad.java +++ b/monitor/src/main/java/bisq/monitor/metric/P2PNetworkLoad.java @@ -17,36 +17,19 @@ package bisq.monitor.metric; -import java.io.File; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.core.env.PropertySource; +import bisq.monitor.AvailableTor; +import bisq.monitor.Metric; +import bisq.monitor.Monitor; +import bisq.monitor.Reporter; +import bisq.monitor.ThreadGate; -import bisq.common.Clock; -import bisq.common.app.Capabilities; -import bisq.common.app.Capability; -import bisq.common.proto.network.NetworkEnvelope; -import bisq.common.proto.network.NetworkProtoResolver; import bisq.core.app.BisqEnvironment; import bisq.core.btc.BaseCurrencyNetwork; import bisq.core.btc.BtcOptionKeys; import bisq.core.network.p2p.seed.DefaultSeedNodeRepository; import bisq.core.proto.network.CoreNetworkProtoResolver; import bisq.core.proto.persistable.CorePersistenceProtoResolver; -import bisq.monitor.AvailableTor; -import bisq.monitor.Metric; -import bisq.monitor.Monitor; -import bisq.monitor.Reporter; -import bisq.monitor.ThreadGate; + import bisq.network.p2p.network.Connection; import bisq.network.p2p.network.MessageListener; import bisq.network.p2p.network.NetworkNode; @@ -56,6 +39,26 @@ import bisq.network.p2p.peers.keepalive.KeepAliveManager; import bisq.network.p2p.peers.peerexchange.PeerExchangeManager; import bisq.network.p2p.storage.messages.BroadcastMessage; + +import bisq.common.Clock; +import bisq.common.app.Capabilities; +import bisq.common.app.Capability; +import bisq.common.proto.network.NetworkEnvelope; +import bisq.common.proto.network.NetworkProtoResolver; + +import org.springframework.core.env.PropertySource; + +import java.io.File; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + import lombok.extern.slf4j.Slf4j; /** @@ -172,7 +175,7 @@ public String getProperty(String name) { }); int maxConnections = Integer.parseInt(configuration.getProperty(MAX_CONNECTIONS, "12")); NetworkProtoResolver networkProtoResolver = new CoreNetworkProtoResolver(); - CorePersistenceProtoResolver persistenceProtoResolver = new CorePersistenceProtoResolver(null, + CorePersistenceProtoResolver persistenceProtoResolver = new CorePersistenceProtoResolver(null, null, networkProtoResolver, storageDir); DefaultSeedNodeRepository seedNodeRepository = new DefaultSeedNodeRepository(environment, null); PeerManager peerManager = new PeerManager(networkNode, seedNodeRepository, new Clock(), From 4ac64a1c9abdf313a44ba7cc91c589730f8127e4 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 1 May 2019 09:52:30 +0200 Subject: [PATCH 2/2] Change icons --- desktop/src/main/java/bisq/desktop/bisq.css | 12 +++-- .../bisq/desktop/components/PeerInfoIcon.java | 48 +++++++++---------- .../java/bisq/desktop/util/FormBuilder.java | 8 ++++ 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index 1e3181cdbe7..67a4243f46f 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -130,6 +130,9 @@ bg color of non edit textFields: fafafa -bs-rd-error-red: #dd0000; /* 5 usages */ -bs-rd-message-bubble: #0086C6; -bs-toggle-selected: #7B7B7B; + -bs-level-bronze: #CD7F32; + -bs-level-silver: #A9A9A9; + -bs-level-gold: #DAA520; -bs-red: #D73030; /* 5 usages */ -fx-box-border: -bs-rd-grey-medium-light; @@ -198,15 +201,18 @@ bg color of non edit textFields: fafafa } .score-gold { - -fx-text-fill: #ffde5d; + -fx-fill: -bs-level-gold; + -fx-opacity: 1; } .score-silver { - -fx-text-fill: #d2d0d1; + -fx-fill: -bs-level-silver; + -fx-opacity: 1; } .score-bronze { - -fx-text-fill: #8f7837; + -fx-fill: -bs-level-bronze; + -fx-opacity: 1; } .delay-label { diff --git a/desktop/src/main/java/bisq/desktop/components/PeerInfoIcon.java b/desktop/src/main/java/bisq/desktop/components/PeerInfoIcon.java index 5628646c36d..57f21cd7f6f 100644 --- a/desktop/src/main/java/bisq/desktop/components/PeerInfoIcon.java +++ b/desktop/src/main/java/bisq/desktop/components/PeerInfoIcon.java @@ -38,8 +38,7 @@ import com.google.common.base.Charsets; -import de.jensd.fx.fontawesome.AwesomeDude; -import de.jensd.fx.fontawesome.AwesomeIcon; +import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import javafx.scene.Group; import javafx.scene.canvas.Canvas; @@ -62,6 +61,8 @@ import javax.annotation.Nullable; +import static bisq.desktop.util.FormBuilder.getBigIconForLabel; +import static bisq.desktop.util.FormBuilder.getIconForLabel; import static com.google.common.base.Preconditions.checkNotNull; @Slf4j @@ -80,7 +81,7 @@ public class PeerInfoIcon extends Group { protected final Pane numTradesPane; private final String fullAddress; private final double scaleFactor; - private final Label delayLabel, categoryIcon, delayIcon, signIcon; + private final Label delayLabel, accountLevelIcon, delayIcon, signIcon; private final BSFormatter formatter; private String tooltipText; @@ -286,22 +287,20 @@ private PeerInfoIcon(NodeAddress nodeAddress, tagPane.getChildren().addAll(tagCircle, tagLabel); //TODO just dummy impl. - categoryIcon = new Label(); - categoryIcon.setLayoutX(-20); - categoryIcon.setLayoutY(5); - categoryIcon.setVisible(false); - categoryIcon.setManaged(false); + accountLevelIcon = new Label(); + accountLevelIcon.setLayoutX(-30); + accountLevelIcon.setVisible(false); + accountLevelIcon.setManaged(false); delayIcon = new Label(); - AwesomeDude.setIcon(delayIcon, AwesomeIcon.TIME); - delayIcon.setLayoutX(-40); - delayIcon.setLayoutY(5); + getIconForLabel(MaterialDesignIcon.CLOCK_FAST, delayIcon); + delayIcon.setLayoutX(-50); delayIcon.setVisible(false); delayIcon.setManaged(false); delayLabel = new Label(); - delayLabel.setLayoutX(-53); - delayLabel.setLayoutY(20); + delayLabel.setLayoutX(-63); + delayLabel.setLayoutY(15); delayLabel.setMinWidth(40); delayLabel.setMaxWidth(40); delayLabel.getStyleClass().add("delay-label"); @@ -309,13 +308,12 @@ private PeerInfoIcon(NodeAddress nodeAddress, delayLabel.setManaged(false); signIcon = new Label(); - AwesomeDude.setIcon(signIcon, AwesomeIcon.SHIELD); - signIcon.setLayoutX(-60); - signIcon.setLayoutY(5); + getIconForLabel(MaterialDesignIcon.APPROVAL, signIcon); + signIcon.setLayoutX(-70); signIcon.setVisible(false); signIcon.setManaged(false); - getChildren().addAll(outerBackground, innerBackground, avatarImageView, tagPane, numTradesPane, categoryIcon, delayIcon, delayLabel, signIcon); + getChildren().addAll(outerBackground, innerBackground, avatarImageView, tagPane, numTradesPane, accountLevelIcon, delayIcon, delayLabel, signIcon); addMouseListener(numTrades, privateNotificationManager, offer, preferences, formatter, useDevPrivilegeKeys, isFiatCurrency, peersAccountAge); @@ -398,8 +396,8 @@ protected void updatePeerInfoIcon() { optionalScoreInfo = accountScoreService.getScoreInfoForBuyer(trade); } boolean isScoreInfoPresent = optionalScoreInfo.isPresent(); - categoryIcon.setVisible(isScoreInfoPresent); - categoryIcon.setManaged(isScoreInfoPresent); + accountLevelIcon.setVisible(isScoreInfoPresent); + accountLevelIcon.setManaged(isScoreInfoPresent); delayIcon.setVisible(isScoreInfoPresent); delayIcon.setManaged(isScoreInfoPresent); signIcon.setVisible(isScoreInfoPresent); @@ -423,14 +421,14 @@ protected void updatePeerInfoIcon() { delayLabel.setManaged(requireDelay); if (scoreInfo.getAccountScoreCategory() == AccountScoreCategory.GOLD) { - categoryIcon.getStyleClass().addAll("score-gold"); - AwesomeDude.setIcon(categoryIcon, AwesomeIcon.STAR); + getBigIconForLabel(MaterialDesignIcon.SHIELD, accountLevelIcon) + .getStyleClass().add("score-gold"); } else if (scoreInfo.getAccountScoreCategory() == AccountScoreCategory.SILVER) { - categoryIcon.getStyleClass().addAll("score-silver"); - AwesomeDude.setIcon(categoryIcon, AwesomeIcon.STAR_HALF_EMPTY); + getBigIconForLabel(MaterialDesignIcon.SHIELD_HALF_FULL, accountLevelIcon) + .getStyleClass().add("score-silver"); } else if (scoreInfo.getAccountScoreCategory() == AccountScoreCategory.BRONZE) { - categoryIcon.getStyleClass().addAll("score-bronze"); - AwesomeDude.setIcon(categoryIcon, AwesomeIcon.STAR_EMPTY); + getBigIconForLabel(MaterialDesignIcon.SHIELD_OUTLINE, accountLevelIcon) + .getStyleClass().add("score-bronze"); } } } diff --git a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java index 767590ee0f7..759586f2ce8 100644 --- a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java @@ -1710,6 +1710,14 @@ public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label } } + public static Text getIconForLabel(GlyphIcons icon, Label label) { + return getIconForLabel(icon, "1.231em", label); + } + + public static Text getBigIconForLabel(GlyphIcons icon, Label label) { + return getIconForLabel(icon, "2em", label); + } + public static Text getSmallIconForLabel(GlyphIcons icon, Label label) { return getIconForLabel(icon, "0.769em", label); }