Add code to save dalamud's window options (pinned/clickthrough/alpha)

This commit is contained in:
Liza 2024-05-11 14:02:25 +02:00
parent 1a72a2dbe0
commit 3e750c3d15
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 15 additions and 3 deletions

2
LLib

@ -1 +1 @@
Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Dalamud.Configuration; using Dalamud.Configuration;
using LLib.ImGui;
using Workshoppa.GameData; using Workshoppa.GameData;
namespace Workshoppa; namespace Workshoppa;
@ -16,6 +17,9 @@ internal sealed class Configuration : IPluginConfiguration
public bool EnableCeruleumTankCalculator { get; set; } = true; public bool EnableCeruleumTankCalculator { get; set; } = true;
public List<Preset> Presets { get; set; } = new(); public List<Preset> Presets { get; set; } = new();
public WindowConfig MainWindowConfig { get; } = new();
public WindowConfig ConfigWindowConfig { get; } = new();
internal sealed class QueuedItem internal sealed class QueuedItem
{ {
public uint WorkshopItemId { get; set; } public uint WorkshopItemId { get; set; }

View File

@ -5,7 +5,7 @@ using LLib.ImGui;
namespace Workshoppa.Windows; namespace Workshoppa.Windows;
internal sealed class ConfigWindow : LWindow internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
{ {
private readonly DalamudPluginInterface _pluginInterface; private readonly DalamudPluginInterface _pluginInterface;
private readonly Configuration _configuration; private readonly Configuration _configuration;
@ -27,6 +27,8 @@ internal sealed class ConfigWindow : LWindow
}; };
} }
public WindowConfig WindowConfig => _configuration.ConfigWindowConfig;
public override void Draw() public override void Draw()
{ {
bool enableRepairKitCalculator = _configuration.EnableRepairKitCalculator; bool enableRepairKitCalculator = _configuration.EnableRepairKitCalculator;
@ -43,4 +45,6 @@ internal sealed class ConfigWindow : LWindow
_pluginInterface.SavePluginConfig(_configuration); _pluginInterface.SavePluginConfig(_configuration);
} }
} }
public void SaveWindowConfig() => _pluginInterface.SavePluginConfig(_configuration);
} }

View File

@ -19,7 +19,7 @@ using Workshoppa.GameData;
namespace Workshoppa.Windows; namespace Workshoppa.Windows;
// FIXME The close button doesn't work near the workshop, either hide it or make it work // FIXME The close button doesn't work near the workshop, either hide it or make it work
internal sealed class MainWindow : LWindow internal sealed class MainWindow : LWindow, IPersistableWindowConfig
{ {
private static readonly Regex CountAndName = new(@"^(\d{1,5})x?\s+(.*)$", RegexOptions.Compiled); private static readonly Regex CountAndName = new(@"^(\d{1,5})x?\s+(.*)$", RegexOptions.Compiled);
@ -72,6 +72,8 @@ internal sealed class MainWindow : LWindow
private bool IsDiscipleOfHand => private bool IsDiscipleOfHand =>
_clientState.LocalPlayer != null && _clientState.LocalPlayer.ClassJob.Id is >= 8 and <= 15; _clientState.LocalPlayer != null && _clientState.LocalPlayer.ClassJob.Id is >= 8 and <= 15;
public WindowConfig WindowConfig => _configuration.MainWindowConfig;
public override void Draw() public override void Draw()
{ {
if (ImGui.BeginMenuBar()) if (ImGui.BeginMenuBar())
@ -617,6 +619,8 @@ internal sealed class MainWindow : LWindow
ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting."); ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting.");
} }
public void SaveWindowConfig() => Save();
public enum ButtonState public enum ButtonState
{ {
None, None,