Add changelog tab

This commit is contained in:
Infi
2024-05-22 03:39:31 +02:00
parent e19682e50d
commit c91858183a
8 changed files with 159 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.25.1</Version>
<Version>1.25.2</Version>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
+31
View File
@@ -21,3 +21,34 @@ tags:
- UI
- Chat
- Replacement
changelog: |-
**New**
- Changelog tab
- Shows the latest changelog
- Has an option to disable printing of changelogs to chat
**Message Preview**
- Message preview has now its own config tab
- Added a new position: Tooltip
- Shows up while hovering the input box
- This won't support the letter selection or any of the hover features
- Added option to set a minimum length before message preview appears
- Added option to only show preview if special parameter are used (<item>, emotes...)
- Selectable letters in message preview
- Click on any letter and the text cursor will jump to its position
- Better word wrapping in message preview
**Fixes**
- Prevent rare null reference on plugin load
- Prevent null strings from being parsed
- Parsing of emotes works with punctuation and non latin letters surrounding it
**Future Updates**
- Message preview will receive numerous features over the next weeks
- More parameter will be supported (<t> ...)
- Better customization (Position it anywhere)
- Feedback is always welcome
- If you want to disable this feature all together, visit the Preview tab in your config
- Fix for dalamuds welcome messages getting shuffled
- Message history viewer, going above the 10,000 that chat2 can display at once
+2
View File
@@ -25,6 +25,7 @@ internal class Configuration : IPluginConfiguration
public bool HideSameTimestamps;
public bool ShowNoviceNetwork;
public bool SidebarTabView;
public bool PrintChangelog = true;
public bool OnlyPreviewIf;
public int PreviewMinimum = 1;
public PreviewPosition PreviewPosition = PreviewPosition.Inside;
@@ -81,6 +82,7 @@ internal class Configuration : IPluginConfiguration
HideSameTimestamps = other.HideSameTimestamps;
ShowNoviceNetwork = other.ShowNoviceNetwork;
SidebarTabView = other.SidebarTabView;
PrintChangelog = other.PrintChangelog;
OnlyPreviewIf = other.OnlyPreviewIf;
PreviewMinimum = other.PreviewMinimum;
PreviewPosition = other.PreviewPosition;
+3 -2
View File
@@ -4,6 +4,7 @@ using ChatTwo.Util;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using System.Text.RegularExpressions;
using Dalamud.Game.Text;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using LiteDB;
@@ -292,7 +293,7 @@ internal partial class Message
? Plugin.DataManager.GetExcelSheet<Item>()!.GetRow(item.ItemID)!.Name.ToString()
: Plugin.DataManager.GetExcelSheet<EventItem>()!.GetRow(item.ItemID)!.Name.ToString();
var link = new ItemPayload(item.ItemID, kind, name);
var link = new ItemPayload(item.ItemID, kind, $"{SeIconChar.LinkMarker.ToIconChar()}{name}");
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, link.DisplayName ?? "Unknown"));
}
else
@@ -309,7 +310,7 @@ internal partial class Message
var rawY = (int)(MathF.Round(mapCoords.YFloat, 3, MidpointRounding.AwayFromZero) * 1000);
var link = new MapLinkPayload(mapCoords.TerritoryId, mapCoords.MapId, rawX, rawY);
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, $"{link.PlaceName} {link.CoordinateString}"));
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, $"{SeIconChar.LinkMarker.ToIconChar()}{link.PlaceName} {link.CoordinateString}"));
}
}
+50 -5
View File
@@ -1598,6 +1598,24 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Changelog:.
/// </summary>
internal static string Options_Changelog_Header {
get {
return ResourceManager.GetString("Options_Changelog_Header", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Changelog.
/// </summary>
internal static string Options_Changelog_Tab {
get {
return ResourceManager.GetString("Options_Changelog_Tab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import from game.
/// </summary>
@@ -2175,7 +2193,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Keeps the input focus, even if you enter battle or do other actions.
/// Looks up a localized string similar to Keeps the input focus, even if you enter battle or do other actions..
/// </summary>
internal static string Options_KeepInputFocus_Description {
get {
@@ -2400,7 +2418,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Displays a preview with special parameter evaluated, like emotes and &lt;item&gt;.
/// Looks up a localized string similar to Displays a preview with special parameter evaluated, like emotes and &lt;item&gt;..
/// </summary>
internal static string Options_Preview_Description {
get {
@@ -2472,7 +2490,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Only show if the text length is greater-than or equal.
/// Looks up a localized string similar to Only show if the text length is greater-than or equal..
/// </summary>
internal static string Options_PreviewMinimum_Description {
get {
@@ -2490,7 +2508,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Only show if the text contains special parameter.
/// Looks up a localized string similar to Only show if the text contains special parameter..
/// </summary>
internal static string Options_PreviewOnlyIf_Description {
get {
@@ -2508,7 +2526,25 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Replaces words with their emote version, currently supports BetterTTV.
/// Looks up a localized string similar to Print the changelog to chat after an update..
/// </summary>
internal static string Options_PrintChangelog_Description {
get {
return ResourceManager.GetString("Options_PrintChangelog_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Print changelog.
/// </summary>
internal static string Options_PrintChangelog_Name {
get {
return ResourceManager.GetString("Options_PrintChangelog_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Replaces words with their emote version, currently supports BetterTTV..
/// </summary>
internal static string Options_ShowEmotes_Desc {
get {
@@ -2840,6 +2876,15 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to This feature isn&apos;t implemented yet.
/// </summary>
internal static string Options_Warning_NotImplemented {
get {
return ResourceManager.GetString("Options_Warning_NotImplemented", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Window opacity.
/// </summary>
+20 -5
View File
@@ -1016,13 +1016,13 @@
<value>Keep input focus</value>
</data>
<data name="Options_KeepInputFocus_Description" xml:space="preserve">
<value>Keeps the input focus, even if you enter battle or do other actions</value>
<value>Keeps the input focus, even if you enter battle or do other actions.</value>
</data>
<data name="Options_ShowEmotes_Name" xml:space="preserve">
<value>Show emotes</value>
</data>
<data name="Options_ShowEmotes_Desc" xml:space="preserve">
<value>Replaces words with their emote version, currently supports BetterTTV</value>
<value>Replaces words with their emote version, currently supports BetterTTV.</value>
</data>
<data name="Options_Emote_Tab" xml:space="preserve">
<value>Emotes</value>
@@ -1052,7 +1052,7 @@
<value>Emotes available:</value>
</data>
<data name="Options_Preview_Description" xml:space="preserve">
<value>Displays a preview with special parameter evaluated, like emotes and &lt;item&gt;</value>
<value>Displays a preview with special parameter evaluated, like emotes and &lt;item&gt;.</value>
</data>
<data name="Options_Preview_Name" xml:space="preserve">
<value>Position (None = off)</value>
@@ -1079,15 +1079,30 @@
<value>Must contain parameter</value>
</data>
<data name="Options_PreviewOnlyIf_Description" xml:space="preserve">
<value>Only show if the text contains special parameter</value>
<value>Only show if the text contains special parameter.</value>
</data>
<data name="Options_PreviewMinimum_Name" xml:space="preserve">
<value>Minimum input length</value>
</data>
<data name="Options_PreviewMinimum_Description" xml:space="preserve">
<value>Only show if the text length is greater-than or equal</value>
<value>Only show if the text length is greater-than or equal.</value>
</data>
<data name="Options_Preview_Tab" xml:space="preserve">
<value>Preview</value>
</data>
<data name="Options_Changelog_Tab" xml:space="preserve">
<value>Changelog</value>
</data>
<data name="Options_PrintChangelog_Name" xml:space="preserve">
<value>Print changelog</value>
</data>
<data name="Options_PrintChangelog_Description" xml:space="preserve">
<value>Print the changelog to chat after an update.</value>
</data>
<data name="Options_Warning_NotImplemented" xml:space="preserve">
<value>This feature isn't implemented yet</value>
</data>
<data name="Options_Changelog_Header" xml:space="preserve">
<value>Changelog:</value>
</data>
</root>
+1
View File
@@ -42,6 +42,7 @@ public sealed class SettingsWindow : Window
new Tabs(Plugin, Mutable),
new Database(Plugin, Mutable),
new Miscellaneous(Mutable),
new Changelog(Mutable),
new About(),
};
+51
View File
@@ -0,0 +1,51 @@
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Changelog : ISettingsTab
{
private Configuration Mutable { get; }
public string Name => Language.Options_Changelog_Tab + "###tabs-changelog";
internal Changelog(Configuration mutable)
{
Mutable = mutable;
}
public void Draw(bool changed)
{
using var wrap = ImGuiUtil.TextWrapPos();
ImGui.TextUnformatted(Language.Options_Warning_NotImplemented);
ImGuiUtil.OptionCheckbox(ref Mutable.PrintChangelog, Language.Options_PrintChangelog_Name, Language.Options_PrintChangelog_Description);
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
var changelog = Plugin.Interface.Manifest.Changelog;
if (changelog != null)
{
ImGui.TextUnformatted(Language.Options_Changelog_Header);
ImGui.TextUnformatted($"Version {Plugin.Interface.Manifest.AssemblyVersion.ToString(3)}");
ImGui.Spacing();
foreach (var sentence in changelog.Split("\n"))
{
if (sentence == string.Empty)
{
ImGui.NewLine();
continue;
}
var condition = sentence.StartsWith('-') || sentence.StartsWith(" -");
using var indent = ImRaii.PushIndent(10.0f, true, condition);
ImGui.TextUnformatted(sentence);
}
}
ImGui.Spacing();
}
}