Give error information on IMC problems.

This commit is contained in:
Ottermandias 2022-06-08 15:22:10 +02:00
parent a37a8eb5aa
commit 35cff163f8
4 changed files with 76 additions and 33 deletions

View file

@ -55,7 +55,7 @@ public partial class ConfigWindow
DrawAdvancedSettings();
_dialogManager.Draw();
DrawDiscordButton();
DrawSupportButtons();
}
// Changing the base mod directory.
@ -209,26 +209,11 @@ public partial class ConfigWindow
ImGui.NewLine();
}
private static void DrawDiscordButton()
public static void DrawDiscordButton( float width )
{
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( 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 );
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.DiscordColor );
if( ImGui.Button( discord, new Vector2( width, 0 ) ) )
{
try
@ -247,5 +232,31 @@ public partial class ConfigWindow
ImGuiUtil.HoverTooltip( $"Open {address}" );
}
private const string SupportInfoButtonText = "Copy Support Info to Clipboard";
public static void DrawSupportButton()
{
if( ImGui.Button( SupportInfoButtonText ) )
{
var text = Penumbra.GatherSupportInformation();
ImGui.SetClipboardText( text );
}
}
private static void DrawSupportButtons()
{
var width = ImGui.CalcTextSize( SupportInfoButtonText ).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() ) );
DrawSupportButton();
ImGui.SetCursorPos( new Vector2( ImGui.GetWindowWidth() - width, 0 ) );
DrawDiscordButton( width );
}
}
}