mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-04-25 12:43:10 +08:00
Compare commits
3 Commits
19feb8ff49
...
ef02403da6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef02403da6 | ||
|
|
adfab363c1 | ||
|
|
123d4cf595 |
@@ -220,6 +220,8 @@ static std::vector<std::string> online = {
|
|||||||
reinterpret_cast<const char*>(u8"在线"), "Online"};
|
reinterpret_cast<const char*>(u8"在线"), "Online"};
|
||||||
static std::vector<std::string> offline = {
|
static std::vector<std::string> offline = {
|
||||||
reinterpret_cast<const char*>(u8"离线"), "Offline"};
|
reinterpret_cast<const char*>(u8"离线"), "Offline"};
|
||||||
|
static std::vector<std::string> device_offline = {
|
||||||
|
reinterpret_cast<const char*>(u8"设备离线"), "Device Offline"};
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
static std::vector<LPCWSTR> exit_program = {L"退出", L"Exit"};
|
static std::vector<LPCWSTR> exit_program = {L"退出", L"Exit"};
|
||||||
|
|||||||
@@ -138,15 +138,17 @@ int Render::ShowRecentConnections() {
|
|||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
ImVec2 circle_pos =
|
ImVec2 circle_pos =
|
||||||
ImVec2(image_screen_pos.x + recent_connection_image_width * 0.07f,
|
ImVec2(image_screen_pos.x + recent_connection_image_width * 0.07f,
|
||||||
image_screen_pos.y + recent_connection_image_height * 0.13f);
|
image_screen_pos.y + recent_connection_image_height * 0.12f);
|
||||||
ImU32 fill_color =
|
ImU32 fill_color =
|
||||||
online ? IM_COL32(0, 255, 0, 255) : IM_COL32(140, 140, 140, 255);
|
online ? IM_COL32(0, 255, 0, 255) : IM_COL32(140, 140, 140, 255);
|
||||||
ImU32 border_color = IM_COL32(255, 255, 255, 230);
|
ImU32 border_color = IM_COL32(255, 255, 255, 255);
|
||||||
draw_list->AddCircleFilled(circle_pos, 6.0f, fill_color);
|
float dot_radius = recent_connection_image_height * 0.06f;
|
||||||
draw_list->AddCircle(circle_pos, 6.0f, border_color, 100, 2.0f);
|
draw_list->AddCircleFilled(circle_pos, dot_radius * 1.25f, border_color,
|
||||||
|
100);
|
||||||
|
draw_list->AddCircleFilled(circle_pos, dot_radius, fill_color, 100);
|
||||||
if (ImGui::IsMouseHoveringRect(
|
if (ImGui::IsMouseHoveringRect(
|
||||||
ImVec2(circle_pos.x - 6.0f, circle_pos.y - 6.0f),
|
ImVec2(circle_pos.x - dot_radius, circle_pos.y - dot_radius),
|
||||||
ImVec2(circle_pos.x + 6.0f, circle_pos.y + 6.0f))) {
|
ImVec2(circle_pos.x + dot_radius, circle_pos.y + dot_radius))) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
ImGui::Text(
|
ImGui::Text(
|
||||||
@@ -238,8 +240,14 @@ int Render::ShowRecentConnections() {
|
|||||||
if (ImGui::Button(connect_to_this_connection_button_name.c_str(),
|
if (ImGui::Button(connect_to_this_connection_button_name.c_str(),
|
||||||
ImVec2(recent_connection_button_width,
|
ImVec2(recent_connection_button_width,
|
||||||
recent_connection_button_height))) {
|
recent_connection_button_height))) {
|
||||||
ConnectTo(it.second.remote_id, it.second.password.c_str(),
|
if (online) {
|
||||||
it.second.remember_password);
|
ConnectTo(it.second.remote_id, it.second.password.c_str(),
|
||||||
|
it.second.remember_password);
|
||||||
|
} else {
|
||||||
|
show_offline_warning_window_ = true;
|
||||||
|
offline_warning_text_ =
|
||||||
|
localization::device_offline[localization_language_index_];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
@@ -270,6 +278,9 @@ int Render::ShowRecentConnections() {
|
|||||||
if (show_confirm_delete_connection_) {
|
if (show_confirm_delete_connection_) {
|
||||||
ConfirmDeleteConnection();
|
ConfirmDeleteConnection();
|
||||||
}
|
}
|
||||||
|
if (show_offline_warning_window_) {
|
||||||
|
OfflineWarningWindow();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -282,7 +293,7 @@ int Render::ConfirmDeleteConnection() {
|
|||||||
ImVec2(io.DisplaySize.x * 0.33f, io.DisplaySize.y * 0.33f));
|
ImVec2(io.DisplaySize.x * 0.33f, io.DisplaySize.y * 0.33f));
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0, 1.0, 1.0, 1.0));
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
|
||||||
|
|
||||||
@@ -327,4 +338,45 @@ int Render::ConfirmDeleteConnection() {
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Render::OfflineWarningWindow() {
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui::SetNextWindowPos(
|
||||||
|
ImVec2(io.DisplaySize.x * 0.33f, io.DisplaySize.y * 0.33f));
|
||||||
|
ImGui::SetNextWindowSize(
|
||||||
|
ImVec2(io.DisplaySize.x * 0.33f, io.DisplaySize.y * 0.33f));
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
|
||||||
|
|
||||||
|
ImGui::Begin("OfflineWarningWindow", nullptr,
|
||||||
|
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
|
||||||
|
ImGuiWindowFlags_NoSavedSettings);
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
|
auto window_width = ImGui::GetWindowSize().x;
|
||||||
|
auto window_height = ImGui::GetWindowSize().y;
|
||||||
|
|
||||||
|
ImGui::SetCursorPosX(window_width * 0.43f);
|
||||||
|
ImGui::SetCursorPosY(window_height * 0.67f);
|
||||||
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
|
if (ImGui::Button(localization::ok[localization_language_index_].c_str()) ||
|
||||||
|
ImGui::IsKeyPressed(ImGuiKey_Enter) ||
|
||||||
|
ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||||
|
show_offline_warning_window_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto text_width = ImGui::CalcTextSize(offline_warning_text_.c_str()).x;
|
||||||
|
ImGui::SetCursorPosX((window_width - text_width) * 0.5f);
|
||||||
|
ImGui::SetCursorPosY(window_height * 0.2f);
|
||||||
|
ImGui::Text("%s", offline_warning_text_.c_str());
|
||||||
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} // namespace crossdesk
|
} // namespace crossdesk
|
||||||
@@ -257,6 +257,7 @@ class Render {
|
|||||||
int DrawStreamWindow();
|
int DrawStreamWindow();
|
||||||
int DrawServerWindow();
|
int DrawServerWindow();
|
||||||
int ConfirmDeleteConnection();
|
int ConfirmDeleteConnection();
|
||||||
|
int OfflineWarningWindow();
|
||||||
int NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props);
|
int NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props);
|
||||||
void DrawConnectionStatusText(
|
void DrawConnectionStatusText(
|
||||||
std::shared_ptr<SubStreamWindowProperties>& props);
|
std::shared_ptr<SubStreamWindowProperties>& props);
|
||||||
@@ -577,9 +578,11 @@ class Render {
|
|||||||
bool is_server_mode_ = false;
|
bool is_server_mode_ = false;
|
||||||
bool reload_recent_connections_ = true;
|
bool reload_recent_connections_ = true;
|
||||||
bool show_confirm_delete_connection_ = false;
|
bool show_confirm_delete_connection_ = false;
|
||||||
|
bool show_offline_warning_window_ = false;
|
||||||
bool delete_connection_ = false;
|
bool delete_connection_ = false;
|
||||||
bool is_tab_bar_hovered_ = false;
|
bool is_tab_bar_hovered_ = false;
|
||||||
std::string delete_connection_name_ = "";
|
std::string delete_connection_name_ = "";
|
||||||
|
std::string offline_warning_text_ = "";
|
||||||
bool re_enter_remote_id_ = false;
|
bool re_enter_remote_id_ = false;
|
||||||
double copy_start_time_ = 0;
|
double copy_start_time_ = 0;
|
||||||
SignalStatus signal_status_ = SignalStatus::SignalClosed;
|
SignalStatus signal_status_ = SignalStatus::SignalClosed;
|
||||||
@@ -685,4 +688,4 @@ class Render {
|
|||||||
FileTransferState file_transfer_;
|
FileTransferState file_transfer_;
|
||||||
};
|
};
|
||||||
} // namespace crossdesk
|
} // namespace crossdesk
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ int Render::StatusBar() {
|
|||||||
ImVec2 dot_pos = ImVec2(status_bar_width * 0.025f,
|
ImVec2 dot_pos = ImVec2(status_bar_width * 0.025f,
|
||||||
io.DisplaySize.y * (1 - STATUS_BAR_HEIGHT * 0.5f));
|
io.DisplaySize.y * (1 - STATUS_BAR_HEIGHT * 0.5f));
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
|
draw_list->AddCircleFilled(dot_pos, status_bar_height * 0.25f,
|
||||||
|
ImColor(1.0f, 1.0f, 1.0f), 100);
|
||||||
draw_list->AddCircleFilled(dot_pos, status_bar_height * 0.2f,
|
draw_list->AddCircleFilled(dot_pos, status_bar_height * 0.2f,
|
||||||
ImColor(signal_connected_ ? 0.0f : 1.0f,
|
ImColor(signal_connected_ ? 0.0f : 1.0f,
|
||||||
signal_connected_ ? 1.0f : 0.0f, 0.0f),
|
signal_connected_ ? 1.0f : 0.0f, 0.0f),
|
||||||
100);
|
100);
|
||||||
draw_list->AddCircle(dot_pos, status_bar_height * 0.25f,
|
|
||||||
ImColor(1.0f, 1.0f, 1.0f), 100);
|
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(0.6f);
|
ImGui::SetWindowFontScale(0.6f);
|
||||||
draw_list->AddText(
|
draw_list->AddText(
|
||||||
|
|||||||
Submodule submodules/minirtc updated: 8307bfaade...24a76443bb
Reference in New Issue
Block a user