diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 0325785016..c86860f7b0 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -697,10 +697,12 @@ namespace osu.Game.Beatmaps
}
}
+ public bool StableInstallationAvailable => GetStableStorage?.Invoke() != null;
+
///
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
///
- public void ImportFromStable()
+ public async Task ImportFromStable()
{
var stable = GetStableStorage?.Invoke();
@@ -710,7 +712,7 @@ namespace osu.Game.Beatmaps
return;
}
- Import(stable.GetDirectories("Songs"));
+ await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs")), TaskCreationOptions.LongRunning);
}
public void DeleteAll()
diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
index e288445c6d..9ab4143613 100644
--- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
+++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs
@@ -30,8 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () =>
{
importButton.Enabled.Value = false;
- Task.Factory.StartNew(beatmaps.ImportFromStable)
- .ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning);
+ beatmaps.ImportFromStable().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true));
}
},
deleteButton = new DangerousSettingsButton
diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs
new file mode 100644
index 0000000000..489ab79fa4
--- /dev/null
+++ b/osu.Game/Screens/Select/ImportFromStablePopup.cs
@@ -0,0 +1,33 @@
+// Copyright (c) 2007-2017 ppy Pty Ltd .
+// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
+
+using System;
+using osu.Game.Graphics;
+using osu.Game.Overlays.Dialog;
+
+namespace osu.Game.Screens.Select
+{
+ public class ImportFromStablePopup : PopupDialog
+ {
+ public ImportFromStablePopup(Action importFromStable)
+ {
+ HeaderText = @"You have no beatmaps!";
+ BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?";
+
+ Icon = FontAwesome.fa_trash_o;
+
+ Buttons = new PopupDialogButton[]
+ {
+ new PopupDialogOkButton
+ {
+ Text = @"Yes please!",
+ Action = importFromStable
+ },
+ new PopupDialogCancelButton
+ {
+ Text = @"No, I'd like to start from scratch",
+ },
+ };
+ }
+ }
+}
diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs
index 4a0ee31fbb..727cdb9959 100644
--- a/osu.Game/Screens/Select/PlaySongSelect.cs
+++ b/osu.Game/Screens/Select/PlaySongSelect.cs
@@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
+using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play;
@@ -45,8 +46,8 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleConfirm;
- [BackgroundDependencyLoader]
- private void load(OsuColour colours, AudioManager audio)
+ [BackgroundDependencyLoader(true)]
+ private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay)
{
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
@@ -59,6 +60,16 @@ namespace osu.Game.Screens.Select
ValidForResume = false;
Push(new Editor());
}, Key.Number3);
+
+ if (dialogOverlay != null)
+ {
+ Schedule(() =>
+ {
+ // if we have no beatmaps but osu-stable is found, let's prompt the user to import.
+ if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
+ dialogOverlay.Push(new ImportFromStablePopup(() => beatmaps.ImportFromStable()));
+ });
+ }
}
protected override void UpdateBeatmap(WorkingBeatmap beatmap)
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 18134582f3..b184486a87 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -311,6 +311,7 @@
+