mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Fix issue with adding mods from clipboard
This commit is contained in:
parent
5bca4b9118
commit
2e52030c31
3 changed files with 26 additions and 9 deletions
|
|
@ -248,7 +248,8 @@ public sealed class DesignManager : DesignEditor
|
||||||
design.LastEdit = DateTimeOffset.UtcNow;
|
design.LastEdit = DateTimeOffset.UtcNow;
|
||||||
SaveService.QueueSave(design);
|
SaveService.QueueSave(design);
|
||||||
Glamourer.Log.Debug($"Renamed tag {oldTag} at {tagIdx} to {newTag} in design {design.Identifier} and reordered tags.");
|
Glamourer.Log.Debug($"Renamed tag {oldTag} at {tagIdx} to {newTag} in design {design.Identifier} and reordered tags.");
|
||||||
DesignChanged.Invoke(DesignChanged.Type.ChangedTag, design, new TagChangedTransaction(oldTag, newTag, tagIdx, design.Tags.IndexOf(newTag)));
|
DesignChanged.Invoke(DesignChanged.Type.ChangedTag, design,
|
||||||
|
new TagChangedTransaction(oldTag, newTag, tagIdx, design.Tags.IndexOf(newTag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Add an associated mod to a design. </summary>
|
/// <summary> Add an associated mod to a design. </summary>
|
||||||
|
|
@ -278,12 +279,20 @@ public sealed class DesignManager : DesignEditor
|
||||||
/// <summary> Add or update an associated mod to a design. </summary>
|
/// <summary> Add or update an associated mod to a design. </summary>
|
||||||
public void UpdateMod(Design design, Mod mod, ModSettings settings)
|
public void UpdateMod(Design design, Mod mod, ModSettings settings)
|
||||||
{
|
{
|
||||||
var oldSettings = design.AssociatedMods[mod];
|
var hasOldSettings = design.AssociatedMods.TryGetValue(mod, out var oldSettings);
|
||||||
design.AssociatedMods[mod] = settings;
|
design.AssociatedMods[mod] = settings;
|
||||||
design.LastEdit = DateTimeOffset.UtcNow;
|
design.LastEdit = DateTimeOffset.UtcNow;
|
||||||
SaveService.QueueSave(design);
|
SaveService.QueueSave(design);
|
||||||
Glamourer.Log.Debug($"Updated (or added) associated mod {mod.DirectoryName} from design {design.Identifier}.");
|
if (hasOldSettings)
|
||||||
DesignChanged.Invoke(DesignChanged.Type.UpdatedMod, design, new ModUpdatedTransaction(mod, oldSettings, settings));
|
{
|
||||||
|
Glamourer.Log.Debug($"Updated associated mod {mod.DirectoryName} from design {design.Identifier}.");
|
||||||
|
DesignChanged.Invoke(DesignChanged.Type.UpdatedMod, design, new ModUpdatedTransaction(mod, oldSettings, settings));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Glamourer.Log.Debug($"Added associated mod {mod.DirectoryName} from design {design.Identifier}.");
|
||||||
|
DesignChanged.Invoke(DesignChanged.Type.AddedMod, design, new ModAddedTransaction(mod, settings));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Set the write protection status of a design. </summary>
|
/// <summary> Set the write protection status of a design. </summary>
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,10 @@ using OtterGui.Classes;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using OtterGui.Text;
|
using OtterGui.Text;
|
||||||
using OtterGui.Text.Widget;
|
using OtterGui.Text.Widget;
|
||||||
using OtterGui.Widgets;
|
|
||||||
|
|
||||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||||
|
|
||||||
public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelector selector, DesignManager manager)
|
public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelector selector, DesignManager manager, Configuration config)
|
||||||
{
|
{
|
||||||
private readonly ModCombo _modCombo = new(penumbra, Glamourer.Log);
|
private readonly ModCombo _modCombo = new(penumbra, Glamourer.Log);
|
||||||
private (Mod, ModSettings)[]? _copy;
|
private (Mod, ModSettings)[]? _copy;
|
||||||
|
|
@ -127,8 +126,17 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
||||||
removedMod = null;
|
removedMod = null;
|
||||||
updatedMod = null;
|
updatedMod = null;
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if (ImUtf8.IconButton(FontAwesomeIcon.Trash, "Delete this mod from associations."u8))
|
var canDelete = config.DeleteDesignModifier.IsActive();
|
||||||
removedMod = mod;
|
if (canDelete)
|
||||||
|
{
|
||||||
|
if (ImUtf8.IconButton(FontAwesomeIcon.Trash, "Delete this mod from associations."u8))
|
||||||
|
removedMod = mod;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImUtf8.IconButton(FontAwesomeIcon.Trash, $"Delete this mod from associations.\nHold {config.DeleteDesignModifier} to delete.",
|
||||||
|
disabled: true);
|
||||||
|
}
|
||||||
|
|
||||||
ImUtf8.SameLineInner();
|
ImUtf8.SameLineInner();
|
||||||
if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8))
|
if (ImUtf8.IconButton(FontAwesomeIcon.Clipboard, "Copy this mod setting to clipboard."u8))
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit a62d62a8532de528f43515233ea44892cdb974b5
|
Subproject commit ad6973c559b4c05aa3c3735ec7b53cc0f5d2f203
|
||||||
Loading…
Add table
Add a link
Reference in a new issue