Tweak UI elements
authorLiza Carvelli <liza@carvel.li>
Tue, 19 Aug 2025 14:49:41 +0000 (16:49 +0200)
committerLiza Carvelli <liza@carvel.li>
Tue, 19 Aug 2025 14:49:41 +0000 (16:49 +0200)
Questionable/Windows/QuestComponents/ARealmRebornComponent.cs
Questionable/Windows/QuestComponents/ActiveQuestComponent.cs
Questionable/Windows/QuestComponents/EventInfoComponent.cs
Questionable/Windows/QuestComponents/QuickAccessButtonsComponent.cs
Questionable/Windows/UiUtils.cs

index e4f8b8b..5a8e65b 100644 (file)
@@ -1,4 +1,5 @@
 using System.Linq;
+using Dalamud.Bindings.ImGui;
 using Dalamud.Interface;
 using Dalamud.Interface.Colors;
 using Dalamud.Interface.Utility.Raii;
@@ -59,7 +60,7 @@ internal sealed class ARealmRebornComponent
         foreach (var instanceId in RequiredPrimalInstances)
         {
             (Vector4 color, FontAwesomeIcon icon) = UiUtils.GetInstanceStyle(instanceId);
-            _uiUtils.ChecklistItem(_territoryData.GetInstanceName(instanceId) ?? "?", color, icon);
+            _uiUtils.ChecklistItem(_territoryData.GetInstanceName(instanceId) ?? "?", color, icon, ImGui.GetStyle().FramePadding.X);
         }
     }
 
@@ -78,7 +79,7 @@ internal sealed class ARealmRebornComponent
         foreach (var questId in QuestData.CrystalTowerQuests)
         {
             (Vector4 color, FontAwesomeIcon icon, _) = _uiUtils.GetQuestStyle(questId);
-            _uiUtils.ChecklistItem(_questData.GetQuestInfo(questId).Name, color, icon);
+            _uiUtils.ChecklistItem(_questData.GetQuestInfo(questId).Name, color, icon, ImGui.GetStyle().FramePadding.X);
         }
     }
 }
index c9857aa..e4a320b 100644 (file)
@@ -331,27 +331,28 @@ internal sealed partial class ActiveQuestComponent
     private void DrawQuestButtons(QuestController.QuestProgress currentQuest, QuestStep? currentStep,
         QuestProgressInfo? questProgressInfo, bool isMinimized)
     {
-        ImGui.BeginDisabled(_questController.IsRunning);
-        if (ImGuiComponents.IconButton(FontAwesomeIcon.Play))
+        using (ImRaii.Disabled(_questController.IsRunning))
         {
-            // if we haven't accepted this quest, mark it as next quest so that we can optionally use aetherytes to travel
-            if (questProgressInfo == null)
-                _questController.SetNextQuest(currentQuest.Quest);
-
-            _questController.Start("UI start");
-        }
+            if (ImGuiComponents.IconButton(FontAwesomeIcon.Play))
+            {
+                // if we haven't accepted this quest, mark it as next quest so that we can optionally use aetherytes to travel
+                if (questProgressInfo == null)
+                    _questController.SetNextQuest(currentQuest.Quest);
 
-        if (!isMinimized)
-        {
-            ImGui.SameLine();
+                _questController.Start("UI start");
+            }
 
-            if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.StepForward, "Step"))
+            if (!isMinimized)
             {
-                _questController.StartSingleStep("UI step");
+                ImGui.SameLine();
+
+                if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.StepForward, "Step"))
+                {
+                    _questController.StartSingleStep("UI step");
+                }
             }
         }
 
-        ImGui.EndDisabled();
         ImGui.SameLine();
 
         if (ImGuiComponents.IconButton(FontAwesomeIcon.Stop))
@@ -376,28 +377,29 @@ internal sealed partial class ActiveQuestComponent
                            && currentStep.InteractionType == EInteractionType.Instruction
                            && _questController.HasCurrentTaskMatching<WaitAtEnd.WaitNextStepOrSequence>(out _);
 
-            ImGui.BeginDisabled(lastStep);
-            if (colored)
-                ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.ParsedGreen);
-            if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.ArrowCircleRight, "Skip"))
+            using (ImRaii.Disabled(lastStep))
             {
-                _movementController.Stop();
-                _questController.Skip(currentQuest.Quest.Id, currentQuest.Sequence);
-            }
-
-            if (colored)
-                ImGui.PopStyleColor();
-            ImGui.EndDisabled();
+                using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedGreen, colored))
+                {
+                    if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.ArrowCircleRight, "Skip"))
+                    {
+                        _movementController.Stop();
+                        _questController.Skip(currentQuest.Quest.Id, currentQuest.Sequence);
+                    }
 
-            ImGui.SameLine();
-            if (ImGuiComponents.IconButton(FontAwesomeIcon.SortAmountDown))
-                _priorityWindow.ToggleOrUncollapse();
+                    if (ImGui.IsItemHovered())
+                        ImGui.SetTooltip("Skip the current step of the quest path.");
+                }
+            }
 
             if (_commandManager.Commands.ContainsKey("/questinfo"))
             {
                 ImGui.SameLine();
                 if (ImGuiComponents.IconButton(FontAwesomeIcon.Atlas))
                     _commandManager.ProcessCommand($"/questinfo {currentQuest.Quest.Id}");
+
+                if (ImGui.IsItemHovered())
+                    ImGui.SetTooltip($"Show information about '{currentQuest.Quest.Info.Name}' in Quest Map plugin.");
             }
         }
     }
index 89efbe4..1152c3e 100644 (file)
@@ -7,7 +7,6 @@ using Dalamud.Bindings.ImGui;
 using Dalamud.Interface;
 using Dalamud.Interface.Components;
 using Dalamud.Interface.Utility.Raii;
-using Dalamud.Plugin;
 using Humanizer;
 using Humanizer.Localisation;
 using Questionable.Controller;
@@ -34,11 +33,14 @@ internal sealed class EventInfoComponent
     private readonly QuestController _questController;
     private readonly QuestTooltipComponent _questTooltipComponent;
     private readonly Configuration _configuration;
-    private readonly IDalamudPluginInterface _pluginInterface;
 
-    public EventInfoComponent(QuestData questData, QuestRegistry questRegistry, QuestFunctions questFunctions,
-        UiUtils uiUtils, QuestController questController, QuestTooltipComponent questTooltipComponent,
-        Configuration configuration, IDalamudPluginInterface pluginInterface)
+    public EventInfoComponent(QuestData questData,
+        QuestRegistry questRegistry,
+        QuestFunctions questFunctions,
+        UiUtils uiUtils,
+        QuestController questController,
+        QuestTooltipComponent questTooltipComponent,
+        Configuration configuration)
     {
         _questData = questData;
         _questRegistry = questRegistry;
@@ -47,7 +49,6 @@ internal sealed class EventInfoComponent
         _questController = questController;
         _questTooltipComponent = questTooltipComponent;
         _configuration = configuration;
-        _pluginInterface = pluginInterface;
     }
 
     [SuppressMessage("ReSharper", "UnusedMember.Local")]
@@ -81,22 +82,12 @@ internal sealed class EventInfoComponent
         else
             ImGui.Text(eventQuest.Name);
 
-        float width;
-        using (var _ = _pluginInterface.UiBuilder.IconFontHandle.Push())
-            width = ImGui.CalcTextSize(FontAwesomeIcon.Play.ToIconString()).X + ImGui.GetStyle().FramePadding.X;
-
-        using (var _ = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
-            width -= ImGui.CalcTextSize(FontAwesomeIcon.Check.ToIconString()).X;
-
         List<ElementId> startableQuests = eventQuest.QuestIds.Where(x =>
                 _questRegistry.IsKnownQuest(x) &&
                 _questFunctions.IsReadyToAcceptQuest(x) &&
                 x != _questController.StartedQuest?.Quest.Id &&
                 x != _questController.NextQuest?.Quest.Id)
             .ToList();
-        if (startableQuests.Count == 0)
-            width = 0;
-
         foreach (var questId in eventQuest.QuestIds)
         {
             if (_questFunctions.IsQuestComplete(questId))
@@ -126,8 +117,7 @@ internal sealed class EventInfoComponent
                 }
                 else
                 {
-                    if (width > 0)
-                        ImGui.SetCursorPosX(ImGui.GetCursorPosX() + width);
+                    ImGui.SetCursorPosX(ImGui.GetCursorPosX());
 
                     var style = _uiUtils.GetQuestStyle(questId);
                     if (_uiUtils.ChecklistItem(questName, style.Color, style.Icon, ImGui.GetStyle().FramePadding.X))
index 949647f..8cdf38a 100644 (file)
@@ -18,6 +18,7 @@ internal sealed class QuickAccessButtonsComponent
     private readonly QuestRegistry _questRegistry;
     private readonly QuestValidationWindow _questValidationWindow;
     private readonly JournalProgressWindow _journalProgressWindow;
+    private readonly PriorityWindow _priorityWindow;
     private readonly ICommandManager _commandManager;
     private readonly IDalamudPluginInterface _pluginInterface;
 
@@ -25,12 +26,14 @@ internal sealed class QuickAccessButtonsComponent
         QuestRegistry questRegistry,
         QuestValidationWindow questValidationWindow,
         JournalProgressWindow journalProgressWindow,
+        PriorityWindow priorityWindow,
         ICommandManager commandManager,
         IDalamudPluginInterface pluginInterface)
     {
         _questRegistry = questRegistry;
         _questValidationWindow = questValidationWindow;
         _journalProgressWindow = journalProgressWindow;
+        _priorityWindow = priorityWindow;
         _commandManager = commandManager;
         _pluginInterface = pluginInterface;
     }
@@ -39,42 +42,69 @@ internal sealed class QuickAccessButtonsComponent
 
     public void Draw()
     {
-        if (_commandManager.Commands.ContainsKey("/vnav"))
+        DrawQuestPriorityButton();
+        ImGui.SameLine();
+        DrawRebuildNavmeshButton();
+
+        DrawReloadDataButton();
+        ImGui.SameLine();
+        DrawJournalProgressButton();
+
+        if (_questRegistry.ValidationIssueCount > 0)
         {
-            using (var unused = ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
-            {
-                if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
-                    _commandManager.ProcessCommand("/vnav rebuild");
-            }
+            ImGui.SameLine();
+            DrawValidationIssuesButton();
+        }
+    }
+
+    private void DrawQuestPriorityButton()
+    {
+        if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Exclamation, "Priority Quests"))
+            _priorityWindow.ToggleOrUncollapse();
+
+        if (ImGui.IsItemHovered())
+            ImGui.SetTooltip("Configure priority quests which will be done as soon as possible.");
+    }
+
+    private void DrawRebuildNavmeshButton()
+    {
+        bool isNavmeshAvailable = _commandManager.Commands.ContainsKey("/vnav");
+        using (ImRaii.Disabled(!isNavmeshAvailable || !ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
+        {
+            if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
+                _commandManager.ProcessCommand("/vnav rebuild");
+        }
 
-            if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
+        if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
+        {
+            if (!isNavmeshAvailable)
+                ImGui.SetTooltip("vnavmesh is not available.\nPlease install it first.");
+            else
                 ImGui.SetTooltip("Hold CTRL to enable this button.\nRebuilding the navmesh will take some time.");
         }
+    }
 
+    private void DrawReloadDataButton()
+    {
         if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.RedoAlt, "Reload Data"))
             Reload?.Invoke(this, EventArgs.Empty);
+    }
 
-        ImGui.SameLine();
+    private void DrawJournalProgressButton()
+    {
         if (ImGuiComponents.IconButton(FontAwesomeIcon.BookBookmark))
             _journalProgressWindow.IsOpenAndUncollapsed = true;
+
         if (ImGui.IsItemHovered())
             ImGui.SetTooltip("Journal Progress");
-
-
-        if (_questRegistry.ValidationIssueCount > 0)
-        {
-            ImGui.SameLine();
-            if (DrawValidationIssuesButton())
-                _questValidationWindow.IsOpenAndUncollapsed = true;
-        }
     }
 
-    private bool DrawValidationIssuesButton()
+    private void DrawValidationIssuesButton()
     {
         int errorCount = _questRegistry.ValidationErrorCount;
         int infoCount = _questRegistry.ValidationIssueCount - _questRegistry.ValidationErrorCount;
         if (errorCount == 0 && infoCount == 0)
-            return false;
+            return;
 
         int partsToRender = errorCount == 0 || infoCount == 0 ? 1 : 2;
         using var id = ImRaii.PushId("validationissues");
@@ -133,6 +163,7 @@ internal sealed class QuickAccessButtonsComponent
             dl.AddText(position, ImGui.GetColorU32(ImGuiCol.Text), text2);
         }
 
-        return button;
+        if (button)
+            _questValidationWindow.IsOpenAndUncollapsed = true;
     }
 }
index 5cf1ba2..ad582bd 100644 (file)
@@ -55,10 +55,11 @@ internal sealed class UiUtils
 
     public bool ChecklistItem(string text, Vector4 color, FontAwesomeIcon icon, float extraPadding = 0)
     {
+        if (extraPadding > 0)
+            ImGui.SetCursorPosX(ImGui.GetCursorPosX() + extraPadding);
+
         using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
-        {
             ImGui.TextColored(color, icon.ToIconString());
-        }
 
         bool hover = ImGui.IsItemHovered();