From 3811cabba1de25735346a06c85d9b8aaf2af2b0e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Fri, 14 Nov 2014 14:28:08 +0100 Subject: [PATCH] Rename Preferences to Settings (#272) --- .../bitsquare/app/gui/BitsquareAppModule.java | 4 +- .../java/io/bitsquare/gui/Navigation.java | 8 +-- src/main/java/io/bitsquare/gui/images.css | 8 +-- .../io/bitsquare/gui/main/MainViewCB.java | 8 +-- .../gui/main/account/AccountView.fxml | 2 +- .../profile/ArbitratorProfileViewCB.java | 8 +-- .../SettingsView.fxml} | 6 +- .../SettingsViewCB.java} | 54 ++++++++---------- .../application/PreferencesModel.java} | 28 ++++----- .../application/PreferencesPM.java} | 8 +-- .../application/PreferencesView.fxml} | 4 +- .../application/PreferencesViewCB.java} | 8 +-- .../network/NetworkSettingsView.fxml} | 2 +- .../network/NetworkSettingsViewCB.java} | 6 +- .../trade/createoffer/CreateOfferModel.java | 10 ++-- .../main/trade/offerbook/OfferBookModel.java | 14 ++--- .../main/trade/takeoffer/TakeOfferModel.java | 10 ++-- .../io/bitsquare/gui/util/Transitions.java | 20 +++---- .../Preferences.java} | 8 +-- .../nav/{preferences.png => settings.png} | Bin .../{preferences@2x.png => settings@2x.png} | Bin ...erences_active.png => settings_active.png} | Bin ...s_active@2x.png => settings_active@2x.png} | Bin 23 files changed, 105 insertions(+), 111 deletions(-) rename src/main/java/io/bitsquare/gui/main/{preferences/PreferencesView.fxml => settings/SettingsView.fxml} (81%) rename src/main/java/io/bitsquare/gui/main/{preferences/PreferencesViewCB.java => settings/SettingsViewCB.java} (73%) rename src/main/java/io/bitsquare/gui/main/{preferences/application/ApplicationPreferencesModel.java => settings/application/PreferencesModel.java} (71%) rename src/main/java/io/bitsquare/gui/main/{preferences/application/ApplicationPreferencesPM.java => settings/application/PreferencesPM.java} (90%) rename src/main/java/io/bitsquare/gui/main/{preferences/application/ApplicationPreferencesView.fxml => settings/application/PreferencesView.fxml} (92%) rename src/main/java/io/bitsquare/gui/main/{preferences/application/ApplicationPreferencesViewCB.java => settings/application/PreferencesViewCB.java} (89%) rename src/main/java/io/bitsquare/gui/main/{preferences/network/NetworkPreferencesView.fxml => settings/network/NetworkSettingsView.fxml} (96%) rename src/main/java/io/bitsquare/gui/main/{preferences/network/NetworkPreferencesViewCB.java => settings/network/NetworkSettingsViewCB.java} (88%) rename src/main/java/io/bitsquare/{preferences/ApplicationPreferences.java => settings/Preferences.java} (95%) rename src/main/resources/images/nav/{preferences.png => settings.png} (100%) rename src/main/resources/images/nav/{preferences@2x.png => settings@2x.png} (100%) rename src/main/resources/images/nav/{preferences_active.png => settings_active.png} (100%) rename src/main/resources/images/nav/{preferences_active@2x.png => settings_active@2x.png} (100%) diff --git a/src/main/java/io/bitsquare/app/gui/BitsquareAppModule.java b/src/main/java/io/bitsquare/app/gui/BitsquareAppModule.java index 1091eb0822..245e72572d 100644 --- a/src/main/java/io/bitsquare/app/gui/BitsquareAppModule.java +++ b/src/main/java/io/bitsquare/app/gui/BitsquareAppModule.java @@ -27,7 +27,7 @@ import io.bitsquare.msg.tomp2p.TomP2PMessageModule; import io.bitsquare.offer.OfferModule; import io.bitsquare.offer.tomp2p.TomP2POfferModule; import io.bitsquare.persistence.Persistence; -import io.bitsquare.preferences.ApplicationPreferences; +import io.bitsquare.settings.Preferences; import io.bitsquare.trade.TradeModule; import io.bitsquare.user.User; @@ -53,7 +53,7 @@ class BitsquareAppModule extends BitsquareModule { @Override protected void configure() { bind(User.class).asEagerSingleton(); - bind(ApplicationPreferences.class).asEagerSingleton(); + bind(Preferences.class).asEagerSingleton(); bind(AccountSettings.class).asEagerSingleton(); File persistenceDir = new File(env.getRequiredProperty(Persistence.DIR_KEY)); diff --git a/src/main/java/io/bitsquare/gui/Navigation.java b/src/main/java/io/bitsquare/gui/Navigation.java index dd024d8733..fac91eaa61 100644 --- a/src/main/java/io/bitsquare/gui/Navigation.java +++ b/src/main/java/io/bitsquare/gui/Navigation.java @@ -165,7 +165,7 @@ public class Navigation { PORTFOLIO("/io/bitsquare/gui/main/portfolio/PortfolioView.fxml"), FUNDS("/io/bitsquare/gui/main/funds/FundsView.fxml"), MSG("/io/bitsquare/gui/main/msg/MsgView.fxml"), - PREFERENCES("/io/bitsquare/gui/main/preferences/PreferencesView.fxml"), + SETTINGS("/io/bitsquare/gui/main/settings/SettingsView.fxml"), ACCOUNT("/io/bitsquare/gui/main/account/AccountView.fxml"), @@ -187,9 +187,9 @@ public class Navigation { WITHDRAWAL("/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.fxml"), TRANSACTIONS("/io/bitsquare/gui/main/funds/transactions/TransactionsView.fxml"), - // preferences - APPLICATION_PREFERENCES("/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesView.fxml"), - NETWORK_PREFERENCES("/io/bitsquare/gui/main/preferences/network/NetworkPreferencesView.fxml"), + // settings + PREFERENCES("/io/bitsquare/gui/main/settings/application/PreferencesView.fxml"), + NETWORK_SETTINGS("/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml"), // account ACCOUNT_SETUP("/io/bitsquare/gui/main/account/setup/AccountSetupView.fxml"), diff --git a/src/main/java/io/bitsquare/gui/images.css b/src/main/java/io/bitsquare/gui/images.css index e56a797c27..ff2d78763f 100644 --- a/src/main/java/io/bitsquare/gui/images.css +++ b/src/main/java/io/bitsquare/gui/images.css @@ -94,12 +94,12 @@ -fx-image: url("../../../images/nav/msg_active.png"); } -#image-nav-preferences { - -fx-image: url("../../../images/nav/preferences.png"); +#image-nav-settings { + -fx-image: url("../../../images/nav/settings.png"); } -#image-nav-preferences-active { - -fx-image: url("../../../images/nav/preferences_active.png"); +#image-nav-settings-active { + -fx-image: url("../../../images/nav/settings_active.png"); } #image-nav-account { diff --git a/src/main/java/io/bitsquare/gui/main/MainViewCB.java b/src/main/java/io/bitsquare/gui/main/MainViewCB.java index 5ce712a4aa..835a4f1974 100644 --- a/src/main/java/io/bitsquare/gui/main/MainViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/MainViewCB.java @@ -65,7 +65,7 @@ public class MainViewCB extends ViewCB { private VBox splashScreen; private AnchorPane contentContainer; private HBox leftNavPane, rightNavPane; - private ToggleButton buyButton, sellButton, homeButton, msgButton, portfolioButton, fundsButton, preferencesButton, + private ToggleButton buyButton, sellButton, homeButton, msgButton, portfolioButton, fundsButton, settingsButton, accountButton; private Pane portfolioButtonButtonPane; private Label numPendingTradesLabel; @@ -253,8 +253,8 @@ public class MainViewCB extends ViewCB { case PORTFOLIO: portfolioButton.setSelected(true); break; - case PREFERENCES: - preferencesButton.setSelected(true); + case SETTINGS: + settingsButton.setSelected(true); break; case SELL: sellButton.setSelected(true); @@ -409,7 +409,7 @@ public class MainViewCB extends ViewCB { addBankAccountComboBox(rightNavPane); - preferencesButton = addNavButton(rightNavPane, "Preferences", Navigation.Item.PREFERENCES); + settingsButton = addNavButton(rightNavPane, "Settings", Navigation.Item.SETTINGS); accountButton = addNavButton(rightNavPane, "Account", Navigation.Item.ACCOUNT); diff --git a/src/main/java/io/bitsquare/gui/main/account/AccountView.fxml b/src/main/java/io/bitsquare/gui/main/account/AccountView.fxml index fbeab9caa4..3bbf71e899 100644 --- a/src/main/java/io/bitsquare/gui/main/account/AccountView.fxml +++ b/src/main/java/io/bitsquare/gui/main/account/AccountView.fxml @@ -25,6 +25,6 @@ AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0" xmlns:fx="http://javafx.com/fxml"> - + \ No newline at end of file diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileViewCB.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileViewCB.java index dfff359eb3..1721573c05 100644 --- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileViewCB.java @@ -21,7 +21,7 @@ import io.bitsquare.arbitrator.Arbitrator; import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.persistence.Persistence; -import io.bitsquare.preferences.ApplicationPreferences; +import io.bitsquare.settings.Preferences; import java.net.URL; @@ -35,7 +35,7 @@ import javafx.scene.control.*; // TODO Arbitration is very basic yet public class ArbitratorProfileViewCB extends CachedViewCB { - private final ApplicationPreferences applicationPreferences; + private final Preferences preferences; private final Persistence persistence; private final BSFormatter formatter; @@ -53,9 +53,9 @@ public class ArbitratorProfileViewCB extends CachedViewCB { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public ArbitratorProfileViewCB(ApplicationPreferences applicationPreferences, Persistence persistence, + public ArbitratorProfileViewCB(Preferences preferences, Persistence persistence, BSFormatter formatter) { - this.applicationPreferences = applicationPreferences; + this.preferences = preferences; this.persistence = persistence; // ApplicationPreferences persistedApplicationPreferences = (ApplicationPreferences) storage diff --git a/src/main/java/io/bitsquare/gui/main/preferences/PreferencesView.fxml b/src/main/java/io/bitsquare/gui/main/settings/SettingsView.fxml similarity index 81% rename from src/main/java/io/bitsquare/gui/main/preferences/PreferencesView.fxml rename to src/main/java/io/bitsquare/gui/main/settings/SettingsView.fxml index 6fb03a0a02..97e9492375 100644 --- a/src/main/java/io/bitsquare/gui/main/preferences/PreferencesView.fxml +++ b/src/main/java/io/bitsquare/gui/main/settings/SettingsView.fxml @@ -19,12 +19,12 @@ - - - + + diff --git a/src/main/java/io/bitsquare/gui/main/preferences/PreferencesViewCB.java b/src/main/java/io/bitsquare/gui/main/settings/SettingsViewCB.java similarity index 73% rename from src/main/java/io/bitsquare/gui/main/preferences/PreferencesViewCB.java rename to src/main/java/io/bitsquare/gui/main/settings/SettingsViewCB.java index 86316b84b7..d7cf2179f4 100644 --- a/src/main/java/io/bitsquare/gui/main/preferences/PreferencesViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/settings/SettingsViewCB.java @@ -15,13 +15,13 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.preferences; +package io.bitsquare.gui.main.settings; import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.Navigation; import io.bitsquare.gui.ViewCB; import io.bitsquare.gui.ViewLoader; -import io.bitsquare.preferences.ApplicationPreferences; +import io.bitsquare.settings.Preferences; import java.net.URL; @@ -38,16 +38,16 @@ import javafx.scene.control.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PreferencesViewCB extends CachedViewCB { - private static final Logger log = LoggerFactory.getLogger(PreferencesViewCB.class); +public class SettingsViewCB extends CachedViewCB { + private static final Logger log = LoggerFactory.getLogger(SettingsViewCB.class); private final Navigation navigation; - private ApplicationPreferences applicationPreferences; + private Preferences preferences; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; - @FXML Tab applicationTab, networkTab; + @FXML Tab preferencesTab, networkSettingsTab; /////////////////////////////////////////////////////////////////////////////////////////// @@ -55,11 +55,11 @@ public class PreferencesViewCB extends CachedViewCB { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - PreferencesViewCB(Navigation navigation, ApplicationPreferences applicationPreferences) { + SettingsViewCB(Navigation navigation, Preferences preferences) { super(); this.navigation = navigation; - this.applicationPreferences = applicationPreferences; + this.preferences = preferences; } @@ -71,17 +71,17 @@ public class PreferencesViewCB extends CachedViewCB { public void initialize(URL url, ResourceBundle rb) { navigationListener = navigationItems -> { if (navigationItems != null && navigationItems.length == 3 - && navigationItems[1] == Navigation.Item.PREFERENCES) + && navigationItems[1] == Navigation.Item.SETTINGS) loadView(navigationItems[2]); }; tabChangeListener = (ov, oldValue, newValue) -> { - if (newValue == applicationTab) - navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PREFERENCES, - Navigation.Item.APPLICATION_PREFERENCES); - else if (newValue == networkTab) - navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PREFERENCES, - Navigation.Item.NETWORK_PREFERENCES); + if (newValue == preferencesTab) + navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.SETTINGS, + Navigation.Item.PREFERENCES); + else if (newValue == networkSettingsTab) + navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.SETTINGS, + Navigation.Item.NETWORK_SETTINGS); }; super.initialize(url, rb); @@ -94,14 +94,14 @@ public class PreferencesViewCB extends CachedViewCB { ((TabPane) root).getSelectionModel().selectedItemProperty().addListener(tabChangeListener); navigation.addListener(navigationListener); - if (((TabPane) root).getSelectionModel().getSelectedItem() == applicationTab) + if (((TabPane) root).getSelectionModel().getSelectedItem() == preferencesTab) navigation.navigationTo(Navigation.Item.MAIN, - Navigation.Item.PREFERENCES, - Navigation.Item.APPLICATION_PREFERENCES); + Navigation.Item.SETTINGS, + Navigation.Item.PREFERENCES); else navigation.navigationTo(Navigation.Item.MAIN, - Navigation.Item.PREFERENCES, - Navigation.Item.NETWORK_PREFERENCES); + Navigation.Item.SETTINGS, + Navigation.Item.NETWORK_SETTINGS); } @Override @@ -112,12 +112,6 @@ public class PreferencesViewCB extends CachedViewCB { navigation.removeListener(navigationListener); } - @SuppressWarnings("EmptyMethod") - @Override - public void terminate() { - super.terminate(); - } - /////////////////////////////////////////////////////////////////////////////////////////// // Navigation @@ -131,11 +125,11 @@ public class PreferencesViewCB extends CachedViewCB { Parent view = loader.load(); Tab tab = null; switch (navigationItem) { - case APPLICATION_PREFERENCES: - tab = applicationTab; + case PREFERENCES: + tab = preferencesTab; break; - case NETWORK_PREFERENCES: - tab = networkTab; + case NETWORK_SETTINGS: + tab = networkSettingsTab; break; } tab.setContent(view); diff --git a/src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesModel.java b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesModel.java similarity index 71% rename from src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesModel.java rename to src/main/java/io/bitsquare/gui/main/settings/application/PreferencesModel.java index 64d87a402b..442e7eb1ac 100644 --- a/src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesModel.java +++ b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesModel.java @@ -15,10 +15,10 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.preferences.application; +package io.bitsquare.gui.main.settings.application; import io.bitsquare.gui.UIModel; -import io.bitsquare.preferences.ApplicationPreferences; +import io.bitsquare.settings.Preferences; import com.google.inject.Inject; @@ -33,10 +33,10 @@ import javafx.collections.ObservableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -class ApplicationPreferencesModel extends UIModel { - private static final Logger log = LoggerFactory.getLogger(ApplicationPreferencesModel.class); +class PreferencesModel extends UIModel { + private static final Logger log = LoggerFactory.getLogger(PreferencesModel.class); - private final ApplicationPreferences applicationPreferences; + private final Preferences preferences; private final ChangeListener useAnimationsListener; private final ChangeListener useEffectsListener; @@ -54,13 +54,13 @@ class ApplicationPreferencesModel extends UIModel { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - ApplicationPreferencesModel(ApplicationPreferences applicationPreferences) { - this.applicationPreferences = applicationPreferences; + PreferencesModel(Preferences preferences) { + this.preferences = preferences; - btcDenominations = FXCollections.observableArrayList(applicationPreferences.getBtcDenominations()); - btcDenominationListener = (ov, oldValue, newValue) -> applicationPreferences.setBtcDenomination(newValue); - useAnimationsListener = (ov, oldValue, newValue) -> applicationPreferences.setUseAnimations(newValue); - useEffectsListener = (ov, oldValue, newValue) -> applicationPreferences.setUseEffects(newValue); + btcDenominations = FXCollections.observableArrayList(preferences.getBtcDenominations()); + btcDenominationListener = (ov, oldValue, newValue) -> preferences.setBtcDenomination(newValue); + useAnimationsListener = (ov, oldValue, newValue) -> preferences.setUseAnimations(newValue); + useEffectsListener = (ov, oldValue, newValue) -> preferences.setUseEffects(newValue); } @@ -78,9 +78,9 @@ class ApplicationPreferencesModel extends UIModel { public void activate() { super.activate(); - useAnimations.set(applicationPreferences.getUseAnimations()); - useEffects.set(applicationPreferences.getUseEffects()); - btcDenomination.set(applicationPreferences.getBtcDenomination()); + useAnimations.set(preferences.getUseAnimations()); + useEffects.set(preferences.getUseEffects()); + btcDenomination.set(preferences.getBtcDenomination()); useAnimations.addListener(useAnimationsListener); useEffects.addListener(useEffectsListener); diff --git a/src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesPM.java b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesPM.java similarity index 90% rename from src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesPM.java rename to src/main/java/io/bitsquare/gui/main/settings/application/PreferencesPM.java index 56a670318a..eda37c41c3 100644 --- a/src/main/java/io/bitsquare/gui/main/preferences/application/ApplicationPreferencesPM.java +++ b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesPM.java @@ -15,7 +15,7 @@ * along with Bitsquare. If not, see . */ -package io.bitsquare.gui.main.preferences.application; +package io.bitsquare.gui.main.settings.application; import io.bitsquare.gui.PresentationModel; @@ -28,8 +28,8 @@ import javafx.collections.ObservableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ApplicationPreferencesPM extends PresentationModel { - private static final Logger log = LoggerFactory.getLogger(ApplicationPreferencesPM.class); +public class PreferencesPM extends PresentationModel { + private static final Logger log = LoggerFactory.getLogger(PreferencesPM.class); /////////////////////////////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ public class ApplicationPreferencesPM extends PresentationModel - - +