|
|
|
|
@@ -1,4 +1,3 @@
|
|
|
|
|
#include "IconsFontAwesome6.h"
|
|
|
|
|
#include "localization.h"
|
|
|
|
|
#include "rd_log.h"
|
|
|
|
|
#include "render.h"
|
|
|
|
|
@@ -87,6 +86,8 @@ int Render::ShowRecentConnections() {
|
|
|
|
|
ImGui::PopStyleColor();
|
|
|
|
|
int recent_connections_count = recent_connection_textures_.size();
|
|
|
|
|
int count = 0;
|
|
|
|
|
int button_width = 20;
|
|
|
|
|
int button_height = 20;
|
|
|
|
|
for (auto it = recent_connection_textures_.begin();
|
|
|
|
|
it != recent_connection_textures_.end(); ++it) {
|
|
|
|
|
sub_containers_pos[it->first] = ImGui::GetCursorPos();
|
|
|
|
|
@@ -112,42 +113,105 @@ int Render::ShowRecentConnections() {
|
|
|
|
|
ImGui::SetCursorPos(pos);
|
|
|
|
|
ImGui::Text(host_name.c_str());
|
|
|
|
|
ImGui::SetWindowFontScale(1.0f);
|
|
|
|
|
ImVec2 image_pos = ImGui::GetCursorPos();
|
|
|
|
|
ImGui::Image((ImTextureID)(intptr_t)it->second,
|
|
|
|
|
ImVec2((float)recent_connection_image_width_,
|
|
|
|
|
(float)recent_connection_image_height_));
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 0.8f));
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered,
|
|
|
|
|
ImVec4(0.1f, 0.4f, 0.8f, 1.0f));
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive,
|
|
|
|
|
ImVec4(1.0f, 1.0f, 1.0f, 0.7f));
|
|
|
|
|
ImVec2 trash_can_button_pos =
|
|
|
|
|
ImVec2(image_pos.x,
|
|
|
|
|
image_pos.y + recent_connection_image_height_ - button_height);
|
|
|
|
|
ImGui::SetCursorPos(trash_can_button_pos);
|
|
|
|
|
ImGui::SetWindowFontScale(0.5f);
|
|
|
|
|
std::string trash_can = ICON_FA_TRASH_CAN;
|
|
|
|
|
std::string recent_connection_delete_button_name =
|
|
|
|
|
trash_can + "##RecentConnectionDelete" +
|
|
|
|
|
std::to_string(trash_can_button_pos.x);
|
|
|
|
|
if (ImGui::Button(recent_connection_delete_button_name.c_str())) {
|
|
|
|
|
show_confirm_delete_connection_ = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (delete_connection_) {
|
|
|
|
|
if (!thumbnail_.DeleteThumbnail(it->first)) {
|
|
|
|
|
reload_recent_connections_ = true;
|
|
|
|
|
delete_connection_ = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImVec2 connect_button_pos =
|
|
|
|
|
ImVec2(image_pos.x + recent_connection_image_width_ - button_width,
|
|
|
|
|
image_pos.y + recent_connection_image_height_ - button_height);
|
|
|
|
|
ImGui::SetCursorPos(connect_button_pos);
|
|
|
|
|
std::string connect = ICON_FA_ARROW_RIGHT_LONG;
|
|
|
|
|
std::string connect_to_this_connection_button_name =
|
|
|
|
|
connect + "##ConnectionTo" + it->first;
|
|
|
|
|
if (ImGui::Button(connect_to_this_connection_button_name.c_str(),
|
|
|
|
|
ImVec2(button_width, button_height))) {
|
|
|
|
|
LOG_ERROR("Connect to [{}]",
|
|
|
|
|
connect_to_this_connection_button_name.c_str());
|
|
|
|
|
}
|
|
|
|
|
ImGui::SetWindowFontScale(1.0f);
|
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
ImGui::SameLine(0, count != recent_connections_count ? 23.0f : 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
|
|
|
|
|
for (const auto& pos : sub_containers_pos) {
|
|
|
|
|
ImVec2 delete_button_pos =
|
|
|
|
|
ImVec2(pos.second.x + recent_connection_sub_container_width - 11.0f,
|
|
|
|
|
pos.second.y - 7.0f);
|
|
|
|
|
ImGui::SetCursorPos(delete_button_pos);
|
|
|
|
|
ImGui::SetWindowFontScale(0.5f);
|
|
|
|
|
std::string xmake = ICON_FA_CIRCLE_XMARK;
|
|
|
|
|
std::string recent_connection_delete_button_name =
|
|
|
|
|
xmake + "##RecentConnectionDelete" +
|
|
|
|
|
std::to_string(delete_button_pos.x);
|
|
|
|
|
if (ImGui::SmallButton(recent_connection_delete_button_name.c_str())) {
|
|
|
|
|
show_confirm_delete_connection_ = true;
|
|
|
|
|
}
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0));
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
|
|
|
|
|
// for (const auto& pos : sub_containers_pos) {
|
|
|
|
|
// ImVec2 delete_button_pos =
|
|
|
|
|
// ImVec2(pos.second.x + recent_connection_sub_container_width - 11.0f,
|
|
|
|
|
// pos.second.y - 7.0f);
|
|
|
|
|
// ImGui::SetCursorPos(delete_button_pos);
|
|
|
|
|
// ImGui::SetWindowFontScale(0.5f);
|
|
|
|
|
// std::string xmake = ICON_FA_CIRCLE_XMARK;
|
|
|
|
|
// std::string recent_connection_delete_button_name =
|
|
|
|
|
// xmake + "##RecentConnectionDelete" +
|
|
|
|
|
// std::to_string(delete_button_pos.x);
|
|
|
|
|
// if (ImGui::SmallButton(recent_connection_delete_button_name.c_str())) {
|
|
|
|
|
// show_confirm_delete_connection_ = true;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (delete_connection_) {
|
|
|
|
|
if (!thumbnail_.DeleteThumbnail(pos.first)) {
|
|
|
|
|
reload_recent_connections_ = true;
|
|
|
|
|
delete_connection_ = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ImGui::SetWindowFontScale(1.0f);
|
|
|
|
|
}
|
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
// if (delete_connection_) {
|
|
|
|
|
// if (!thumbnail_.DeleteThumbnail(pos.first)) {
|
|
|
|
|
// reload_recent_connections_ = true;
|
|
|
|
|
// delete_connection_ = false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// ImGui::SetWindowFontScale(1.0f);
|
|
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
// int delete_button_width = 20;
|
|
|
|
|
// int delete_button_height = 20;
|
|
|
|
|
// int pos_x = pos.second.x;
|
|
|
|
|
// int pos_y = pos.second.y + recent_connection_sub_container_height -
|
|
|
|
|
// delete_button_height;
|
|
|
|
|
// ImVec2 connect_button_pos = ImVec2(pos_x, pos_y);
|
|
|
|
|
// ImGui::SetCursorPos(connect_button_pos);
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 0, 0, 1));
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 1, 0, 1));
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 1, 1));
|
|
|
|
|
// std::string connect_to_this_connection_button_name =
|
|
|
|
|
// "##ConnectionTo" + pos.first;
|
|
|
|
|
// if (ImGui::Button(connect_to_this_connection_button_name.c_str(),
|
|
|
|
|
// ImVec2(delete_button_width, delete_button_height))) {
|
|
|
|
|
// LOG_ERROR("Connect to [{}]",
|
|
|
|
|
// connect_to_this_connection_button_name.c_str());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ImGui::PopStyleColor(3);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
|
|
|
|
|
|