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 DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
public bool FixMainWindow { get; set; } = false; public bool FixMainWindow { get; set; } = false;
public bool ShowAdvanced { get; set; }
public bool AutoDeduplicateOnImport { get; set; } = true; public bool AutoDeduplicateOnImport { get; set; } = true;
public bool EnableHttpApi { 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. // Only gets drawn when actually relevant.
private static void DrawCleanCollectionButton( Vector2 width ) private static void DrawCleanCollectionButton( Vector2 width )
{ {
if( Penumbra.Config.ShowAdvanced && Penumbra.CollectionManager.Current.HasUnusedSettings ) if( Penumbra.CollectionManager.Current.HasUnusedSettings )
{ {
ImGui.SameLine(); ImGui.SameLine();
if( ImGuiUtil.DrawDisabledButton( if( ImGuiUtil.DrawDisabledButton(

View file

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

View file

@ -49,15 +49,13 @@ public partial class ConfigWindow
| ( _mod.ChangedItems.Count > 0 ? Tabs.ChangedItems : 0 ) | ( _mod.ChangedItems.Count > 0 ? Tabs.ChangedItems : 0 )
| ( _mod.Description.Length > 0 ? Tabs.Description : 0 ) | ( _mod.Description.Length > 0 ? Tabs.Description : 0 )
| ( _conflicts.Count > 0 ? Tabs.Conflicts : 0 ) | ( _conflicts.Count > 0 ? Tabs.Conflicts : 0 )
| ( Penumbra.Config.ShowAdvanced ? Tabs.Edit : 0 ); | Tabs.Edit;
DrawSettingsTab(); DrawSettingsTab();
DrawDescriptionTab(); DrawDescriptionTab();
DrawChangedItemsTab(); DrawChangedItemsTab();
DrawConflictsTab(); DrawConflictsTab();
DrawEditModTab(); 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.ChangeMod( _mod );
@ -74,7 +72,6 @@ public partial class ConfigWindow
+ "\t\t- duplicates\n" + "\t\t- duplicates\n"
+ "\t\t- textures" ); + "\t\t- textures" );
} }
}
// Just a simple text box with the wrapped description, if it exists. // Just a simple text box with the wrapped description, if it exists.
private void DrawDescriptionTab() private void DrawDescriptionTab()

View file

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

View file

@ -6,7 +6,6 @@ using System.Numerics;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Logging;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using ImGuiNET;
using OtterGui; using OtterGui;
@ -45,7 +44,6 @@ public partial class ConfigWindow
} }
DrawEnabledBox(); DrawEnabledBox();
DrawShowAdvancedBox();
Checkbox( "Lock Main Window", "Prevent the main window from being resized or moved.", Penumbra.Config.FixMainWindow, v => Checkbox( "Lock Main Window", "Prevent the main window from being resized or moved.", Penumbra.Config.FixMainWindow, v =>
{ {
Penumbra.Config.FixMainWindow = v; Penumbra.Config.FixMainWindow = v;
@ -88,7 +86,7 @@ public partial class ConfigWindow
static bool IsSubPathOf( string basePath, string subPath ) static bool IsSubPathOf( string basePath, string subPath )
{ {
var rel = Path.GetRelativePath( basePath, 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 ) if( newName.Length > RootDirectoryMaxLength )
@ -113,6 +111,13 @@ public partial class ConfigWindow
return ( "Path may not be on your Desktop.", false ); 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!; var dalamud = Dalamud.PluginInterface.ConfigDirectory.Parent!.Parent!;
if( IsSubPathOf( dalamud.FullName, newName ) ) if( IsSubPathOf( dalamud.FullName, newName ) )
{ {
@ -198,12 +203,19 @@ public partial class ConfigWindow
DrawDirectoryPickerButton(); DrawDirectoryPickerButton();
style.Pop(); style.Pop();
ImGui.SameLine(); 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" + "TTMP files are not copied, just extracted.\n"
+ "This directory needs to be accessible and you need write access here.\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 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" + "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(); group.Dispose();
OpenTutorial( BasicTutorialSteps.ModDirectory ); OpenTutorial( BasicTutorialSteps.ModDirectory );
ImGui.SameLine(); ImGui.SameLine();
@ -242,32 +254,6 @@ public partial class ConfigWindow
OpenTutorial( BasicTutorialSteps.EnableMods ); 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() private static void DrawColorSettings()
{ {
if( !ImGui.CollapsingHeader( "Colors" ) ) if( !ImGui.CollapsingHeader( "Colors" ) )