From 3fe6d430e34a7922747d5765dec063ab1901e5d4 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Thu, 6 Oct 2022 16:51:01 +0200 Subject: [PATCH] add copy user notes to clipboard --- MareSynchronos/UI/GroupPanel.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/MareSynchronos/UI/GroupPanel.cs b/MareSynchronos/UI/GroupPanel.cs index 0e3dc40..b5dfb17 100644 --- a/MareSynchronos/UI/GroupPanel.cs +++ b/MareSynchronos/UI/GroupPanel.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Text; namespace MareSynchronos.UI { @@ -280,8 +281,8 @@ namespace MareSynchronos.UI ImGui.Separator(); foreach (var pair in pairsInGroup) { - UiShared.DrawWithID(group.GID + pair.UserUID, () => DrawSyncshellPairedClient(pair, - string.Equals(group.OwnedBy, _apiController.UID, StringComparison.Ordinal), + UiShared.DrawWithID(group.GID + pair.UserUID, () => DrawSyncshellPairedClient(pair, + string.Equals(group.OwnedBy, _apiController.UID, StringComparison.Ordinal), group.IsModerator ?? false, group?.IsPaused ?? false)); } @@ -329,6 +330,24 @@ namespace MareSynchronos.UI } UiShared.AttachToolTip("Copy Syncshell ID to Clipboard"); + if (UiShared.IconTextButton(FontAwesomeIcon.UserSecret, "Copy Notes")) + { + var entries = _apiController.GroupPairedClients.Where(p => string.Equals(p.GroupGID, entry.GID, StringComparison.Ordinal)); + var comments = _configuration.GetCurrentServerUidComments(); + StringBuilder sb = new(); + sb.AppendLine("##MARE_SYNCHRONOS_USER_NOTES_START##"); + foreach (var userEntry in entries) + { + if (comments.TryGetValue(userEntry.UserUID, out var comment)) + { + sb.AppendLine(userEntry.UserUID + ":\"" + comment + "\""); + } + } + sb.AppendLine("##MARE_SYNCHRONOS_USER_NOTES_END##"); + ImGui.SetClipboardText(sb.ToString()); + } + UiShared.AttachToolTip("Copies all your notes for all users in this Syncshell to the clipboard"); + if (isOwner || (entry.IsModerator ?? false)) { ImGui.Separator();