Add opening mods from associated mods tab.

This commit is contained in:
Ottermandias 2023-09-22 16:01:37 +02:00
parent 927a7d4775
commit 65a0528e38
3 changed files with 22 additions and 4 deletions

View file

@ -80,8 +80,16 @@ public class ModAssociationsTab
"Delete this mod from associations", false, true))
removedMod = mod;
ImGuiUtil.DrawTableColumn(mod.Name);
ImGuiUtil.DrawTableColumn(mod.DirectoryName);
ImGui.TableNextColumn();
var selected = ImGui.Selectable($"{mod.Name}##name");
var hovered = ImGui.IsItemHovered();
ImGui.TableNextColumn();
selected |= ImGui.Selectable($"{mod.DirectoryName}##directory");
hovered |= ImGui.IsItemHovered();
if (selected)
_penumbra.OpenModPage(mod);
if (hovered)
ImGui.SetTooltip("Click to open mod page in Penumbra.");
ImGui.TableNextColumn();
using (var font = ImRaii.PushFont(UiBuilder.IconFont))
{

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Logging;
using Dalamud.Plugin;
using Glamourer.Events;
@ -59,6 +60,7 @@ public unsafe class PenumbraService : IDisposable
private FuncSubscriber<string, string, string, int, PenumbraApiEc> _setModPriority;
private FuncSubscriber<string, string, string, string, string, PenumbraApiEc> _setModSetting;
private FuncSubscriber<string, string, string, string, IReadOnlyList<string>, PenumbraApiEc> _setModSettings;
private FuncSubscriber<TabType, string, string, PenumbraApiEc> _openModPage;
private readonly EventSubscriber _initializedEvent;
private readonly EventSubscriber _disposedEvent;
@ -141,6 +143,13 @@ public unsafe class PenumbraService : IDisposable
}
}
public void OpenModPage(Mod mod)
{
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.",
"Mod Missing", NotificationType.Info);
}
public string CurrentCollection
=> Available ? _currentCollection.Invoke(ApiCollectionType.Current) : "<Unavailable>";
@ -258,6 +267,7 @@ public unsafe class PenumbraService : IDisposable
_setModPriority = Ipc.TrySetModPriority.Subscriber(_pluginInterface);
_setModSetting = Ipc.TrySetModSetting.Subscriber(_pluginInterface);
_setModSettings = Ipc.TrySetModSettings.Subscriber(_pluginInterface);
_openModPage = Ipc.OpenMainWindow.Subscriber(_pluginInterface);
Available = true;
_penumbraReloaded.Invoke();
Glamourer.Log.Debug("Glamourer attached to Penumbra.");

@ -1 +1 @@
Subproject commit 97610e1c9d27d863ae8563bb9c8525cc6f8a3709
Subproject commit 9472b6e327109216368c3dc1720159f5295bdb13