mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
File Selector improvements.
This commit is contained in:
parent
002778f4c1
commit
35e68e74f4
5 changed files with 34 additions and 4 deletions
|
|
@ -41,7 +41,7 @@ public partial class ModEditWindow
|
|||
private int _offsetX = 0;
|
||||
private int _offsetY = 0;
|
||||
|
||||
private readonly FileDialogManager _dialogManager = new();
|
||||
private readonly FileDialogManager _dialogManager = ConfigWindow.SetupFileManager();
|
||||
|
||||
private static bool DragFloat( string label, float width, ref float value )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Penumbra.UI.Classes;
|
|||
|
||||
public sealed partial class ModFileSystemSelector : FileSystemSelector< Mod, ModFileSystemSelector.ModState >
|
||||
{
|
||||
private readonly FileDialogManager _fileManager = new();
|
||||
private readonly FileDialogManager _fileManager = ConfigWindow.SetupFileManager();
|
||||
private TexToolsImporter? _import;
|
||||
public ModSettings SelectedSettings { get; private set; } = ModSettings.Empty;
|
||||
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.ImGuiFileDialog;
|
||||
using ImGuiNET;
|
||||
using Lumina.Data.Parsing;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
|
@ -11,6 +13,7 @@ using Penumbra.GameData.ByteString;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Penumbra.UI.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.UI;
|
||||
|
||||
|
|
@ -114,4 +117,32 @@ public partial class ConfigWindow
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the file selector with the right flags and custom side bar items.
|
||||
public static FileDialogManager SetupFileManager()
|
||||
{
|
||||
var fileManager = new FileDialogManager
|
||||
{
|
||||
AddedWindowFlags = ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoDocking,
|
||||
};
|
||||
|
||||
if( Functions.GetDownloadsFolder( out var downloadsFolder ) )
|
||||
{
|
||||
fileManager.CustomSideBarItems.Add( ("Downloads", downloadsFolder, FontAwesomeIcon.Download, -1) );
|
||||
}
|
||||
|
||||
if( Functions.GetQuickAccessFolders( out var folders ) )
|
||||
{
|
||||
foreach( var ((name, path), idx) in folders.WithIndex() )
|
||||
{
|
||||
fileManager.CustomSideBarItems.Add( ($"{name}##{idx}", path, FontAwesomeIcon.Folder, -1) );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove Videos and Music.
|
||||
fileManager.CustomSideBarItems.Add( ("Videos", string.Empty, 0, -1) );
|
||||
fileManager.CustomSideBarItems.Add( ("Music", string.Empty, 0, -1) );
|
||||
|
||||
return fileManager;
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ public partial class ConfigWindow
|
|||
|
||||
// Changing the base mod directory.
|
||||
private string? _newModDirectory;
|
||||
private readonly FileDialogManager _dialogManager = new();
|
||||
private readonly FileDialogManager _dialogManager = SetupFileManager();
|
||||
private bool _dialogOpen; // For toggling on/off.
|
||||
|
||||
// Do not change the directory without explicitly pressing enter or this button.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ public sealed partial class ConfigWindow : Window, IDisposable
|
|||
_effectiveTab = new EffectiveTab();
|
||||
_debugTab = new DebugTab( this );
|
||||
_resourceTab = new ResourceTab( this );
|
||||
Flags |= ImGuiWindowFlags.NoDocking;
|
||||
if( Penumbra.Config.FixMainWindow )
|
||||
{
|
||||
Flags |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue