muffin v7.5.12
This commit is contained in:
parent
3102923ce2
commit
911ed68baa
65 changed files with 2356 additions and 1539 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
|
|
@ -18,6 +19,8 @@ namespace Questionable.Windows.ConfigComponents;
|
|||
|
||||
internal sealed class BlacklistConfigComponent : ConfigComponent
|
||||
{
|
||||
private const string ClipboardPrefix = "qst:blacklist:";
|
||||
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
private readonly QuestSelector _questSelector;
|
||||
|
|
@ -152,14 +155,62 @@ internal sealed class BlacklistConfigComponent : ConfigComponent
|
|||
}
|
||||
}
|
||||
_questSelector.DrawSelection();
|
||||
if (blacklistedQuests.Count > 0 && UiThemeUtils.DestructiveButton(FontAwesomeIcon.Trash, "Clear all"))
|
||||
DrawClipboardButtons(blacklistedQuests);
|
||||
if (blacklistedQuests.Count > 0)
|
||||
{
|
||||
base.Configuration.General.BlacklistedQuests.Clear();
|
||||
Save();
|
||||
ImGui.SameLine();
|
||||
if (UiThemeUtils.DestructiveButton(FontAwesomeIcon.Trash, "Clear all"))
|
||||
{
|
||||
base.Configuration.General.BlacklistedQuests.Clear();
|
||||
Save();
|
||||
}
|
||||
}
|
||||
UiThemeUtils.EndCard(contentStartPos, availableWidth, drawList);
|
||||
}
|
||||
|
||||
private void DrawClipboardButtons(HashSet<ElementId> blacklistedQuests)
|
||||
{
|
||||
using (ImRaii.Disabled(blacklistedQuests.Count == 0))
|
||||
{
|
||||
if (UiThemeUtils.IconTextButton(FontAwesomeIcon.Copy, "Copy"))
|
||||
{
|
||||
string s = string.Join(";", from x in blacklistedQuests
|
||||
orderby x.ToString()
|
||||
select x.ToString());
|
||||
ImGui.SetClipboardText("qst:blacklist:" + Convert.ToBase64String(Encoding.UTF8.GetBytes(s)));
|
||||
}
|
||||
}
|
||||
ImGui.SameLine();
|
||||
string text = ThrottledClipboard.GetText();
|
||||
using (ImRaii.Disabled(!text.StartsWith("qst:blacklist:", StringComparison.InvariantCulture)))
|
||||
{
|
||||
if (UiThemeUtils.IconTextButton(FontAwesomeIcon.Paste, "Paste"))
|
||||
{
|
||||
ImportBlacklistedQuests(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ImportBlacklistedQuests(string clipboardText)
|
||||
{
|
||||
try
|
||||
{
|
||||
string s = clipboardText.Substring("qst:blacklist:".Length);
|
||||
int skippedCount;
|
||||
List<ElementId> list = ElementId.FromStrings(Encoding.UTF8.GetString(Convert.FromBase64String(s)).Split(";", StringSplitOptions.RemoveEmptyEntries), out skippedCount);
|
||||
if (list.Count != 0)
|
||||
{
|
||||
base.Configuration.General.BlacklistedQuests.Clear();
|
||||
base.Configuration.General.BlacklistedQuests.UnionWith(list);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
_logger.LogDebug(exception, "Failed to import blacklisted quests from clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCurrentlyAcceptedQuests()
|
||||
{
|
||||
List<Quest> currentlyAcceptedQuests = GetCurrentlyAcceptedQuests();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue