mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Add a button which can copy local id to clipboard
This commit is contained in:
@@ -18,32 +18,40 @@ int Render::ConnectionStatusWindow() {
|
||||
connection_status_window_height_));
|
||||
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0, 1.0, 1.0, 1.0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
||||
ImGui::Begin("ConnectionStatusWindow", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoSavedSettings);
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::SetCursorPosX(connection_status_window_width_ * 1 / 3);
|
||||
ImGui::SetCursorPosY(connection_status_window_height_ * 1 / 3);
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::SetWindowFontScale(0.6f);
|
||||
std::string text;
|
||||
|
||||
if (ConnectionStatus::Connecting == connection_status_) {
|
||||
ImGui::Text("Connecting...");
|
||||
text = "Connecting...";
|
||||
} else if (ConnectionStatus::Connected == connection_status_) {
|
||||
ImGui::Text("Connected");
|
||||
text = "Connected";
|
||||
} else if (ConnectionStatus::Disconnected == connection_status_) {
|
||||
ImGui::Text("Disonnected");
|
||||
text = "Disonnected";
|
||||
} else if (ConnectionStatus::Failed == connection_status_) {
|
||||
ImGui::Text("Failed");
|
||||
text = "Failed";
|
||||
} else if (ConnectionStatus::Closed == connection_status_) {
|
||||
ImGui::Text("Closed");
|
||||
text = "Closed";
|
||||
} else if (ConnectionStatus::IncorrectPassword == connection_status_) {
|
||||
ImGui::Text("Incorrect password");
|
||||
text = "Incorrect password";
|
||||
} else if (ConnectionStatus::NoSuchTransmissionId == connection_status_) {
|
||||
ImGui::Text("No such transmissionId");
|
||||
text = "No such transmissionId";
|
||||
}
|
||||
|
||||
auto window_width = ImGui::GetWindowSize().x;
|
||||
auto window_height = ImGui::GetWindowSize().y;
|
||||
auto text_width = ImGui::CalcTextSize(text.c_str()).x;
|
||||
ImGui::SetCursorPosX((window_width - text_width) * 0.5f);
|
||||
ImGui::SetCursorPosY(window_height * 0.3f);
|
||||
ImGui::Text("%s", text.c_str());
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||
@@ -59,6 +67,8 @@ int Render::ConnectionStatusWindow() {
|
||||
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user