From: jprocter Date: Tue, 13 Oct 2009 13:55:06 +0000 (+0000) Subject: added preferences for usage stats, questionnaire check and version check. X-Git-Tag: Jalview_2_4_0b2~17 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=297480d2e19bf7737f6ad250e044aafe64fa63e7;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 9489368..7aaec9e 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -205,6 +205,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(); @@ -346,7 +351,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 bed10c8..47959df 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -190,6 +190,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. @@ -317,6 +320,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() { @@ -541,6 +556,15 @@ 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,