mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Add Ephemeral Config.
This commit is contained in:
parent
9c8e9f5ead
commit
b4b104f919
15 changed files with 202 additions and 85 deletions
|
|
@ -19,12 +19,13 @@ namespace Glamourer;
|
||||||
|
|
||||||
public class Configuration : IPluginConfiguration, ISavable
|
public class Configuration : IPluginConfiguration, ISavable
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public readonly EphemeralConfig Ephemeral;
|
||||||
|
|
||||||
public bool UseRestrictedGearProtection { get; set; } = false;
|
public bool UseRestrictedGearProtection { get; set; } = false;
|
||||||
public bool OpenFoldersByDefault { get; set; } = false;
|
public bool OpenFoldersByDefault { get; set; } = false;
|
||||||
public bool AutoRedrawEquipOnChanges { get; set; } = false;
|
public bool AutoRedrawEquipOnChanges { get; set; } = false;
|
||||||
public bool EnableAutoDesigns { get; set; } = true;
|
public bool EnableAutoDesigns { get; set; } = true;
|
||||||
public bool IncognitoMode { get; set; } = false;
|
|
||||||
public bool UnlockDetailMode { get; set; } = true;
|
|
||||||
public bool HideApplyCheckmarks { get; set; } = false;
|
public bool HideApplyCheckmarks { get; set; } = false;
|
||||||
public bool SmallEquip { get; set; } = false;
|
public bool SmallEquip { get; set; } = false;
|
||||||
public bool UnlockedItemMode { get; set; } = false;
|
public bool UnlockedItemMode { get; set; } = false;
|
||||||
|
|
@ -35,24 +36,17 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
public bool ShowAllAutomatedApplicationRules { get; set; } = true;
|
public bool ShowAllAutomatedApplicationRules { get; set; } = true;
|
||||||
public bool ShowUnlockedItemWarnings { get; set; } = true;
|
public bool ShowUnlockedItemWarnings { get; set; } = true;
|
||||||
public bool RevertManualChangesOnZoneChange { get; set; } = false;
|
public bool RevertManualChangesOnZoneChange { get; set; } = false;
|
||||||
public bool ShowDesignQuickBar { get; set; } = false;
|
|
||||||
public bool LockDesignQuickBar { get; set; } = false;
|
|
||||||
public bool ShowQuickBarInTabs { get; set; } = true;
|
public bool ShowQuickBarInTabs { get; set; } = true;
|
||||||
public bool LockMainWindow { get; set; } = false;
|
|
||||||
public bool OpenWindowAtStart { get; set; } = false;
|
public bool OpenWindowAtStart { get; set; } = false;
|
||||||
|
|
||||||
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
|
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
|
||||||
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
|
|
||||||
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||||
|
|
||||||
public int LastSeenVersion { get; set; } = GlamourerChangelog.LastChangelogVersion;
|
|
||||||
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
|
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
|
||||||
|
|
||||||
[JsonConverter(typeof(SortModeConverter))]
|
[JsonConverter(typeof(SortModeConverter))]
|
||||||
[JsonProperty(Order = int.MaxValue)]
|
[JsonProperty(Order = int.MaxValue)]
|
||||||
public ISortMode<Design> SortMode { get; set; } = ISortMode<Design>.FoldersFirst;
|
public ISortMode<Design> SortMode { get; set; } = ISortMode<Design>.FoldersFirst;
|
||||||
|
|
||||||
public List<(string Code, bool Enabled)> Codes { get; set; } = new();
|
public List<(string Code, bool Enabled)> Codes { get; set; } = [];
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public bool DebugMode { get; set; } = true;
|
public bool DebugMode { get; set; } = true;
|
||||||
|
|
@ -68,9 +62,10 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private readonly SaveService _saveService;
|
private readonly SaveService _saveService;
|
||||||
|
|
||||||
public Configuration(SaveService saveService, ConfigMigrationService migrator)
|
public Configuration(SaveService saveService, ConfigMigrationService migrator, EphemeralConfig ephemeral)
|
||||||
{
|
{
|
||||||
_saveService = saveService;
|
_saveService = saveService;
|
||||||
|
Ephemeral = ephemeral;
|
||||||
Load(migrator);
|
Load(migrator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +115,7 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
|
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
public const int CurrentVersion = 4;
|
public const int CurrentVersion = 5;
|
||||||
|
|
||||||
public static readonly ISortMode<Design>[] ValidSortModes =
|
public static readonly ISortMode<Design>[] ValidSortModes =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
73
Glamourer/EphemeralConfig.cs
Normal file
73
Glamourer/EphemeralConfig.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
|
using Glamourer.Gui;
|
||||||
|
using Glamourer.Services;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using OtterGui.Classes;
|
||||||
|
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||||
|
|
||||||
|
namespace Glamourer;
|
||||||
|
|
||||||
|
public class EphemeralConfig : ISavable
|
||||||
|
{
|
||||||
|
public int Version { get; set; } = Configuration.Constants.CurrentVersion;
|
||||||
|
public bool IncognitoMode { get; set; } = false;
|
||||||
|
public bool UnlockDetailMode { get; set; } = true;
|
||||||
|
public bool ShowDesignQuickBar { get; set; } = false;
|
||||||
|
public bool LockDesignQuickBar { get; set; } = false;
|
||||||
|
public bool LockMainWindow { get; set; } = false;
|
||||||
|
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
|
||||||
|
public int LastSeenVersion { get; set; } = GlamourerChangelog.LastChangelogVersion;
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
private readonly SaveService _saveService;
|
||||||
|
|
||||||
|
public EphemeralConfig(SaveService saveService)
|
||||||
|
{
|
||||||
|
_saveService = saveService;
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
=> _saveService.DelaySave(this, TimeSpan.FromSeconds(5));
|
||||||
|
|
||||||
|
public void Load()
|
||||||
|
{
|
||||||
|
static void HandleDeserializationError(object? sender, ErrorEventArgs errorArgs)
|
||||||
|
{
|
||||||
|
Glamourer.Log.Error(
|
||||||
|
$"Error parsing ephemeral Configuration at {errorArgs.ErrorContext.Path}, using default or migrating:\n{errorArgs.ErrorContext.Error}");
|
||||||
|
errorArgs.ErrorContext.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(_saveService.FileNames.EphemeralConfigFile))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var text = File.ReadAllText(_saveService.FileNames.EphemeralConfigFile);
|
||||||
|
JsonConvert.PopulateObject(text, this, new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
Error = HandleDeserializationError,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Glamourer.Messager.NotificationMessage(ex,
|
||||||
|
"Error reading ephemeral Configuration, reverting to default.",
|
||||||
|
"Error reading ephemeral Configuration", NotificationType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ToFilename(FilenameService fileNames)
|
||||||
|
=> fileNames.EphemeralConfigFile;
|
||||||
|
|
||||||
|
public void Save(StreamWriter writer)
|
||||||
|
{
|
||||||
|
using var jWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
||||||
|
var serializer = new JsonSerializer { Formatting = Formatting.Indented };
|
||||||
|
serializer.Serialize(jWriter, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Glamourer.Gui;
|
||||||
|
|
||||||
public abstract class DesignComboBase : FilterComboCache<Tuple<Design, string>>, IDisposable
|
public abstract class DesignComboBase : FilterComboCache<Tuple<Design, string>>, IDisposable
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly EphemeralConfig _config;
|
||||||
private readonly DesignChanged _designChanged;
|
private readonly DesignChanged _designChanged;
|
||||||
private readonly DesignColors _designColors;
|
private readonly DesignColors _designColors;
|
||||||
protected readonly TabSelected TabSelected;
|
protected readonly TabSelected TabSelected;
|
||||||
|
|
@ -26,7 +26,7 @@ public abstract class DesignComboBase : FilterComboCache<Tuple<Design, string>>,
|
||||||
private Design? _currentDesign;
|
private Design? _currentDesign;
|
||||||
|
|
||||||
protected DesignComboBase(Func<IReadOnlyList<Tuple<Design, string>>> generator, Logger log, DesignChanged designChanged,
|
protected DesignComboBase(Func<IReadOnlyList<Tuple<Design, string>>> generator, Logger log, DesignChanged designChanged,
|
||||||
TabSelected tabSelected, Configuration config, DesignColors designColors)
|
TabSelected tabSelected, EphemeralConfig config, DesignColors designColors)
|
||||||
: base(generator, log)
|
: base(generator, log)
|
||||||
{
|
{
|
||||||
_designChanged = designChanged;
|
_designChanged = designChanged;
|
||||||
|
|
@ -136,7 +136,7 @@ public sealed class DesignCombo : DesignComboBase
|
||||||
private readonly DesignManager _manager;
|
private readonly DesignManager _manager;
|
||||||
|
|
||||||
public DesignCombo(DesignManager designs, DesignFileSystem fileSystem, Logger log, DesignChanged designChanged, TabSelected tabSelected,
|
public DesignCombo(DesignManager designs, DesignFileSystem fileSystem, Logger log, DesignChanged designChanged, TabSelected tabSelected,
|
||||||
Configuration config, DesignColors designColors)
|
EphemeralConfig config, DesignColors designColors)
|
||||||
: base(() => designs.Designs
|
: base(() => designs.Designs
|
||||||
.Select(d => new Tuple<Design, string>(d, fileSystem.FindLeaf(d, out var l) ? l.FullName() : string.Empty))
|
.Select(d => new Tuple<Design, string>(d, fileSystem.FindLeaf(d, out var l) ? l.FullName() : string.Empty))
|
||||||
.OrderBy(d => d.Item2)
|
.OrderBy(d => d.Item2)
|
||||||
|
|
@ -180,12 +180,13 @@ public sealed class RevertDesignCombo : DesignComboBase, IDisposable
|
||||||
|
|
||||||
public RevertDesignCombo(DesignManager designs, DesignFileSystem fileSystem, TabSelected tabSelected, DesignColors designColors,
|
public RevertDesignCombo(DesignManager designs, DesignFileSystem fileSystem, TabSelected tabSelected, DesignColors designColors,
|
||||||
ItemManager items, CustomizationService customize, Logger log, DesignChanged designChanged, AutoDesignManager autoDesignManager,
|
ItemManager items, CustomizationService customize, Logger log, DesignChanged designChanged, AutoDesignManager autoDesignManager,
|
||||||
Configuration config)
|
EphemeralConfig config)
|
||||||
: this(designs, fileSystem, tabSelected, designColors, CreateRevertDesign(customize, items), log, designChanged, autoDesignManager, config)
|
: this(designs, fileSystem, tabSelected, designColors, CreateRevertDesign(customize, items), log, designChanged, autoDesignManager,
|
||||||
|
config)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
private RevertDesignCombo(DesignManager designs, DesignFileSystem fileSystem, TabSelected tabSelected, DesignColors designColors,
|
private RevertDesignCombo(DesignManager designs, DesignFileSystem fileSystem, TabSelected tabSelected, DesignColors designColors,
|
||||||
Design revertDesign, Logger log, DesignChanged designChanged, AutoDesignManager autoDesignManager, Configuration config)
|
Design revertDesign, Logger log, DesignChanged designChanged, AutoDesignManager autoDesignManager, EphemeralConfig config)
|
||||||
: base(() => designs.Designs
|
: base(() => designs.Designs
|
||||||
.Select(d => new Tuple<Design, string>(d, fileSystem.FindLeaf(d, out var l) ? l.FullName() : string.Empty))
|
.Select(d => new Tuple<Design, string>(d, fileSystem.FindLeaf(d, out var l) ? l.FullName() : string.Empty))
|
||||||
.OrderBy(d => d.Item2)
|
.OrderBy(d => d.Item2)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Glamourer.Gui;
|
||||||
public class DesignQuickBar : Window, IDisposable
|
public class DesignQuickBar : Window, IDisposable
|
||||||
{
|
{
|
||||||
private ImGuiWindowFlags GetFlags
|
private ImGuiWindowFlags GetFlags
|
||||||
=> _config.LockDesignQuickBar
|
=> _config.Ephemeral.LockDesignQuickBar
|
||||||
? ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoMove
|
? ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoMove
|
||||||
: ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing;
|
: ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing;
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class DesignQuickBar : Window, IDisposable
|
||||||
_keyState = keyState;
|
_keyState = keyState;
|
||||||
_objects = objects;
|
_objects = objects;
|
||||||
_autoDesignApplier = autoDesignApplier;
|
_autoDesignApplier = autoDesignApplier;
|
||||||
IsOpen = _config.ShowDesignQuickBar;
|
IsOpen = _config.Ephemeral.ShowDesignQuickBar;
|
||||||
DisableWindowSounds = true;
|
DisableWindowSounds = true;
|
||||||
Size = Vector2.Zero;
|
Size = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public class DesignQuickBar : Window, IDisposable
|
||||||
public override void PreOpenCheck()
|
public override void PreOpenCheck()
|
||||||
{
|
{
|
||||||
CheckHotkeys();
|
CheckHotkeys();
|
||||||
IsOpen = _config.ShowDesignQuickBar;
|
IsOpen = _config.Ephemeral.ShowDesignQuickBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PreDraw()
|
public override void PreDraw()
|
||||||
|
|
@ -133,7 +133,7 @@ public class DesignQuickBar : Window, IDisposable
|
||||||
if (_playerIdentifier.IsValid && _playerData.Valid)
|
if (_playerIdentifier.IsValid && _playerData.Valid)
|
||||||
{
|
{
|
||||||
available |= 1;
|
available |= 1;
|
||||||
tooltip = $"Left-Click: Apply {(_config.IncognitoMode ? design.Incognito : design.Name)} to yourself.";
|
tooltip = $"Left-Click: Apply {(_config.Ephemeral.IncognitoMode ? design.Incognito : design.Name)} to yourself.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_targetIdentifier.IsValid && _targetData.Valid)
|
if (_targetIdentifier.IsValid && _targetData.Valid)
|
||||||
|
|
@ -141,7 +141,7 @@ public class DesignQuickBar : Window, IDisposable
|
||||||
if (available != 0)
|
if (available != 0)
|
||||||
tooltip += '\n';
|
tooltip += '\n';
|
||||||
available |= 2;
|
available |= 2;
|
||||||
tooltip += $"Right-Click: Apply {(_config.IncognitoMode ? design.Incognito : design.Name)} to {_targetIdentifier}.";
|
tooltip += $"Right-Click: Apply {(_config.Ephemeral.IncognitoMode ? design.Incognito : design.Name)} to {_targetIdentifier}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (available == 0)
|
if (available == 0)
|
||||||
|
|
@ -249,8 +249,8 @@ public class DesignQuickBar : Window, IDisposable
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_keyboardToggle = DateTime.UtcNow.AddMilliseconds(500);
|
_keyboardToggle = DateTime.UtcNow.AddMilliseconds(500);
|
||||||
_config.ShowDesignQuickBar = !_config.ShowDesignQuickBar;
|
_config.Ephemeral.ShowDesignQuickBar = !_config.Ephemeral.ShowDesignQuickBar;
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckKeyState(ModifiableHotkey key, bool noKey)
|
public bool CheckKeyState(ModifiableHotkey key, bool noKey)
|
||||||
|
|
|
||||||
|
|
@ -26,24 +26,36 @@ public class GlamourerChangelog
|
||||||
}
|
}
|
||||||
|
|
||||||
private (int, ChangeLogDisplayType) ConfigData()
|
private (int, ChangeLogDisplayType) ConfigData()
|
||||||
=> (_config.LastSeenVersion, _config.ChangeLogDisplayType);
|
=> (_config.Ephemeral.LastSeenVersion, _config.ChangeLogDisplayType);
|
||||||
|
|
||||||
private void Save(int version, ChangeLogDisplayType type)
|
private void Save(int version, ChangeLogDisplayType type)
|
||||||
{
|
{
|
||||||
_config.LastSeenVersion = version;
|
if (_config.Ephemeral.LastSeenVersion != version)
|
||||||
|
{
|
||||||
|
_config.Ephemeral.LastSeenVersion = version;
|
||||||
|
_config.Ephemeral.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_config.ChangeLogDisplayType != type)
|
||||||
|
{
|
||||||
_config.ChangeLogDisplayType = type;
|
_config.ChangeLogDisplayType = type;
|
||||||
_config.Save();
|
_config.Save();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void Add1_0_5_0(Changelog log)
|
private static void Add1_0_5_0(Changelog log)
|
||||||
=> log.NextVersion("Version 1.0.5.0")
|
=> log.NextVersion("Version 1.0.5.0")
|
||||||
.RegisterHighlight("Dyes are can now be favorited the same way equipment pieces can.")
|
.RegisterHighlight("Dyes are can now be favorited the same way equipment pieces can.")
|
||||||
.RegisterHighlight("The quick design bar combo can now be scrolled through via mousewheel when hovering over the combo without opening it.")
|
.RegisterHighlight(
|
||||||
.RegisterEntry("Control-Rightclicking the quick design bar now not only jumps to the corresponding design, but also opens the main window if it is not currently open.")
|
"The quick design bar combo can now be scrolled through via mousewheel when hovering over the combo without opening it.")
|
||||||
|
.RegisterEntry(
|
||||||
|
"Control-Rightclicking the quick design bar now not only jumps to the corresponding design, but also opens the main window if it is not currently open.")
|
||||||
.RegisterHighlight("You can now filter for designs containing specific items by using \"i:partial item name\".")
|
.RegisterHighlight("You can now filter for designs containing specific items by using \"i:partial item name\".")
|
||||||
.RegisterEntry("When overwriting a saved designs data entirely from clipboard, you can now undo this change and restore the prior design data once via a button top-left.")
|
.RegisterEntry(
|
||||||
|
"When overwriting a saved designs data entirely from clipboard, you can now undo this change and restore the prior design data once via a button top-left.")
|
||||||
.RegisterEntry("Removed the \"Enabled\" checkbox in the settings since it was barely doing anything but breaking Glamourer.")
|
.RegisterEntry("Removed the \"Enabled\" checkbox in the settings since it was barely doing anything but breaking Glamourer.")
|
||||||
.RegisterEntry("If you want to disable Glamourers state-tracking and hooking, you will need to disable the entire Plugin via Dalamud now.", 1)
|
.RegisterEntry(
|
||||||
|
"If you want to disable Glamourers state-tracking and hooking, you will need to disable the entire Plugin via Dalamud now.", 1)
|
||||||
.RegisterEntry("Added a reference to \"/glamour\" in the \"/glamourer help\" section.")
|
.RegisterEntry("Added a reference to \"/glamour\" in the \"/glamourer help\" section.")
|
||||||
.RegisterEntry("Updated BNPC Data with new crowd-sourced data from the gubal library.")
|
.RegisterEntry("Updated BNPC Data with new crowd-sourced data from the gubal library.")
|
||||||
.RegisterEntry("Fixed an issue with the quick design bar when no designs are saved.")
|
.RegisterEntry("Fixed an issue with the quick design bar when no designs are saved.")
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class MainWindow : Window, IDisposable
|
||||||
|
|
||||||
public override void PreDraw()
|
public override void PreDraw()
|
||||||
{
|
{
|
||||||
Flags = _config.LockMainWindow
|
Flags = _config.Ephemeral.LockMainWindow
|
||||||
? Flags | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize
|
? Flags | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize
|
||||||
: Flags & ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
|
: Flags & ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
|
||||||
}
|
}
|
||||||
|
|
@ -95,8 +95,8 @@ public class MainWindow : Window, IDisposable
|
||||||
if (TabBar.Draw("##tabs", ImGuiTabBarFlags.None, ToLabel(SelectTab), out var currentTab, () => { }, _tabs))
|
if (TabBar.Draw("##tabs", ImGuiTabBarFlags.None, ToLabel(SelectTab), out var currentTab, () => { }, _tabs))
|
||||||
{
|
{
|
||||||
SelectTab = TabType.None;
|
SelectTab = TabType.None;
|
||||||
_config.SelectedTab = FromLabel(currentTab);
|
_config.Ephemeral.SelectedTab = FromLabel(currentTab);
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.ShowQuickBarInTabs)
|
if (_config.ShowQuickBarInTabs)
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ namespace Glamourer.Gui.Tabs.ActorTab;
|
||||||
|
|
||||||
public class ActorSelector
|
public class ActorSelector
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly EphemeralConfig _config;
|
||||||
private readonly ObjectManager _objects;
|
private readonly ObjectManager _objects;
|
||||||
private readonly ActorService _actors;
|
private readonly ActorService _actors;
|
||||||
|
|
||||||
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
||||||
|
|
||||||
public ActorSelector(ObjectManager objects, ActorService actors, Configuration config)
|
public ActorSelector(ObjectManager objects, ActorService actors, EphemeralConfig config)
|
||||||
{
|
{
|
||||||
_objects = objects;
|
_objects = objects;
|
||||||
_actors = actors;
|
_actors = actors;
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@ public class SetSelector : IDisposable
|
||||||
|
|
||||||
public bool IncognitoMode
|
public bool IncognitoMode
|
||||||
{
|
{
|
||||||
get => _config.IncognitoMode;
|
get => _config.Ephemeral.IncognitoMode;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_config.IncognitoMode = value;
|
_config.Ephemeral.IncognitoMode = value;
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using Dalamud.Interface.Internal.Notifications;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
using Glamourer.Events;
|
using Glamourer.Events;
|
||||||
using Glamourer.Services;
|
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
|
@ -32,11 +31,11 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
||||||
|
|
||||||
public bool IncognitoMode
|
public bool IncognitoMode
|
||||||
{
|
{
|
||||||
get => _config.IncognitoMode;
|
get => _config.Ephemeral.IncognitoMode;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_config.IncognitoMode = value;
|
_config.Ephemeral.IncognitoMode = value;
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,11 @@ public class SettingsTab : ITab
|
||||||
if (!ImGui.CollapsingHeader("Interface"))
|
if (!ImGui.CollapsingHeader("Interface"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Checkbox("Show Quick Design Bar",
|
EphemeralCheckbox("Show Quick Design Bar",
|
||||||
"Show a bar separate from the main window that allows you to quickly apply designs or revert your character and target.",
|
"Show a bar separate from the main window that allows you to quickly apply designs or revert your character and target.",
|
||||||
_config.ShowDesignQuickBar, v => _config.ShowDesignQuickBar = v);
|
_config.Ephemeral.ShowDesignQuickBar, v => _config.Ephemeral.ShowDesignQuickBar = v);
|
||||||
Checkbox("Lock Quick Design Bar", "Prevent the quick design bar from being moved and lock it in place.", _config.LockDesignQuickBar,
|
EphemeralCheckbox("Lock Quick Design Bar", "Prevent the quick design bar from being moved and lock it in place.", _config.Ephemeral.LockDesignQuickBar,
|
||||||
v => _config.LockDesignQuickBar = v);
|
v => _config.Ephemeral.LockDesignQuickBar = v);
|
||||||
if (Widget.ModifiableKeySelector("Hotkey to Toggle Quick Design Bar", "Set a hotkey that opens or closes the quick design bar.",
|
if (Widget.ModifiableKeySelector("Hotkey to Toggle Quick Design Bar", "Set a hotkey that opens or closes the quick design bar.",
|
||||||
100 * ImGuiHelpers.GlobalScale,
|
100 * ImGuiHelpers.GlobalScale,
|
||||||
_config.ToggleQuickDesignBar, v => _config.ToggleQuickDesignBar = v, _validKeys))
|
_config.ToggleQuickDesignBar, v => _config.ToggleQuickDesignBar = v, _validKeys))
|
||||||
|
|
@ -138,8 +138,8 @@ public class SettingsTab : ITab
|
||||||
_config.HideWindowInCutscene = v;
|
_config.HideWindowInCutscene = v;
|
||||||
_uiBuilder.DisableCutsceneUiHide = !v;
|
_uiBuilder.DisableCutsceneUiHide = !v;
|
||||||
});
|
});
|
||||||
Checkbox("Lock Main Window", "Prevent the main window from being moved and lock it in place.", _config.LockMainWindow,
|
EphemeralCheckbox("Lock Main Window", "Prevent the main window from being moved and lock it in place.", _config.Ephemeral.LockMainWindow,
|
||||||
v => _config.LockMainWindow = v);
|
v => _config.Ephemeral.LockMainWindow = v);
|
||||||
Checkbox("Open Main Window at Game Start", "Whether the main Glamourer window should be open or closed after launching the game.",
|
Checkbox("Open Main Window at Game Start", "Whether the main Glamourer window should be open or closed after launching the game.",
|
||||||
_config.OpenWindowAtStart, v => _config.OpenWindowAtStart = v);
|
_config.OpenWindowAtStart, v => _config.OpenWindowAtStart = v);
|
||||||
ImGui.Dummy(Vector2.Zero);
|
ImGui.Dummy(Vector2.Zero);
|
||||||
|
|
@ -285,6 +285,21 @@ public class SettingsTab : ITab
|
||||||
ImGuiUtil.LabeledHelpMarker(label, tooltip);
|
ImGuiUtil.LabeledHelpMarker(label, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||||
|
private void EphemeralCheckbox(string label, string tooltip, bool current, Action<bool> setter)
|
||||||
|
{
|
||||||
|
using var id = ImRaii.PushId(label);
|
||||||
|
var tmp = current;
|
||||||
|
if (ImGui.Checkbox(string.Empty, ref tmp) && tmp != current)
|
||||||
|
{
|
||||||
|
setter(tmp);
|
||||||
|
_config.Ephemeral.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiUtil.LabeledHelpMarker(label, tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Different supported sort modes as a combo. </summary>
|
/// <summary> Different supported sort modes as a combo. </summary>
|
||||||
private void DrawFolderSortType()
|
private void DrawFolderSortType()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ namespace Glamourer.Gui.Tabs.UnlocksTab;
|
||||||
|
|
||||||
public class UnlocksTab : Window, ITab
|
public class UnlocksTab : Window, ITab
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly EphemeralConfig _config;
|
||||||
private readonly UnlockOverview _overview;
|
private readonly UnlockOverview _overview;
|
||||||
private readonly UnlockTable _table;
|
private readonly UnlockTable _table;
|
||||||
|
|
||||||
public UnlocksTab(Configuration config, UnlockOverview overview, UnlockTable table)
|
public UnlocksTab(EphemeralConfig config, UnlockOverview overview, UnlockTable table)
|
||||||
: base("Unlocked Equipment")
|
: base("Unlocked Equipment")
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,13 @@ public class CommandService : IDisposable
|
||||||
case "designs":
|
case "designs":
|
||||||
case "design":
|
case "design":
|
||||||
case "design bar":
|
case "design bar":
|
||||||
_config.ShowDesignQuickBar = !_config.ShowDesignQuickBar;
|
_config.Ephemeral.ShowDesignQuickBar = !_config.Ephemeral.ShowDesignQuickBar;
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
return;
|
return;
|
||||||
case "lock":
|
case "lock":
|
||||||
case "unlock":
|
case "unlock":
|
||||||
_config.LockMainWindow = !_config.LockMainWindow;
|
_config.Ephemeral.LockMainWindow = !_config.Ephemeral.LockMainWindow;
|
||||||
_config.Save();
|
_config.Ephemeral.Save();
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
_chat.Print("Use without argument to toggle the main window.");
|
_chat.Print("Use without argument to toggle the main window.");
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,28 @@ public class ConfigMigrationService
|
||||||
_data = JObject.Parse(File.ReadAllText(_saveService.FileNames.ConfigFile));
|
_data = JObject.Parse(File.ReadAllText(_saveService.FileNames.ConfigFile));
|
||||||
MigrateV1To2();
|
MigrateV1To2();
|
||||||
MigrateV2To4();
|
MigrateV2To4();
|
||||||
|
MigrateV4To5();
|
||||||
AddColors(config, true);
|
AddColors(config, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ephemeral Config.
|
||||||
|
private void MigrateV4To5()
|
||||||
|
{
|
||||||
|
if (_config.Version > 4)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_config.Ephemeral.IncognitoMode = _data["IncognitoMode"]?.ToObject<bool>() ?? _config.Ephemeral.IncognitoMode;
|
||||||
|
_config.Ephemeral.UnlockDetailMode = _data["UnlockDetailMode"]?.ToObject<bool>() ?? _config.Ephemeral.UnlockDetailMode;
|
||||||
|
_config.Ephemeral.ShowDesignQuickBar = _data["ShowDesignQuickBar"]?.ToObject<bool>() ?? _config.Ephemeral.ShowDesignQuickBar;
|
||||||
|
_config.Ephemeral.LockDesignQuickBar = _data["LockDesignQuickBar"]?.ToObject<bool>() ?? _config.Ephemeral.LockDesignQuickBar;
|
||||||
|
_config.Ephemeral.LockMainWindow = _data["LockMainWindow"]?.ToObject<bool>() ?? _config.Ephemeral.LockMainWindow;
|
||||||
|
_config.Ephemeral.SelectedTab = _data["SelectedTab"]?.ToObject<MainWindow.TabType>() ?? _config.Ephemeral.SelectedTab;
|
||||||
|
_config.Ephemeral.LastSeenVersion = _data["LastSeenVersion"]?.ToObject<int>() ?? _config.Ephemeral.LastSeenVersion;
|
||||||
|
_config.Version = 5;
|
||||||
|
_config.Ephemeral.Version = 5;
|
||||||
|
_config.Ephemeral.Save();
|
||||||
|
}
|
||||||
|
|
||||||
private void MigrateV1To2()
|
private void MigrateV1To2()
|
||||||
{
|
{
|
||||||
if (_config.Version > 1)
|
if (_config.Version > 1)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public class FilenameService
|
||||||
public readonly string UnlockFileItems;
|
public readonly string UnlockFileItems;
|
||||||
public readonly string FavoriteFile;
|
public readonly string FavoriteFile;
|
||||||
public readonly string DesignColorFile;
|
public readonly string DesignColorFile;
|
||||||
|
public readonly string EphemeralConfigFile;
|
||||||
|
|
||||||
public FilenameService(DalamudPluginInterface pi)
|
public FilenameService(DalamudPluginInterface pi)
|
||||||
{
|
{
|
||||||
|
|
@ -30,6 +31,7 @@ public class FilenameService
|
||||||
DesignDirectory = Path.Combine(ConfigDirectory, "designs");
|
DesignDirectory = Path.Combine(ConfigDirectory, "designs");
|
||||||
FavoriteFile = Path.Combine(ConfigDirectory, "favorites.json");
|
FavoriteFile = Path.Combine(ConfigDirectory, "favorites.json");
|
||||||
DesignColorFile = Path.Combine(ConfigDirectory, "design_colors.json");
|
DesignColorFile = Path.Combine(ConfigDirectory, "design_colors.json");
|
||||||
|
EphemeralConfigFile = Path.Combine(ConfigDirectory, "ephemeral_config.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public static class ServiceManager
|
||||||
.AddSingleton<CodeService>()
|
.AddSingleton<CodeService>()
|
||||||
.AddSingleton<ConfigMigrationService>()
|
.AddSingleton<ConfigMigrationService>()
|
||||||
.AddSingleton<Configuration>()
|
.AddSingleton<Configuration>()
|
||||||
|
.AddSingleton<EphemeralConfig>()
|
||||||
.AddSingleton<TextureService>()
|
.AddSingleton<TextureService>()
|
||||||
.AddSingleton<FavoriteManager>();
|
.AddSingleton<FavoriteManager>();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue