Remove Show Advanced, forbid ProgramFiles root folders.

This commit is contained in:
Ottermandias 2022-08-01 18:24:20 +02:00
parent 70a5ee9485
commit 4881e4ef09
7 changed files with 39 additions and 62 deletions

@ -1 +1 @@
Subproject commit f137f521c588472247510a3fd4183bd651477618
Subproject commit ea6ebcc073412419a051ac73a697980da20233e2

View file

@ -59,7 +59,6 @@ public partial class Configuration : IPluginConfiguration
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
public bool FixMainWindow { get; set; } = false;
public bool ShowAdvanced { get; set; }
public bool AutoDeduplicateOnImport { get; set; } = true;
public bool EnableHttpApi { get; set; } = true;

View file

@ -57,7 +57,7 @@ public partial class ConfigWindow
// Only gets drawn when actually relevant.
private static void DrawCleanCollectionButton( Vector2 width )
{
if( Penumbra.Config.ShowAdvanced && Penumbra.CollectionManager.Current.HasUnusedSettings )
if( Penumbra.CollectionManager.Current.HasUnusedSettings )
{
ImGui.SameLine();
if( ImGuiUtil.DrawDisabledButton(

View file

@ -20,11 +20,6 @@ public partial class ConfigWindow
// Draw the effective tab if ShowAdvanced is on.
public void Draw()
{
if( !Penumbra.Config.ShowAdvanced )
{
return;
}
using var tab = ImRaii.TabItem( "Effective Changes" );
if( !tab )
{

View file

@ -49,31 +49,28 @@ public partial class ConfigWindow
| ( _mod.ChangedItems.Count > 0 ? Tabs.ChangedItems : 0 )
| ( _mod.Description.Length > 0 ? Tabs.Description : 0 )
| ( _conflicts.Count > 0 ? Tabs.Conflicts : 0 )
| ( Penumbra.Config.ShowAdvanced ? Tabs.Edit : 0 );
| Tabs.Edit;
DrawSettingsTab();
DrawDescriptionTab();
DrawChangedItemsTab();
DrawConflictsTab();
DrawEditModTab();
if( Penumbra.Config.ShowAdvanced )
if( ImGui.TabItemButton( "Advanced Editing", ImGuiTabItemFlags.Trailing | ImGuiTabItemFlags.NoTooltip ) )
{
if( ImGui.TabItemButton( "Advanced Editing", ImGuiTabItemFlags.Trailing | ImGuiTabItemFlags.NoTooltip ) )
{
_window.ModEditPopup.ChangeMod( _mod );
_window.ModEditPopup.ChangeOption( _mod.Default );
_window.ModEditPopup.IsOpen = true;
}
ImGuiUtil.HoverTooltip(
"Clicking this will open a new window in which you can\nedit the following things per option for this mod:\n\n"
+ "\t\t- file redirections\n"
+ "\t\t- file swaps\n"
+ "\t\t- metadata manipulations\n"
+ "\t\t- model materials\n"
+ "\t\t- duplicates\n"
+ "\t\t- textures" );
_window.ModEditPopup.ChangeMod( _mod );
_window.ModEditPopup.ChangeOption( _mod.Default );
_window.ModEditPopup.IsOpen = true;
}
ImGuiUtil.HoverTooltip(
"Clicking this will open a new window in which you can\nedit the following things per option for this mod:\n\n"
+ "\t\t- file redirections\n"
+ "\t\t- file swaps\n"
+ "\t\t- metadata manipulations\n"
+ "\t\t- model materials\n"
+ "\t\t- duplicates\n"
+ "\t\t- textures" );
}
// Just a simple text box with the wrapped description, if it exists.

View file

@ -15,11 +15,11 @@ public partial class ConfigWindow
{
private void DrawAdvancedSettings()
{
if( !Penumbra.Config.ShowAdvanced || !ImGui.CollapsingHeader( "Advanced" ) )
{
return;
}
var header = ImGui.CollapsingHeader( "Advanced" );
OpenTutorial( BasicTutorialSteps.AdvancedSettings );
if( !header )
return;
Checkbox( "Auto Deduplicate on Import",
"Automatically deduplicate mod files on import. This will make mod file sizes smaller, but deletes (binary identical) files.",
Penumbra.Config.AutoDeduplicateOnImport, v => Penumbra.Config.AutoDeduplicateOnImport = v );

View file

@ -6,7 +6,6 @@ using System.Numerics;
using Dalamud.Interface;
using Dalamud.Interface.Components;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Logging;
using Dalamud.Utility;
using ImGuiNET;
using OtterGui;
@ -45,7 +44,6 @@ public partial class ConfigWindow
}
DrawEnabledBox();
DrawShowAdvancedBox();
Checkbox( "Lock Main Window", "Prevent the main window from being resized or moved.", Penumbra.Config.FixMainWindow, v =>
{
Penumbra.Config.FixMainWindow = v;
@ -76,8 +74,8 @@ public partial class ConfigWindow
// Shows up only if the current input does not correspond to the current directory.
private static bool DrawPressEnterWarning( string newName, string old, float width, bool saved )
{
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.PressEnterWarningBg );
var w = new Vector2( width, 0 );
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.PressEnterWarningBg );
var w = new Vector2( width, 0 );
var (text, valid) = CheckPath( newName, old );
return ( ImGui.Button( text, w ) || saved ) && valid;
@ -88,7 +86,7 @@ public partial class ConfigWindow
static bool IsSubPathOf( string basePath, string subPath )
{
var rel = Path.GetRelativePath( basePath, subPath );
return rel == "." || (!rel.StartsWith( '.' ) && !Path.IsPathRooted( rel ));
return rel == "." || !rel.StartsWith( '.' ) && !Path.IsPathRooted( rel );
}
if( newName.Length > RootDirectoryMaxLength )
@ -113,6 +111,13 @@ public partial class ConfigWindow
return ( "Path may not be on your Desktop.", false );
}
var programFiles = Environment.GetFolderPath( Environment.SpecialFolder.ProgramFiles );
var programFilesX86 = Environment.GetFolderPath( Environment.SpecialFolder.ProgramFilesX86 );
if( IsSubPathOf( programFiles, newName ) || IsSubPathOf( programFilesX86, newName ) )
{
return ( "Path may not be in ProgramFiles.", false );
}
var dalamud = Dalamud.PluginInterface.ConfigDirectory.Parent!.Parent!;
if( IsSubPathOf( dalamud.FullName, newName ) )
{
@ -198,12 +203,19 @@ public partial class ConfigWindow
DrawDirectoryPickerButton();
style.Pop();
ImGui.SameLine();
ImGuiUtil.LabeledHelpMarker( "Root Directory", "This is where Penumbra will store your extracted mod files.\n"
const string tt = "This is where Penumbra will store your extracted mod files.\n"
+ "TTMP files are not copied, just extracted.\n"
+ "This directory needs to be accessible and you need write access here.\n"
+ "It is recommended that this directory is placed on a fast hard drive, preferably an SSD.\n"
+ "It should also be placed near the root of a logical drive - the shorter the total path to this folder, the better.\n"
+ "Definitely do not place it in your Dalamud directory or any sub-directory thereof." );
+ "Definitely do not place it in your Dalamud directory or any sub-directory thereof.";
ImGuiComponents.HelpMarker( tt );
OpenTutorial( BasicTutorialSteps.GeneralTooltips );
ImGui.SameLine();
ImGui.TextUnformatted( "Root Directory" );
ImGuiUtil.HoverTooltip( tt );
group.Dispose();
OpenTutorial( BasicTutorialSteps.ModDirectory );
ImGui.SameLine();
@ -242,32 +254,6 @@ public partial class ConfigWindow
OpenTutorial( BasicTutorialSteps.EnableMods );
}
private static void DrawShowAdvancedBox()
{
var showAdvanced = Penumbra.Config.ShowAdvanced;
using( var _ = ImRaii.Group() )
{
if( ImGui.Checkbox( "##showAdvanced", ref showAdvanced ) )
{
Penumbra.Config.ShowAdvanced = showAdvanced;
Penumbra.Config.Save();
}
ImGui.SameLine();
const string tt = "Enable some advanced options in this window and in the mod selector.\n"
+ "This is required to enable manually editing any mod information.";
// Manually split due to tutorial.
ImGuiComponents.HelpMarker( tt );
OpenTutorial( BasicTutorialSteps.GeneralTooltips );
ImGui.SameLine();
ImGui.TextUnformatted( "Show Advanced Settings" );
ImGuiUtil.HoverTooltip( tt );
}
OpenTutorial( BasicTutorialSteps.AdvancedSettings );
}
private static void DrawColorSettings()
{
if( !ImGui.CollapsingHeader( "Colors" ) )