mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
even more profile => collection
This commit is contained in:
parent
3d057c4e35
commit
6dd7188f6c
4 changed files with 15 additions and 15 deletions
|
|
@ -50,8 +50,8 @@ public class SettingsTabExperimental : SettingsTab
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsEnableProfiles", "Enable plugin profiles"),
|
Loc.Localize("DalamudSettingsEnableProfiles", "Enable plugin collections"),
|
||||||
Loc.Localize("DalamudSettingsEnableProfilesHint", "EXPERIMENTAL: Enables plugin profiles."),
|
Loc.Localize("DalamudSettingsEnableProfilesHint", "Enables plugin collections, which lets you create toggleable lists of plugins."),
|
||||||
c => c.ProfilesEnabled,
|
c => c.ProfilesEnabled,
|
||||||
(v, c) => c.ProfilesEnabled = v),
|
(v, c) => c.ProfilesEnabled = v),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,19 +42,19 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
||||||
|
|
||||||
this.cmd.AddHandler("/xlenableprofile", new CommandInfo(this.OnEnableProfile)
|
this.cmd.AddHandler("/xlenableprofile", new CommandInfo(this.OnEnableProfile)
|
||||||
{
|
{
|
||||||
HelpMessage = Loc.Localize("ProfileCommandsEnableHint", "Enable a profile. Usage: /xlenableprofile \"Profile Name\""),
|
HelpMessage = Loc.Localize("ProfileCommandsEnableHint", "Enable a collection. Usage: /xlenablecollection \"Collection Name\""),
|
||||||
ShowInHelp = true,
|
ShowInHelp = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cmd.AddHandler("/xldisableprofile", new CommandInfo(this.OnDisableProfile)
|
this.cmd.AddHandler("/xldisableprofile", new CommandInfo(this.OnDisableProfile)
|
||||||
{
|
{
|
||||||
HelpMessage = Loc.Localize("ProfileCommandsDisableHint", "Disable a profile. Usage: /xldisableprofile \"Profile Name\""),
|
HelpMessage = Loc.Localize("ProfileCommandsDisableHint", "Disable a collection. Usage: /xldisablecollection \"Collection Name\""),
|
||||||
ShowInHelp = true,
|
ShowInHelp = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cmd.AddHandler("/xltoggleprofile", new CommandInfo(this.OnToggleProfile)
|
this.cmd.AddHandler("/xltoggleprofile", new CommandInfo(this.OnToggleProfile)
|
||||||
{
|
{
|
||||||
HelpMessage = Loc.Localize("ProfileCommandsToggleHint", "Toggle a profile. Usage: /xltoggleprofile \"Profile Name\""),
|
HelpMessage = Loc.Localize("ProfileCommandsToggleHint", "Toggle a collection. Usage: /xltogglecollection \"Collection Name\""),
|
||||||
ShowInHelp = true,
|
ShowInHelp = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -71,9 +71,9 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
this.cmd.RemoveHandler("/xlenableprofile");
|
this.cmd.RemoveHandler("/xlenablecollection");
|
||||||
this.cmd.RemoveHandler("/xldisableprofile");
|
this.cmd.RemoveHandler("/xldisablecollection");
|
||||||
this.cmd.RemoveHandler("/xltoggleprofile");
|
this.cmd.RemoveHandler("/xltogglecollection");
|
||||||
|
|
||||||
this.framework.Update += this.FrameworkOnUpdate;
|
this.framework.Update += this.FrameworkOnUpdate;
|
||||||
}
|
}
|
||||||
|
|
@ -111,11 +111,11 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
||||||
|
|
||||||
if (profile.IsEnabled)
|
if (profile.IsEnabled)
|
||||||
{
|
{
|
||||||
this.chat.Print(Loc.Localize("ProfileCommandsEnabling", "Enabling profile \"{0}\"...").Format(profile.Name));
|
this.chat.Print(Loc.Localize("ProfileCommandsEnabling", "Enabling collection \"{0}\"...").Format(profile.Name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.chat.Print(Loc.Localize("ProfileCommandsDisabling", "Disabling profile \"{0}\"...").Format(profile.Name));
|
this.chat.Print(Loc.Localize("ProfileCommandsDisabling", "Disabling collection \"{0}\"...").Format(profile.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.Run(() => this.profileManager.ApplyAllWantStates()).ContinueWith(t =>
|
Task.Run(() => this.profileManager.ApplyAllWantStates()).ContinueWith(t =>
|
||||||
|
|
@ -123,11 +123,11 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
||||||
if (!t.IsCompletedSuccessfully && t.Exception != null)
|
if (!t.IsCompletedSuccessfully && t.Exception != null)
|
||||||
{
|
{
|
||||||
Log.Error(t.Exception, "Could not apply profiles through commands");
|
Log.Error(t.Exception, "Could not apply profiles through commands");
|
||||||
this.chat.PrintError(Loc.Localize("ProfileCommandsApplyFailed", "Failed to apply all of your profiles. Please check the console for errors."));
|
this.chat.PrintError(Loc.Localize("ProfileCommandsApplyFailed", "Failed to apply your collections. Please check the console for errors."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.chat.Print(Loc.Localize("ProfileCommandsApplySuccess", "Profiles applied."));
|
this.chat.Print(Loc.Localize("ProfileCommandsApplySuccess", "Collections applied."));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ internal class ProfileCommandHandler : IServiceType, IDisposable
|
||||||
var name = arguments.Replace("\"", string.Empty);
|
var name = arguments.Replace("\"", string.Empty);
|
||||||
if (this.profileManager.Profiles.All(x => x.Name != name))
|
if (this.profileManager.Profiles.All(x => x.Name != name))
|
||||||
{
|
{
|
||||||
this.chat.PrintError($"No profile like \"{name}\".");
|
this.chat.PrintError($"No collection like \"{name}\".");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ internal class ProfileManager : IServiceType
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
newModel.Guid = Guid.NewGuid();
|
newModel.Guid = Guid.NewGuid();
|
||||||
newModel.Name = this.GenerateUniqueProfileName(newModel.Name.IsNullOrEmpty() ? "Unknown Profile" : newModel.Name);
|
newModel.Name = this.GenerateUniqueProfileName(newModel.Name.IsNullOrEmpty() ? "Unknown Collection" : newModel.Name);
|
||||||
if (newModel is ProfileModelV1 modelV1)
|
if (newModel is ProfileModelV1 modelV1)
|
||||||
modelV1.IsEnabled = false;
|
modelV1.IsEnabled = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public abstract class ProfileModel
|
||||||
if (model.StartsWith(ProfileModelV1.SerializedPrefix))
|
if (model.StartsWith(ProfileModelV1.SerializedPrefix))
|
||||||
return JsonConvert.DeserializeObject<ProfileModelV1>(json);
|
return JsonConvert.DeserializeObject<ProfileModelV1>(json);
|
||||||
|
|
||||||
throw new ArgumentException("Was not a compressed style model.");
|
throw new ArgumentException("Was not a compressed profile.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue