mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-03-15 10:26:37 -04:00
add alert icon to sys tray
This commit is contained in:
parent
d23a965cdc
commit
64502c54c5
@ -157,6 +157,7 @@ public class BitSquare extends Application
|
||||
return menuBar;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public class Relay extends Application
|
||||
{
|
||||
masterPeer = new PeerMaker(ID).setPorts(port).makeAndListen();
|
||||
// masterPeer = new PeerMaker(ID).setPorts(port).setBagSize(100).makeAndListen(); // setBagSize cause sync problems...
|
||||
masterPeer.getBroadcastRPC().getConnectionBean().getConnectionReservation().reserve(100).awaitUninterruptibly();
|
||||
masterPeer.getBroadcastRPC().getConnectionBean().getConnectionReservation().reserve(1).awaitUninterruptibly();
|
||||
masterPeer.getConnectionHandler().getPeerBean().getPeerMap().addPeerMapChangeListener(new PeerMapChangeListener()
|
||||
{
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.Direction;
|
||||
import io.bitsquare.trade.Trading;
|
||||
import io.bitsquare.user.User;
|
||||
import io.bitsquare.util.AWTSystemTray;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
@ -226,6 +227,8 @@ public class MainController implements Initializable, NavigationController
|
||||
});
|
||||
Tooltip.install(alertButton, new Tooltip("Someone accepted your offer"));
|
||||
ordersButtonButtonHolder.getChildren().add(alertButton);
|
||||
|
||||
AWTSystemTray.setAlert();
|
||||
}
|
||||
|
||||
private void addNavigation()
|
||||
|
@ -25,6 +25,7 @@ import io.bitsquare.trade.Direction;
|
||||
import io.bitsquare.trade.Offer;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.Trading;
|
||||
import io.bitsquare.util.AWTSystemTray;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
@ -311,6 +312,8 @@ public class PendingTradeController implements Initializable, ChildController, H
|
||||
secondaryBankAccountIDCopyIcon.setVisible(false);
|
||||
|
||||
bankTransferInitedButton.setVisible(false);
|
||||
|
||||
AWTSystemTray.unSetAlert();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@ import javafx.scene.image.ImageView;
|
||||
|
||||
public class Icons
|
||||
{
|
||||
public static final String SYS_TRAY = "/images/systemTrayIcon.png";
|
||||
public static final String SYS_TRAY_ALERT = "/images/systemTrayAlertIcon.png";
|
||||
|
||||
public static final String HOME = "/images/nav/home.png";
|
||||
public static final String HOME_ACTIVE = "/images/nav/home_active.png";
|
||||
public static final String NAV_BUY = "/images/nav/nav_buy.png";
|
||||
|
@ -32,8 +32,8 @@ public class HandleTakeOfferRequest
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("AcceptTakeOfferRequestMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("AcceptTakeOfferRequestMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("AcceptTakeOfferRequestMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("AcceptTakeOfferRequestMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public class RequestTakerDepositPayment
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("RequestTakerDepositPaymentMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestTakerDepositPaymentMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("RequestTakerDepositPaymentMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestTakerDepositPaymentMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class SendDepositTxIdToTaker
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("DepositTxPublishedMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("DepositTxPublishedMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("DepositTxPublishedMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("DepositTxPublishedMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ public class SendSignedPayoutTx
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("BankTransferInitedMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("BankTransferInitedMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("BankTransferInitedMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("BankTransferInitedMessage did not arrive at peer"));
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -27,8 +27,8 @@ public class RequestTakeOffer
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("RequestTakeOfferMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestTakeOfferMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("RequestTakeOfferMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestTakeOfferMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ public class SendPayoutTxToOfferer
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("PayoutTxPublishedMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("PayoutTxPublishedMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("PayoutTxPublishedMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("PayoutTxPublishedMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -60,8 +60,8 @@ public class SendSignedTakerDepositTxAsHex
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("RequestOffererDepositPublicationMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestOffererDepositPublicationMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("RequestOffererDepositPublicationMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("RequestOffererDepositPublicationMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ public class SendTakeOfferFeePayedTxId
|
||||
@Override
|
||||
public void onFailed()
|
||||
{
|
||||
log.error("TakeOfferFeePayedMessage faultHandler.onFault to arrive at peer");
|
||||
faultHandler.onFault(new Exception("TakeOfferFeePayedMessage faultHandler.onFault to arrive at peer"));
|
||||
log.error("TakeOfferFeePayedMessage did not arrive at peer");
|
||||
faultHandler.onFault(new Exception("TakeOfferFeePayedMessage did not arrive at peer"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package io.bitsquare.util;
|
||||
|
||||
|
||||
import io.bitsquare.BitSquare;
|
||||
import io.bitsquare.gui.util.Icons;
|
||||
import java.awt.*;
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
@ -16,6 +17,7 @@ public class AWTSystemTray
|
||||
private static boolean isStageVisible = true;
|
||||
private static MenuItem showGuiItem;
|
||||
private static Stage stage;
|
||||
private static TrayIcon trayIcon;
|
||||
|
||||
public static void createSystemTray(Stage stage)
|
||||
{
|
||||
@ -26,7 +28,7 @@ public class AWTSystemTray
|
||||
Platform.setImplicitExit(false);
|
||||
|
||||
SystemTray systemTray = SystemTray.getSystemTray();
|
||||
TrayIcon trayIcon = new TrayIcon(getImage());
|
||||
trayIcon = new TrayIcon(getImage(Icons.SYS_TRAY));
|
||||
trayIcon.setToolTip("BitSquare P2P Fiat-Bitcoin exchange");
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu();
|
||||
@ -59,7 +61,7 @@ public class AWTSystemTray
|
||||
});
|
||||
exitItem.addActionListener(e -> {
|
||||
systemTray.remove(trayIcon);
|
||||
Platform.exit();
|
||||
System.exit(0);
|
||||
});
|
||||
|
||||
|
||||
@ -77,6 +79,15 @@ public class AWTSystemTray
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAlert()
|
||||
{
|
||||
trayIcon.setImage(getImage(Icons.SYS_TRAY_ALERT));
|
||||
}
|
||||
|
||||
public static void unSetAlert()
|
||||
{
|
||||
trayIcon.setImage(getImage(Icons.SYS_TRAY));
|
||||
}
|
||||
public static void setStageHidden()
|
||||
{
|
||||
stage.hide();
|
||||
@ -84,8 +95,8 @@ public class AWTSystemTray
|
||||
showGuiItem.setLabel("Open exchange window");
|
||||
}
|
||||
|
||||
private static Image getImage()
|
||||
private static Image getImage(String path)
|
||||
{
|
||||
return new ImageIcon(AWTSystemTray.class.getResource("/images/systemTrayIcon.png"), "system tray icon").getImage();
|
||||
return new ImageIcon(AWTSystemTray.class.getResource(path), "system tray icon").getImage();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user