mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-09 08:14:43 +00:00
add config, usb status fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.sparrowwallet.sparrow.control;
|
||||
|
||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands;
|
||||
import com.sparrowwallet.sparrow.io.Device;
|
||||
import javafx.geometry.Side;
|
||||
@@ -10,33 +11,41 @@ import org.controlsfx.glyphfont.Glyph;
|
||||
import java.util.List;
|
||||
|
||||
public class UsbStatusButton extends MenuButton {
|
||||
private final List<Device> devices;
|
||||
|
||||
public UsbStatusButton(List<Device> devices) {
|
||||
public UsbStatusButton() {
|
||||
super("");
|
||||
setGraphic(getIcon());
|
||||
this.devices = devices;
|
||||
|
||||
this.setPopupSide(Side.TOP);
|
||||
getStyleClass().add("status-bar-button");
|
||||
this.setPopupSide(Side.RIGHT);
|
||||
}
|
||||
|
||||
public void setDevices(List<Device> devices) {
|
||||
for(Device device : devices) {
|
||||
MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString());
|
||||
if(device.getNeedsPinSent()) {
|
||||
deviceItem.setGraphic(getLockIcon());
|
||||
} else {
|
||||
deviceItem.setGraphic(getLockOpenIcon());
|
||||
}
|
||||
getItems().add(deviceItem);
|
||||
}
|
||||
}
|
||||
|
||||
private Node getIcon() {
|
||||
Glyph usb = new Glyph(FontAwesome5Brands.FONT_NAME, FontAwesome5Brands.Glyph.USB);
|
||||
usb.setFontSize(10);
|
||||
usb.setFontSize(15);
|
||||
return usb;
|
||||
}
|
||||
|
||||
private class UsbStatusContextMenu extends ContextMenu {
|
||||
public UsbStatusContextMenu() {
|
||||
for(Device device : devices) {
|
||||
MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString());
|
||||
getItems().add(deviceItem);
|
||||
}
|
||||
}
|
||||
private Node getLockIcon() {
|
||||
Glyph usb = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.LOCK);
|
||||
usb.setFontSize(12);
|
||||
return usb;
|
||||
}
|
||||
|
||||
private Node getLockOpenIcon() {
|
||||
Glyph usb = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.LOCK_OPEN);
|
||||
usb.setFontSize(12);
|
||||
return usb;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user