Skip to content

Commit 540d0ce

Browse files
Merge pull request #37 from PassiveModding/feature/update-window
Add update window on new version install
2 parents 41a780c + f96ad1a commit 540d0ce

File tree

9 files changed

+178
-15
lines changed

9 files changed

+178
-15
lines changed

Meddle/Meddle.Plugin/Plugin.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Meddle.Plugin.Models;
77
using Meddle.Plugin.Services;
88
using Meddle.Plugin.UI.Layout;
9+
using Meddle.Plugin.UI.Windows;
910
using Meddle.Plugin.Utils;
1011
using Meddle.Utils.Files.SqPack;
1112
using Microsoft.Extensions.DependencyInjection;
@@ -159,6 +160,7 @@ public void Migrate()
159160

160161
public LayoutWindow.LayoutConfig LayoutConfig { get; set; } = new();
161162
public ExportConfiguration ExportConfig { get; set; } = new();
163+
public UpdateWindow.UpdateConfig UpdateConfig { get; set; } = new();
162164

163165
public class ExportConfiguration
164166
{

Meddle/Meddle.Plugin/ServiceUtility.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static IServiceCollection AddUi(this IServiceCollection services)
2626
.AddSingleton<MainWindow>()
2727
.AddSingleton<DebugWindow>()
2828
.AddSingleton<LayoutWindow>()
29+
.AddSingleton<UpdateWindow>()
2930
.AddSingleton<MdlMaterialWindowManager>()
3031
.AddSingleton(new WindowSystem("Meddle"))
3132
.AddHostedService<WindowManager>();

Meddle/Meddle.Plugin/Services/LayoutService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Lumina.Excel.Sheets;
1313
using Meddle.Plugin.Models.Layout;
1414
using Meddle.Plugin.Models.Structs;
15+
using Meddle.Plugin.Utils;
1516
using Microsoft.Extensions.Logging;
1617
using HousingFurniture = FFXIVClientStructs.FFXIV.Client.Game.HousingFurniture;
1718
using Object = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.Object;

Meddle/Meddle.Plugin/UI/AboutTab.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void Draw()
3131
{
3232
Process.Start(new ProcessStartInfo
3333
{
34-
FileName = "https://github.com/PassiveModding/Meddle/", UseShellExecute = true
34+
FileName = Constants.MeddleUrl, UseShellExecute = true
3535
});
3636
}
3737
}
@@ -43,7 +43,7 @@ public void Draw()
4343
{
4444
Process.Start(new ProcessStartInfo
4545
{
46-
FileName = "https://github.com/PassiveModding/Meddle/issues", UseShellExecute = true
46+
FileName = Constants.MeddleBugReportUrl, UseShellExecute = true
4747
});
4848
}
4949

@@ -60,7 +60,7 @@ public void Draw()
6060
{
6161
Process.Start(new ProcessStartInfo
6262
{
63-
FileName = "https://github.com/PassiveModding/MeddleTools/", UseShellExecute = true
63+
FileName = Constants.MeddleToolsUrl, UseShellExecute = true
6464
});
6565
}
6666
}
@@ -121,16 +121,13 @@ public void Draw()
121121

122122
private static List<(string, string, string)> UserCredits =>
123123
[
124-
("PassiveModding", "Developer", "https://github.com/PassiveModding/Meddle"),
125-
("Asriel", "GPU/DX11 data handling, shape and attribute logic, attach work, skeleton traversal",
126-
"https://github.com/WorkingRobot")
124+
("PassiveModding", "Developer", Constants.MeddleUrl),
125+
("Asriel", "GPU/DX11 data handling, shape and attribute logic, attach work, skeleton traversal", "https://github.com/WorkingRobot")
127126
];
128127

129128
private static List<(string, string, string)> ProjectCredits =>
130129
[
131-
("Xande", "Base for the plugin, PBD file structure, meshbuilder, racedeformer, havok research",
132-
"https://github.com/xivdev/Xande"),
133-
130+
("Xande", "Base for the plugin, PBD file structure, meshbuilder, racedeformer, havok research", "https://github.com/xivdev/Xande"),
134131
("Penumbra", "Shader logic, vertex info, spanbinaryreader impl.", "https://github.com/xivdev/Penumbra"),
135132
("Lumina", "File structures", "https://github.com/NotAdam/Lumina/"),
136133
("Pathfinder", "World overlay reference design.", "https://github.com/chirpxiv/ffxiv-pathfinder")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace Meddle.Plugin.UI;
2+
3+
public class Constants
4+
{
5+
public const string KoFiUrl = "https://ko-fi.com/ramen_au";
6+
public const string CarrdUrl = "https://meddle.carrd.co/";
7+
public const string DiscordUrl = "https://discord.gg/2jnZMNVM4p";
8+
public const string MeddleToolsUrl = "https://github.com/PassiveModding/MeddleTools";
9+
public const string MeddleUrl = "https://github.com/PassiveModding/Meddle";
10+
public const string MeddleBugReportUrl = "https://github.com/PassiveModding/Meddle/issues";
11+
}

Meddle/Meddle.Plugin/UI/OptionsTab.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ public void Draw()
6868
config.Save();
6969
}
7070

71+
var update = config.UpdateConfig.ShowUpdateWindow;
72+
if (ImGui.Checkbox("Show Update Window when a new version is loaded", ref update))
73+
{
74+
config.UpdateConfig.ShowUpdateWindow = update;
75+
config.Save();
76+
}
77+
7178
ImGui.Separator();
7279

7380
// DrawExportType();

Meddle/Meddle.Plugin/UI/Windows/MainWindow.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ public sealed class MainWindow : MeddleWindowBase
1414
private readonly ILogger<MainWindow> log;
1515
private readonly DebugWindow debugWindow;
1616
private readonly LayoutWindow layoutWindow;
17+
private readonly UpdateWindow updateWindow;
1718
private readonly ITab[] tabs;
1819

19-
public MainWindow(IEnumerable<ITab> tabs, ILogger<MainWindow> log, DebugWindow debugWindow, LayoutWindow layoutWindow) :
20+
public MainWindow(IEnumerable<ITab> tabs, ILogger<MainWindow> log, DebugWindow debugWindow, LayoutWindow layoutWindow, UpdateWindow updateWindow) :
2021
base(log, "Meddle", ImGuiWindowFlags.MenuBar)
2122
{
2223
this.tabs = tabs.OrderBy(x => x.Order).Where(x => x.MenuType == MenuType.Default).ToArray();
2324
this.log = log;
2425
this.debugWindow = debugWindow;
2526
this.layoutWindow = layoutWindow;
27+
this.updateWindow = updateWindow;
2628
SizeConstraints = new WindowSizeConstraints
2729
{
2830
MinimumSize = new Vector2(375, 350),
@@ -59,34 +61,39 @@ protected override void BeforeDraw()
5961
{
6062
Process.Start(new ProcessStartInfo
6163
{
62-
FileName = "https://github.com/PassiveModding/MeddleTools", UseShellExecute = true
64+
FileName = Constants.MeddleToolsUrl, UseShellExecute = true
6365
});
6466
}
6567

6668
if (ImGui.MenuItem("Github"))
6769
{
6870
Process.Start(new ProcessStartInfo
6971
{
70-
FileName = "https://github.com/PassiveModding/Meddle", UseShellExecute = true
72+
FileName = Constants.MeddleUrl, UseShellExecute = true
7173
});
7274
}
7375

7476
if (ImGui.MenuItem("Bug Report"))
7577
{
7678
Process.Start(new ProcessStartInfo
7779
{
78-
FileName = "https://github.com/PassiveModding/Meddle/issues", UseShellExecute = true
80+
FileName = Constants.MeddleBugReportUrl, UseShellExecute = true
7981
});
8082
}
8183

84+
if (ImGui.MenuItem("Updates"))
85+
{
86+
updateWindow.IsOpen = true;
87+
}
88+
8289
using (ImRaii.PushFont(UiBuilder.IconFont))
8390
using (ImRaii.PushColor(ImGuiCol.Text, new Vector4(0.8f, 0, 0, 1)))
8491
{
8592
if (ImGui.MenuItem(FontAwesomeIcon.Heart.ToIconString()))
8693
{
8794
Process.Start(new ProcessStartInfo
8895
{
89-
FileName = "https://ko-fi.com/ramen_au", UseShellExecute = true
96+
FileName = Constants.KoFiUrl, UseShellExecute = true
9097
});
9198
}
9299
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
using System.Diagnostics;
2+
using System.Reflection;
3+
using Dalamud.Interface.Windowing;
4+
using ImGuiNET;
5+
6+
namespace Meddle.Plugin.UI.Windows;
7+
8+
public class UpdateWindow : Window
9+
{
10+
private readonly Configuration config;
11+
public UpdateWindow(Configuration config) : base("Updates", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
12+
{
13+
this.config = config;
14+
SizeConstraints = new WindowSizeConstraints
15+
{
16+
MinimumSize = new System.Numerics.Vector2(400, 300),
17+
MaximumSize = new System.Numerics.Vector2(800, 600)
18+
};
19+
}
20+
21+
public static readonly List<UpdateLog> UpdateLogs =
22+
[
23+
new()
24+
{
25+
Tag = "Camera Exports Support",
26+
Date = "2025-06-05",
27+
Changes =
28+
[
29+
new TextUpdateLine(" + Added support for exporting cameras from the layout tab."),
30+
new TextUpdateLine(" + Added this update window (Can be disabled from Options)."),
31+
new TextUpdateLine(" + Fix obj export failing in come circumstances."),
32+
new TextUpdateLine(" + Fix name override being ignored in some cases."),
33+
]
34+
}
35+
];
36+
37+
public class UpdateLog
38+
{
39+
public string Tag { get; set; } = string.Empty;
40+
public string Date { get; set; } = string.Empty;
41+
public IUpdateLine[] Changes { get; set; } = [];
42+
}
43+
44+
public interface IUpdateLine
45+
{
46+
public void Draw();
47+
}
48+
49+
public record TextUpdateLine(string Text) : IUpdateLine
50+
{
51+
public void Draw()
52+
{
53+
ImGui.Text(Text);
54+
}
55+
}
56+
57+
public class UpdateConfig
58+
{
59+
public string? LastSeenUpdateTag { get; set; } = null;
60+
public bool ShowUpdateWindow { get; set; } = true;
61+
}
62+
63+
public override void OnOpen()
64+
{
65+
if (config.UpdateConfig.LastSeenUpdateTag != UpdateLogs.LastOrDefault()?.Tag)
66+
{
67+
config.UpdateConfig.LastSeenUpdateTag = UpdateLogs.LastOrDefault()?.Tag;
68+
config.Save();
69+
}
70+
71+
base.OnOpen();
72+
}
73+
74+
public override void Draw()
75+
{
76+
ImGui.Text("Meddle Version: " + Assembly.GetExecutingAssembly().GetName().Version);
77+
ImGui.Separator();
78+
79+
if (ImGui.Button("Carrd"))
80+
{
81+
Process.Start(new ProcessStartInfo
82+
{
83+
FileName = Constants.CarrdUrl,
84+
UseShellExecute = true
85+
});
86+
}
87+
88+
ImGui.SameLine();
89+
90+
if (ImGui.Button("Ko-fi"))
91+
{
92+
Process.Start(new ProcessStartInfo
93+
{
94+
FileName = Constants.KoFiUrl,
95+
UseShellExecute = true
96+
});
97+
}
98+
99+
ImGui.SameLine();
100+
101+
if (ImGui.Button("Discord"))
102+
{
103+
Process.Start(new ProcessStartInfo
104+
{
105+
FileName = Constants.DiscordUrl,
106+
UseShellExecute = true
107+
});
108+
}
109+
110+
ImGui.Separator();
111+
112+
for (var i = UpdateLogs.Count - 1; i >= 0; i--)
113+
{
114+
var update = UpdateLogs[i];
115+
if (ImGui.CollapsingHeader($"{update.Tag} - {update.Date}", ImGuiTreeNodeFlags.DefaultOpen))
116+
{
117+
foreach (var change in update.Changes)
118+
{
119+
ImGui.Indent();
120+
change.Draw();
121+
ImGui.Unindent();
122+
}
123+
}
124+
}
125+
}
126+
}

Meddle/Meddle.Plugin/UI/Windows/WindowManager.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ public class WindowManager : IHostedService, IDisposable
1919
private readonly DebugWindow debugWindow;
2020
private readonly LayoutWindow layoutWindow;
2121
private readonly WindowSystem windowSystem;
22-
22+
private readonly UpdateWindow updateWindow;
23+
2324
private bool disposed;
2425

2526
public WindowManager(
2627
MainWindow mainWindow,
2728
DebugWindow debugWindow,
2829
LayoutWindow layoutWindow,
2930
WindowSystem windowSystem,
31+
UpdateWindow updateWindow,
3032
IDalamudPluginInterface pluginInterface,
3133
ILogger<WindowManager> log,
3234
Configuration config,
@@ -40,6 +42,7 @@ public WindowManager(
4042
this.debugWindow = debugWindow;
4143
this.layoutWindow = layoutWindow;
4244
this.windowSystem = windowSystem;
45+
this.updateWindow = updateWindow;
4346
}
4447

4548
public void Dispose()
@@ -62,6 +65,7 @@ public Task StartAsync(CancellationToken cancellationToken)
6265
{
6366
windowSystem.AddWindow(mainWindow);
6467
windowSystem.AddWindow(debugWindow);
68+
windowSystem.AddWindow(updateWindow);
6569

6670
config.OnConfigurationSaved += OnSave;
6771
pluginInterface.UiBuilder.Draw += windowSystem.Draw;
@@ -83,6 +87,13 @@ public Task StartAsync(CancellationToken cancellationToken)
8387
OpenDebugUi();
8488
}
8589

90+
if (config.UpdateConfig.ShowUpdateWindow &&
91+
config.UpdateConfig.LastSeenUpdateTag != UpdateWindow.UpdateLogs.LastOrDefault()?.Tag)
92+
{
93+
updateWindow.IsOpen = true;
94+
updateWindow.BringToFront();
95+
}
96+
8697
// if (config.OpenLayoutMenuOnLoad)
8798
// {
8899
// OpenLayoutUi();

0 commit comments

Comments
 (0)