Add Incognito Modifier.

This commit is contained in:
Ottermandias 2025-04-04 22:35:42 +02:00
parent 118f51cc64
commit 46f8818cee
7 changed files with 30 additions and 11 deletions

View file

@ -75,6 +75,7 @@ public class Configuration : IPluginConfiguration, ISavable
public RenameField ShowRename { get; set; } = RenameField.BothDataPrio; public RenameField ShowRename { get; set; } = RenameField.BothDataPrio;
public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY); public ModifiableHotkey ToggleQuickDesignBar { get; set; } = new(VirtualKey.NO_KEY);
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
public DoubleModifier IncognitoModifier { get; set; } = new(ModifierHotkey.Control);
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New; public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;
public QdbButtons QdbButtons { get; set; } = public QdbButtons QdbButtons { get; set; } =

View file

@ -87,7 +87,7 @@ public class ActorPanel
_rightButtons = _rightButtons =
[ [
new LockedButton(this), new LockedButton(this),
new HeaderDrawer.IncognitoButton(_config.Ephemeral), new HeaderDrawer.IncognitoButton(_config),
]; ];
} }

View file

@ -31,7 +31,7 @@ public class SetPanel(
RandomRestrictionDrawer _randomDrawer) RandomRestrictionDrawer _randomDrawer)
{ {
private readonly JobGroupCombo _jobGroupCombo = new(_manager, _jobs, Glamourer.Log); private readonly JobGroupCombo _jobGroupCombo = new(_manager, _jobs, Glamourer.Log);
private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(_config.Ephemeral)]; private readonly HeaderDrawer.Button[] _rightButtons = [new HeaderDrawer.IncognitoButton(_config)];
private string? _tempName; private string? _tempName;
private int _dragIndex = -1; private int _dragIndex = -1;

View file

@ -89,7 +89,7 @@ public class DesignPanel
_rightButtons = _rightButtons =
[ [
new LockButton(this), new LockButton(this),
new IncognitoButton(_config.Ephemeral), new IncognitoButton(_config),
]; ];
} }

View file

@ -13,7 +13,7 @@ namespace Glamourer.Gui.Tabs.DesignTab;
public class MultiDesignPanel(DesignFileSystemSelector selector, DesignManager editor, DesignColors colors, Configuration config) public class MultiDesignPanel(DesignFileSystemSelector selector, DesignManager editor, DesignColors colors, Configuration config)
{ {
private readonly Button[] _leftButtons = []; private readonly Button[] _leftButtons = [];
private readonly Button[] _rightButtons = [new IncognitoButton(config.Ephemeral)]; private readonly Button[] _rightButtons = [new IncognitoButton(config)];
private readonly DesignColorCombo _colorCombo = new(colors, true); private readonly DesignColorCombo _colorCombo = new(colors, true);

View file

@ -44,22 +44,36 @@ public static class HeaderDrawer
} }
} }
public sealed class IncognitoButton(EphemeralConfig config) : Button public sealed class IncognitoButton(Configuration config) : Button
{ {
protected override string Description protected override string Description
=> config.IncognitoMode {
? "Toggle incognito mode off." get
: "Toggle incognito mode on."; {
var hold = config.IncognitoModifier.IsActive();
return (config.Ephemeral.IncognitoMode, hold)
switch
{
(true, true) => "Toggle incognito mode off.",
(false, true) => "Toggle incognito mode on.",
(true, false) => $"Toggle incognito mode off.\n\nHold {config.IncognitoModifier} while clicking to toggle.",
(false, false) => $"Toggle incognito mode on.\n\nHold {config.IncognitoModifier} while clicking to toggle.",
};
}
}
protected override FontAwesomeIcon Icon protected override FontAwesomeIcon Icon
=> config.IncognitoMode => config.Ephemeral.IncognitoMode
? FontAwesomeIcon.EyeSlash ? FontAwesomeIcon.EyeSlash
: FontAwesomeIcon.Eye; : FontAwesomeIcon.Eye;
protected override void OnClick() protected override void OnClick()
{ {
config.IncognitoMode = !config.IncognitoMode; if (!config.IncognitoModifier.IsActive())
config.Save(); return;
config.Ephemeral.IncognitoMode = !config.Ephemeral.IncognitoMode;
config.Ephemeral.Save();
} }
} }

View file

@ -188,6 +188,10 @@ public class SettingsTab(
"A modifier you need to hold while clicking the Delete Design button for it to take effect.", 100 * ImGuiHelpers.GlobalScale, "A modifier you need to hold while clicking the Delete Design button for it to take effect.", 100 * ImGuiHelpers.GlobalScale,
config.DeleteDesignModifier, v => config.DeleteDesignModifier = v)) config.DeleteDesignModifier, v => config.DeleteDesignModifier = v))
config.Save(); config.Save();
if (Widget.DoubleModifierSelector("Incognito Modifier",
"A modifier you need to hold while clicking the Incognito button for it to take effect.", 100 * ImGuiHelpers.GlobalScale,
config.IncognitoModifier, v => config.IncognitoModifier = v))
config.Save();
DrawRenameSettings(); DrawRenameSettings();
Checkbox("Auto-Open Design Folders"u8, Checkbox("Auto-Open Design Folders"u8,
"Have design folders open or closed as their default state after launching."u8, config.OpenFoldersByDefault, "Have design folders open or closed as their default state after launching."u8, config.OpenFoldersByDefault,