mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 15:27:43 +01:00
add icon for dev plugins
This commit is contained in:
parent
b3740d0539
commit
d827151ee5
5 changed files with 55 additions and 23 deletions
|
|
@ -64,40 +64,47 @@ public enum DalamudAsset
|
||||||
[DalamudAssetPath("UIRes", "troubleIcon.png")]
|
[DalamudAssetPath("UIRes", "troubleIcon.png")]
|
||||||
TroubleIcon = 1006,
|
TroubleIcon = 1006,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The plugin trouble icon overlay.
|
||||||
|
/// </summary>
|
||||||
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
|
[DalamudAssetPath("UIRes", "devPluginIcon.png")]
|
||||||
|
DevPluginIcon = 1007,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The plugin update icon overlay.
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The plugin update icon overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "updateIcon.png")]
|
[DalamudAssetPath("UIRes", "updateIcon.png")]
|
||||||
UpdateIcon = 1007,
|
UpdateIcon = 1008,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The plugin installed icon overlay.
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The plugin installed icon overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "installedIcon.png")]
|
[DalamudAssetPath("UIRes", "installedIcon.png")]
|
||||||
InstalledIcon = 1008,
|
InstalledIcon = 1009,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The third party plugin icon overlay.
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The third party plugin icon overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "thirdIcon.png")]
|
[DalamudAssetPath("UIRes", "thirdIcon.png")]
|
||||||
ThirdIcon = 1009,
|
ThirdIcon = 1010,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The installed third party plugin icon overlay.
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The installed third party plugin icon overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "thirdInstalledIcon.png")]
|
[DalamudAssetPath("UIRes", "thirdInstalledIcon.png")]
|
||||||
ThirdInstalledIcon = 1010,
|
ThirdInstalledIcon = 1011,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The API bump explainer icon.
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The API bump explainer icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "changelogApiBump.png")]
|
[DalamudAssetPath("UIRes", "changelogApiBump.png")]
|
||||||
ChangelogApiBumpIcon = 1011,
|
ChangelogApiBumpIcon = 1012,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The background shade for
|
/// <see cref="DalamudAssetPurpose.TextureFromPng"/>: The background shade for
|
||||||
|
|
@ -105,7 +112,7 @@ public enum DalamudAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
[DalamudAsset(DalamudAssetPurpose.TextureFromPng)]
|
||||||
[DalamudAssetPath("UIRes", "tsmShade.png")]
|
[DalamudAssetPath("UIRes", "tsmShade.png")]
|
||||||
TitleScreenMenuShade = 1012,
|
TitleScreenMenuShade = 1013,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="DalamudAssetPurpose.Font"/>: Noto Sans CJK JP Medium.
|
/// <see cref="DalamudAssetPurpose.Font"/>: Noto Sans CJK JP Medium.
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,12 @@ internal class PluginImageCache : IDisposable, IServiceType
|
||||||
public IDalamudTextureWrap TroubleIcon =>
|
public IDalamudTextureWrap TroubleIcon =>
|
||||||
this.dalamudAssetManager.GetDalamudTextureWrap(DalamudAsset.TroubleIcon, this.EmptyTexture);
|
this.dalamudAssetManager.GetDalamudTextureWrap(DalamudAsset.TroubleIcon, this.EmptyTexture);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the devPlugin icon overlay.
|
||||||
|
/// </summary>
|
||||||
|
public IDalamudTextureWrap DevPluginIcon =>
|
||||||
|
this.dalamudAssetManager.GetDalamudTextureWrap(DalamudAsset.DevPluginIcon, this.EmptyTexture);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin update icon overlay.
|
/// Gets the plugin update icon overlay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1800,6 +1800,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
var isLoaded = plugin is { IsLoaded: true };
|
var isLoaded = plugin is { IsLoaded: true };
|
||||||
|
|
||||||
|
if (plugin is LocalDevPlugin)
|
||||||
|
{
|
||||||
|
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.4f);
|
||||||
|
ImGui.Image(this.imageCache.DevPluginIcon.ImGuiHandle, iconSize);
|
||||||
|
ImGui.PopStyleVar();
|
||||||
|
ImGui.SetCursorPos(cursorBeforeImage);
|
||||||
|
}
|
||||||
|
|
||||||
if (updateAvailable)
|
if (updateAvailable)
|
||||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||||
else if ((trouble && !pluginDisabled) || isOrphan)
|
else if ((trouble && !pluginDisabled) || isOrphan)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using Dalamud.Plugin.Internal.Profiles;
|
using Dalamud.Plugin.Internal.Profiles;
|
||||||
|
using Dalamud.Plugin.Internal.Types;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
@ -315,13 +316,13 @@ internal class ProfileManagerWidget
|
||||||
if (ImGui.BeginListBox("###pluginPicker", new Vector2(width, width - 80)))
|
if (ImGui.BeginListBox("###pluginPicker", new Vector2(width, width - 80)))
|
||||||
{
|
{
|
||||||
// TODO: Plugin searching should be abstracted... installer and this should use the same search
|
// TODO: Plugin searching should be abstracted... installer and this should use the same search
|
||||||
foreach (var plugin in pm.InstalledPlugins.Where(x => x.Manifest.SupportsProfiles && !x.IsDev &&
|
foreach (var plugin in pm.InstalledPlugins.Where(x => x.Manifest.SupportsProfiles &&
|
||||||
(this.pickerSearch.IsNullOrWhitespace() || x.Manifest.Name.ToLowerInvariant().Contains(this.pickerSearch.ToLowerInvariant()))))
|
(this.pickerSearch.IsNullOrWhitespace() || x.Manifest.Name.ToLowerInvariant().Contains(this.pickerSearch.ToLowerInvariant()))))
|
||||||
{
|
{
|
||||||
using var disabled2 =
|
using var disabled2 =
|
||||||
ImRaii.Disabled(profile.Plugins.Any(y => y.InternalName == plugin.Manifest.InternalName));
|
ImRaii.Disabled(profile.Plugins.Any(y => y.InternalName == plugin.Manifest.InternalName));
|
||||||
|
|
||||||
if (ImGui.Selectable($"{plugin.Manifest.Name}###selector{plugin.Manifest.InternalName}"))
|
if (ImGui.Selectable($"{plugin.Manifest.Name}{(plugin is LocalDevPlugin ? "(dev plugin)" : string.Empty)}###selector{plugin.Manifest.InternalName}"))
|
||||||
{
|
{
|
||||||
Task.Run(() => profile.AddOrUpdateAsync(plugin.Manifest.WorkingPluginId, true, false))
|
Task.Run(() => profile.AddOrUpdateAsync(plugin.Manifest.WorkingPluginId, true, false))
|
||||||
.ContinueWith(this.installer.DisplayErrorContinuation, Locs.ErrorCouldNotChangeState);
|
.ContinueWith(this.installer.DisplayErrorContinuation, Locs.ErrorCouldNotChangeState);
|
||||||
|
|
@ -426,18 +427,28 @@ internal class ProfileManagerWidget
|
||||||
Guid? wantRemovePluginGuid = null;
|
Guid? wantRemovePluginGuid = null;
|
||||||
|
|
||||||
using var syncScope = profile.GetSyncScope();
|
using var syncScope = profile.GetSyncScope();
|
||||||
foreach (var plugin in profile.Plugins.ToArray())
|
foreach (var profileEntry in profile.Plugins.ToArray())
|
||||||
{
|
{
|
||||||
didAny = true;
|
didAny = true;
|
||||||
var pmPlugin = pm.InstalledPlugins.FirstOrDefault(x => x.Manifest.WorkingPluginId == plugin.WorkingPluginId);
|
var pmPlugin = pm.InstalledPlugins.FirstOrDefault(x => x.Manifest.WorkingPluginId == profileEntry.WorkingPluginId);
|
||||||
var btnOffset = 2;
|
var btnOffset = 2;
|
||||||
|
|
||||||
if (pmPlugin != null)
|
if (pmPlugin != null)
|
||||||
{
|
{
|
||||||
|
var cursorBeforeIcon = ImGui.GetCursorPos();
|
||||||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon);
|
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon);
|
||||||
icon ??= pic.DefaultIcon;
|
icon ??= pic.DefaultIcon;
|
||||||
|
|
||||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||||
|
|
||||||
|
if (pmPlugin is LocalDevPlugin)
|
||||||
|
{
|
||||||
|
ImGui.SetCursorPos(cursorBeforeIcon);
|
||||||
|
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.4f);
|
||||||
|
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||||
|
ImGui.PopStyleVar();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
var text = $"{pmPlugin.Name}";
|
var text = $"{pmPlugin.Name}";
|
||||||
|
|
@ -454,17 +465,17 @@ internal class ProfileManagerWidget
|
||||||
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
var text = Locs.NotInstalled(plugin.InternalName);
|
var text = Locs.NotInstalled(profileEntry.InternalName);
|
||||||
var textHeight = ImGui.CalcTextSize(text);
|
var textHeight = ImGui.CalcTextSize(text);
|
||||||
var before = ImGui.GetCursorPos();
|
var before = ImGui.GetCursorPos();
|
||||||
|
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2));
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2));
|
||||||
ImGui.TextUnformatted(text);
|
ImGui.TextUnformatted(text);
|
||||||
|
|
||||||
var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == plugin.InternalName);
|
var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == profileEntry.InternalName);
|
||||||
var installable =
|
var installable =
|
||||||
pm.AvailablePlugins.FirstOrDefault(
|
pm.AvailablePlugins.FirstOrDefault(
|
||||||
x => x.InternalName == plugin.InternalName && !x.SourceRepo.IsThirdParty);
|
x => x.InternalName == profileEntry.InternalName && !x.SourceRepo.IsThirdParty);
|
||||||
|
|
||||||
if (firstAvailableInstalled != null)
|
if (firstAvailableInstalled != null)
|
||||||
{
|
{
|
||||||
|
|
@ -494,10 +505,10 @@ internal class ProfileManagerWidget
|
||||||
ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30));
|
ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30));
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (ImGui.GetFrameHeight() / 2));
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (ImGui.GetFrameHeight() / 2));
|
||||||
|
|
||||||
var enabled = plugin.IsEnabled;
|
var enabled = profileEntry.IsEnabled;
|
||||||
if (ImGui.Checkbox($"###{this.editingProfileGuid}-{plugin.InternalName}", ref enabled))
|
if (ImGui.Checkbox($"###{this.editingProfileGuid}-{profileEntry.InternalName}", ref enabled))
|
||||||
{
|
{
|
||||||
Task.Run(() => profile.AddOrUpdateAsync(plugin.WorkingPluginId, enabled))
|
Task.Run(() => profile.AddOrUpdateAsync(profileEntry.WorkingPluginId, enabled))
|
||||||
.ContinueWith(this.installer.DisplayErrorContinuation, Locs.ErrorCouldNotChangeState);
|
.ContinueWith(this.installer.DisplayErrorContinuation, Locs.ErrorCouldNotChangeState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -505,9 +516,9 @@ internal class ProfileManagerWidget
|
||||||
ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30 * btnOffset) - 5);
|
ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30 * btnOffset) - 5);
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (ImGui.GetFrameHeight() / 2));
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (ImGui.GetFrameHeight() / 2));
|
||||||
|
|
||||||
if (ImGuiComponents.IconButton($"###removePlugin{plugin.InternalName}", FontAwesomeIcon.Trash))
|
if (ImGuiComponents.IconButton($"###removePlugin{profileEntry.InternalName}", FontAwesomeIcon.Trash))
|
||||||
{
|
{
|
||||||
wantRemovePluginGuid = plugin.WorkingPluginId;
|
wantRemovePluginGuid = profileEntry.WorkingPluginId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class ModuleLog
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
public void Verbose(Exception exception, string messageTemplate, params object?[] values)
|
public void Verbose(Exception? exception, string messageTemplate, params object?[] values)
|
||||||
=> this.WriteLog(LogEventLevel.Verbose, messageTemplate, exception, values);
|
=> this.WriteLog(LogEventLevel.Verbose, messageTemplate, exception, values);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -62,7 +62,7 @@ public class ModuleLog
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
public void Debug(Exception exception, string messageTemplate, params object?[] values)
|
public void Debug(Exception? exception, string messageTemplate, params object?[] values)
|
||||||
=> this.WriteLog(LogEventLevel.Debug, messageTemplate, exception, values);
|
=> this.WriteLog(LogEventLevel.Debug, messageTemplate, exception, values);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -81,7 +81,7 @@ public class ModuleLog
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
public void Information(Exception exception, string messageTemplate, params object?[] values)
|
public void Information(Exception? exception, string messageTemplate, params object?[] values)
|
||||||
=> this.WriteLog(LogEventLevel.Information, messageTemplate, exception, values);
|
=> this.WriteLog(LogEventLevel.Information, messageTemplate, exception, values);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -100,7 +100,7 @@ public class ModuleLog
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
public void Warning(Exception exception, string messageTemplate, params object?[] values)
|
public void Warning(Exception? exception, string messageTemplate, params object?[] values)
|
||||||
=> this.WriteLog(LogEventLevel.Warning, messageTemplate, exception, values);
|
=> this.WriteLog(LogEventLevel.Warning, messageTemplate, exception, values);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -138,7 +138,7 @@ public class ModuleLog
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
public void Fatal(Exception exception, string messageTemplate, params object?[] values)
|
public void Fatal(Exception? exception, string messageTemplate, params object?[] values)
|
||||||
=> this.WriteLog(LogEventLevel.Fatal, messageTemplate, exception, values);
|
=> this.WriteLog(LogEventLevel.Fatal, messageTemplate, exception, values);
|
||||||
|
|
||||||
[MessageTemplateFormatMethod("messageTemplate")]
|
[MessageTemplateFormatMethod("messageTemplate")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue