Prevent downloading songs that are already loaded. (base: fluddokt/opsu/76778f8)

- All beatmap set IDs are now stored in a set in OsuGroupList.
- OsuParser now checks the directory name for beatmap set IDs if the OsuFile doesn't contain one (for older beatmap formats).

Tweaks:
- Clear completed downloads when hitting "Import All".
- Call Download.updateReadSoFar() upon starting downloads instead of waiting for user to hover over the button (causing an unnecessary delay).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-02-09 23:22:58 -05:00
parent f56c02864b
commit be3b94f5db
7 changed files with 72 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ package itdelatrisu.opsu.downloads;
import itdelatrisu.opsu.ErrorHandler;
import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.OsuGroupList;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.downloads.Download.Status;
@@ -296,6 +297,12 @@ public class DownloadNode {
g.setColor((focus) ? BG_FOCUS : (hover) ? BG_HOVER : BG_NORMAL);
g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
// map is already loaded
if (OsuGroupList.get().containsBeatmapSetID(beatmapSetID)) {
g.setColor(Utils.COLOR_BLUE_BUTTON);
g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
}
// download progress
if (dl != null) {
float progress = dl.getProgress();
@@ -349,7 +356,7 @@ public class DownloadNode {
else if (status == Download.Status.WAITING)
info = String.format("%s...", status.getName());
else {
if (hover)
if (hover && status == Download.Status.DOWNLOADING)
info = String.format("%s: %s left (%s)", status.getName(), download.getTimeRemaining(), download.getDownloadSpeed());
else
info = String.format("%s: %.1f%% (%s/%s)", status.getName(), progress,