From 051375293ec12d97d9615c739cf92ef9725cc7dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 8 Aug 2013 02:19:25 +0200 Subject: [PATCH] Show downloads sorted by name and status. --- src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 9cd2a12..5feabd7 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -17,6 +17,9 @@ package net.pterodactylus.xdcc.ui.stdin; +import static net.pterodactylus.xdcc.data.Download.BY_NAME; +import static net.pterodactylus.xdcc.data.Download.BY_RUNNING; + import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; @@ -44,7 +47,9 @@ import net.pterodactylus.xdcc.data.Pack; import com.google.common.base.Predicate; import com.google.common.collect.ComparisonChain; +import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; +import com.google.common.collect.Ordering; import com.google.common.collect.Sets; import com.google.common.eventbus.Subscribe; import com.google.common.primitives.Ints; @@ -125,7 +130,7 @@ public class CommandReader extends AbstractExecutionThreadService { writeLine("End of Search."); } else if (words[0].equalsIgnoreCase("dcc")) { int counter = 0; - for (Download download : core.downloads()) { + for (Download download : FluentIterable.from(core.downloads()).toSortedList(Ordering.from(BY_NAME).compound(BY_RUNNING))) { DccReceiver dccReceiver = download.dccReceiver(); if (dccReceiver == null) { /* download has not even started. */ -- 2.7.4