mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Add shortcut for displaying DAO menu item
This commit is contained in:
parent
9166494d69
commit
68501364e9
@ -78,9 +78,13 @@ public class BisqEnvironment extends StandardEnvironment {
|
||||
return BaseCurrencyNetwork.LTC_MAINNET;
|
||||
}
|
||||
|
||||
public static boolean isBaseCurrencySupportingBsq() {
|
||||
public static boolean isDAOActivatedAndBaseCurrencySupportingBsq() {
|
||||
//noinspection ConstantConditions,PointlessBooleanExpression
|
||||
return DevEnv.DAO_ACTIVATED && getBaseCurrencyNetwork().getCurrencyCode().equals("LTC");
|
||||
return DevEnv.DAO_ACTIVATED && isBaseCurrencySupportingBsq();
|
||||
}
|
||||
|
||||
public static boolean isBaseCurrencySupportingBsq() {
|
||||
return getBaseCurrencyNetwork().getCurrencyCode().equals("LTC");
|
||||
}
|
||||
|
||||
public static NetworkParameters getParameters() {
|
||||
|
@ -52,7 +52,7 @@ public class DaoManager {
|
||||
}
|
||||
|
||||
public void onAllServicesInitialized(ErrorMessageHandler errorMessageHandler) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq()) {
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
|
||||
daoPeriodService.onAllServicesInitialized();
|
||||
bsqUtxoFeedService.onAllServicesInitialized();
|
||||
voteManager.onAllServicesInitialized();
|
||||
|
@ -43,7 +43,7 @@ public class BsqBlockchainManager {
|
||||
}
|
||||
|
||||
public void addBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq())
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq())
|
||||
bsqNode.addBsqChainStateListener(bsqChainStateListener);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class BsqBlockchainManager {
|
||||
}
|
||||
|
||||
public void removeBsqChainStateListener(BsqChainStateListener bsqChainStateListener) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq())
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq())
|
||||
bsqNode.removeBsqChainStateListener(bsqChainStateListener);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class CompensationRequestManager implements PersistedDataHost {
|
||||
|
||||
observableList = FXCollections.observableArrayList(model.getList());
|
||||
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq()) {
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
|
||||
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
|
||||
@Override
|
||||
public void onAdded(ProtectedStorageEntry data) {
|
||||
@ -108,7 +108,7 @@ public class CompensationRequestManager implements PersistedDataHost {
|
||||
|
||||
@Override
|
||||
public void readPersisted() {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq()) {
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
|
||||
PersistableList<CompensationRequest> persisted = compensationRequestsStorage.initAndGetPersistedWithFileName("CompensationRequests");
|
||||
if (persisted != null)
|
||||
model.setPersistedCompensationRequest(persisted.getList());
|
||||
|
@ -93,7 +93,7 @@ public class VotingManager implements PersistedDataHost {
|
||||
|
||||
@Override
|
||||
public void readPersisted() {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq()) {
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
|
||||
PersistableList<VoteItemsList> persisted = voteItemCollectionsStorage.initAndGetPersistedWithFileName("VoteItemCollections");
|
||||
if (persisted != null)
|
||||
voteItemsLists.addAll(persisted.getList());
|
||||
|
@ -166,7 +166,7 @@ public class BisqApp extends Application {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
|
||||
final BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
|
||||
|
||||
|
||||
Res.setBaseCurrencyCode(baseCurrencyNetwork.getCurrencyCode());
|
||||
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
|
||||
|
||||
@ -261,33 +261,31 @@ public class BisqApp extends Application {
|
||||
stop();
|
||||
} else if (new KeyCodeCombination(KeyCode.E, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
|
||||
showEmptyWalletPopup(injector.getInstance(BtcWalletService.class));
|
||||
} else //noinspection ConstantConditions,ConstantConditions
|
||||
if (DevEnv.DEV_MODE && new KeyCodeCombination(KeyCode.B, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
|
||||
// BSQ empty wallet not public yet
|
||||
showEmptyWalletPopup(injector.getInstance(BsqWalletService.class));
|
||||
} else if (new KeyCodeCombination(KeyCode.M, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showSendAlertMessagePopup();
|
||||
} else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showFilterPopup();
|
||||
} else if (new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showFPSWindow();
|
||||
} else if (new KeyCodeCombination(KeyCode.J, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
WalletsManager walletsManager = injector.getInstance(WalletsManager.class);
|
||||
if (walletsManager.areWalletsAvailable())
|
||||
new ShowWalletDataWindow(walletsManager).show();
|
||||
else
|
||||
new Popup<>().warning(Res.get("popup.warning.walletNotInitialized")).show();
|
||||
} else if (new KeyCodeCombination(KeyCode.G, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
TradeWalletService tradeWalletService = injector.getInstance(TradeWalletService.class);
|
||||
BtcWalletService walletService = injector.getInstance(BtcWalletService.class);
|
||||
if (walletService.isWalletReady())
|
||||
new SpendFromDepositTxWindow(tradeWalletService).show();
|
||||
else
|
||||
new Popup<>().warning(Res.get("popup.warning.walletNotInitialized")).show();
|
||||
} else //noinspection ConstantConditions,ConstantConditions
|
||||
if (DevEnv.DEV_MODE && new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) {
|
||||
showDebugWindow();
|
||||
}
|
||||
} else if (new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) {
|
||||
// BSQ empty wallet not public yet
|
||||
showEmptyWalletPopup(injector.getInstance(BsqWalletService.class));
|
||||
} else if (new KeyCodeCombination(KeyCode.M, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showSendAlertMessagePopup();
|
||||
} else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showFilterPopup();
|
||||
} else if (new KeyCodeCombination(KeyCode.J, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
WalletsManager walletsManager = injector.getInstance(WalletsManager.class);
|
||||
if (walletsManager.areWalletsAvailable())
|
||||
new ShowWalletDataWindow(walletsManager).show();
|
||||
else
|
||||
new Popup<>().warning(Res.get("popup.warning.walletNotInitialized")).show();
|
||||
} else if (new KeyCodeCombination(KeyCode.G, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
TradeWalletService tradeWalletService = injector.getInstance(TradeWalletService.class);
|
||||
BtcWalletService walletService = injector.getInstance(BtcWalletService.class);
|
||||
if (walletService.isWalletReady())
|
||||
new SpendFromDepositTxWindow(tradeWalletService).show();
|
||||
else
|
||||
new Popup<>().warning(Res.get("popup.warning.walletNotInitialized")).show();
|
||||
} else if (DevEnv.DEV_MODE && new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
showFPSWindow();
|
||||
} else if (DevEnv.DEV_MODE && new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) {
|
||||
showDebugWindow();
|
||||
}
|
||||
});
|
||||
|
||||
// configure the primary stage
|
||||
|
@ -46,6 +46,10 @@ import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
@ -126,7 +130,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
MainView.rootContainer = this.root;
|
||||
MainView.rootContainer = root;
|
||||
|
||||
ToggleButton marketButton = new NavButton(MarketView.class, Res.get("mainView.menu.market"));
|
||||
ToggleButton buyButton = new NavButton(BuyOfferView.class, Res.get("mainView.menu.buyBtc"));
|
||||
@ -140,10 +144,21 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
Pane portfolioButtonHolder = new Pane(portfolioButton);
|
||||
Pane disputesButtonHolder = new Pane(disputesButton);
|
||||
|
||||
if (!BisqEnvironment.isBaseCurrencySupportingBsq()) {
|
||||
if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) {
|
||||
daoButton.setVisible(false);
|
||||
daoButton.setManaged(false);
|
||||
}
|
||||
|
||||
// TODO can be removed once DAo is released
|
||||
UserThread.runAfter(() -> {
|
||||
root.getScene().addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
|
||||
if (new KeyCodeCombination(KeyCode.D, KeyCombination.ALT_DOWN).match(keyEvent)) {
|
||||
daoButton.setVisible(true);
|
||||
daoButton.setManaged(true);
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
|
||||
HBox leftNavPane = new HBox(marketButton, buyButton, sellButton, portfolioButtonHolder, fundsButton, disputesButtonHolder) {{
|
||||
setLeftAnchor(this, 10d);
|
||||
setTopAnchor(this, 0d);
|
||||
|
@ -123,7 +123,7 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
|
||||
chainSyncIndicator = new ProgressBar();
|
||||
chainSyncIndicator.setPrefWidth(120);
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq())
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq())
|
||||
chainSyncIndicator.setProgress(-1);
|
||||
else
|
||||
chainSyncIndicator.setProgress(0);
|
||||
|
@ -944,7 +944,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||
makerFeeRowHBox.setSpacing(5);
|
||||
makerFeeRowHBox.setAlignment(Pos.CENTER_LEFT);
|
||||
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq())
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq())
|
||||
makerFeeRowHBox.getChildren().addAll(makerFeeValueCurrencyBox, payFeeInBtcToggleButtonsHBox);
|
||||
else
|
||||
makerFeeRowHBox.getChildren().addAll(makerFeeValueCurrencyBox);
|
||||
|
@ -837,7 +837,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
takerFeeRowHBox.setSpacing(5);
|
||||
takerFeeRowHBox.setAlignment(Pos.CENTER_LEFT);
|
||||
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq())
|
||||
if (BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq())
|
||||
takerFeeRowHBox.getChildren().addAll(makerFeeValueCurrencyBox, payFeeInBtcToggleButtonsHBox);
|
||||
else
|
||||
takerFeeRowHBox.getChildren().addAll(makerFeeValueCurrencyBox);
|
||||
|
Loading…
Reference in New Issue
Block a user