mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Remove btc network selector
This commit is contained in:
parent
f77ac16e0f
commit
4cab29d812
2 changed files with 13 additions and 57 deletions
|
@ -34,17 +34,14 @@
|
||||||
|
|
||||||
<TitledGroupBg text="Bitcoin network" GridPane.rowSpan="2"/>
|
<TitledGroupBg text="Bitcoin network" GridPane.rowSpan="2"/>
|
||||||
|
|
||||||
<Label text="Select Network:" GridPane.rowIndex="0"/>
|
|
||||||
<ComboBox fx:id="netWorkComboBox" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
|
|
||||||
|
|
||||||
<!-- <Label text="Use tor:" GridPane.rowIndex="1"/>
|
<!-- <Label text="Use tor:" GridPane.rowIndex="1"/>
|
||||||
<CheckBox fx:id="useTorCheckBox" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
<CheckBox fx:id="useTorCheckBox" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
||||||
-->
|
-->
|
||||||
<Label fx:id="bitcoinPeersLabel" text="Connected peers:" GridPane.rowIndex="1"/>
|
<Label fx:id="bitcoinPeersLabel" text="Connected peers:" GridPane.rowIndex="0"/>
|
||||||
<TextArea fx:id="bitcoinPeersTextArea" GridPane.rowIndex="1" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
<TextArea fx:id="bitcoinPeersTextArea" GridPane.rowIndex="0" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
||||||
GridPane.vgrow="SOMETIMES" editable="false" focusTraversable="false"/>
|
GridPane.vgrow="SOMETIMES" editable="false" focusTraversable="false"/>
|
||||||
|
|
||||||
<TitledGroupBg text="P2P network" GridPane.rowIndex="2" GridPane.rowSpan="5">
|
<TitledGroupBg text="P2P network" GridPane.rowIndex="1" GridPane.rowSpan="5">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets top="50.0"/>
|
<Insets top="50.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
|
@ -53,20 +50,20 @@
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TitledGroupBg>
|
</TitledGroupBg>
|
||||||
|
|
||||||
<Label text="My onion address:" GridPane.rowIndex="2">
|
<Label text="My onion address:" GridPane.rowIndex="1">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets top="50.0"/>
|
<Insets top="50.0"/>
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<TextField fx:id="onionAddress" GridPane.rowIndex="2" GridPane.columnIndex="1"
|
<TextField fx:id="onionAddress" GridPane.rowIndex="1" GridPane.columnIndex="1"
|
||||||
editable="false" focusTraversable="false">
|
editable="false" focusTraversable="false">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets top="50.0"/>
|
<Insets top="50.0"/>
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TextField>
|
</TextField>
|
||||||
|
|
||||||
<Label fx:id="p2PPeersLabel" text="Connected peers:" GridPane.rowIndex="3"/>
|
<Label fx:id="p2PPeersLabel" text="Connected peers:" GridPane.rowIndex="2"/>
|
||||||
<TableView fx:id="tableView" GridPane.rowIndex="3" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
<TableView fx:id="tableView" GridPane.rowIndex="2" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
||||||
GridPane.vgrow="ALWAYS">
|
GridPane.vgrow="ALWAYS">
|
||||||
<columns>
|
<columns>
|
||||||
<TableColumn text="Onion address" fx:id="onionAddressColumn" minWidth="220">
|
<TableColumn text="Onion address" fx:id="onionAddressColumn" minWidth="220">
|
||||||
|
@ -112,14 +109,14 @@
|
||||||
</columns>
|
</columns>
|
||||||
</TableView>
|
</TableView>
|
||||||
|
|
||||||
<Label text="Total traffic:" GridPane.rowIndex="4"/>
|
<Label text="Total traffic:" GridPane.rowIndex="3"/>
|
||||||
<TextField fx:id="totalTraffic" GridPane.rowIndex="4" GridPane.columnIndex="1" editable="false"
|
<TextField fx:id="totalTraffic" GridPane.rowIndex="3" GridPane.columnIndex="1" editable="false"
|
||||||
focusTraversable="false"/>
|
focusTraversable="false"/>
|
||||||
|
|
||||||
<Label text="Use Tor bridges:" GridPane.rowIndex="5"/>
|
<Label text="Use Tor bridges:" GridPane.rowIndex="4"/>
|
||||||
<CheckBox fx:id="useBridgesCheckBox" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
<CheckBox fx:id="useBridgesCheckBox" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
|
||||||
<Label fx:id="bridgesLabel" text="Tor bridges:" GridPane.rowIndex="6" visible="false" managed="false"/>
|
<Label fx:id="bridgesLabel" text="Tor bridges:" GridPane.rowIndex="5" visible="false" managed="false"/>
|
||||||
<TextArea fx:id="bridgesTextArea" GridPane.rowIndex="6" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
<TextArea fx:id="bridgesTextArea" GridPane.rowIndex="5" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
||||||
minHeight="60"
|
minHeight="60"
|
||||||
GridPane.vgrow="SOMETIMES" editable="true" focusTraversable="true" visible="false" managed="false"/>
|
GridPane.vgrow="SOMETIMES" editable="true" focusTraversable="true" visible="false" managed="false"/>
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.main.settings.network;
|
package io.bitsquare.gui.main.settings.network;
|
||||||
|
|
||||||
import io.bitsquare.app.BitsquareApp;
|
|
||||||
import io.bitsquare.btc.BitcoinNetwork;
|
|
||||||
import io.bitsquare.btc.WalletService;
|
import io.bitsquare.btc.WalletService;
|
||||||
import io.bitsquare.common.Clock;
|
import io.bitsquare.common.Clock;
|
||||||
import io.bitsquare.common.UserThread;
|
|
||||||
import io.bitsquare.gui.common.model.Activatable;
|
import io.bitsquare.gui.common.model.Activatable;
|
||||||
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
|
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
|
||||||
import io.bitsquare.gui.common.view.FxmlView;
|
import io.bitsquare.gui.common.view.FxmlView;
|
||||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
import io.bitsquare.gui.util.BSFormatter;
|
||||||
import io.bitsquare.p2p.P2PService;
|
import io.bitsquare.p2p.P2PService;
|
||||||
import io.bitsquare.p2p.network.Statistic;
|
import io.bitsquare.p2p.network.Statistic;
|
||||||
|
@ -39,14 +35,12 @@ import javafx.geometry.Insets;
|
||||||
import javafx.geometry.VPos;
|
import javafx.geometry.VPos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.util.StringConverter;
|
|
||||||
import org.bitcoinj.core.Peer;
|
import org.bitcoinj.core.Peer;
|
||||||
import org.fxmisc.easybind.EasyBind;
|
import org.fxmisc.easybind.EasyBind;
|
||||||
import org.fxmisc.easybind.Subscription;
|
import org.fxmisc.easybind.Subscription;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@FxmlView
|
@FxmlView
|
||||||
|
@ -64,8 +58,6 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
||||||
@FXML
|
@FXML
|
||||||
CheckBox useBridgesCheckBox;
|
CheckBox useBridgesCheckBox;
|
||||||
@FXML
|
@FXML
|
||||||
ComboBox<BitcoinNetwork> netWorkComboBox;
|
|
||||||
@FXML
|
|
||||||
TextArea bitcoinPeersTextArea, bridgesTextArea;
|
TextArea bitcoinPeersTextArea, bridgesTextArea;
|
||||||
@FXML
|
@FXML
|
||||||
Label bitcoinPeersLabel, p2PPeersLabel, bridgesLabel;
|
Label bitcoinPeersLabel, p2PPeersLabel, bridgesLabel;
|
||||||
|
@ -101,20 +93,6 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
||||||
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
||||||
|
|
||||||
bitcoinPeersTextArea.setPrefRowCount(10);
|
bitcoinPeersTextArea.setPrefRowCount(10);
|
||||||
netWorkComboBox.setItems(FXCollections.observableArrayList(BitcoinNetwork.values()));
|
|
||||||
netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork());
|
|
||||||
netWorkComboBox.setOnAction(e -> onSelectNetwork());
|
|
||||||
netWorkComboBox.setConverter(new StringConverter<BitcoinNetwork>() {
|
|
||||||
@Override
|
|
||||||
public String toString(BitcoinNetwork bitcoinNetwork) {
|
|
||||||
return formatter.formatBitcoinNetwork(bitcoinNetwork);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BitcoinNetwork fromString(String string) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tableView.setMinHeight(300);
|
tableView.setMinHeight(300);
|
||||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||||
|
@ -226,24 +204,5 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectNetwork() {
|
|
||||||
if (netWorkComboBox.getSelectionModel().getSelectedItem() != preferences.getBitcoinNetwork())
|
|
||||||
selectNetwork();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectNetwork() {
|
|
||||||
//TODO restart
|
|
||||||
new Popup().warning("You need to shut down and restart the application to apply the change of the Bitcoin network.\n\n" +
|
|
||||||
"Do you want to shut down now?")
|
|
||||||
.onAction(() -> {
|
|
||||||
preferences.setBitcoinNetwork(netWorkComboBox.getSelectionModel().getSelectedItem());
|
|
||||||
UserThread.runAfter(BitsquareApp.shutDownHandler::run, 500, TimeUnit.MILLISECONDS);
|
|
||||||
})
|
|
||||||
.actionButtonText("Shut down")
|
|
||||||
.closeButtonText("Cancel")
|
|
||||||
.onClose(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork()))
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue