From: jprocter Date: Tue, 13 Oct 2009 15:13:32 +0000 (+0000) Subject: added preferences for usage stats, questionnaire check and version check. X-Git-Tag: Release_2_5~184 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e3d37653250ad19df4c310f1fd6a50510467a764;p=jalview.git added preferences for usage stats, questionnaire check and version check. --- diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 26d7260..b96fb71 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -208,6 +208,11 @@ public class Preferences extends GPreferences proxyPortTB.setText(Cache.getDefault("PROXY_PORT", "")); defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", "")); + + usagestats.setSelected(Cache.getDefault("USAGESTATS", false)); + questionnaire.setSelected(Cache.getProperty("NOQUESTIONNAIRES")==null); // note antisense here + versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true)); // default is true + try { jbInit(); @@ -349,7 +354,20 @@ public class Preferences extends GPreferences System.setProperty("http.proxyHost", ""); System.setProperty("http.proxyPort", ""); } - + Cache.setProperty("VERSION_CHECK", Boolean + .toString(versioncheck.isSelected())); + if (Cache.getProperty("USAGESTATS")!=null || usagestats.isSelected()) { + // default is false - we only set this if the user has actively agreed + Cache.setProperty("USAGESTATS",Boolean + .toString(usagestats.isSelected())); + } + if (!questionnaire.isSelected()) + { + Cache.setProperty("NOQUESTIONNAIRES", "true"); + } else { + // special - made easy to edit a property file to disable questionnaires by just adding the given line + Cache.removeProperty("NOQUESTIONNAIRES"); + } Cache.applicationProperties.setProperty("BLC_JVSUFFIX", Boolean .toString(blcjv.isSelected())); Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", Boolean diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 7ff1757..7b2e5c4 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -193,6 +193,9 @@ public class GPreferences extends JPanel protected JCheckBox idItalics = new JCheckBox(); protected JCheckBox openoverv = new JCheckBox(); + protected JCheckBox usagestats = new JCheckBox(); + protected JCheckBox questionnaire = new JCheckBox(); + protected JCheckBox versioncheck = new JCheckBox(); /** * Creates a new GPreferences object. @@ -334,6 +337,18 @@ public class GPreferences extends JPanel browserLabel.setText("Default Browser (Unix)"); defaultBrowser.setFont(verdana11); defaultBrowser.setText(""); + usagestats.setText("Send usage statistics"); + usagestats.setFont(verdana11); + usagestats.setHorizontalAlignment(SwingConstants.RIGHT); + usagestats.setHorizontalTextPosition(SwingConstants.LEADING); + questionnaire.setText("Check for questionnaires"); + questionnaire.setFont(verdana11); + questionnaire.setHorizontalAlignment(SwingConstants.RIGHT); + questionnaire.setHorizontalTextPosition(SwingConstants.LEADING); + versioncheck.setText("Check for latest version"); + versioncheck.setFont(verdana11); + versioncheck.setHorizontalAlignment(SwingConstants.RIGHT); + versioncheck.setHorizontalTextPosition(SwingConstants.LEADING); newLink.setText("New"); newLink.addActionListener(new java.awt.event.ActionListener() { @@ -560,7 +575,16 @@ public class GPreferences extends JPanel connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 0, 0, 15), 307, 1)); - + connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, + 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(0, 2, 4,2), 70, 1)); + connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0, + 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(0, 2, 4,2), 70, 1)); + connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0, + 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(0, 2, 4,2), 70, 1)); + jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 5, 185), 2, -4));