mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Chinese support in connection status window
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,13 @@ static std::vector<std::string> enable_hardware_video_codec = {
|
|||||||
static std::vector<std::string> ok = {u8"确认", "OK"};
|
static std::vector<std::string> ok = {u8"确认", "OK"};
|
||||||
static std::vector<std::string> cancel = {u8"取消", "Cancel"};
|
static std::vector<std::string> cancel = {u8"取消", "Cancel"};
|
||||||
|
|
||||||
|
static std::vector<std::string> input_password = {u8"请输入密码",
|
||||||
|
"Please input password"};
|
||||||
|
static std::vector<std::string> validate_password = {u8"验证密码中...",
|
||||||
|
"Validate password ..."};
|
||||||
|
static std::vector<std::string> reinput_password = {
|
||||||
|
u8"请重新输入密码", "Please input password again"};
|
||||||
|
|
||||||
static std::vector<std::string> signal_connected = {u8"已连接服务器",
|
static std::vector<std::string> signal_connected = {u8"已连接服务器",
|
||||||
"Connected"};
|
"Connected"};
|
||||||
static std::vector<std::string> signal_disconnected = {u8"未连接服务器",
|
static std::vector<std::string> signal_disconnected = {u8"未连接服务器",
|
||||||
@@ -56,10 +63,15 @@ static std::vector<std::string> p2p_connected = {u8"对等连接已建立",
|
|||||||
"P2P Connected"};
|
"P2P Connected"};
|
||||||
static std::vector<std::string> p2p_disconnected = {u8"对等连接已断开",
|
static std::vector<std::string> p2p_disconnected = {u8"对等连接已断开",
|
||||||
"P2P Disconnected"};
|
"P2P Disconnected"};
|
||||||
static std::vector<std::string> p2p_connecting = {u8"正在建立对等连接",
|
static std::vector<std::string> p2p_connecting = {u8"正在建立对等连接...",
|
||||||
"P2P Connecting"};
|
"P2P Connecting ..."};
|
||||||
|
static std::vector<std::string> p2p_failed = {u8"对等连接失败", "P2P Failed"};
|
||||||
|
static std::vector<std::string> p2p_closed = {u8"对等连接已关闭", "P2P closed"};
|
||||||
|
|
||||||
|
static std::vector<std::string> no_such_id = {u8"无此ID", "No such ID"};
|
||||||
|
|
||||||
static std::vector<std::string> about = {u8"关于", "About"};
|
static std::vector<std::string> about = {u8"关于", "About"};
|
||||||
|
static std::vector<std::string> version = {u8"版本", "Version"};
|
||||||
|
|
||||||
} // namespace localization
|
} // namespace localization
|
||||||
|
|
||||||
|
|||||||
@@ -32,22 +32,17 @@ int Render::ConnectionStatusWindow() {
|
|||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(0.6f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
if (ConnectionStatus::Connecting == connection_status_) {
|
if (ConnectionStatus::Connecting == connection_status_) {
|
||||||
text = "Connecting...";
|
text = localization::p2p_connecting[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
// Cancel
|
|
||||||
if (ImGui::Button(
|
|
||||||
localization::cancel[localization_language_index_].c_str())) {
|
|
||||||
connect_button_pressed_ = false;
|
|
||||||
}
|
|
||||||
} else if (ConnectionStatus::Connected == connection_status_) {
|
} else if (ConnectionStatus::Connected == connection_status_) {
|
||||||
text = "Connected";
|
text = localization::p2p_connected[localization_language_index_];
|
||||||
} else if (ConnectionStatus::Disconnected == connection_status_) {
|
} else if (ConnectionStatus::Disconnected == connection_status_) {
|
||||||
text = "Disonnected";
|
text = localization::p2p_disconnected[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
// Cancel
|
// Cancel
|
||||||
@@ -56,7 +51,7 @@ int Render::ConnectionStatusWindow() {
|
|||||||
connect_button_pressed_ = false;
|
connect_button_pressed_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Failed == connection_status_) {
|
} else if (ConnectionStatus::Failed == connection_status_) {
|
||||||
text = "Failed";
|
text = localization::p2p_failed[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
// Cancel
|
// Cancel
|
||||||
@@ -65,47 +60,59 @@ int Render::ConnectionStatusWindow() {
|
|||||||
connect_button_pressed_ = false;
|
connect_button_pressed_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Closed == connection_status_) {
|
} else if (ConnectionStatus::Closed == connection_status_) {
|
||||||
text = "Closed";
|
text = localization::p2p_closed[localization_language_index_];
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
// Cancel
|
// Cancel
|
||||||
if (ImGui::Button(
|
if (ImGui::Button(
|
||||||
localization::cancel[localization_language_index_].c_str())) {
|
localization::ok[localization_language_index_].c_str())) {
|
||||||
connect_button_pressed_ = false;
|
connect_button_pressed_ = false;
|
||||||
}
|
}
|
||||||
} else if (ConnectionStatus::IncorrectPassword == connection_status_) {
|
} else if (ConnectionStatus::IncorrectPassword == connection_status_) {
|
||||||
text = "Please input password";
|
if (!password_validating_) {
|
||||||
auto window_width = ImGui::GetWindowSize().x;
|
if (password_validating_time_ == 1) {
|
||||||
auto window_height = ImGui::GetWindowSize().y;
|
text = localization::input_password[localization_language_index_];
|
||||||
ImGui::SetCursorPosX((window_width - IPUT_WINDOW_WIDTH / 2) * 0.5f);
|
} else {
|
||||||
ImGui::SetCursorPosY(window_height * 0.4f);
|
text = localization::reinput_password[localization_language_index_];
|
||||||
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2);
|
}
|
||||||
|
auto window_width = ImGui::GetWindowSize().x;
|
||||||
|
auto window_height = ImGui::GetWindowSize().y;
|
||||||
|
ImGui::SetCursorPosX((window_width - IPUT_WINDOW_WIDTH / 2) * 0.5f);
|
||||||
|
ImGui::SetCursorPosY(window_height * 0.4f);
|
||||||
|
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2);
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||||
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
|
||||||
ImGuiInputTextFlags_CharsNoBlank);
|
ImGuiInputTextFlags_CharsNoBlank);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
ImGui::SetCursorPosX(window_width * 0.28f);
|
ImGui::SetCursorPosX(window_width * 0.315f);
|
||||||
ImGui::SetCursorPosY(window_height * 0.75f);
|
ImGui::SetCursorPosY(window_height * 0.75f);
|
||||||
// OK
|
// OK
|
||||||
if (ImGui::Button(
|
if (ImGui::Button(
|
||||||
localization::ok[localization_language_index_].c_str())) {
|
localization::ok[localization_language_index_].c_str())) {
|
||||||
connect_button_pressed_ = true;
|
connect_button_pressed_ = true;
|
||||||
JoinConnection(peer_reserved_ ? peer_reserved_ : peer_, remote_id_,
|
password_validating_ = true;
|
||||||
remote_password_.c_str());
|
JoinConnection(peer_reserved_ ? peer_reserved_ : peer_, remote_id_,
|
||||||
|
remote_password_.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
if (ImGui::Button(
|
||||||
|
localization::cancel[localization_language_index_].c_str())) {
|
||||||
|
remote_password_ = "";
|
||||||
|
connect_button_pressed_ = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
text = localization::validate_password[localization_language_index_];
|
||||||
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
else if (ConnectionStatus::NoSuchTransmissionId == connection_status_) {
|
||||||
|
text = localization::no_such_id[localization_language_index_];
|
||||||
if (ImGui::Button(
|
|
||||||
localization::cancel[localization_language_index_].c_str())) {
|
|
||||||
remote_password_ = "";
|
|
||||||
connect_button_pressed_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (ConnectionStatus::NoSuchTransmissionId == connection_status_) {
|
|
||||||
text = "No such transmissionId";
|
|
||||||
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7);
|
||||||
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3);
|
||||||
// Cancel
|
// Cancel
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int Render::AboutWindow() {
|
|||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(about_window_width_, about_window_height_));
|
ImGui::SetNextWindowSize(ImVec2(about_window_width_, about_window_height_));
|
||||||
|
|
||||||
// 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, 5.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
@@ -61,7 +61,16 @@ int Render::AboutWindow() {
|
|||||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
std::string text = "Version 0.0.1";
|
|
||||||
|
std::string version;
|
||||||
|
#ifdef RD_VERSION
|
||||||
|
version = RD_VERSION;
|
||||||
|
#else
|
||||||
|
version = "Unknown";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string text =
|
||||||
|
localization::version[localization_language_index_] + ": " + version;
|
||||||
ImGui::Text("%s", text.c_str());
|
ImGui::Text("%s", text.c_str());
|
||||||
|
|
||||||
ImGui::SetCursorPosX(about_window_width_ * 0.42f);
|
ImGui::SetCursorPosX(about_window_width_ * 0.42f);
|
||||||
@@ -76,6 +85,7 @@ int Render::AboutWindow() {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -161,6 +161,8 @@ class Render {
|
|||||||
bool connection_established_ = false;
|
bool connection_established_ = false;
|
||||||
bool subwindow_hovered_ = false;
|
bool subwindow_hovered_ = false;
|
||||||
bool connect_button_pressed_ = false;
|
bool connect_button_pressed_ = false;
|
||||||
|
bool password_validating_ = false;
|
||||||
|
uint32_t password_validating_time_ = 0;
|
||||||
bool control_bar_button_pressed_ = false;
|
bool control_bar_button_pressed_ = false;
|
||||||
bool fullscreen_button_pressed_ = false;
|
bool fullscreen_button_pressed_ = false;
|
||||||
bool mouse_control_button_pressed_ = false;
|
bool mouse_control_button_pressed_ = false;
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
|
|||||||
render->connection_status_str_ = "Connected";
|
render->connection_status_str_ = "Connected";
|
||||||
render->connection_established_ = true;
|
render->connection_established_ = true;
|
||||||
render->streaming_ = true;
|
render->streaming_ = true;
|
||||||
// render->connect_button_pressed_ = false;
|
|
||||||
SDL_SetWindowSize(render->main_window_, render->stream_window_width_,
|
SDL_SetWindowSize(render->main_window_, render->stream_window_width_,
|
||||||
render->stream_window_height_);
|
render->stream_window_height_);
|
||||||
SDL_SetWindowPosition(render->main_window_, SDL_WINDOWPOS_CENTERED,
|
SDL_SetWindowPosition(render->main_window_, SDL_WINDOWPOS_CENTERED,
|
||||||
@@ -185,10 +184,13 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
|
|||||||
}
|
}
|
||||||
} else if (ConnectionStatus::Disconnected == status) {
|
} else if (ConnectionStatus::Disconnected == status) {
|
||||||
render->connection_status_str_ = "Disconnected";
|
render->connection_status_str_ = "Disconnected";
|
||||||
|
render->password_validating_time_ = 0;
|
||||||
} else if (ConnectionStatus::Failed == status) {
|
} else if (ConnectionStatus::Failed == status) {
|
||||||
render->connection_status_str_ = "Failed";
|
render->connection_status_str_ = "Failed";
|
||||||
|
render->password_validating_time_ = 0;
|
||||||
} else if (ConnectionStatus::Closed == status) {
|
} else if (ConnectionStatus::Closed == status) {
|
||||||
render->connection_status_str_ = "Closed";
|
render->connection_status_str_ = "Closed";
|
||||||
|
render->password_validating_time_ = 0;
|
||||||
render->start_screen_capture_ = false;
|
render->start_screen_capture_ = false;
|
||||||
render->start_mouse_control_ = false;
|
render->start_mouse_control_ = false;
|
||||||
render->connection_established_ = false;
|
render->connection_established_ = false;
|
||||||
@@ -202,8 +204,9 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
|
|||||||
}
|
}
|
||||||
} else if (ConnectionStatus::IncorrectPassword == status) {
|
} else if (ConnectionStatus::IncorrectPassword == status) {
|
||||||
render->connection_status_str_ = "Incorrect password";
|
render->connection_status_str_ = "Incorrect password";
|
||||||
|
render->password_validating_ = false;
|
||||||
|
render->password_validating_time_++;
|
||||||
if (render->connect_button_pressed_) {
|
if (render->connect_button_pressed_) {
|
||||||
// render->connect_button_pressed_ = false;
|
|
||||||
render->connection_established_ = false;
|
render->connection_established_ = false;
|
||||||
render->connect_button_label_ =
|
render->connect_button_label_ =
|
||||||
render->connect_button_pressed_
|
render->connect_button_pressed_
|
||||||
@@ -213,7 +216,6 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
|
|||||||
} else if (ConnectionStatus::NoSuchTransmissionId == status) {
|
} else if (ConnectionStatus::NoSuchTransmissionId == status) {
|
||||||
render->connection_status_str_ = "No such transmission id";
|
render->connection_status_str_ = "No such transmission id";
|
||||||
if (render->connect_button_pressed_) {
|
if (render->connect_button_pressed_) {
|
||||||
// render->connect_button_pressed_ = false;
|
|
||||||
render->connection_established_ = false;
|
render->connection_established_ = false;
|
||||||
render->connect_button_label_ =
|
render->connect_button_label_ =
|
||||||
render->connect_button_pressed_
|
render->connect_button_pressed_
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ int Render::SettingButton() {
|
|||||||
// Settings
|
// Settings
|
||||||
{
|
{
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
|
|
||||||
@@ -251,6 +252,7 @@ int Render::SettingButton() {
|
|||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
set_project("remote_desk")
|
set_project("remote_desk")
|
||||||
set_version("0.0.1")
|
|
||||||
set_license("LGPL-3.0")
|
set_license("LGPL-3.0")
|
||||||
|
|
||||||
|
set_version("0.0.1")
|
||||||
|
add_defines("RD_VERSION=\"0.0.1\"");
|
||||||
|
|
||||||
add_rules("mode.release", "mode.debug")
|
add_rules("mode.release", "mode.debug")
|
||||||
set_languages("c++17")
|
set_languages("c++17")
|
||||||
set_encodings("utf-8")
|
set_encodings("utf-8")
|
||||||
|
|||||||
Reference in New Issue
Block a user