mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Merge pull request #16423 from peppy/realm/manual-compact
Add button to compact realm on demand
This commit is contained in:
commit
2e34887999
@ -44,6 +44,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ClearAllCaches => new TranslatableString(getKey(@"clear_all_caches"), @"Clear all caches");
|
public static LocalisableString ClearAllCaches => new TranslatableString(getKey(@"clear_all_caches"), @"Clear all caches");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Compact realm"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString CompactRealm => new TranslatableString(getKey(@"compact_realm"), @"Compact realm");
|
||||||
|
|
||||||
private static string getKey(string key) => $"{prefix}:{key}";
|
private static string getKey(string key) => $"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Configuration;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
||||||
@ -15,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
|||||||
protected override LocalisableString Header => DebugSettingsStrings.MemoryHeader;
|
protected override LocalisableString Header => DebugSettingsStrings.MemoryHeader;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkDebugConfigManager config, GameHost host)
|
private void load(FrameworkDebugConfigManager config, GameHost host, RealmContextFactory realmFactory)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -24,6 +25,17 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
|||||||
Text = DebugSettingsStrings.ClearAllCaches,
|
Text = DebugSettingsStrings.ClearAllCaches,
|
||||||
Action = host.Collect
|
Action = host.Collect
|
||||||
},
|
},
|
||||||
|
new SettingsButton
|
||||||
|
{
|
||||||
|
Text = DebugSettingsStrings.CompactRealm,
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
// Blocking operations implicitly causes a Compact().
|
||||||
|
using (realmFactory.BlockAllOperations())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user