mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add Trade and Set Note to social frame friends context menu
- "Trade" option initiates a trade via existing initiateTrade(guid) API (only shown for online friends with a known GUID) - "Set Note" option opens an inline popup with InputText pre-filled with the current note; Enter or OK saves via setFriendNote(), Esc/Cancel discards
This commit is contained in:
parent
71b0a18238
commit
611946bd3e
1 changed files with 37 additions and 0 deletions
|
|
@ -9835,6 +9835,10 @@ void GameScreen::renderSocialFrame(game::GameHandler& gameHandler) {
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.1f, 0.1f, 0.1f, 0.92f));
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.1f, 0.1f, 0.1f, 0.92f));
|
||||||
|
|
||||||
|
// State for "Set Note" inline editing
|
||||||
|
static int noteEditContactIdx = -1;
|
||||||
|
static char noteEditBuf[128] = {};
|
||||||
|
|
||||||
bool open = showSocialFrame_;
|
bool open = showSocialFrame_;
|
||||||
char socialTitle[32];
|
char socialTitle[32];
|
||||||
snprintf(socialTitle, sizeof(socialTitle), "Social (%d online)##SocialFrame", onlineCount);
|
snprintf(socialTitle, sizeof(socialTitle), "Social (%d online)##SocialFrame", onlineCount);
|
||||||
|
|
@ -9924,6 +9928,14 @@ void GameScreen::renderSocialFrame(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
if (ImGui::MenuItem("Invite to Group"))
|
if (ImGui::MenuItem("Invite to Group"))
|
||||||
gameHandler.inviteToGroup(c.name);
|
gameHandler.inviteToGroup(c.name);
|
||||||
|
if (c.guid != 0 && ImGui::MenuItem("Trade"))
|
||||||
|
gameHandler.initiateTrade(c.guid);
|
||||||
|
}
|
||||||
|
if (ImGui::MenuItem("Set Note")) {
|
||||||
|
noteEditContactIdx = static_cast<int>(ci);
|
||||||
|
strncpy(noteEditBuf, c.note.c_str(), sizeof(noteEditBuf) - 1);
|
||||||
|
noteEditBuf[sizeof(noteEditBuf) - 1] = '\0';
|
||||||
|
ImGui::OpenPopup("##SetFriendNote");
|
||||||
}
|
}
|
||||||
if (ImGui::MenuItem("Remove Friend"))
|
if (ImGui::MenuItem("Remove Friend"))
|
||||||
gameHandler.removeFriend(c.name);
|
gameHandler.removeFriend(c.name);
|
||||||
|
|
@ -9944,6 +9956,31 @@ void GameScreen::renderSocialFrame(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
// "Set Note" modal popup
|
||||||
|
if (ImGui::BeginPopup("##SetFriendNote")) {
|
||||||
|
const std::string& noteName = (noteEditContactIdx >= 0 &&
|
||||||
|
noteEditContactIdx < static_cast<int>(contacts.size()))
|
||||||
|
? contacts[noteEditContactIdx].name : "";
|
||||||
|
ImGui::TextDisabled("Note for %s:", noteName.c_str());
|
||||||
|
ImGui::SetNextItemWidth(180.0f);
|
||||||
|
bool confirm = ImGui::InputText("##noteinput", noteEditBuf, sizeof(noteEditBuf),
|
||||||
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (confirm || ImGui::Button("OK")) {
|
||||||
|
if (!noteName.empty())
|
||||||
|
gameHandler.setFriendNote(noteName, noteEditBuf);
|
||||||
|
noteEditContactIdx = -1;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Cancel")) {
|
||||||
|
noteEditContactIdx = -1;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Add friend
|
// Add friend
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue