Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shortcut list #3695

Merged
merged 8 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void sendRepublishRequest() {
republishGovernanceDataHandler.sendRepublishRequest();
}

// Can be triggered with shortcut ctrl+UP or alt+UP
// Can be triggered with shortcut ctrl+h, cmd+h or alt+h
public void reRepublishAllGovernanceData() {
// We only want to do it once in case we would get flooded with requests.
if (!reRepublishAllGovernanceDataDone) {
Expand Down
55 changes: 55 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,61 @@ setting.about.version=Application version
setting.about.subsystems.label=Versions of subsystems
setting.about.subsystems.val=Network version: {0}; P2P message version: {1}; Local DB version: {2}; Trade protocol version: {3}

setting.about.shortcuts=Short cuts
setting.about.shortcuts.ctrlOrAltOrCmd=''Ctrl + {0}'' or ''alt + {0}'' or ''cmd + {0}''

setting.about.shortcuts.menuNav=Navigate main menu
setting.about.shortcuts.menuNav.value=To navigate the main menu press: 'Ctrl' or 'alt' or 'cmd' with a numeric key between '1-9'

setting.about.shortcuts.close=Close Bisq
setting.about.shortcuts.close.value=''Ctrl + {0}'' or ''cmd + {0}'' or ''Ctrl + {1}'' or ''cmd + {1}''

setting.about.shortcuts.closePopup=Close popup or dialog window
setting.about.shortcuts.closePopup.value='ESCAPE' key

setting.about.shortcuts.chatSendMsg=Send trader chat message
setting.about.shortcuts.chatSendMsg.value=''Ctrl + ENTER'' or ''alt + ENTER'' or ''cmd + ENTER''

setting.about.shortcuts.openDispute=Open dispute
setting.about.shortcuts.openDispute.value=Select pending trade and click: {0}

setting.about.shortcuts.walletDetails=Open wallet details window

setting.about.shortcuts.openEmergencyBtcWalletTool=Open emergency wallet tool for BTC wallet

setting.about.shortcuts.openEmergencyBsqWalletTool=Open emergency wallet tool for BSQ wallet

setting.about.shortcuts.showTorLogs=Toggle log level for Tor messages between DEBUG and WARN

setting.about.shortcuts.showDisputeStatistics=Show summary of all disputes
setting.about.shortcuts.showDisputeStatistics.value=Navigate to disputes view and click: {0}

setting.about.shortcuts.manualPayoutTxWindow=Open window for manual payout from 2of2 Multisig deposit tx

setting.about.shortcuts.reRepublishAllGovernanceData=Republish DAO governance data (proposals, votes)

setting.about.shortcuts.removeStuckTrade=Open popup to move stuck trade to failed trades tab (only use if you are sure)
setting.about.shortcuts.removeStuckTrade.value=Select pending trade and click: {0}

setting.about.shortcuts.registerArbitrator=Register arbitrator (mediator/arbitrator only)
setting.about.shortcuts.registerArbitrator.value=Navigate to account and click: {0}

setting.about.shortcuts.registerMediator=Register mediator (mediator/arbitrator only)
setting.about.shortcuts.registerMediator.value=Navigate to account and click: {0}

setting.about.shortcuts.reOpenDispute=Re-open already closed dispute (mediator/arbitrator only)
setting.about.shortcuts.reOpenDispute.value=Select closed dispute and click: {0}

setting.about.shortcuts.openSignPaymentAccountsWindow=Open window for account age signing (legacy arbitrators only)
setting.about.shortcuts.openSignPaymentAccountsWindow.value=Navigate to legacy arbitrator view and click: {0}

setting.about.shortcuts.sendAlertMsg=Send alert or update message (privileged activity)

setting.about.shortcuts.sendFilter=Set Filter (privileged activity)

setting.about.shortcuts.sendPrivateNotification=Send private notification to peer (privileged activity)
setting.about.shortcuts.sendPrivateNotification.value=Open peer info at avatar or dispute and click: {0}


####################################################################
# Account
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/main/java/bisq/desktop/app/BisqApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private void addSceneKeyEventHandler(Scene scene, Injector injector) {
injector.getInstance(SendAlertMessageWindow.class).show();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.F, keyEvent)) {
injector.getInstance(FilterWindow.class).show();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.UP, keyEvent)) {
chimp1984 marked this conversation as resolved.
Show resolved Hide resolved
} else if (Utilities.isAltOrCtrlPressed(KeyCode.H, keyEvent)) {
log.warn("We re-published all proposalPayloads and blindVotePayloads to the P2P network.");
injector.getInstance(MissingDataRequestService.class).reRepublishAllGovernanceData();
} else if (Utilities.isAltOrCtrlPressed(KeyCode.T, keyEvent)) {
Expand Down
13 changes: 1 addition & 12 deletions desktop/src/main/java/bisq/desktop/main/account/AccountView.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,7 @@ public void initialize() {
};

keyEventEventHandler = event -> {
if (Utilities.isAltOrCtrlPressed(KeyCode.R, event) && arbitratorRegistrationTab == null) {
if (mediatorRegistrationTab != null) {
root.getTabs().remove(mediatorRegistrationTab);
}
if (refundAgentRegistrationTab != null) {
root.getTabs().remove(refundAgentRegistrationTab);
}
arbitratorRegistrationTab = new Tab(Res.get("account.tab.arbitratorRegistration").toUpperCase());
arbitratorRegistrationTab.setClosable(true);
root.getTabs().add(arbitratorRegistrationTab);
navigation.navigateTo(MainView.class, AccountView.class, ArbitratorRegistrationView.class);
} else if (Utilities.isAltOrCtrlPressed(KeyCode.D, event) && mediatorRegistrationTab == null) {
if (Utilities.isAltOrCtrlPressed(KeyCode.D, event) && mediatorRegistrationTab == null) {
if (arbitratorRegistrationTab != null) {
root.getTabs().remove(arbitratorRegistrationTab);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

import bisq.network.p2p.P2PService;

import bisq.common.util.Tuple2;
import bisq.common.util.Tuple4;
import bisq.common.util.Utilities;

import org.bitcoinj.core.Coin;
Expand Down Expand Up @@ -83,16 +81,8 @@

import javafx.util.Callback;

import java.text.DateFormat;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;

import javax.annotation.Nullable;

Expand Down Expand Up @@ -218,15 +208,15 @@ public void onKeysAdded(List<ECKey> keys) {
};

keyEventEventHandler = event -> {
// Not intended to be public to users as the feature is not well tested
if (Utilities.isAltOrCtrlPressed(KeyCode.R, event)) {
if (revertTxColumn.isVisible()) {
confidenceColumn.getStyleClass().remove("last-column");
} else {
confidenceColumn.getStyleClass().add("last-column");
}
revertTxColumn.setVisible(!revertTxColumn.isVisible());
} else if (Utilities.isAltOrCtrlPressed(KeyCode.A, event))
chimp1984 marked this conversation as resolved.
Show resolved Hide resolved
showStatisticsPopup();
}
};

exportButton.updateText(Res.get("shared.exportCSV"));
Expand Down Expand Up @@ -556,101 +546,5 @@ private void revertTransaction(String txId, @Nullable Tradable tradable) {
}
}
}

// This method is not intended for the public so we don't translate here
private void showStatisticsPopup() {
Map<Long, List<Coin>> map = new HashMap<>();
Map<String, Tuple4<Date, Integer, Integer, Integer>> dataByDayMap = new HashMap<>();
displayedTransactions.forEach(item -> {
Coin amountAsCoin = item.getAmountAsCoin();
List<Coin> amounts;
long key = amountAsCoin.getValue();
if (!map.containsKey(key)) {
amounts = new ArrayList<>();
map.put(key, amounts);
} else {
amounts = map.get(key);
}
amounts.add(amountAsCoin);

DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.US);
String day = dateFormatter.format(item.getDate());

// TODO fee is dynamic now
Coin txFee = Coin.valueOf(20_000);
Coin createOfferFee = Coin.valueOf(50_000);
Coin takeOfferFee = Coin.valueOf(100_000);

if (!dataByDayMap.containsKey(day)) {
int numOffers = 0;
int numTrades = 0;
if (amountAsCoin.compareTo(createOfferFee.subtract(txFee)) == 0)
numOffers++;
else if (amountAsCoin.compareTo(takeOfferFee.subtract(txFee)) == 0)
numTrades++;

dataByDayMap.put(day, new Tuple4<>(item.getDate(), 1, numOffers, numTrades));
} else {
Tuple4<Date, Integer, Integer, Integer> tuple = dataByDayMap.get(day);
int prev = tuple.second;
int numOffers = tuple.third;
int numTrades = tuple.fourth;
if (amountAsCoin.compareTo(createOfferFee.subtract(txFee)) == 0)
numOffers++;
else if (amountAsCoin.compareTo(takeOfferFee.subtract(txFee)) == 0)
numTrades++;

dataByDayMap.put(day, new Tuple4<>(tuple.first, ++prev, numOffers, numTrades));
}
});

StringBuilder stringBuilder = new StringBuilder();
map.forEach((key, value) -> {
// This is not intended for the public so we don't translate here
stringBuilder.append("No. of transactions for amount ").
append(formatter.formatCoinWithCode(Coin.valueOf(key))).
append(": ").
append(value.size()).
append("\n");
});

List<Tuple4<String, Date, Integer, Tuple2<Integer, Integer>>> sortedDataByDayList = dataByDayMap.entrySet().stream().
map(e -> {
Tuple4<Date, Integer, Integer, Integer> data = e.getValue();
return new Tuple4<>(e.getKey(), data.first, data.second, new Tuple2<>(data.third, data.fourth));
}).sorted((o1, o2) -> o2.second.compareTo(o1.second))
.collect(Collectors.toList());
StringBuilder transactionsByDayStringBuilder = new StringBuilder();
StringBuilder offersStringBuilder = new StringBuilder();
StringBuilder tradesStringBuilder = new StringBuilder();
StringBuilder allStringBuilder = new StringBuilder();
// This is not intended for the public so we don't translate here
allStringBuilder.append(Res.get("shared.date")).append(";").append("Offers").append(";").append("Trades").append("\n");
sortedDataByDayList.forEach(tuple4 -> {
offersStringBuilder.append(tuple4.fourth.first).append(",");
tradesStringBuilder.append(tuple4.fourth.second).append(",");
allStringBuilder.append(tuple4.first).append(";").append(tuple4.fourth.first).append(";").append(tuple4.fourth.second).append("\n");
transactionsByDayStringBuilder.append("\n").
append(tuple4.first).
append(": ").
append(tuple4.third).
append(" (Offers: ").
append(tuple4.fourth.first).
append(" / Trades: ").
append(tuple4.fourth.second).
append(")");
});
// This is not intended for the public so we don't translate here
String message = stringBuilder.toString() + "\nNo. of transactions by day:" + transactionsByDayStringBuilder.toString();
new Popup().headLine("Statistical info")
.information(message)
.actionButtonText("Copy")
.onAction(() -> Utilities.copyToClipboard(message +
"\n\nCSV (Offers):\n" + offersStringBuilder.toString() +
"\n\nCSV (Trades):\n" + tradesStringBuilder.toString() +
"\n\nCSV (all):\n" + allStringBuilder.toString()))
.show();
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
import bisq.common.UserThread;
import bisq.common.util.Utilities;

import javax.inject.Named;

import javax.inject.Inject;
import javax.inject.Named;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

Expand Down Expand Up @@ -210,7 +209,7 @@ public void initialize() {
.closeButtonText(Res.get("shared.cancel"))
.onClose(popup::hide)
.show();
} else if (Utilities.isAltPressed(KeyCode.Y, keyEvent)) {
} else if (Utilities.isAltOrCtrlPressed(KeyCode.Y, keyEvent)) {
new Popup().warning(Res.get("portfolio.pending.removeFailedTrade"))
.onAction(model.dataModel::onMoveToFailedTrades)
.show();
Expand Down
Loading