Improve Messaging.

This commit is contained in:
Ottermandias 2023-10-05 16:00:53 +02:00
parent 5ad1be30a7
commit 520fc58e95
20 changed files with 100 additions and 67 deletions

View file

@ -14,6 +14,7 @@ using Glamourer.Structs;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Filesystem; using OtterGui.Filesystem;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
@ -359,7 +360,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
case < 1: case < 1:
case > CurrentVersion: case > CurrentVersion:
Glamourer.Chat.NotificationMessage("Failure to load automated designs: No valid version available.", "Error", Glamourer.Messager.NotificationMessage("Failure to load automated designs: No valid version available.",
NotificationType.Error); NotificationType.Error);
break; break;
case 1: case 1:
@ -369,8 +370,8 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, "Failure to load automated designs: Error during parsing.", Glamourer.Messager.NotificationMessage(ex, "Failure to load automated designs: Error during parsing.",
"Failure to load automated designs", "Error", NotificationType.Error); "Failure to load automated designs", NotificationType.Error);
} }
} }
@ -384,14 +385,14 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
var name = obj["Name"]?.ToObject<string>() ?? string.Empty; var name = obj["Name"]?.ToObject<string>() ?? string.Empty;
if (name.Length == 0) if (name.Length == 0)
{ {
Glamourer.Chat.NotificationMessage("Skipped loading Automation Set: No name provided.", "Warning", NotificationType.Warning); Glamourer.Messager.NotificationMessage("Skipped loading Automation Set: No name provided.", NotificationType.Warning);
continue; continue;
} }
var id = _actors.AwaitedService.FromJson(obj["Identifier"] as JObject); var id = _actors.AwaitedService.FromJson(obj["Identifier"] as JObject);
if (!IdentifierValid(id, out var group)) if (!IdentifierValid(id, out var group))
{ {
Glamourer.Chat.NotificationMessage("Skipped loading Automation Set: Invalid Identifier.", "Warning", NotificationType.Warning); Glamourer.Messager.NotificationMessage("Skipped loading Automation Set: Invalid Identifier.", NotificationType.Warning);
continue; continue;
} }
@ -419,7 +420,8 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
if (designObj is not JObject j) if (designObj is not JObject j)
{ {
Glamourer.Chat.NotificationMessage($"Skipped loading design in Automation Set for {id.Incognito(null)}: Unknown design."); Glamourer.Messager.NotificationMessage(
$"Skipped loading design in Automation Set for {id.Incognito(null)}: Unknown design.");
continue; continue;
} }
@ -439,13 +441,13 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
if (designIdentifier.Length == 0) if (designIdentifier.Length == 0)
{ {
Glamourer.Chat.NotificationMessage("Error parsing automatically applied design: No design specified."); Glamourer.Messager.NotificationMessage("Error parsing automatically applied design: No design specified.");
return null; return null;
} }
if (!Guid.TryParse(designIdentifier, out var guid)) if (!Guid.TryParse(designIdentifier, out var guid))
{ {
Glamourer.Chat.NotificationMessage($"Error parsing automatically applied design: {designIdentifier} is not a valid GUID."); Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design: {designIdentifier} is not a valid GUID.");
return null; return null;
} }
@ -453,7 +455,8 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
design = _designs.Designs.FirstOrDefault(d => d.Identifier == guid); design = _designs.Designs.FirstOrDefault(d => d.Identifier == guid);
if (design == null) if (design == null)
{ {
Glamourer.Chat.NotificationMessage($"Error parsing automatically applied design: The specified design {guid} does not exist."); Glamourer.Messager.NotificationMessage(
$"Error parsing automatically applied design: The specified design {guid} does not exist.");
return null; return null;
} }
} }
@ -475,7 +478,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
if (!_jobs.JobGroups.TryGetValue((ushort)jobs, out var jobGroup)) if (!_jobs.JobGroups.TryGetValue((ushort)jobs, out var jobGroup))
{ {
Glamourer.Chat.NotificationMessage($"Error parsing automatically applied design: The job condition {jobs} does not exist."); Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design: The job condition {jobs} does not exist.");
return null; return null;
} }

View file

@ -6,6 +6,7 @@ using Glamourer.Interop;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Structs; using Glamourer.Structs;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Classes;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.String; using Penumbra.String;
@ -45,7 +46,7 @@ public class FixedDesignMigrator
id = actors.AwaitedService.CreatePlayer(byteString, actors.AwaitedService.Data.Worlds.First().Key); id = actors.AwaitedService.CreatePlayer(byteString, actors.AwaitedService.Data.Worlds.First().Key);
if (!id.IsValid) if (!id.IsValid)
{ {
Glamourer.Chat.NotificationMessage($"Could not migrate fixed design {data.Name}.", "Error", NotificationType.Error); Glamourer.Messager.NotificationMessage($"Could not migrate fixed design {data.Name}.", NotificationType.Error);
allEnabled = false; allEnabled = false;
continue; continue;
} }
@ -58,7 +59,7 @@ public class FixedDesignMigrator
{ {
if (!designFileSystem.Find(design.Item1, out var child) || child is not DesignFileSystem.Leaf leaf) if (!designFileSystem.Find(design.Item1, out var child) || child is not DesignFileSystem.Leaf leaf)
{ {
Glamourer.Chat.NotificationMessage($"Could not find design with path {design.Item1}, skipped fixed design.", "Warning", Glamourer.Messager.NotificationMessage($"Could not find design with path {design.Item1}, skipped fixed design.",
NotificationType.Warning); NotificationType.Warning);
continue; continue;
} }
@ -81,7 +82,7 @@ public class FixedDesignMigrator
var name = obj["Name"]?.ToObject<string>() ?? string.Empty; var name = obj["Name"]?.ToObject<string>() ?? string.Empty;
if (name.Length == 0) if (name.Length == 0)
{ {
Glamourer.Chat.NotificationMessage("Could not semi-migrate fixed design: No character name available.", "Warning", Glamourer.Messager.NotificationMessage("Could not semi-migrate fixed design: No character name available.",
NotificationType.Warning); NotificationType.Warning);
continue; continue;
} }
@ -89,7 +90,7 @@ public class FixedDesignMigrator
var path = obj["Path"]?.ToObject<string>() ?? string.Empty; var path = obj["Path"]?.ToObject<string>() ?? string.Empty;
if (path.Length == 0) if (path.Length == 0)
{ {
Glamourer.Chat.NotificationMessage("Could not semi-migrate fixed design: No design path available.", "Warning", Glamourer.Messager.NotificationMessage("Could not semi-migrate fixed design: No design path available.",
NotificationType.Warning); NotificationType.Warning);
continue; continue;
} }
@ -97,7 +98,7 @@ public class FixedDesignMigrator
var job = obj["JobGroups"]?.ToObject<int>() ?? -1; var job = obj["JobGroups"]?.ToObject<int>() ?? -1;
if (job < 0 || !_jobs.JobGroups.TryGetValue((ushort)job, out var group)) if (job < 0 || !_jobs.JobGroups.TryGetValue((ushort)job, out var group))
{ {
Glamourer.Chat.NotificationMessage("Could not semi-migrate fixed design: Invalid job group specified.", "Warning", Glamourer.Messager.NotificationMessage("Could not semi-migrate fixed design: Invalid job group specified.",
NotificationType.Warning); NotificationType.Warning);
continue; continue;
} }

View file

@ -93,9 +93,9 @@ public class Configuration : IPluginConfiguration, ISavable
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, Glamourer.Messager.NotificationMessage(ex,
"Error reading Configuration, reverting to default.\nYou may be able to restore your configuration using the rolling backups in the XIVLauncher/backups/Glamourer directory.", "Error reading Configuration, reverting to default.\nYou may be able to restore your configuration using the rolling backups in the XIVLauncher/backups/Glamourer directory.",
"Error reading Configuration", "Error", NotificationType.Error); "Error reading Configuration", NotificationType.Error);
} }
migrator.Migrate(this); migrator.Migrate(this);

View file

@ -146,7 +146,7 @@ public sealed class Design : DesignBase, ISavable
var enabled = tok["Enabled"]?.ToObject<bool>(); var enabled = tok["Enabled"]?.ToObject<bool>();
if (name == null || directory == null || enabled == null) if (name == null || directory == null || enabled == null)
{ {
Glamourer.Chat.NotificationMessage("The loaded design contains an invalid mod, skipped.", "Warning", NotificationType.Warning); Glamourer.Messager.NotificationMessage("The loaded design contains an invalid mod, skipped.", NotificationType.Warning);
continue; continue;
} }
@ -156,8 +156,7 @@ public sealed class Design : DesignBase, ISavable
settings.Add(key, value); settings.Add(key, value);
var priority = tok["Priority"]?.ToObject<int>() ?? 0; var priority = tok["Priority"]?.ToObject<int>() ?? 0;
if (!design.AssociatedMods.TryAdd(new Mod(name, directory), new ModSettings(settings, priority, enabled.Value))) if (!design.AssociatedMods.TryAdd(new Mod(name, directory), new ModSettings(settings, priority, enabled.Value)))
Glamourer.Chat.NotificationMessage("The loaded design contains a mod more than once, skipped.", "Warning", Glamourer.Messager.NotificationMessage("The loaded design contains a mod more than once, skipped.", NotificationType.Warning);
NotificationType.Warning);
} }
} }

View file

@ -286,7 +286,7 @@ public class DesignBase
if (equip == null) if (equip == null)
{ {
design.DesignData.SetDefaultEquipment(items); design.DesignData.SetDefaultEquipment(items);
Glamourer.Chat.NotificationMessage("The loaded design does not contain any equipment data, reset to default.", "Warning", Glamourer.Messager.NotificationMessage("The loaded design does not contain any equipment data, reset to default.",
NotificationType.Warning); NotificationType.Warning);
return; return;
} }
@ -310,7 +310,7 @@ public class DesignBase
void PrintWarning(string msg) void PrintWarning(string msg)
{ {
if (msg.Length > 0 && name != "Temporary Design") if (msg.Length > 0 && name != "Temporary Design")
Glamourer.Chat.NotificationMessage($"{msg} ({name})", "Warning", NotificationType.Warning); Glamourer.Messager.NotificationMessage($"{msg} ({name})", NotificationType.Warning);
} }
foreach (var slot in EquipSlotExtensions.EqdpSlots) foreach (var slot in EquipSlotExtensions.EqdpSlots)
@ -366,7 +366,7 @@ public class DesignBase
design.DesignData.ModelId = 0; design.DesignData.ModelId = 0;
design.DesignData.IsHuman = true; design.DesignData.IsHuman = true;
design.DesignData.Customize = Customize.Default; design.DesignData.Customize = Customize.Default;
Glamourer.Chat.NotificationMessage("The loaded design does not contain any customization data, reset to default.", "Warning", Glamourer.Messager.NotificationMessage("The loaded design does not contain any customization data, reset to default.",
NotificationType.Warning); NotificationType.Warning);
return; return;
} }
@ -374,9 +374,9 @@ public class DesignBase
void PrintWarning(string msg) void PrintWarning(string msg)
{ {
if (msg.Length > 0) if (msg.Length > 0)
Glamourer.Chat.NotificationMessage( Glamourer.Messager.NotificationMessage(
$"{msg} ({name})\n\nThis change is not saved automatically. If you want this replacement to stick and the warning to stop appearing, please save the design manually once by changing something in it.", $"{msg} ({name})\nThis change is not saved automatically. If you want this replacement to stick and the warning to stop appearing, please save the design manually once by changing something in it.",
"Warning", NotificationType.Warning); NotificationType.Warning);
} }
var wetness = QuadBool.FromJObject(json["Wetness"], "Value", "Apply", QuadBool.NullFalse); var wetness = QuadBool.FromJObject(json["Wetness"], "Value", "Apply", QuadBool.NullFalse);
@ -451,8 +451,7 @@ public class DesignBase
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, "Could not parse Base64 design.", "Could not parse Base64 design", "Failure", Glamourer.Messager.NotificationMessage(ex, "Could not parse Base64 design.", NotificationType.Error);
NotificationType.Error);
} }
} }

View file

@ -10,6 +10,7 @@ using Glamourer.Interop.Penumbra;
using Glamourer.Services; using Glamourer.Services;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OtterGui.Classes;
using OtterGui.Filesystem; using OtterGui.Filesystem;
namespace Glamourer.Designs; namespace Glamourer.Designs;
@ -111,9 +112,7 @@ public sealed class DesignFileSystem : FileSystem<Design>, IDisposable, ISavable
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not move design to {path} because the folder could not be created.", Glamourer.Messager.NotificationMessage(ex, $"Could not move design to {path} because the folder could not be created.", NotificationType.Error);
$"Could not move design to {path} because the folder could not be created", "Error",
NotificationType.Error);
} }
CreateDuplicateLeaf(parent, design.Name.Text, design); CreateDuplicateLeaf(parent, design.Name.Text, design);

View file

@ -20,8 +20,8 @@ public class Glamourer : IDalamudPlugin
Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown"; Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
public static readonly Logger Log = new(); public static readonly Logger Log = new();
public static ChatService Chat { get; private set; } = null!; public static MessageService Messager { get; private set; } = null!;
private readonly ServiceProvider _services; private readonly ServiceProvider _services;
@ -30,7 +30,7 @@ public class Glamourer : IDalamudPlugin
try try
{ {
_services = ServiceManager.CreateProvider(pluginInterface, Log); _services = ServiceManager.CreateProvider(pluginInterface, Log);
Chat = _services.GetRequiredService<ChatService>(); Messager = _services.GetRequiredService<MessageService>();
_services.GetRequiredService<GlamourerWindowSystem>(); // initialize ui. _services.GetRequiredService<GlamourerWindowSystem>(); // initialize ui.
_services.GetRequiredService<CommandService>(); // initialize commands. _services.GetRequiredService<CommandService>(); // initialize commands.
_services.GetRequiredService<VisorService>(); _services.GetRequiredService<VisorService>();

View file

@ -27,6 +27,7 @@ public class MainWindow : Window, IDisposable
Designs = 3, Designs = 3,
Automation = 4, Automation = 4,
Unlocks = 5, Unlocks = 5,
Messages = 6,
} }
private readonly Configuration _config; private readonly Configuration _config;
@ -40,11 +41,13 @@ public class MainWindow : Window, IDisposable
public readonly DesignTab Designs; public readonly DesignTab Designs;
public readonly AutomationTab Automation; public readonly AutomationTab Automation;
public readonly UnlocksTab Unlocks; public readonly UnlocksTab Unlocks;
public readonly MessagesTab Messages;
public TabType SelectTab = TabType.None; public TabType SelectTab = TabType.None;
public MainWindow(DalamudPluginInterface pi, Configuration config, SettingsTab settings, ActorTab actors, DesignTab designs, public MainWindow(DalamudPluginInterface pi, Configuration config, SettingsTab settings, ActorTab actors, DesignTab designs,
DebugTab debugTab, AutomationTab automation, UnlocksTab unlocks, TabSelected @event, ConvenienceRevertButtons convenienceButtons) DebugTab debugTab, AutomationTab automation, UnlocksTab unlocks, TabSelected @event, ConvenienceRevertButtons convenienceButtons,
MessagesTab messages)
: base(GetLabel()) : base(GetLabel())
{ {
pi.UiBuilder.DisableGposeUiHide = true; pi.UiBuilder.DisableGposeUiHide = true;
@ -61,6 +64,7 @@ public class MainWindow : Window, IDisposable
Unlocks = unlocks; Unlocks = unlocks;
_event = @event; _event = @event;
_convenienceButtons = convenienceButtons; _convenienceButtons = convenienceButtons;
Messages = messages;
_config = config; _config = config;
_tabs = new ITab[] _tabs = new ITab[]
{ {
@ -69,6 +73,7 @@ public class MainWindow : Window, IDisposable
designs, designs,
automation, automation,
unlocks, unlocks,
messages,
debugTab, debugTab,
}; };
_event.Subscribe(OnTabSelected, TabSelected.Priority.MainWindow); _event.Subscribe(OnTabSelected, TabSelected.Priority.MainWindow);
@ -100,6 +105,7 @@ public class MainWindow : Window, IDisposable
TabType.Designs => Designs.Label, TabType.Designs => Designs.Label,
TabType.Automation => Automation.Label, TabType.Automation => Automation.Label,
TabType.Unlocks => Unlocks.Label, TabType.Unlocks => Unlocks.Label,
TabType.Messages => Messages.Label,
_ => ReadOnlySpan<byte>.Empty, _ => ReadOnlySpan<byte>.Empty,
}; };
@ -111,6 +117,7 @@ public class MainWindow : Window, IDisposable
if (label == Settings.Label) return TabType.Settings; if (label == Settings.Label) return TabType.Settings;
if (label == Automation.Label) return TabType.Automation; if (label == Automation.Label) return TabType.Automation;
if (label == Unlocks.Label) return TabType.Unlocks; if (label == Unlocks.Label) return TabType.Unlocks;
if (label == Messages.Label) return TabType.Messages;
if (label == Debug.Label) return TabType.Debug; if (label == Debug.Label) return TabType.Debug;
// @formatter:on // @formatter:on
return TabType.None; return TabType.None;
@ -126,10 +133,10 @@ public class MainWindow : Window, IDisposable
xPos -= ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().FramePadding.X; xPos -= ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().FramePadding.X;
ImGui.SetCursorPos(new Vector2(xPos, 0)); ImGui.SetCursorPos(new Vector2(xPos, 0));
CustomGui.DrawDiscordButton(Glamourer.Chat, width); CustomGui.DrawDiscordButton(Glamourer.Messager, width);
ImGui.SetCursorPos(new Vector2(xPos, ImGui.GetFrameHeightWithSpacing())); ImGui.SetCursorPos(new Vector2(xPos, ImGui.GetFrameHeightWithSpacing()));
CustomGui.DrawGuideButton(Glamourer.Chat, width); CustomGui.DrawGuideButton(Glamourer.Messager, width);
ImGui.SetCursorPos(new Vector2(xPos, 2 * ImGui.GetFrameHeightWithSpacing())); ImGui.SetCursorPos(new Vector2(xPos, 2 * ImGui.GetFrameHeightWithSpacing()));
if (ImGui.Button("Show Changelogs", new Vector2(width, 0))) if (ImGui.Button("Show Changelogs", new Vector2(width, 0)))

View file

@ -17,6 +17,7 @@ using Glamourer.Services;
using Glamourer.State; using Glamourer.State;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -354,8 +355,8 @@ public class ActorPanel
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not apply clipboard to {_identifier}.", Glamourer.Messager.NotificationMessage(ex, $"Could not apply clipboard to {_identifier}.",
$"Could not apply clipboard to design {_identifier.Incognito(null)}", "Failure", NotificationType.Error); $"Could not apply clipboard to design {_identifier.Incognito(null)}", NotificationType.Error, false);
} }
} }
@ -369,8 +370,8 @@ public class ActorPanel
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not copy {_identifier} data to clipboard.", Glamourer.Messager.NotificationMessage(ex, $"Could not copy {_identifier} data to clipboard.",
$"Could not copy data from design {_identifier.Incognito(null)} to clipboard", "Failure", NotificationType.Error); $"Could not copy data from design {_identifier.Incognito(null)} to clipboard", NotificationType.Error);
} }
} }

View file

@ -7,6 +7,7 @@ using Glamourer.Designs;
using Glamourer.Services; using Glamourer.Services;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Widgets; using OtterGui.Widgets;
@ -88,8 +89,7 @@ public class DesignDetailTab
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not open file {fileName}.", $"Could not open file {fileName}", "Failure", Glamourer.Messager.NotificationMessage(ex, $"Could not open file {fileName}.", $"Could not open file {fileName}", NotificationType.Warning);
NotificationType.Warning);
} }
} }
@ -114,7 +114,7 @@ public class DesignDetailTab
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, ex.Message, "Could not rename or move design", "Error", NotificationType.Error); Glamourer.Messager.NotificationMessage(ex, ex.Message, "Could not rename or move design", NotificationType.Error);
} }
ImGuiUtil.DrawFrameColumn("Creation Date"); ImGuiUtil.DrawFrameColumn("Creation Date");

View file

@ -141,7 +141,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
} }
catch catch
{ {
Glamourer.Chat.NotificationMessage("Could not import data from clipboard.", "Failure", NotificationType.Error); Glamourer.Messager.NotificationMessage("Could not import data from clipboard.", NotificationType.Error, false);
} }
} }
@ -173,8 +173,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
else if (design != null) else if (design != null)
_designManager.CreateClone(design, _newName, true); _designManager.CreateClone(design, _newName, true);
else else
Glamourer.Chat.NotificationMessage("Could not create a design, clipboard did not contain valid design data.", "Failure", Glamourer.Messager.NotificationMessage("Could not create a design, clipboard did not contain valid design data.", NotificationType.Error, false);
NotificationType.Error);
_clipboardText = null; _clipboardText = null;
} }
else if (_cloneDesign != null) else if (_cloneDesign != null)

View file

@ -18,6 +18,7 @@ using Glamourer.State;
using Glamourer.Structs; using Glamourer.Structs;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii; using OtterGui.Raii;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
@ -405,8 +406,8 @@ public class DesignPanel
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not apply clipboard to {_selector.Selected!.Name}.", Glamourer.Messager.NotificationMessage(ex, $"Could not apply clipboard to {_selector.Selected!.Name}.",
$"Could not apply clipboard to design {_selector.Selected!.Identifier}", "Failure", NotificationType.Error); $"Could not apply clipboard to design {_selector.Selected!.Identifier}", NotificationType.Error, false);
} }
} }
@ -419,8 +420,8 @@ public class DesignPanel
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not copy {_selector.Selected!.Name} data to clipboard.", Glamourer.Messager.NotificationMessage(ex, $"Could not copy {_selector.Selected!.Name} data to clipboard.",
$"Could not copy data from design {_selector.Selected!.Identifier} to clipboard", "Failure", NotificationType.Error); $"Could not copy data from design {_selector.Selected!.Identifier} to clipboard", NotificationType.Error, false);
} }
} }

View file

@ -7,6 +7,7 @@ using Glamourer.Designs;
using Glamourer.Interop.Penumbra; using Glamourer.Interop.Penumbra;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii; using OtterGui.Raii;
namespace Glamourer.Gui.Tabs.DesignTab; namespace Glamourer.Gui.Tabs.DesignTab;
@ -125,7 +126,7 @@ public class ModAssociationsTab
{ {
var text = _penumbra.SetMod(mod, settings); var text = _penumbra.SetMod(mod, settings);
if (text.Length > 0) if (text.Length > 0)
Glamourer.Chat.NotificationMessage(text, "Failure", NotificationType.Warning); Glamourer.Messager.NotificationMessage(text, NotificationType.Warning, false);
} }
DrawAssociatedModTooltip(settings); DrawAssociatedModTooltip(settings);

View file

@ -0,0 +1,22 @@
using System;
using OtterGui.Classes;
using OtterGui.Widgets;
namespace Glamourer.Gui.Tabs;
public class MessagesTab : ITab
{
private readonly MessageService _messages;
public MessagesTab(MessageService messages)
=> _messages = messages;
public ReadOnlySpan<byte> Label
=> "Messages"u8;
public bool IsVisible
=> _messages.Count > 0;
public void DrawContent()
=> _messages.Draw();
}

View file

@ -7,6 +7,7 @@ using Glamourer.Customization;
using Glamourer.Services; using Glamourer.Services;
using Glamourer.Unlocks; using Glamourer.Unlocks;
using ImGuiNET; using ImGuiNET;
using OtterGui.Classes;
namespace Glamourer.Interop; namespace Glamourer.Interop;
@ -62,8 +63,7 @@ public class DatFileService
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not read character data file {path}.", Glamourer.Messager.NotificationMessage(ex, $"Could not read character data file {path}.", NotificationType.Error);
$"Could not read character data file {path}", "Failure", NotificationType.Error);
file = default; file = default;
} }
@ -94,8 +94,7 @@ public class DatFileService
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Could not save character data to file {path}.", Glamourer.Messager.NotificationMessage(ex, $"Could not save character data to file {path}.", "Failure", NotificationType.Error);
$"Could not save character data to file {path}", "Failure", NotificationType.Error);
return false; return false;
} }
} }

View file

@ -8,6 +8,7 @@ using Dalamud.Logging;
using Dalamud.Plugin; using Dalamud.Plugin;
using Glamourer.Events; using Glamourer.Events;
using Glamourer.Interop.Structs; using Glamourer.Interop.Structs;
using OtterGui.Classes;
using Penumbra.Api; using Penumbra.Api;
using Penumbra.Api.Enums; using Penumbra.Api.Enums;
using Penumbra.Api.Helpers; using Penumbra.Api.Helpers;
@ -147,8 +148,7 @@ public unsafe class PenumbraService : IDisposable
public void OpenModPage(Mod mod) public void OpenModPage(Mod mod)
{ {
if (_openModPage.Invoke(TabType.Mods, mod.DirectoryName, mod.Name) == PenumbraApiEc.ModMissing) if (_openModPage.Invoke(TabType.Mods, mod.DirectoryName, mod.Name) == PenumbraApiEc.ModMissing)
Glamourer.Chat.NotificationMessage($"Could not open the mod {mod.Name}, no fitting mod was found in your Penumbra install.", Glamourer.Messager.NotificationMessage($"Could not open the mod {mod.Name}, no fitting mod was found in your Penumbra install.", NotificationType.Info, false);
"Mod Missing", NotificationType.Info);
} }
public string CurrentCollection public string CurrentCollection

View file

@ -48,7 +48,7 @@ public static class ServiceManager
} }
private static IServiceCollection AddMeta(this IServiceCollection services) private static IServiceCollection AddMeta(this IServiceCollection services)
=> services.AddSingleton<ChatService>() => services.AddSingleton<MessageService>()
.AddSingleton<FilenameService>() .AddSingleton<FilenameService>()
.AddSingleton<BackupService>() .AddSingleton<BackupService>()
.AddSingleton<FrameworkManager>() .AddSingleton<FrameworkManager>()
@ -115,6 +115,7 @@ public static class ServiceManager
private static IServiceCollection AddUi(this IServiceCollection services) private static IServiceCollection AddUi(this IServiceCollection services)
=> services.AddSingleton<DebugTab>() => services.AddSingleton<DebugTab>()
.AddSingleton<MessagesTab>()
.AddSingleton<SettingsTab>() .AddSingleton<SettingsTab>()
.AddSingleton<ActorTab>() .AddSingleton<ActorTab>()
.AddSingleton<ActorSelector>() .AddSingleton<ActorSelector>()

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Interface.Internal.Notifications;
using Glamourer.Customization; using Glamourer.Customization;
using Glamourer.Designs; using Glamourer.Designs;
using Glamourer.Gui; using Glamourer.Gui;
@ -247,7 +248,7 @@ public unsafe class FunModule : IDisposable
tmp.FixCustomizeApplication(_customizations, CustomizeFlagExtensions.AllRelevant); tmp.FixCustomizeApplication(_customizations, CustomizeFlagExtensions.AllRelevant);
var data = _designConverter.ShareBase64(tmp); var data = _designConverter.ShareBase64(tmp);
ImGui.SetClipboardText(data); ImGui.SetClipboardText(data);
Glamourer.Chat.NotificationMessage($"Copied current actual design of {actor.Utf8Name} to clipboard."); Glamourer.Messager.NotificationMessage($"Copied current actual design of {actor.Utf8Name} to clipboard.", NotificationType.Info, false);
} }
catch catch
{ {

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Internal.Notifications;
using OtterGui.Classes;
namespace Glamourer.Unlocks; namespace Glamourer.Unlocks;
@ -47,8 +48,7 @@ public static class UnlockDictionaryHelpers
revertEndian = true; revertEndian = true;
break; break;
default: default:
Glamourer.Chat.NotificationMessage($"Loading unlocked {type}s failed: Invalid magic number.", "Warning", Glamourer.Messager.NotificationMessage($"Loading unlocked {type}s failed: Invalid magic number.", NotificationType.Warning);
NotificationType.Warning);
return -1; return -1;
} }
@ -80,12 +80,12 @@ public static class UnlockDictionaryHelpers
} }
if (skips > 0) if (skips > 0)
Glamourer.Chat.NotificationMessage($"Skipped {skips} unlocked {type}s while loading unlocked {type}s.", "Warning", Glamourer.Messager.NotificationMessage($"Skipped {skips} unlocked {type}s while loading unlocked {type}s.",
NotificationType.Warning); NotificationType.Warning);
break; break;
default: default:
Glamourer.Chat.NotificationMessage($"Loading unlocked {type}s failed: Version {version} is unknown.", "Warning", Glamourer.Messager.NotificationMessage($"Loading unlocked {type}s failed: Version {version} is unknown.",
NotificationType.Warning); NotificationType.Warning);
return version; return version;
} }
@ -95,8 +95,8 @@ public static class UnlockDictionaryHelpers
} }
catch (Exception ex) catch (Exception ex)
{ {
Glamourer.Chat.NotificationMessage(ex, $"Loading unlocked {type}s failed: Unknown Error.", $"Loading unlocked {type}s failed:\n", Glamourer.Messager.NotificationMessage(ex, $"Loading unlocked {type}s failed: Unknown Error.",
"Error", NotificationType.Error); $"Loading unlocked {type}s failed:\n", NotificationType.Error);
return -1; return -1;
} }

@ -1 +1 @@
Subproject commit df07c4ed08e8e6c1188867c7863a19e02c8adb53 Subproject commit 96c9055a1d8a19d9cdb61f41ddfb372871e204ac