From a5418ab99eea47e8570de8e47b92a8c279ac5f02 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 13 Oct 2009 13:55:50 +0000 Subject: [PATCH] prompt user to enable usage stats --- src/jalview/bin/Jalview.java | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 3dd6f75..925401e 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -136,12 +136,8 @@ public class Jalview desktop = new Desktop(); desktop.setVisible(true); desktop.discoverer.start(); - if (!aparser.contains("nousagestats") && Cache.getDefault("USAGESTATS", true)) { - Cache.log.info("Initialising googletracker for usage stats."); - Cache.initGoogleTracker(); - Cache.log.debug("Tracking enabled."); - } else { - Cache.log.info("Not enabling Google Tracking."); + if (!aparser.contains("nousagestats")) { + startUsageStats(desktop); } if (!aparser.contains("noquestionnaire")) { @@ -412,6 +408,28 @@ public class Jalview // Once all other stuff is done, execute any groovy scripts (in order) } + private static void startUsageStats(final Desktop desktop) + { + /** + * start a User Config prompt asking if we can log usage statistics. + */ + jalview.gui.PromptUserConfig prompter = new jalview.gui.PromptUserConfig(desktop.desktop,"USAGESTATS", "Jalview Usage Statistics", "Jalview uses Google Analytics to report usage statistics.\nDo you want to enable this ?\n\n(if you press cancel, you will be asked again next time)", + new Runnable() { + public void run() + { + Cache.log.info("Initialising googletracker for usage stats."); + Cache.initGoogleTracker(); + Cache.log.debug("Tracking enabled."); + } + }, + new Runnable() { + public void run() { + Cache.log.info("Not enabling Google Tracking."); + } + }, null, true); + SwingUtilities.invokeLater(prompter); + } + /** * Locate the given string as a file and pass it to the groovy interpreter. * -- 1.7.10.2