1
0
mirror of synced 2025-01-29 19:17:28 +01:00

impr: Various TCP Client/Server tool improvements

This commit is contained in:
WerWolv 2023-11-05 00:00:32 +01:00
parent ec95c260bb
commit 4c2fe8e03c

View File

@ -1961,15 +1961,22 @@ namespace hex::plugin::builtin {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PushItemWidth(-(50_scaled)); ImGui::BeginDisabled(!client.isConnected());
ImGui::InputText("##input", input); {
ImGui::PopItemWidth(); ImGui::PushItemWidth(-(50_scaled));
ImGui::SameLine(); bool pressedEnter = ImGui::InputText("##input", input, ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::PopItemWidth();
ImGui::SameLine();
if (ImGui::IconButton(ICON_VS_DEBUG_STACKFRAME, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { if (pressedEnter)
client.writeString(input); ImGui::SetKeyboardFocusHere(-1);
input.clear();
if (ImGui::IconButton(ICON_VS_DEBUG_STACKFRAME, ImGui::GetStyleColorVec4(ImGuiCol_Text)) || pressedEnter) {
client.writeString(input);
input.clear();
}
} }
ImGui::EndDisabled();
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
@ -2016,6 +2023,8 @@ namespace hex::plugin::builtin {
return {}; return {};
}, nullptr, true); }, nullptr, true);
std::this_thread::sleep_for(100ms);
} }
}); });
} }
@ -2027,10 +2036,15 @@ namespace hex::plugin::builtin {
if (ImGui::BeginTable("##response", 1, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders, ImVec2(0, -50_scaled))) { if (ImGui::BeginTable("##response", 1, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders, ImVec2(0, -50_scaled))) {
{ {
std::scoped_lock lock(receiverMutex); std::scoped_lock lock(receiverMutex);
u32 index = 0;
for (const auto &message : messages) { for (const auto &message : messages) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::PushID(index);
ImGui::TextFormattedSelectable("{}", message.c_str()); ImGui::TextFormattedSelectable("{}", message.c_str());
ImGui::PopID();
index += 1;
} }
} }