mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-02 13:53:42 +01:00
Add shared tag system for tagging individual mods
Adds a new system of shared tags that are saved in the Penumbra config, and can then be 1-click added or removed to/from mods via a popup menu. The use case for this new system is to allow users to more easily re-use tags and to allow them to quickly tag individual mods. Shared tags can be added/removed/modified via a new Tags section of the main Penumbra Settings tab. Once any shared tags have been saved, they can be added via a new tags button that shows up in the Description and Edit Mod tabs, to the right of the existing + button that already existed for typing in new tags. Shared tags have the same restrictions as regular mod tags, and the application of shared tags should respect the same limits as application of normal tags. Signed-off-by: AeAstralis <causal_inverse@fastmail.com>
This commit is contained in:
parent
0220257efa
commit
7128326ab9
7 changed files with 248 additions and 6 deletions
|
|
@ -41,15 +41,18 @@ public class SettingsTab : ITab
|
|||
private readonly DalamudConfigService _dalamudConfig;
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
private readonly IDataManager _gameData;
|
||||
private readonly SharedTagManager _sharedTagManager;
|
||||
|
||||
private int _minimumX = int.MaxValue;
|
||||
private int _minimumY = int.MaxValue;
|
||||
|
||||
private readonly TagButtons _sharedTags = new();
|
||||
|
||||
public SettingsTab(DalamudPluginInterface pluginInterface, Configuration config, FontReloader fontReloader, TutorialService tutorial,
|
||||
Penumbra penumbra, FileDialogService fileDialog, ModManager modManager, ModFileSystemSelector selector,
|
||||
CharacterUtility characterUtility, ResidentResourceManager residentResources, ModExportManager modExportManager, HttpApi httpApi,
|
||||
DalamudSubstitutionProvider dalamudSubstitutionProvider, FileCompactor compactor, DalamudConfigService dalamudConfig,
|
||||
IDataManager gameData)
|
||||
IDataManager gameData, SharedTagManager sharedTagConfig)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_config = config;
|
||||
|
|
@ -69,6 +72,9 @@ public class SettingsTab : ITab
|
|||
_gameData = gameData;
|
||||
if (_compactor.CanCompact)
|
||||
_compactor.Enabled = _config.UseFileSystemCompression;
|
||||
_sharedTagManager = sharedTagConfig;
|
||||
if (sharedTagConfig.SharedTags.Count == 0 && _config.SharedTags != null)
|
||||
sharedTagConfig.SharedTags = _config.SharedTags;
|
||||
}
|
||||
|
||||
public void DrawHeader()
|
||||
|
|
@ -96,6 +102,7 @@ public class SettingsTab : ITab
|
|||
DrawGeneralSettings();
|
||||
DrawColorSettings();
|
||||
DrawAdvancedSettings();
|
||||
DrawSharedTagsSection();
|
||||
DrawSupportButtons();
|
||||
}
|
||||
|
||||
|
|
@ -902,4 +909,21 @@ public class SettingsTab : ITab
|
|||
if (ImGui.Button("Show Changelogs", new Vector2(width, 0)))
|
||||
_penumbra.ForceChangelogOpen();
|
||||
}
|
||||
|
||||
private void DrawSharedTagsSection()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Tags"))
|
||||
return;
|
||||
|
||||
var tagIdx = _sharedTags.Draw("Shared Tags: ",
|
||||
"Tags that can be added/removed from mods with 1 click.", _sharedTagManager.SharedTags,
|
||||
out var editedTag);
|
||||
|
||||
if (tagIdx >= 0)
|
||||
{
|
||||
_sharedTagManager.ChangeSharedTag(tagIdx, editedTag);
|
||||
_config.SharedTags = _sharedTagManager.SharedTags;
|
||||
_config.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue