From ba0acd4724172a09559817c6e16a6138d75c06d4 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Tue, 5 Nov 2019 15:09:59 -0300 Subject: [PATCH 1/2] Hide avoid standby mode feature on *nux OS Displays standby mode button on only on Windows and OSX, and hides it on Linux and Unix distributions. TitledGroupBg num rows reduced to 7 when standby mode button is not displayed. Fixes #3223 Replaces PR #3322 -- rejected because source file reformat rearanged class level field declarations, making review more difficult. --- .../settings/preferences/PreferencesView.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java index d8233b5589f..2db5d2c600c 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java @@ -53,6 +53,7 @@ import bisq.common.UserThread; import bisq.common.app.DevEnv; import bisq.common.util.Tuple3; +import bisq.common.util.Utilities; import org.bitcoinj.core.Coin; @@ -144,7 +145,7 @@ public class PreferencesView extends ActivatableViewAndModel useCustomFeeCheckboxListener; private ChangeListener transactionFeeChangeListener; private final boolean daoOptionsSet; - + private final boolean displayStandbyModeFeature; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor, initialisation @@ -173,6 +174,7 @@ public PreferencesView(PreferencesViewModel model, rpcUser != null && !rpcUser.isEmpty() && rpcPassword != null && !rpcPassword.isEmpty() && rpcBlockNotificationPort != null && !rpcBlockNotificationPort.isEmpty(); + this.displayStandbyModeFeature = Utilities.isOSX() || Utilities.isWindows(); } @Override @@ -224,7 +226,8 @@ protected void deactivate() { /////////////////////////////////////////////////////////////////////////////////////////// private void initializeGeneralOptions() { - TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 8, Res.get("setting.preferences.general")); + int titledGroupBgRowSpan = displayStandbyModeFeature ? 8 : 7; + TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, titledGroupBgRowSpan, Res.get("setting.preferences.general")); GridPane.setColumnSpan(titledGroupBg, 1); userLanguageComboBox = addComboBox(root, gridRow, @@ -346,9 +349,11 @@ private void initializeGeneralOptions() { } }; - // AvoidStandbyModeService - avoidStandbyMode = addSlideToggleButton(root, ++gridRow, - Res.get("setting.preferences.avoidStandbyMode")); + if (displayStandbyModeFeature) { + // AvoidStandbyModeService feature works only on OSX & Windows + avoidStandbyMode = addSlideToggleButton(root, ++gridRow, + Res.get("setting.preferences.avoidStandbyMode")); + } } private void initializeSeparator() { @@ -806,8 +811,10 @@ private void activateDisplayPreferences() { // We use opposite property (useStandbyMode) in preferences to have the default value (false) set as we want it, // so users who update gets set avoidStandbyMode=true (useStandbyMode=false) - avoidStandbyMode.setSelected(!preferences.isUseStandbyMode()); - avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected())); + if (displayStandbyModeFeature) { + avoidStandbyMode.setSelected(!preferences.isUseStandbyMode()); + avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected())); + } } private void activateDaoPreferences() { @@ -929,7 +936,9 @@ private void deactivateDisplayPreferences() { sortMarketCurrenciesNumerically.setOnAction(null); showOwnOffersInOfferBook.setOnAction(null); resetDontShowAgainButton.setOnAction(null); - avoidStandbyMode.setOnAction(null); + if (displayStandbyModeFeature) { + avoidStandbyMode.setOnAction(null); + } } private void deactivateDaoPreferences() { From dd8fd30e7cd7a51af4717dce294f21d61f20fbe9 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 18 Nov 2019 11:30:35 -0300 Subject: [PATCH 2/2] Set use standby mode to false on non Win, OSX desktops --- .../bisq/desktop/main/settings/preferences/PreferencesView.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java index 2db5d2c600c..4dad14f63bd 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java @@ -814,6 +814,8 @@ private void activateDisplayPreferences() { if (displayStandbyModeFeature) { avoidStandbyMode.setSelected(!preferences.isUseStandbyMode()); avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected())); + } else { + preferences.setUseStandbyMode(false); } }