Selaa lähdekoodia

Adds optional progress percentage of transfers into DCC window titles

Fixes issue 3823
Change-Id: I421684f69ccb615898a11e2a1628a31fa10ca781
Reviewed-on: http://gerrit.dmdirc.com/941
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4
Simon Mott 14 vuotta sitten
vanhempi
commit
4835f684af

+ 4
- 0
src/com/dmdirc/addons/dcc/DCCPlugin.java Näytä tiedosto

@@ -614,6 +614,10 @@ public final class DCCPlugin extends Plugin implements ActionListener {
614 614
                 getDomain(), "send.blocksize", "Blocksize to use for DCC",
615 615
                 "Change the block size for send/receive, this can " +
616 616
                 "sometimes speed up transfers."));
617
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
618
+                getDomain(), "general.percentageInTitle",
619
+                "Show percentage of transfers in the window title",
620
+                "Show the current percentage of transfers in the DCC window title"));
617 621
     }
618 622
 
619 623
 }

+ 13
- 0
src/com/dmdirc/addons/dcc/DCCTransferWindow.java Näytä tiedosto

@@ -277,12 +277,25 @@ public class DCCTransferWindow extends DCCFrame implements DCCTransferHandler,
277 277
             percent = (100.00 / dcc.getFileSize()) * (transferCount + dcc.getFileStart());
278 278
         }
279 279
 
280
+        boolean percentageInTitle = IdentityManager.getGlobalConfig().getOptionBool(
281
+                            plugin.getDomain(), "general.percentageInTitle");
282
+
280 283
         if (dcc.getType() == DCCTransfer.TransferType.SEND) {
281 284
             status.setText("Status: Sending");
282 285
         } else {
283 286
             status.setText("Status: Recieving");
284 287
         }
285 288
 
289
+        if (percentageInTitle) {
290
+            final StringBuilder title = new StringBuilder();
291
+            if (dcc.isListenSocket()) { title.append("*"); }
292
+            title.append(dcc.getType() == DCCTransfer.TransferType.SEND ? "Sending: " : "Recieving: ");
293
+            title.append(otherNickname);
294
+            title.append(" ("+ String.format("%.0f", Math.floor(percent)) +"%)");
295
+            this.setName(title.toString());
296
+            this.getFrame().setTitle(title.toString());
297
+        }
298
+
286 299
         updateSpeedAndTime();
287 300
 
288 301
         progress.setValue((int) Math.floor(percent));

+ 1
- 0
src/com/dmdirc/addons/dcc/plugin.config Näytä tiedosto

@@ -41,6 +41,7 @@ required-services:
41 41
 
42 42
 defaults:
43 43
   general.useKFileChooser=false
44
+  general.percentageInTitle=false
44 45
   send.reverse=false
45 46
   send.forceturbo=true
46 47
   receive.reverse.sendtoken=false

Loading…
Peruuta
Tallenna