mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add copy help text button.
This commit is contained in:
parent
ced5e344cf
commit
c247446ba6
2 changed files with 71 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
|
|
@ -397,4 +398,61 @@ public class Penumbra : IDisposable
|
|||
list.Add( new FileInfo( ModCollection.Manager.ActiveCollectionFile ) );
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string GatherSupportInformation()
|
||||
{
|
||||
var sb = new StringBuilder( 10240 );
|
||||
sb.AppendLine( "**Settings**" );
|
||||
sb.AppendFormat( "> **`Plugin Version: `** {0}\n", Version );
|
||||
sb.AppendFormat( "> **`Commit Hash: `** {0}\n", CommitHash );
|
||||
sb.AppendFormat( "> **`Enable Mods: `** {0}\n", Config.EnableMods );
|
||||
sb.AppendFormat( "> **`Enable Sound Modification: `** {0}\n", Config.DisableSoundStreaming );
|
||||
sb.AppendFormat( "> **`Enable HTTP API: `** {0}\n", Config.EnableHttpApi );
|
||||
sb.AppendFormat( "> **`Root Directory: `** {0}, {1}\n", Config.ModDirectory,
|
||||
Config.ModDirectory.Length > 0 && Directory.Exists( Config.ModDirectory ) ? "Exists" : "Not Existing" );
|
||||
sb.AppendLine( "**Mods**" );
|
||||
sb.AppendFormat( "> **`Installed Mods: `** {0}\n", ModManager.Count );
|
||||
sb.AppendFormat( "> **`Mods with Config: `** {0}\n", ModManager.Count( m => m.HasOptions ) );
|
||||
sb.AppendFormat( "> **`Mods with File Redirections: `** {0}, Total: {1}\n", ModManager.Count( m => m.TotalFileCount > 0 ),
|
||||
ModManager.Sum( m => m.TotalFileCount ) );
|
||||
sb.AppendFormat( "> **`Mods with FileSwaps: `** {0}, Total: {1}\n", ModManager.Count( m => m.TotalSwapCount > 0 ),
|
||||
ModManager.Sum( m => m.TotalSwapCount ) );
|
||||
sb.AppendFormat( "> **`Mods with Meta Manipulations:`** {0}, Total {1}\n", ModManager.Count( m => m.TotalManipulations > 0 ),
|
||||
ModManager.Sum( m => m.TotalManipulations ) );
|
||||
|
||||
string CollectionName( ModCollection c )
|
||||
=> c == ModCollection.Empty ? ModCollection.Empty.Name : c.Name.Length >= 2 ? c.Name[ ..2 ] : c.Name;
|
||||
|
||||
string CharacterName( string name )
|
||||
=> string.Join( " ", name.Split().Select( n => $"{n[ 0 ]}." ) ) + ':';
|
||||
|
||||
void PrintCollection( ModCollection c )
|
||||
=> sb.AppendFormat( "**Collection {0}... ({1})**\n"
|
||||
+ "> **`Inheritances: `** {2}\n"
|
||||
+ "> **`Enabled Mods: `** {3}\n"
|
||||
+ "> **`Total Conflicts: `** {4}\n"
|
||||
+ "> **`Solved Conflicts: `** {5}\n",
|
||||
CollectionName( c ), c.Index, c.Inheritance.Count, c.ActualSettings.Count( s => s is { Enabled: true } ), c.Conflicts.Count,
|
||||
c.Conflicts.Count( con => con.Solved ) );
|
||||
|
||||
sb.AppendLine( "**Collections**" );
|
||||
sb.AppendFormat( "> **`#Collections: `** {0}\n", CollectionManager.Count );
|
||||
sb.AppendFormat( "> **`Active Collections: `** {0}\n", CollectionManager.Count( c => c.HasCache ) );
|
||||
sb.AppendFormat( "> **`Default Collection: `** {0}... ({1})\n", CollectionName( CollectionManager.Default ),
|
||||
CollectionManager.Default.Index );
|
||||
sb.AppendFormat( "> **`Current Collection: `** {0}... ({1})\n", CollectionName( CollectionManager.Current ),
|
||||
CollectionManager.Current.Index );
|
||||
foreach( var (name, collection) in CollectionManager.Characters )
|
||||
{
|
||||
sb.AppendFormat( "> **`{2,-29}`** {0}... ({1})\n", CollectionName( collection ),
|
||||
collection.Index, CharacterName( name ) );
|
||||
}
|
||||
|
||||
foreach( var collection in CollectionManager.Where( c => c.HasCache ) )
|
||||
{
|
||||
PrintCollection( collection );
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
|
@ -203,14 +203,25 @@ public partial class ConfigWindow
|
|||
|
||||
private static void DrawDiscordButton()
|
||||
{
|
||||
const string help = "Copy Support Info to Clipboard";
|
||||
const string discord = "Join Discord for Support";
|
||||
const string address = @"https://discord.gg/kVva7DHV4r";
|
||||
var width = ImGui.CalcTextSize( discord ).X + ImGui.GetStyle().FramePadding.X * 2;
|
||||
var width = ImGui.CalcTextSize( help ).X + ImGui.GetStyle().FramePadding.X * 2;
|
||||
if( ImGui.GetScrollMaxY() > 0 )
|
||||
{
|
||||
width += ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().ItemSpacing.X;
|
||||
}
|
||||
|
||||
ImGui.SetCursorPos( new Vector2( ImGui.GetWindowWidth() - width, ImGui.GetFrameHeightWithSpacing() ) );
|
||||
if( ImGui.Button( help ) )
|
||||
{
|
||||
var text = Penumbra.GatherSupportInformation();
|
||||
ImGui.SetClipboardText( text );
|
||||
}
|
||||
|
||||
ImGui.SetCursorPos( new Vector2( ImGui.GetWindowWidth() - width, 0 ) );
|
||||
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.DiscordColor );
|
||||
if( ImGui.Button( discord ) )
|
||||
if( ImGui.Button( discord, new Vector2( width, 0 ) ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue