Files
HellionChat/ChatTwo/Ui/FirstRunWizard.cs
T
JonKazama-Hellion 07470f527e Apply Hellion theme plugin-wide with multi-accent palette
Move from a local color stack inside Hellion-only surfaces to a
single push wrapping Plugin.Draw, so chat log, settings,
viewers, the file dialog and the wizard all render under the same
palette. The local Push() helper stays for explicit use, but the
two existing call sites (Privacy tab, FirstRunWizard) now drop
their local pushes — the global stack already covers them and
double-pushing would shift colors on every frame.

Palette grew from a single cyan accent into a three-tone HUD set:

  Primary cyan-teal (#00B8D4)  → buttons, checkboxes, slider grabs,
                                 separator hover/active.
  Secondary industrial amber   → scrollbar grab and resize-grip
  (#FFB300)                      hover/active highlights.
  Tertiary slate violet         → active title bars and active tabs
  (#7B61FF)                      so identity beats out the cyan
                                 accent without competing with it on
                                 action controls.

Surfaces are deep slate (#0E1A20 windows, #102027 children, #162831
frames) with steel borders (#37474F). Style variables flatten the
default Dalamud rounding into something more geometric: 4 px window
rounding, 2 px frame/grab/tab/scrollbar, 1 px borders.

A new Configuration.HellionThemeEnabled (default true) and a
matching Appearance section at the top of the Privacy tab let users
turn the whole thing off and fall back to the Dalamud default look.
The flag is checked once per frame in Plugin.Draw — `using
IDisposable? _ = ... ? PushGlobal() : null` — so disabling has zero
overhead beyond a bool check.
2026-05-01 21:13:58 +02:00

151 lines
5.1 KiB
C#

using System.Numerics;
using ChatTwo.Code;
using ChatTwo.Privacy;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using Dalamud.Bindings.ImGui;
namespace ChatTwo.Ui;
public sealed class FirstRunWizard : Window
{
private readonly Plugin Plugin;
internal FirstRunWizard(Plugin plugin) : base($"{HellionStrings.Wizard_Title}###hellion-firstrun")
{
Plugin = plugin;
Flags = ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoDocking;
SizeCondition = ImGuiCond.Appearing;
Size = new Vector2(900, 560);
SizeConstraints = new WindowSizeConstraints
{
MinimumSize = new Vector2(720, 480),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue),
};
}
public override void OnClose()
{
// Closing the wizard without picking anything = the user accepts
// whatever defaults are already in place. Mark as complete so we
// don't pester them again on the next launch.
if (!Plugin.Config.FirstRunCompleted)
{
Plugin.Config.FirstRunCompleted = true;
Plugin.SaveConfig();
}
}
public override void Draw()
{
ImGui.TextWrapped(HellionStrings.Wizard_Intro);
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
var avail = ImGui.GetContentRegionAvail();
var cardWidth = (avail.X - ImGui.GetStyle().ItemSpacing.X * 2) / 3f;
var cardHeight = avail.Y - ImGui.GetTextLineHeightWithSpacing();
DrawCard("privacy-first", cardWidth, cardHeight,
HellionStrings.Wizard_Profile_PrivacyFirst_Heading,
HellionStrings.Wizard_Profile_PrivacyFirst_Description,
null,
HellionStrings.Wizard_Profile_PrivacyFirst_Apply,
ApplyPrivacyFirst);
ImGui.SameLine();
DrawCard("casual", cardWidth, cardHeight,
HellionStrings.Wizard_Profile_Casual_Heading,
HellionStrings.Wizard_Profile_Casual_Description,
null,
HellionStrings.Wizard_Profile_Casual_Apply,
ApplyCasual);
ImGui.SameLine();
DrawCard("full-history", cardWidth, cardHeight,
HellionStrings.Wizard_Profile_FullHistory_Heading,
HellionStrings.Wizard_Profile_FullHistory_Description,
HellionStrings.Wizard_Profile_FullHistory_GdprWarning,
HellionStrings.Wizard_Profile_FullHistory_Apply,
ApplyFullHistory);
}
private void DrawCard(string id, float width, float height, string heading, string description, string? warning, string buttonLabel, Action onApply)
{
using var child = ImRaii.Child($"##wizard-card-{id}", new Vector2(width, height), true);
if (!child.Success)
return;
ImGui.TextUnformatted(heading);
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
ImGui.TextWrapped(description);
if (warning is not null)
{
ImGui.Spacing();
ImGuiUtil.WarningText(warning);
}
// Push the button to the bottom of the card.
var lineHeight = ImGui.GetFrameHeightWithSpacing();
var remaining = ImGui.GetContentRegionAvail().Y - lineHeight;
if (remaining > 0)
ImGui.Dummy(new Vector2(0, remaining));
if (ImGui.Button($"{buttonLabel}##{id}", new Vector2(-1, 0)))
{
onApply();
Plugin.Config.FirstRunCompleted = true;
Plugin.SaveConfig();
IsOpen = false;
}
}
private void ApplyPrivacyFirst()
{
Plugin.Config.PrivacyFilterEnabled = true;
Plugin.Config.PrivacyPersistChannels = [..PrivacyDefaults.PrivacyFirstWhitelist];
Plugin.Config.PrivacyPersistUnknownChannels = false;
Plugin.Config.RetentionEnabled = true;
Plugin.Config.RetentionDefaultDays = 30;
Plugin.Config.RetentionPerChannelDays =
PrivacyDefaults.DefaultRetentionDays.ToDictionary(p => p.Key, p => p.Value);
}
private void ApplyCasual()
{
Plugin.Config.PrivacyFilterEnabled = true;
Plugin.Config.PrivacyPersistChannels = [..PrivacyDefaults.CasualWhitelist];
Plugin.Config.PrivacyPersistUnknownChannels = false;
Plugin.Config.RetentionEnabled = true;
Plugin.Config.RetentionDefaultDays = 30;
var policy = PrivacyDefaults.DefaultRetentionDays.ToDictionary(p => p.Key, p => p.Value);
foreach (var (type, days) in PrivacyDefaults.CasualRetentionOverrides)
policy[type] = days;
Plugin.Config.RetentionPerChannelDays = policy;
}
private void ApplyFullHistory()
{
// Full history = upstream Chat 2 behavior. Filter off, retention off,
// everything (except battle messages, which Chat 2 itself controls)
// accumulates indefinitely.
Plugin.Config.PrivacyFilterEnabled = false;
Plugin.Config.PrivacyPersistUnknownChannels = true;
Plugin.Config.RetentionEnabled = false;
Plugin.Config.RetentionPerChannelDays.Clear();
}
}