Skip to content

Commit

Permalink
Add donate links to title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Nov 28, 2024
1 parent 127fa43 commit 8451572
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Craftimizer/ImGuiUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ public static unsafe void Hyperlink(string text, string url, bool underline = tr
{
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
Dalamud.Utility.Util.OpenLink(url);
var urlWithoutScheme = url;
if (Uri.TryCreate(url, UriKind.Absolute, out var uri))
urlWithoutScheme = uri.Host + (string.Equals(uri.PathAndQuery, "/", StringComparison.Ordinal) ? string.Empty : uri.PathAndQuery);
Expand Down
1 change: 1 addition & 0 deletions Craftimizer/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public sealed class Plugin : IDalamudPlugin
public string Author { get; }
public string BuildConfiguration { get; }
public ILoadedTextureIcon Icon { get; }
public const string SupportLink = "https://ko-fi.com/camora";

public WindowSystem WindowSystem { get; }
public Settings SettingsWindow { get; }
Expand Down
7 changes: 7 additions & 0 deletions Craftimizer/Windows/MacroEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Sim = Craftimizer.Simulator.Simulator;
using SimNoRandom = Craftimizer.Simulator.SimulatorNoRandom;
using Recipe = Lumina.Excel.Sheets.Recipe;
using Dalamud.Utility;

namespace Craftimizer.Windows;

Expand Down Expand Up @@ -147,6 +148,12 @@ public MacroEditor(CharacterStats characterStats, RecipeData recipeData, Crafter
IconOffset = new(2, 1),
Click = _ => Service.Plugin.OpenSettingsTab("Macro Editor"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Settings")
},
new() {
Icon = FontAwesomeIcon.Heart,
IconOffset = new(2, 1),
Click = _ => Util.OpenLink(Plugin.Plugin.SupportLink),
ShowTooltip = () => ImGuiUtils.Tooltip("Support me on Ko-fi!")
}
];

Expand Down
7 changes: 7 additions & 0 deletions Craftimizer/Windows/MacroList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Numerics;
using Sim = Craftimizer.Simulator.SimulatorNoRandom;
using Dalamud.Interface.Utility;
using Dalamud.Utility;

namespace Craftimizer.Windows;

Expand Down Expand Up @@ -45,6 +46,12 @@ public MacroList() : base("Craftimizer Macro List", WindowFlags, false)
IconOffset = new(2, 1),
Click = _ => Service.Plugin.OpenSettingsTab("General"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Settings")
},
new() {
Icon = FontAwesomeIcon.Heart,
IconOffset = new(2, 1),
Click = _ => Util.OpenLink(Plugin.Plugin.SupportLink),
ShowTooltip = () => ImGuiUtils.Tooltip("Support me on Ko-fi!")
}
];

Expand Down
6 changes: 6 additions & 0 deletions Craftimizer/Windows/RecipeNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public RecipeNote() : base(WindowNamePinned)
IconOffset = new(2, 1),
Click = _ => Service.Plugin.OpenSettingsTab("Crafting Log"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Settings")
},
new() {
Icon = FontAwesomeIcon.Heart,
IconOffset = new(2, 1),
Click = _ => Util.OpenLink(Plugin.Plugin.SupportLink),
ShowTooltip = () => ImGuiUtils.Tooltip("Support me on Ko-fi!")
}
];

Expand Down
2 changes: 1 addition & 1 deletion Craftimizer/Windows/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ private void DrawTabAbout()
ImGuiUtils.AlignCentered(ImGui.CalcTextSize($"Support me on Ko-fi!").X);
ImGui.TextUnformatted($"Support me on ");
ImGui.SameLine(0, 0);
ImGuiUtils.Hyperlink("Ko-fi", "https://ko-fi.com/camora");
ImGuiUtils.Hyperlink("Ko-fi", Plugin.SupportLink);
ImGui.SameLine(0, 0);
ImGui.TextUnformatted("!");
}
Expand Down
7 changes: 7 additions & 0 deletions Craftimizer/Windows/SynthHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.UI;
Expand Down Expand Up @@ -94,6 +95,12 @@ public SynthHelper() : base(WindowNamePinned)
IconOffset = new(2, 1),
Click = _ => Service.Plugin.OpenSettingsTab("Synthesis Helper"),
ShowTooltip = () => ImGuiUtils.Tooltip("Open Settings")
},
new() {
Icon = FontAwesomeIcon.Heart,
IconOffset = new(2, 1),
Click = _ => Util.OpenLink(Plugin.Plugin.SupportLink),
ShowTooltip = () => ImGuiUtils.Tooltip("Support me on Ko-fi!")
}
];

Expand Down

1 comment on commit 8451572

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8451572 Previous: f89203a Ratio
Craftimizer.Benchmark.Bench.Solve(State: 27B238C9, Config: C7C70442) 78053007.14285715 ns (± 602574.1837053193)
Craftimizer.Benchmark.Bench.Solve(State: 33A0A76A, Config: C7C70442) 99911252.38095239 ns (± 526636.3391891795)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.