fix some warnings

This commit is contained in:
goat 2024-12-26 14:11:14 +01:00
parent ce5ee71c91
commit 2e2feb144f
9 changed files with 40 additions and 34 deletions

View file

@ -48,7 +48,6 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
private bool lastConditionNone = true;
[ServiceManager.ServiceConstructor]
private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLifecycle lifecycle)
{

View file

@ -36,12 +36,12 @@ public sealed class XivChatEntry
}
/// <summary>
/// Gets or Sets the name payloads
/// Gets or sets the name payloads.
/// </summary>
public byte[] NameBytes { get; set; } = [];
/// <summary>
/// Gets or Sets the message payloads.
/// Gets or sets the message payloads.
/// </summary>
public byte[] MessageBytes { get; set; } = [];

View file

@ -182,7 +182,10 @@ public static partial class ImGuiComponents
/// </summary>
/// <param name="icon">Icon to show.</param>
/// <param name="text">Text to show.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param>
/// <param name="size">
/// Sets the size of the button. If either dimension is set to 0,
/// that dimension will conform to the size of the icon and text.
/// </param>
/// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size);
@ -194,7 +197,10 @@ public static partial class ImGuiComponents
/// <param name="defaultColor">The default color of the button.</param>
/// <param name="activeColor">The color of the button when active.</param>
/// <param name="hoveredColor">The color of the button when hovered.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param>
/// <param name="size">
/// Sets the size of the button. If either dimension is set to 0,
/// that dimension will conform to the size of the icon and text.
/// </param>
/// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null)
{

View file

@ -8,6 +8,9 @@ using ImGuiNET;
namespace Dalamud.Interface.Components;
/// <summary>
/// ImGui component used to create a radio-like input that uses icon buttons.
/// </summary>
public static partial class ImGuiComponents
{
/// <summary>

View file

@ -18,7 +18,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
public class IconBrowserWidget : IDataWindowWidget
{
private const int MaxIconId = 250_000;
private Vector2 iconSize = new(64.0f, 64.0f);
private Vector2 editIconSize = new(64.0f, 64.0f);
@ -126,7 +126,6 @@ public class IconBrowserWidget : IDataWindowWidget
this.valueRange = null;
}
ImGui.NextColumn();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0))
@ -204,7 +203,7 @@ public class IconBrowserWidget : IDataWindowWidget
ImGui.GetColorU32(ImGuiColors.DalamudRed),
iconText);
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%"));
@ -224,7 +223,7 @@ public class IconBrowserWidget : IDataWindowWidget
cursor + ((this.iconSize - textSize) / 2),
color,
text);
if (ImGui.IsItemHovered())
ImGui.SetTooltip(iconId.ToString());

View file

@ -1,7 +1,7 @@
using Dalamud.Game.Text;
using ImGuiNET;
using System.Linq;
using System.Linq;
using Dalamud.Game.Text;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -196,6 +196,14 @@ public class DevPluginsSettingsEntry : SettingsEntry
}
}
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
private void AddDevPlugin()
{
if (this.devPluginLocations.Any(
@ -223,16 +231,7 @@ public class DevPluginsSettingsEntry : SettingsEntry
this.devPluginTempLocation = string.Empty;
}
var config = Service<DalamudConfiguration>.Get();
if (!config.ImGuiAssertsEnabledAtStartup.HasValue)
config.ImGuiAssertsEnabledAtStartup = true;
// Enable ImGui asserts if a dev plugin is added, if no choice was made prior
Service<DalamudConfiguration>.Get().ImGuiAssertsEnabledAtStartup ??= true;
}
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
}

View file

@ -72,6 +72,8 @@ internal class AutoUpdateManager : IServiceType
private readonly IConsoleVariable<bool> isDryRun;
private readonly Task<DalamudLinkPayload> openInstallerWindowLinkTask;
private DateTime? loginTime;
private DateTime? nextUpdateCheckTime;
private DateTime? unblockedSince;
@ -82,8 +84,6 @@ internal class AutoUpdateManager : IServiceType
private Task? autoUpdateTask;
private readonly Task<DalamudLinkPayload> openInstallerWindowLink;
/// <summary>
/// Initializes a new instance of the <see cref="AutoUpdateManager"/> class.
/// </summary>
@ -99,7 +99,7 @@ internal class AutoUpdateManager : IServiceType
});
Service<Framework>.GetAsync().ContinueWith(t => { t.Result.Update += this.OnUpdate; });
this.openInstallerWindowLink =
this.openInstallerWindowLinkTask =
Service<ChatGui>.GetAsync().ContinueWith(
chatGuiTask => chatGuiTask.Result.AddChatLinkHandler(
"Dalamud",
@ -109,7 +109,6 @@ internal class AutoUpdateManager : IServiceType
Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins);
}));
this.isDryRun = console.AddVariable("dalamud.autoupdate.dry_run", "Simulate updates instead", false);
console.AddCommand("dalamud.autoupdate.trigger_login", "Trigger a login event", () =>
{
@ -441,7 +440,7 @@ internal class AutoUpdateManager : IServiceType
new TextPayload(Locs.NotificationContentUpdatesAvailableMinimized(updatablePlugins.Count)),
new TextPayload(" ["),
new UIForegroundPayload(500),
this.openInstallerWindowLink.Result,
this.openInstallerWindowLinkTask.Result,
new TextPayload(Loc.Localize("DalamudInstallerHelp", "Open the plugin installer")),
RawPayload.LinkTerminator,
new UIForegroundPayload(0),

View file

@ -19,6 +19,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Support;
using ImGuiNET;
using Lumina.Excel.Sheets;
@ -28,8 +29,6 @@ using Windows.Win32.Storage.FileSystem;
using Windows.Win32.System.Memory;
using Windows.Win32.System.Ole;
using Dalamud.Interface.Utility.Raii;
using static TerraFX.Interop.Windows.Windows;
using Win32_PInvoke = Windows.Win32.PInvoke;
@ -139,11 +138,11 @@ public static class Util
public static string GetScmVersion()
{
if (scmVersionInternal != null) return scmVersionInternal;
var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value
return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value
?? asm.GetName().Version!.ToString();
}
@ -853,7 +852,7 @@ public static class Util
// ignore
}
}
/// <summary>
/// Print formatted IGameObject Information to ImGui.
/// </summary>
@ -1051,7 +1050,8 @@ public static class Util
}
}
private static unsafe void ShowSpanEntryPrivate<T>(ulong addr, IList<string> path, int offset, Span<T> spanobj) {
private static unsafe void ShowSpanEntryPrivate<T>(ulong addr, IList<string> path, int offset, Span<T> spanobj)
{
const int batchSize = 20;
if (spanobj.Length > batchSize)
{
@ -1221,6 +1221,7 @@ public static class Util
ImGui.TextDisabled($"[0x{offset.Value:X}]");
ImGui.SameLine();
}
ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}");
}