mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 15:27:43 +01:00
Add "startup behavior" to profiles
Choose between remember, always enable, always disable
This commit is contained in:
parent
08f959444b
commit
f4102db488
3 changed files with 115 additions and 41 deletions
|
|
@ -56,11 +56,11 @@ internal class ProfileManagerWidget
|
||||||
this.DrawChoice();
|
this.DrawChoice();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tutorialTitle = Locs.TutorialTitle + "###collectionsTutorWindow";
|
var tutorialTitle = Locs.TutorialTitle + "###collectionsTutorWindow";
|
||||||
var tutorialId = ImGui.GetID(tutorialTitle);
|
var tutorialId = ImGui.GetID(tutorialTitle);
|
||||||
this.DrawTutorial(tutorialTitle);
|
this.DrawTutorial(tutorialTitle);
|
||||||
|
|
||||||
switch (this.mode)
|
switch (this.mode)
|
||||||
{
|
{
|
||||||
case Mode.Overview:
|
case Mode.Overview:
|
||||||
|
|
@ -120,22 +120,22 @@ internal class ProfileManagerWidget
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphFour);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphFour);
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommands);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommands);
|
||||||
|
|
||||||
ImGui.Bullet();
|
ImGui.Bullet();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnable);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnable);
|
||||||
|
|
||||||
ImGui.Bullet();
|
ImGui.Bullet();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsDisable);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsDisable);
|
||||||
|
|
||||||
ImGui.Bullet();
|
ImGui.Bullet();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsToggle);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsToggle);
|
||||||
|
|
||||||
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnd);
|
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnd);
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
var buttonWidth = 120f;
|
var buttonWidth = 120f;
|
||||||
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);
|
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);
|
||||||
if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
|
if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
|
||||||
|
|
@ -186,14 +186,14 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(Locs.ImportProfileHint);
|
ImGui.SetTooltip(Locs.ImportProfileHint);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Question))
|
if (ImGuiComponents.IconButton(FontAwesomeIcon.Question))
|
||||||
ImGui.OpenPopup(tutorialId);
|
ImGui.OpenPopup(tutorialId);
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(Locs.TutorialHint);
|
ImGui.SetTooltip(Locs.TutorialHint);
|
||||||
|
|
||||||
|
|
@ -386,10 +386,19 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
var enableAtBoot = profile.AlwaysEnableAtBoot;
|
ImGui.TextUnformatted(Locs.StartupBehavior);
|
||||||
if (ImGui.Checkbox(Locs.AlwaysEnableAtBoot, ref enableAtBoot))
|
if (ImGui.BeginCombo("##startupBehaviorPicker", Locs.PolicyToLocalisedName(profile.StartupPolicy)))
|
||||||
{
|
{
|
||||||
profile.AlwaysEnableAtBoot = enableAtBoot;
|
foreach (var policy in Enum.GetValues(typeof(ProfileModelV1.ProfileStartupPolicy)).Cast<ProfileModelV1.ProfileStartupPolicy>())
|
||||||
|
{
|
||||||
|
var name = Locs.PolicyToLocalisedName(policy);
|
||||||
|
if (ImGui.Selectable(name, profile.StartupPolicy == policy))
|
||||||
|
{
|
||||||
|
profile.StartupPolicy = policy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
@ -425,7 +434,7 @@ internal class ProfileManagerWidget
|
||||||
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
var text = $"{pmPlugin.Name}{(pmPlugin.IsDev ? " (dev plugin" : string.Empty)}";
|
var text = $"{pmPlugin.Name}{(pmPlugin.IsDev ? " (dev plugin" : string.Empty)}";
|
||||||
|
|
@ -448,12 +457,12 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2));
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2));
|
||||||
ImGui.TextUnformatted(text);
|
ImGui.TextUnformatted(text);
|
||||||
|
|
||||||
var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == profileEntry.InternalName);
|
var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == profileEntry.InternalName);
|
||||||
var installable =
|
var installable =
|
||||||
pm.AvailablePlugins.FirstOrDefault(
|
pm.AvailablePlugins.FirstOrDefault(
|
||||||
x => x.InternalName == profileEntry.InternalName && !x.SourceRepo.IsThirdParty);
|
x => x.InternalName == profileEntry.InternalName && !x.SourceRepo.IsThirdParty);
|
||||||
|
|
||||||
if (firstAvailableInstalled != null)
|
if (firstAvailableInstalled != null)
|
||||||
{
|
{
|
||||||
ImGui.Text($"Match to plugin '{firstAvailableInstalled.Name}'?");
|
ImGui.Text($"Match to plugin '{firstAvailableInstalled.Name}'?");
|
||||||
|
|
@ -488,7 +497,7 @@ internal class ProfileManagerWidget
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(Locs.InstallPlugin);
|
ImGui.SetTooltip(Locs.InstallPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetCursorPos(before);
|
ImGui.SetCursorPos(before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -554,6 +563,9 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
private static class Locs
|
private static class Locs
|
||||||
{
|
{
|
||||||
|
public static string StartupBehavior =>
|
||||||
|
Loc.Localize("ProfileManagerStartupBehavior", "Startup behavior");
|
||||||
|
|
||||||
public static string TooltipEnableDisable =>
|
public static string TooltipEnableDisable =>
|
||||||
Loc.Localize("ProfileManagerEnableDisableHint", "Enable/Disable this collection");
|
Loc.Localize("ProfileManagerEnableDisableHint", "Enable/Disable this collection");
|
||||||
|
|
||||||
|
|
@ -567,9 +579,6 @@ internal class ProfileManagerWidget
|
||||||
public static string NoPluginsInProfile =>
|
public static string NoPluginsInProfile =>
|
||||||
Loc.Localize("ProfileManagerNoPluginsInProfile", "Collection has no plugins!");
|
Loc.Localize("ProfileManagerNoPluginsInProfile", "Collection has no plugins!");
|
||||||
|
|
||||||
public static string AlwaysEnableAtBoot =>
|
|
||||||
Loc.Localize("ProfileManagerAlwaysEnableAtBoot", "Always enable when game starts");
|
|
||||||
|
|
||||||
public static string DeleteProfileHint => Loc.Localize("ProfileManagerDeleteProfile", "Delete this collection");
|
public static string DeleteProfileHint => Loc.Localize("ProfileManagerDeleteProfile", "Delete this collection");
|
||||||
|
|
||||||
public static string CopyToClipboardHint =>
|
public static string CopyToClipboardHint =>
|
||||||
|
|
@ -608,13 +617,13 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
public static string TutorialTitle =>
|
public static string TutorialTitle =>
|
||||||
Loc.Localize("ProfileManagerTutorial", "About Collections");
|
Loc.Localize("ProfileManagerTutorial", "About Collections");
|
||||||
|
|
||||||
public static string TutorialParagraphOne =>
|
public static string TutorialParagraphOne =>
|
||||||
Loc.Localize("ProfileManagerTutorialParagraphOne", "Collections are shareable lists of plugins that can be enabled or disabled in the plugin installer or via chat commands.\nWhen a plugin is part of a collection, it will be enabled if the collection is enabled. If a plugin is part of multiple collections, it will be enabled if one or more collections it is a part of are enabled.");
|
Loc.Localize("ProfileManagerTutorialParagraphOne", "Collections are shareable lists of plugins that can be enabled or disabled in the plugin installer or via chat commands.\nWhen a plugin is part of a collection, it will be enabled if the collection is enabled. If a plugin is part of multiple collections, it will be enabled if one or more collections it is a part of are enabled.");
|
||||||
|
|
||||||
public static string TutorialParagraphTwo =>
|
public static string TutorialParagraphTwo =>
|
||||||
Loc.Localize("ProfileManagerTutorialParagraphTwo", "You can add plugins to collections by clicking the plus button when editing a collection on this screen, or by using the button with the toolbox icon on the \"Installed Plugins\" screen.");
|
Loc.Localize("ProfileManagerTutorialParagraphTwo", "You can add plugins to collections by clicking the plus button when editing a collection on this screen, or by using the button with the toolbox icon on the \"Installed Plugins\" screen.");
|
||||||
|
|
||||||
public static string TutorialParagraphThree =>
|
public static string TutorialParagraphThree =>
|
||||||
Loc.Localize("ProfileManagerTutorialParagraphThree", "If a collection's \"Start on boot\" checkbox is ticked, the collection and the plugins within will be enabled every time the game starts up, even if it has been manually disabled in a prior session.");
|
Loc.Localize("ProfileManagerTutorialParagraphThree", "If a collection's \"Start on boot\" checkbox is ticked, the collection and the plugins within will be enabled every time the game starts up, even if it has been manually disabled in a prior session.");
|
||||||
|
|
||||||
|
|
@ -623,29 +632,46 @@ internal class ProfileManagerWidget
|
||||||
|
|
||||||
public static string TutorialCommands =>
|
public static string TutorialCommands =>
|
||||||
Loc.Localize("ProfileManagerTutorialCommands", "You can use the following commands in chat or in macros to manage active collections:");
|
Loc.Localize("ProfileManagerTutorialCommands", "You can use the following commands in chat or in macros to manage active collections:");
|
||||||
|
|
||||||
public static string TutorialCommandsEnable =>
|
public static string TutorialCommandsEnable =>
|
||||||
Loc.Localize("ProfileManagerTutorialCommandsEnable", "{0} \"Collection Name\" - Enable a collection").Format(PluginManagementCommandHandler.CommandEnableProfile);
|
Loc.Localize("ProfileManagerTutorialCommandsEnable", "{0} \"Collection Name\" - Enable a collection").Format(PluginManagementCommandHandler.CommandEnableProfile);
|
||||||
|
|
||||||
public static string TutorialCommandsDisable =>
|
public static string TutorialCommandsDisable =>
|
||||||
Loc.Localize("ProfileManagerTutorialCommandsDisable", "{0} \"Collection Name\" - Disable a collection").Format(PluginManagementCommandHandler.CommandDisableProfile);
|
Loc.Localize("ProfileManagerTutorialCommandsDisable", "{0} \"Collection Name\" - Disable a collection").Format(PluginManagementCommandHandler.CommandDisableProfile);
|
||||||
|
|
||||||
public static string TutorialCommandsToggle =>
|
public static string TutorialCommandsToggle =>
|
||||||
Loc.Localize("ProfileManagerTutorialCommandsToggle", "{0} \"Collection Name\" - Toggle a collection's state").Format(PluginManagementCommandHandler.CommandToggleProfile);
|
Loc.Localize("ProfileManagerTutorialCommandsToggle", "{0} \"Collection Name\" - Toggle a collection's state").Format(PluginManagementCommandHandler.CommandToggleProfile);
|
||||||
|
|
||||||
public static string TutorialCommandsEnd =>
|
public static string TutorialCommandsEnd =>
|
||||||
Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order.");
|
Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order.");
|
||||||
|
|
||||||
public static string Choice1 =>
|
public static string Choice1 =>
|
||||||
Loc.Localize("ProfileManagerChoice1", "Plugin collections are a new feature that allow you to group plugins into collections which can be toggled and shared.");
|
Loc.Localize("ProfileManagerChoice1", "Plugin collections are a new feature that allow you to group plugins into collections which can be toggled and shared.");
|
||||||
|
|
||||||
public static string Choice2 =>
|
public static string Choice2 =>
|
||||||
Loc.Localize("ProfileManagerChoice2", "They are experimental and may still contain bugs. Do you want to enable them now?");
|
Loc.Localize("ProfileManagerChoice2", "They are experimental and may still contain bugs. Do you want to enable them now?");
|
||||||
|
|
||||||
public static string ChoiceConfirmation =>
|
public static string ChoiceConfirmation =>
|
||||||
Loc.Localize("ProfileManagerChoiceConfirmation", "Yes, enable Plugin Collections");
|
Loc.Localize("ProfileManagerChoiceConfirmation", "Yes, enable Plugin Collections");
|
||||||
|
|
||||||
public static string NotInstalled(string name) =>
|
public static string NotInstalled(string name) =>
|
||||||
Loc.Localize("ProfileManagerNotInstalled", "{0} (Not Installed)").Format(name);
|
Loc.Localize("ProfileManagerNotInstalled", "{0} (Not Installed)").Format(name);
|
||||||
|
|
||||||
|
public static string PolicyToLocalisedName(ProfileModelV1.ProfileStartupPolicy policy)
|
||||||
|
{
|
||||||
|
return policy switch
|
||||||
|
{
|
||||||
|
ProfileModelV1.ProfileStartupPolicy.RememberState => Loc.Localize(
|
||||||
|
"ProfileManagerRememberState",
|
||||||
|
"Remember state"),
|
||||||
|
ProfileModelV1.ProfileStartupPolicy.AlwaysEnable => Loc.Localize(
|
||||||
|
"ProfileManagerAlwaysEnableAtBoot",
|
||||||
|
"Always enable at boot"),
|
||||||
|
ProfileModelV1.ProfileStartupPolicy.AlwaysDisable => Loc.Localize(
|
||||||
|
"ProfileManagerAlwaysDisableAtBoot",
|
||||||
|
"Always disable at boot"),
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(policy), policy, null),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,18 @@ internal class Profile
|
||||||
this.modelV1 = model as ProfileModelV1 ??
|
this.modelV1 = model as ProfileModelV1 ??
|
||||||
throw new ArgumentException("Model was null or unhandled version");
|
throw new ArgumentException("Model was null or unhandled version");
|
||||||
|
|
||||||
|
// Migrate "policy"
|
||||||
|
if (this.modelV1.StartupPolicy == null)
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0618
|
||||||
|
this.modelV1.StartupPolicy = this.modelV1.AlwaysEnableOnBoot
|
||||||
|
? ProfileModelV1.ProfileStartupPolicy.AlwaysEnable
|
||||||
|
: ProfileModelV1.ProfileStartupPolicy.RememberState;
|
||||||
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
|
Service<DalamudConfiguration>.Get().QueueSave();
|
||||||
|
}
|
||||||
|
|
||||||
// We don't actually enable plugins here, PM will do it on bootup
|
// We don't actually enable plugins here, PM will do it on bootup
|
||||||
if (isDefaultProfile)
|
if (isDefaultProfile)
|
||||||
{
|
{
|
||||||
|
|
@ -40,10 +52,18 @@ internal class Profile
|
||||||
this.IsEnabled = this.modelV1.IsEnabled = true;
|
this.IsEnabled = this.modelV1.IsEnabled = true;
|
||||||
this.Name = this.modelV1.Name = "DEFAULT";
|
this.Name = this.modelV1.Name = "DEFAULT";
|
||||||
}
|
}
|
||||||
else if (this.modelV1.AlwaysEnableOnBoot && isBoot)
|
else if (isBoot)
|
||||||
{
|
{
|
||||||
this.IsEnabled = true;
|
if (this.modelV1.StartupPolicy == ProfileModelV1.ProfileStartupPolicy.AlwaysEnable)
|
||||||
Log.Verbose("{Guid} set enabled because bootup", this.modelV1.Guid);
|
{
|
||||||
|
this.IsEnabled = true;
|
||||||
|
Log.Verbose("{Guid} set enabled because always enable", this.modelV1.Guid);
|
||||||
|
}
|
||||||
|
else if (this.modelV1.StartupPolicy == ProfileModelV1.ProfileStartupPolicy.AlwaysDisable)
|
||||||
|
{
|
||||||
|
this.IsEnabled = false;
|
||||||
|
Log.Verbose("{Guid} set disabled because always disable", this.modelV1.Guid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (this.modelV1.IsEnabled)
|
else if (this.modelV1.IsEnabled)
|
||||||
{
|
{
|
||||||
|
|
@ -72,12 +92,12 @@ internal class Profile
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this profile shall always be enabled at boot.
|
/// Gets or sets a value indicating whether this profile shall always be enabled at boot.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AlwaysEnableAtBoot
|
public ProfileModelV1.ProfileStartupPolicy StartupPolicy
|
||||||
{
|
{
|
||||||
get => this.modelV1.AlwaysEnableOnBoot;
|
get => this.modelV1.StartupPolicy ?? ProfileModelV1.ProfileStartupPolicy.RememberState;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
this.modelV1.AlwaysEnableOnBoot = value;
|
this.modelV1.StartupPolicy = value;
|
||||||
Service<DalamudConfiguration>.Get().QueueSave();
|
Service<DalamudConfiguration>.Get().QueueSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +184,7 @@ internal class Profile
|
||||||
public async Task AddOrUpdateAsync(Guid workingPluginId, string? internalName, bool state, bool apply = true)
|
public async Task AddOrUpdateAsync(Guid workingPluginId, string? internalName, bool state, bool apply = true)
|
||||||
{
|
{
|
||||||
Debug.Assert(workingPluginId != Guid.Empty, "Trying to add plugin with empty guid");
|
Debug.Assert(workingPluginId != Guid.Empty, "Trying to add plugin with empty guid");
|
||||||
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
var existing = this.modelV1.Plugins.FirstOrDefault(x => x.WorkingPluginId == workingPluginId);
|
var existing = this.modelV1.Plugins.FirstOrDefault(x => x.WorkingPluginId == workingPluginId);
|
||||||
|
|
@ -182,9 +202,9 @@ internal class Profile
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Information("Adding plugin {Plugin}({Guid}) to profile {Profile} with state {State}", internalName, workingPluginId, this.Guid, state);
|
Log.Information("Adding plugin {Plugin}({Guid}) to profile {Profile} with state {State}", internalName, workingPluginId, this.Guid, state);
|
||||||
|
|
||||||
// We need to remove this plugin from the default profile, if it declares it.
|
// We need to remove this plugin from the default profile, if it declares it.
|
||||||
if (!this.IsDefaultProfile && this.manager.DefaultProfile.WantsPlugin(workingPluginId) != null)
|
if (!this.IsDefaultProfile && this.manager.DefaultProfile.WantsPlugin(workingPluginId) != null)
|
||||||
{
|
{
|
||||||
|
|
@ -221,7 +241,7 @@ internal class Profile
|
||||||
if (!this.modelV1.Plugins.Remove(entry))
|
if (!this.modelV1.Plugins.Remove(entry))
|
||||||
throw new Exception("Couldn't remove plugin from model collection");
|
throw new Exception("Couldn't remove plugin from model collection");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Information("Removing plugin {Plugin}({Guid}) from profile {Profile}", entry.InternalName, entry.WorkingPluginId, this.Guid);
|
Log.Information("Removing plugin {Plugin}({Guid}) from profile {Profile}", entry.InternalName, entry.WorkingPluginId, this.Guid);
|
||||||
|
|
||||||
// We need to add this plugin back to the default profile, if we were the last profile to have it.
|
// We need to add this plugin back to the default profile, if we were the last profile to have it.
|
||||||
|
|
@ -260,7 +280,7 @@ internal class Profile
|
||||||
// TODO: What should happen if a profile has a GUID locked in, but the plugin
|
// TODO: What should happen if a profile has a GUID locked in, but the plugin
|
||||||
// is not installed anymore? That probably means that the user uninstalled the plugin
|
// is not installed anymore? That probably means that the user uninstalled the plugin
|
||||||
// and is now reinstalling it. We should still satisfy that and update the ID.
|
// and is now reinstalling it. We should still satisfy that and update the ID.
|
||||||
|
|
||||||
if (plugin.InternalName == internalName && plugin.WorkingPluginId == Guid.Empty)
|
if (plugin.InternalName == internalName && plugin.WorkingPluginId == Guid.Empty)
|
||||||
{
|
{
|
||||||
plugin.WorkingPluginId = newGuid;
|
plugin.WorkingPluginId = newGuid;
|
||||||
|
|
@ -268,7 +288,7 @@ internal class Profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Service<DalamudConfiguration>.Get().QueueSave();
|
Service<DalamudConfiguration>.Get().QueueSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -319,7 +339,7 @@ internal sealed class PluginNotFoundException : ProfileOperationException
|
||||||
: base($"The plugin '{internalName}' was not found in the profile")
|
: base($"The plugin '{internalName}' was not found in the profile")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginNotFoundException"/> class.
|
/// Initializes a new instance of the <see cref="PluginNotFoundException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,27 @@ namespace Dalamud.Plugin.Internal.Profiles;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProfileModelV1 : ProfileModel
|
public class ProfileModelV1 : ProfileModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Enum representing the startup policy of a profile.
|
||||||
|
/// </summary>
|
||||||
|
public enum ProfileStartupPolicy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Remember the last state of the profile.
|
||||||
|
/// </summary>
|
||||||
|
RememberState,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Always enable the profile.
|
||||||
|
/// </summary>
|
||||||
|
AlwaysEnable,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Always disable the profile.
|
||||||
|
/// </summary>
|
||||||
|
AlwaysDisable,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the prefix of this version.
|
/// Gets the prefix of this version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -18,8 +39,15 @@ public class ProfileModelV1 : ProfileModel
|
||||||
/// Gets or sets a value indicating whether or not this profile should always be enabled at boot.
|
/// Gets or sets a value indicating whether or not this profile should always be enabled at boot.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("b")]
|
[JsonProperty("b")]
|
||||||
|
[Obsolete("Superseded by StartupPolicy")]
|
||||||
public bool AlwaysEnableOnBoot { get; set; } = false;
|
public bool AlwaysEnableOnBoot { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the policy to use when Dalamud is loading.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("p")]
|
||||||
|
public ProfileStartupPolicy? StartupPolicy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether or not this profile is currently enabled.
|
/// Gets or sets a value indicating whether or not this profile is currently enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -46,7 +74,7 @@ public class ProfileModelV1 : ProfileModel
|
||||||
/// Gets or sets the internal name of the plugin.
|
/// Gets or sets the internal name of the plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? InternalName { get; set; }
|
public string? InternalName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an ID uniquely identifying this specific instance of a plugin.
|
/// Gets or sets an ID uniquely identifying this specific instance of a plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue