Author: jflesch
Date: 2007-09-03 23:54:42 +0000 (Mon, 03 Sep 2007)
New Revision: 14955
Modified:
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
Log:
Use the trayicon to notify the user when a transfer ends
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-09-03 23:31:22 UTC
(rev 14954)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-09-03 23:54:42 UTC
(rev 14955)
@@ -160,6 +160,12 @@
thaw.plugin.queueWatcher=Transfers
+thaw.plugin.queueWatcher.downloadSuccessful='X' successfully downloaded
+thaw.plugin.queueWatcher.downloadFailed=Download of 'X' has failed
+thaw.plugin.queueWatcher.insertionSuccessful='X' successfully inserted
+thaw.plugin.queueWatcher.insertionFailed=Insertion of 'X' has failed
+
+
thaw.plugin.insert.fileToInsert=File to insert
thaw.plugin.insert.filesToInsert=File(s) to insert
thaw.plugin.insert.selectKey=Select the kind of key wanted
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-09-03 23:31:22 UTC (rev 14954)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-09-03 23:54:42 UTC (rev 14955)
@@ -103,7 +103,9 @@
this.core = core;
this.detailPanel = detailPanel;
- tableModel = new QueueTableModel(isForInsertionQueue,
core.getQueueManager());
+ tableModel = new QueueTableModel(isForInsertionQueue,
+ core.getPluginManager(),
+ core.getQueueManager());
table = new Table(core.getConfig(),
isForInsertionQueue ? "table_insertions" :
"table_downloads",
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2007-09-03 23:31:22 UTC (rev 14954)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2007-09-03 23:54:42 UTC (rev 14955)
@@ -20,8 +20,9 @@
import thaw.fcp.FCPTransferQuery;
import thaw.fcp.FCPClientGet;
import thaw.fcp.FCPClientPut;
-
import thaw.gui.IconBox;
+import thaw.core.PluginManager;
+import thaw.plugins.TrayIcon;
public class QueueTableModel extends javax.swing.table.AbstractTableModel
implements Observer {
@@ -38,11 +39,14 @@
private int sortedColumn = -1;
private FCPQueueManager queueManager;
+ private PluginManager pluginManager;
-
- public QueueTableModel(boolean isForInsertions, final FCPQueueManager
queueManager) {
+ public QueueTableModel(boolean isForInsertions,
+ PluginManager pluginManager,
+ final FCPQueueManager queueManager) {
super();
+ this.pluginManager = pluginManager;
this.queueManager = queueManager;
this.isForInsertions = isForInsertions;
@@ -294,6 +298,31 @@
}
public void update(final Observable o, final Object arg) {
+ if (o instanceof FCPTransferQuery
+ && ((FCPTransferQuery)o).isFinished()) {
+
+ String str = null;
+
+ boolean success = ((FCPTransferQuery)o).isSuccessful();
+
+ if (o instanceof FCPClientGet) {
+ str = (success ?
+
I18n.getMessage("thaw.plugin.queueWatcher.downloadSuccessful") :
+
I18n.getMessage("thaw.plugin.queueWatcher.downloadFailed"));
+ } else if (o instanceof FCPClientPut) {
+ str = (success ?
+
I18n.getMessage("thaw.plugin.queueWatcher.insertionSuccessful") :
+
I18n.getMessage("thaw.plugin.queueWatcher.insertionFailed"));
+ }
+
+ if (str != null) {
+ str = str.replaceAll("X",
((FCPTransferQuery)o).getFilename());
+ TrayIcon.popMessage(pluginManager, "Thaw",
+ str,
thaw.gui.SysTrayIcon.MSG_INFO);
+ }
+ }
+
+
int oldPos = -1;
int i = 0;