This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 116e58ae8d244bb37f33f28a7d93275e1b84418f Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Jun 20 17:34:32 2018 +0200 fixes #145: Add an option to show in system tray the name of the currently running task --- src/main/java/org/chorem/jtimer/JTimer.java | 19 +++++++++++++++++++ src/main/java/org/chorem/jtimer/JTimerConfig.java | 22 +++++++++++++++++++++- .../chorem/jtimer/ui/systray/SystrayManager.java | 8 ++++++-- .../org/chorem/jtimer/resources/JTimer.properties | 7 +++++-- .../chorem/jtimer/resources/JTimer_fr.properties | 3 +++ .../ui/systray/resources/SystrayManager.properties | 1 + .../systray/resources/SystrayManager_fr.properties | 1 + 7 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimer.java b/src/main/java/org/chorem/jtimer/JTimer.java index 0402637..b5fb76b 100644 --- a/src/main/java/org/chorem/jtimer/JTimer.java +++ b/src/main/java/org/chorem/jtimer/JTimer.java @@ -408,6 +408,13 @@ public class JTimer extends SingleFrameApplication implements closeToSysItem.setIcon(null); menu.add(closeToSysItem); + // close to systray + JMenuItem showTaskNameItem = new JCheckBoxMenuItem(); + showTaskNameItem.setAction(getAction("isShowTaskNameInSystray")); + showTaskNameItem.setSelected(config.isShowTaskNameInSystray()); + showTaskNameItem.setIcon(null); + menu.add(showTaskNameItem); + // report first day of week JMenu reportFDoW = new JMenu(); reportFDoW.setName("optionReportFirstDayMenu"); @@ -896,6 +903,18 @@ public class JTimer extends SingleFrameApplication implements config.setCloseToSystray(closeToSystray); } + /** + * Change show task name option. + * + * @param event action event + */ + @Action + public void isShowTaskNameInSystray(ActionEvent event) { + JCheckBoxMenuItem source = (JCheckBoxMenuItem) event.getSource(); + boolean showTaskNameInSystray = source.isSelected(); + config.setShowTaskNameInSystray(showTaskNameInSystray); + } + /** * Change report first day of week. */ diff --git a/src/main/java/org/chorem/jtimer/JTimerConfig.java b/src/main/java/org/chorem/jtimer/JTimerConfig.java index 50db0ab..1e4fc56 100644 --- a/src/main/java/org/chorem/jtimer/JTimerConfig.java +++ b/src/main/java/org/chorem/jtimer/JTimerConfig.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2012 - 2016 Codelutin + * Copyright (C) 2012 - 2018 Codelutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -255,6 +255,25 @@ public class JTimerConfig { appConfig.saveForUser(); } + /** + * Set showTaskNameInSystray option + * + * @param showTaskNameInSystray showTaskNameInSystray + */ + public void setShowTaskNameInSystray(boolean showTaskNameInSystray) { + appConfig.setOption(JTimerOption.UI_SHOW_TASK_NAME_IN_SYSTRAY.key, String.valueOf(showTaskNameInSystray)); + appConfig.saveForUser(); + } + + /** + * Get showTaskNameInSystray option. + * + * @return showTaskNameInSystray + */ + public boolean isShowTaskNameInSystray() { + return appConfig.getOptionAsBoolean(JTimerOption.UI_SHOW_TASK_NAME_IN_SYSTRAY.key); + } + /** * Return first day of week. * Default to {@code -1} (no preference). @@ -292,6 +311,7 @@ public class JTimerConfig { UI_IDLE_TIME("jtimer.ui.idletime", "300"), UI_SHOW_CLOSED("jtimer.ui.showclosed", "false"), UI_CLOSE_TO_SYSTRAY("jtimer.ui.closetosystray", "true"), + UI_SHOW_TASK_NAME_IN_SYSTRAY("jtimer.ui.showtasknameinsystray", "false"), UI_REPORT_FIRSTDAYOFWEEK("jtimer.ui.report.firstdayofweek", "0"); protected String key; diff --git a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java index b6f0eb0..bb33fa6 100644 --- a/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java +++ b/src/main/java/org/chorem/jtimer/ui/systray/SystrayManager.java @@ -2,7 +2,7 @@ * #%L * jTimer * %% - * Copyright (C) 2008 - 2016 CodeLutin + * Copyright (C) 2008 - 2018 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -226,7 +226,11 @@ public class SystrayManager extends WindowAdapter implements ActionListener, Dat } else { trayIcon.setImage(runningImage); if (nbTasksRunning == 1) { - message = resourceMap.getString("tooltipRunningTaskText", nbTasksRunning); + if (JTimer.config.isShowTaskNameInSystray()) { + message = resourceMap.getString("tooltipRunningTaskNameText", task.getName()); + } else { + message = resourceMap.getString("tooltipRunningTaskText", nbTasksRunning); + } } else { message = resourceMap.getString("tooltipRunningTasksText", nbTasksRunning); } diff --git a/src/main/resources/org/chorem/jtimer/resources/JTimer.properties b/src/main/resources/org/chorem/jtimer/resources/JTimer.properties index 4d92c8e..5ccb538 100644 --- a/src/main/resources/org/chorem/jtimer/resources/JTimer.properties +++ b/src/main/resources/org/chorem/jtimer/resources/JTimer.properties @@ -125,8 +125,11 @@ makeReport.Action.shortDescription = Create report isShowClosed.Action.text = Show &closed isShowClosed.Action.shortDescription = Show closed task and project -isCloseToSystray.Action.text = Close to &systray -isCloseToSystray.Action.shortDescription = Reduce application to system tray instead of closing +isCloseToSystray.Action.text = Show task &name in systray +isCloseToSystray.Action.shortDescription = Show current running task name in systray tooltip + +isShowTaskNameInSystray.Action.text = Close to &systray +isShowTaskNameInSystray.Action.shortDescription = Reduce application to system tray instead of closing isReportFirstDayOfWeek1.Action.text = &Sunday isReportFirstDayOfWeek2.Action.text = &Monday diff --git a/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties b/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties index e4563ca..1c222ca 100644 --- a/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties +++ b/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties @@ -95,6 +95,9 @@ isShowClosed.Action.shortDescription = Affiche les projets et t\u00E2ches ferm\u isCloseToSystray.Action.text = Fermer vers le &systray isCloseToSystray.Action.shortDescription = R\u00E9duit l'application dans le systray au lieu de la fermer +isShowTaskNameInSystray.Action.text = Afficher le &nom de la t\u00E2che dans le systray +isShowTaskNameInSystray.Action.shortDescription = Afficher le nom de la t\u00E2che en cours dans l'infobulle du systray + isReportFirstDayOfWeek1.Action.text = &Dimanche isReportFirstDayOfWeek2.Action.text = &Lundi isReportFirstDayOfWeek3.Action.text = &Mardi diff --git a/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager.properties b/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager.properties index 7219e97..cebac1c 100644 --- a/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager.properties +++ b/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager.properties @@ -28,6 +28,7 @@ idleDetectImage = jtimer-40-grey.png tooltipIdleText = ${Application.title} tooltipRunningTaskText = ${Application.title} - %d task running tooltipRunningTasksText = ${Application.title} - %d tasks running +tooltipRunningTaskNameText = ${Application.title} - %s showMenuText = Show hideMenuText = Hide stopMenuText = Stop all tasks diff --git a/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager_fr.properties b/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager_fr.properties index 64bce90..7efaf45 100644 --- a/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager_fr.properties +++ b/src/main/resources/org/chorem/jtimer/ui/systray/resources/SystrayManager_fr.properties @@ -23,6 +23,7 @@ tooltipIdleText = ${Application.title} tooltipRunningTaskText = ${Application.title} - %d t\u00E2che en cours tooltipRunningTasksText = ${Application.title} - %d t\u00E2ches en cours +tooltipRunningTaskNameText = ${Application.title} - %s showMenuText = Montrer hideMenuText = Cacher stopMenuText = Arr\u00EAter toutes les t\u00E2ches -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.