mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Use version and website information and add edit options.
This commit is contained in:
parent
28cce87855
commit
8e87e2d1cf
1 changed files with 82 additions and 13 deletions
|
|
@ -6,8 +6,9 @@ using System.Numerics;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Plugin;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Plugin;
|
||||
using ImGuiNET;
|
||||
using Newtonsoft.Json;
|
||||
using Penumbra.Importer;
|
||||
using Penumbra.Models;
|
||||
|
||||
|
|
@ -500,7 +501,63 @@ namespace Penumbra.UI
|
|||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
// Website button with On-Hover address if valid http(s), otherwise text.
|
||||
private void DrawWebsiteText()
|
||||
{
|
||||
if ((_selectedMod.Mod.Meta.Website?.Length ?? 0) > 0)
|
||||
{
|
||||
var validUrl = Uri.TryCreate(_selectedMod.Mod.Meta.Website, UriKind.Absolute, out Uri uriResult)
|
||||
&& (uriResult.Scheme == Uri.UriSchemeHttps ||uriResult.Scheme == Uri.UriSchemeHttp);
|
||||
ImGui.SameLine();
|
||||
if (validUrl)
|
||||
{
|
||||
if (ImGui.SmallButton("Open Website"))
|
||||
{
|
||||
Process.Start( _selectedMod.Mod.Meta.Website );
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Text( _selectedMod.Mod.Meta.Website );
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TextColored( new Vector4( 1f, 1f, 1f, 0.66f ), "from" );
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(_selectedMod.Mod.Meta.Website);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create Mod-Handling buttons.
|
||||
private void DrawEditButtons()
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( "Open Mod Folder" ) )
|
||||
{
|
||||
Process.Start( _selectedMod.Mod.ModBasePath.FullName );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( "Edit JSON" ) )
|
||||
{
|
||||
var metaPath = Path.Combine( _selectedMod.Mod.ModBasePath.FullName, "meta.json");
|
||||
File.WriteAllText( metaPath, JsonConvert.SerializeObject( _selectedMod.Mod.Meta, Formatting.Indented ) );
|
||||
Process.Start( metaPath );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( "Reload JSON" ) )
|
||||
{
|
||||
ReloadMods();
|
||||
_selectedMod = _plugin.ModManager.Mods.ModSettings[ _selectedModIndex ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DrawInstalledMods()
|
||||
{
|
||||
|
|
@ -532,13 +589,25 @@ namespace Penumbra.UI
|
|||
{
|
||||
ImGui.BeginChild( "selectedModInfo", AutoFillSize, true );
|
||||
|
||||
ImGui.Text( _selectedMod.Mod.Meta.Name );
|
||||
ImGui.Text( _selectedMod.Mod.Meta.Name );
|
||||
|
||||
// (Version ...) or nothing.
|
||||
if ((_selectedMod.Mod.Meta.Version?.Length ?? 0) > 0)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.Text($"(Version {_selectedMod.Mod.Meta.Version})" );
|
||||
}
|
||||
|
||||
// by Author or Unknown.
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored( new Vector4( 1f, 1f, 1f, 0.66f ), "by" );
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( _selectedMod.Mod.Meta.Author );
|
||||
|
||||
ImGui.TextWrapped( _selectedMod.Mod.Meta.Description ?? "" );
|
||||
ImGui.SameLine();
|
||||
if ((_selectedMod.Mod.Meta.Author?.Length ?? 0) > 0 )
|
||||
ImGui.Text( _selectedMod.Mod.Meta.Author );
|
||||
else
|
||||
ImGui.Text( "Unknown" );
|
||||
|
||||
DrawWebsiteText();
|
||||
|
||||
ImGui.SetCursorPosY( ImGui.GetCursorPosY() + 10 );
|
||||
|
||||
|
|
@ -548,12 +617,12 @@ namespace Penumbra.UI
|
|||
_selectedMod.Enabled = enabled;
|
||||
_plugin.ModManager.Mods.Save();
|
||||
_plugin.ModManager.CalculateEffectiveFileList();
|
||||
}
|
||||
|
||||
if( ImGui.Button( "Open Mod Folder" ) )
|
||||
{
|
||||
Process.Start( _selectedMod.Mod.ModBasePath.FullName );
|
||||
}
|
||||
}
|
||||
|
||||
DrawEditButtons();
|
||||
|
||||
|
||||
ImGui.TextWrapped( _selectedMod.Mod.Meta.Description ?? "" );
|
||||
|
||||
ImGui.BeginTabBar( "PenumbraPluginDetails" );
|
||||
if( ImGui.BeginTabItem( "Files" ) )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue