mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
show warning in preferences if currencies could not be retrieved from exchange rate source
This commit is contained in:
parent
4c408ac7b1
commit
31bd64f821
3 changed files with 19 additions and 0 deletions
|
@ -18,6 +18,7 @@ import javafx.collections.FXCollections;
|
|||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.util.StringConverter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -45,6 +46,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
@FXML
|
||||
private ComboBox<ExchangeSource> exchangeSource;
|
||||
|
||||
@FXML
|
||||
private Label currenciesLoadWarning;
|
||||
|
||||
@FXML
|
||||
private UnlabeledToggleSwitch loadRecentWallets;
|
||||
|
||||
|
@ -87,6 +91,9 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
EventManager.get().post(new FeeRatesSourceChangedEvent(newValue));
|
||||
});
|
||||
|
||||
currenciesLoadWarning.managedProperty().bind(currenciesLoadWarning.visibleProperty());
|
||||
currenciesLoadWarning.setVisible(false);
|
||||
|
||||
blockExplorers.setItems(getBlockExplorerList());
|
||||
blockExplorers.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
|
@ -237,6 +244,8 @@ public class GeneralPreferencesController extends PreferencesDetailController {
|
|||
fiatCurrency.setDisable(true);
|
||||
}
|
||||
|
||||
currenciesLoadWarning.setVisible(exchangeSource.getValue() != ExchangeSource.NONE && currencies.isEmpty());
|
||||
|
||||
//Always fire event regardless of previous selection to update rates
|
||||
EventManager.get().post(new FiatCurrencySelectedEvent(exchangeSource.getValue(), fiatCurrency.getValue()));
|
||||
|
||||
|
|
|
@ -320,3 +320,7 @@ CellView > .text-input.text-field {
|
|||
-fx-background-color: -fx-control-inner-background;
|
||||
}
|
||||
|
||||
.field-warning {
|
||||
-fx-text-fill: rgb(238, 210, 2);
|
||||
-fx-padding: 0 0 0 12;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<?import com.sparrowwallet.sparrow.control.UnlabeledToggleSwitch?>
|
||||
<?import com.sparrowwallet.sparrow.control.HelpLabel?>
|
||||
<?import com.sparrowwallet.sparrow.net.FeeRatesSource?>
|
||||
<?import org.controlsfx.glyphfont.Glyph?>
|
||||
|
||||
<GridPane hgap="10.0" vgap="10.0" stylesheets="@preferences.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.preferences.GeneralPreferencesController">
|
||||
<padding>
|
||||
|
@ -60,6 +61,11 @@
|
|||
</FXCollections>
|
||||
</items>
|
||||
</ComboBox>
|
||||
<Label fx:id="currenciesLoadWarning" text="Error retrieving currencies">
|
||||
<graphic>
|
||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="EXCLAMATION_TRIANGLE" styleClass="field-warning" />
|
||||
</graphic>
|
||||
</Label>
|
||||
</Field>
|
||||
</Fieldset>
|
||||
<Fieldset inputGrow="SOMETIMES" text="Wallet" styleClass="wideLabelFieldSet">
|
||||
|
|
Loading…
Reference in a new issue