Improved messaging.

This commit is contained in:
Ottermandias 2023-10-05 18:20:41 +02:00
parent 19c4c3b50e
commit 779d6b37a5
30 changed files with 146 additions and 139 deletions

View file

@ -18,14 +18,14 @@ using Penumbra.Mods.Manager;
using Penumbra.Mods.Subclasses;
using Penumbra.Services;
using Penumbra.UI.Classes;
using ChatService = Penumbra.Services.ChatService;
using MessageService = Penumbra.Services.MessageService;
namespace Penumbra.UI.ModsTab;
public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSystemSelector.ModState>
{
private readonly CommunicatorService _communicator;
private readonly ChatService _chat;
private readonly MessageService _messager;
private readonly Configuration _config;
private readonly FileDialogService _fileDialog;
private readonly ModManager _modManager;
@ -37,7 +37,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
public ModFileSystemSelector(IKeyState keyState, CommunicatorService communicator, ModFileSystem fileSystem, ModManager modManager,
CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat,
CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, MessageService messager,
ModImportManager modImportManager, IDragDropManager dragDrop)
: base(fileSystem, keyState, Penumbra.Log, HandleException, allowMultipleSelection: true)
{
@ -47,7 +47,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
_config = config;
_tutorial = tutorial;
_fileDialog = fileDialog;
_chat = chat;
_messager = messager;
_modImportManager = modImportManager;
_dragDrop = dragDrop;
@ -326,9 +326,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
}
catch (Exception e)
{
_chat.NotificationMessage(
$"Could not move newly imported mod {mod.Name} to default import folder {_config.DefaultImportFolder}:\n{e}", "Warning",
NotificationType.Warning);
_messager.NotificationMessage(e, $"Could not move newly imported mod {mod.Name} to default import folder {_config.DefaultImportFolder}.", NotificationType.Warning);
}
}
@ -392,7 +390,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
}
private static void HandleException(Exception e)
=> Penumbra.Chat.NotificationMessage(e.Message, "Failure", NotificationType.Warning);
=> Penumbra.Messager.NotificationMessage(e, e.Message, NotificationType.Warning);
#endregion

View file

@ -6,6 +6,7 @@ using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Widgets;
using OtterGui.Classes;
using Penumbra.Api.Enums;
using Penumbra.Mods;
using Penumbra.Mods.Editor;
@ -18,15 +19,15 @@ namespace Penumbra.UI.ModsTab;
public class ModPanelEditTab : ITab
{
private readonly ChatService _chat;
private readonly FilenameService _filenames;
private readonly ModManager _modManager;
private readonly ModExportManager _modExportManager;
private readonly ModFileSystem _fileSystem;
private readonly ModFileSystemSelector _selector;
private readonly ModEditWindow _editWindow;
private readonly ModEditor _editor;
private readonly Configuration _config;
private readonly Services.MessageService _messager;
private readonly FilenameService _filenames;
private readonly ModManager _modManager;
private readonly ModExportManager _modExportManager;
private readonly ModFileSystem _fileSystem;
private readonly ModFileSystemSelector _selector;
private readonly ModEditWindow _editWindow;
private readonly ModEditor _editor;
private readonly Configuration _config;
private readonly TagButtons _modTags = new();
@ -35,13 +36,13 @@ public class ModPanelEditTab : ITab
private ModFileSystem.Leaf _leaf = null!;
private Mod _mod = null!;
public ModPanelEditTab(ModManager modManager, ModFileSystemSelector selector, ModFileSystem fileSystem, ChatService chat,
public ModPanelEditTab(ModManager modManager, ModFileSystemSelector selector, ModFileSystem fileSystem, Services.MessageService messager,
ModEditWindow editWindow, ModEditor editor, FilenameService filenames, ModExportManager modExportManager, Configuration config)
{
_modManager = modManager;
_selector = selector;
_fileSystem = fileSystem;
_chat = chat;
_messager = messager;
_editWindow = editWindow;
_editor = editor;
_filenames = filenames;
@ -75,7 +76,7 @@ public class ModPanelEditTab : ITab
}
catch (Exception e)
{
_chat.NotificationMessage(e.Message, "Warning", NotificationType.Warning);
_messager.NotificationMessage(e.Message, NotificationType.Warning, false);
}
UiHelpers.DefaultLineSpace();