mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-08-20 01:55:48 +08:00
Compare commits
3
Commits
d6d30b6842
...
c487d3a62c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c487d3a62c | ||
|
|
aee5be5ee6 | ||
|
|
6ff2783105 |
@@ -5,6 +5,15 @@
|
|||||||
|
|
||||||
namespace crossdesk {
|
namespace crossdesk {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool IsValidTurnModeValue(long value) {
|
||||||
|
return value >= static_cast<long>(ConfigCenter::TURN_MODE::DISABLED) &&
|
||||||
|
value <= static_cast<long>(ConfigCenter::TURN_MODE::FORCE_TCP);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
ConfigCenter::ConfigCenter(const std::string& config_path)
|
ConfigCenter::ConfigCenter(const std::string& config_path)
|
||||||
: config_path_(config_path) {
|
: config_path_(config_path) {
|
||||||
ini_.SetUnicode(true);
|
ini_.SetUnicode(true);
|
||||||
@@ -20,6 +29,8 @@ int ConfigCenter::Load() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool persist_turn_mode_migration = false;
|
||||||
|
|
||||||
const long language_value =
|
const long language_value =
|
||||||
ini_.GetLongValue(section_, "language", static_cast<long>(language_));
|
ini_.GetLongValue(section_, "language", static_cast<long>(language_));
|
||||||
if (language_value < static_cast<long>(LANGUAGE::CHINESE) ||
|
if (language_value < static_cast<long>(LANGUAGE::CHINESE) ||
|
||||||
@@ -42,7 +53,25 @@ int ConfigCenter::Load() {
|
|||||||
hardware_video_codec_ = ini_.GetBoolValue(section_, "hardware_video_codec",
|
hardware_video_codec_ = ini_.GetBoolValue(section_, "hardware_video_codec",
|
||||||
hardware_video_codec_);
|
hardware_video_codec_);
|
||||||
|
|
||||||
enable_turn_ = ini_.GetBoolValue(section_, "enable_turn", enable_turn_);
|
const char* turn_mode_value = ini_.GetValue(section_, "turn_mode", nullptr);
|
||||||
|
if (turn_mode_value != nullptr && strlen(turn_mode_value) > 0) {
|
||||||
|
const long parsed_turn_mode = ini_.GetLongValue(
|
||||||
|
section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||||
|
if (IsValidTurnModeValue(parsed_turn_mode)) {
|
||||||
|
turn_mode_ = static_cast<TURN_MODE>(parsed_turn_mode);
|
||||||
|
} else {
|
||||||
|
LOG_WARN("Invalid TURN mode [{}], using auto UDP/TCP",
|
||||||
|
parsed_turn_mode);
|
||||||
|
turn_mode_ = TURN_MODE::AUTO_UDP_TCP;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const bool legacy_enable_turn = ini_.GetBoolValue(
|
||||||
|
section_, "enable_turn", turn_mode_ != TURN_MODE::DISABLED);
|
||||||
|
turn_mode_ = legacy_enable_turn ? TURN_MODE::AUTO_UDP_TCP
|
||||||
|
: TURN_MODE::DISABLED;
|
||||||
|
ini_.SetLongValue(section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||||
|
persist_turn_mode_migration = true;
|
||||||
|
}
|
||||||
enable_srtp_ = ini_.GetBoolValue(section_, "enable_srtp", enable_srtp_);
|
enable_srtp_ = ini_.GetBoolValue(section_, "enable_srtp", enable_srtp_);
|
||||||
enable_self_hosted_ =
|
enable_self_hosted_ =
|
||||||
ini_.GetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
ini_.GetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
||||||
@@ -92,6 +121,11 @@ int ConfigCenter::Load() {
|
|||||||
file_transfer_save_path_ = "";
|
file_transfer_save_path_ = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (persist_turn_mode_migration &&
|
||||||
|
ini_.SaveFile(config_path_.c_str()) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +138,9 @@ int ConfigCenter::Save() {
|
|||||||
ini_.SetLongValue(section_, "video_encode_format",
|
ini_.SetLongValue(section_, "video_encode_format",
|
||||||
static_cast<long>(video_encode_format_));
|
static_cast<long>(video_encode_format_));
|
||||||
ini_.SetBoolValue(section_, "hardware_video_codec", hardware_video_codec_);
|
ini_.SetBoolValue(section_, "hardware_video_codec", hardware_video_codec_);
|
||||||
ini_.SetBoolValue(section_, "enable_turn", enable_turn_);
|
ini_.SetLongValue(section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||||
|
ini_.SetBoolValue(section_, "enable_turn",
|
||||||
|
turn_mode_ != TURN_MODE::DISABLED);
|
||||||
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
||||||
ini_.SetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
ini_.SetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
||||||
|
|
||||||
@@ -191,9 +227,15 @@ int ConfigCenter::SetHardwareVideoCodec(bool hardware_video_codec) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigCenter::SetTurn(bool enable_turn) {
|
int ConfigCenter::SetTurnMode(TURN_MODE turn_mode) {
|
||||||
enable_turn_ = enable_turn;
|
if (!IsValidTurnModeValue(static_cast<long>(turn_mode))) {
|
||||||
ini_.SetBoolValue(section_, "enable_turn", enable_turn_);
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
turn_mode_ = turn_mode;
|
||||||
|
ini_.SetLongValue(section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||||
|
ini_.SetBoolValue(section_, "enable_turn",
|
||||||
|
turn_mode_ != TURN_MODE::DISABLED);
|
||||||
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -201,6 +243,16 @@ int ConfigCenter::SetTurn(bool enable_turn) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ConfigCenter::SetTurn(bool enable_turn) {
|
||||||
|
if (!enable_turn) {
|
||||||
|
return SetTurnMode(TURN_MODE::DISABLED);
|
||||||
|
}
|
||||||
|
if (turn_mode_ == TURN_MODE::DISABLED) {
|
||||||
|
return SetTurnMode(TURN_MODE::AUTO_UDP_TCP);
|
||||||
|
}
|
||||||
|
return SetTurnMode(turn_mode_);
|
||||||
|
}
|
||||||
|
|
||||||
int ConfigCenter::SetSrtp(bool enable_srtp) {
|
int ConfigCenter::SetSrtp(bool enable_srtp) {
|
||||||
enable_srtp_ = enable_srtp;
|
enable_srtp_ = enable_srtp;
|
||||||
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
||||||
@@ -362,7 +414,13 @@ bool ConfigCenter::IsHardwareVideoCodec() const {
|
|||||||
return hardware_video_codec_;
|
return hardware_video_codec_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigCenter::IsEnableTurn() const { return enable_turn_; }
|
ConfigCenter::TURN_MODE ConfigCenter::GetTurnMode() const {
|
||||||
|
return turn_mode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigCenter::IsEnableTurn() const {
|
||||||
|
return turn_mode_ != TURN_MODE::DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
bool ConfigCenter::IsEnableSrtp() const { return enable_srtp_; }
|
bool ConfigCenter::IsEnableSrtp() const { return enable_srtp_; }
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ class ConfigCenter {
|
|||||||
enum class VIDEO_QUALITY { LOW = 0, MEDIUM = 1, HIGH = 2 };
|
enum class VIDEO_QUALITY { LOW = 0, MEDIUM = 1, HIGH = 2 };
|
||||||
enum class VIDEO_FRAME_RATE { FPS_30 = 0, FPS_60 = 1 };
|
enum class VIDEO_FRAME_RATE { FPS_30 = 0, FPS_60 = 1 };
|
||||||
enum class VIDEO_ENCODE_FORMAT { H264 = 0, AV1 = 1 };
|
enum class VIDEO_ENCODE_FORMAT { H264 = 0, AV1 = 1 };
|
||||||
|
enum class TURN_MODE {
|
||||||
|
DISABLED = 0,
|
||||||
|
AUTO_UDP_TCP = 1,
|
||||||
|
FORCE_UDP = 2,
|
||||||
|
FORCE_TCP = 3
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigCenter(const std::string& config_path = "config.ini");
|
explicit ConfigCenter(const std::string& config_path = "config.ini");
|
||||||
@@ -30,6 +36,7 @@ class ConfigCenter {
|
|||||||
int SetVideoFrameRate(VIDEO_FRAME_RATE video_frame_rate);
|
int SetVideoFrameRate(VIDEO_FRAME_RATE video_frame_rate);
|
||||||
int SetVideoEncodeFormat(VIDEO_ENCODE_FORMAT video_encode_format);
|
int SetVideoEncodeFormat(VIDEO_ENCODE_FORMAT video_encode_format);
|
||||||
int SetHardwareVideoCodec(bool hardware_video_codec);
|
int SetHardwareVideoCodec(bool hardware_video_codec);
|
||||||
|
int SetTurnMode(TURN_MODE turn_mode);
|
||||||
int SetTurn(bool enable_turn);
|
int SetTurn(bool enable_turn);
|
||||||
int SetSrtp(bool enable_srtp);
|
int SetSrtp(bool enable_srtp);
|
||||||
int SetServerHost(const std::string& signal_server_host);
|
int SetServerHost(const std::string& signal_server_host);
|
||||||
@@ -49,6 +56,7 @@ class ConfigCenter {
|
|||||||
VIDEO_FRAME_RATE GetVideoFrameRate() const;
|
VIDEO_FRAME_RATE GetVideoFrameRate() const;
|
||||||
VIDEO_ENCODE_FORMAT GetVideoEncodeFormat() const;
|
VIDEO_ENCODE_FORMAT GetVideoEncodeFormat() const;
|
||||||
bool IsHardwareVideoCodec() const;
|
bool IsHardwareVideoCodec() const;
|
||||||
|
TURN_MODE GetTurnMode() const;
|
||||||
bool IsEnableTurn() const;
|
bool IsEnableTurn() const;
|
||||||
bool IsEnableSrtp() const;
|
bool IsEnableSrtp() const;
|
||||||
std::string GetSignalServerHost() const;
|
std::string GetSignalServerHost() const;
|
||||||
@@ -77,7 +85,7 @@ class ConfigCenter {
|
|||||||
VIDEO_FRAME_RATE video_frame_rate_ = VIDEO_FRAME_RATE::FPS_60;
|
VIDEO_FRAME_RATE video_frame_rate_ = VIDEO_FRAME_RATE::FPS_60;
|
||||||
VIDEO_ENCODE_FORMAT video_encode_format_ = VIDEO_ENCODE_FORMAT::H264;
|
VIDEO_ENCODE_FORMAT video_encode_format_ = VIDEO_ENCODE_FORMAT::H264;
|
||||||
bool hardware_video_codec_ = false;
|
bool hardware_video_codec_ = false;
|
||||||
bool enable_turn_ = true;
|
TURN_MODE turn_mode_ = TURN_MODE::AUTO_UDP_TCP;
|
||||||
bool enable_srtp_ = false;
|
bool enable_srtp_ = false;
|
||||||
std::string signal_server_host_ = "";
|
std::string signal_server_host_ = "";
|
||||||
std::string signal_server_host_default_ = "api.crossdesk.cn";
|
std::string signal_server_host_default_ = "api.crossdesk.cn";
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct TranslationRow {
|
|||||||
X(max_password_len, u8"最大6个字符", "Max 6 chars", u8"Макс. 6 символов") \
|
X(max_password_len, u8"最大6个字符", "Max 6 chars", u8"Макс. 6 символов") \
|
||||||
X(remote_desktop, u8"远程桌面", "Remote Desktop", \
|
X(remote_desktop, u8"远程桌面", "Remote Desktop", \
|
||||||
u8"Удаленный рабочий стол") \
|
u8"Удаленный рабочий стол") \
|
||||||
|
X(device_name, u8"设备名称", "Device Name", u8"Имя устройства") \
|
||||||
X(remote_id, u8"对端ID", "Remote ID", u8"Удаленный ID") \
|
X(remote_id, u8"对端ID", "Remote ID", u8"Удаленный ID") \
|
||||||
X(connect, u8"连接", "Connect", u8"Подключиться") \
|
X(connect, u8"连接", "Connect", u8"Подключиться") \
|
||||||
X(recent_connections, u8"近期连接", "Recent Connections", \
|
X(recent_connections, u8"近期连接", "Recent Connections", \
|
||||||
|
|||||||
@@ -82,6 +82,16 @@ int Render::ShowRecentConnections() {
|
|||||||
float recent_connection_footer_height =
|
float recent_connection_footer_height =
|
||||||
recent_connection_button_height * 1.18f;
|
recent_connection_button_height * 1.18f;
|
||||||
float recent_connection_name_width = recent_connection_image_width;
|
float recent_connection_name_width = recent_connection_image_width;
|
||||||
|
const float recent_connection_spacing = recent_connection_image_width * 0.16f;
|
||||||
|
const float recent_connections_content_width =
|
||||||
|
recent_connections_.empty()
|
||||||
|
? 0.0f
|
||||||
|
: recent_connections_.size() * recent_connection_sub_container_width +
|
||||||
|
(recent_connections_.size() - 1) * recent_connection_spacing;
|
||||||
|
const float recent_connections_available_width =
|
||||||
|
recent_connection_panel_width - 2.0f * ImGui::GetStyle().WindowPadding.x;
|
||||||
|
const bool has_horizontal_overflow =
|
||||||
|
recent_connections_content_width > recent_connections_available_width;
|
||||||
|
|
||||||
ImGui::SetCursorPos(
|
ImGui::SetCursorPos(
|
||||||
ImVec2(io.DisplaySize.x * 0.045f, io.DisplaySize.y * 0.1f));
|
ImVec2(io.DisplaySize.x * 0.045f, io.DisplaySize.y * 0.1f));
|
||||||
@@ -92,10 +102,10 @@ int Render::ShowRecentConnections() {
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 10.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 10.0f);
|
||||||
const ImGuiWindowFlags container_flags =
|
const ImGuiWindowFlags container_flags =
|
||||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
|
||||||
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoScrollWithMouse |
|
ImGuiWindowFlags_NoBringToFrontOnFocus |
|
||||||
(recent_connections_.empty()
|
ImGuiWindowFlags_NoScrollWithMouse |
|
||||||
? ImGuiWindowFlags_None
|
(has_horizontal_overflow ? ImGuiWindowFlags_AlwaysHorizontalScrollbar
|
||||||
: ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
: ImGuiWindowFlags_None);
|
||||||
ImGui::BeginChild(
|
ImGui::BeginChild(
|
||||||
"RecentConnectionsContainer",
|
"RecentConnectionsContainer",
|
||||||
ImVec2(recent_connection_panel_width, recent_connection_panel_height),
|
ImVec2(recent_connection_panel_width, recent_connection_panel_height),
|
||||||
@@ -196,12 +206,18 @@ int Render::ShowRecentConnections() {
|
|||||||
const ImVec2 toolbar_pos = ImVec2(
|
const ImVec2 toolbar_pos = ImVec2(
|
||||||
image_pos.x + recent_connection_image_width -
|
image_pos.x + recent_connection_image_width -
|
||||||
recent_connection_toolbar_width - recent_connection_toolbar_padding,
|
recent_connection_toolbar_width - recent_connection_toolbar_padding,
|
||||||
image_pos.y + recent_connection_toolbar_padding);
|
image_pos.y + recent_connection_image_height +
|
||||||
|
(recent_connection_footer_height -
|
||||||
|
recent_connection_button_height) *
|
||||||
|
0.5f);
|
||||||
|
|
||||||
const ImVec2 toolbar_screen_pos = ImVec2(
|
const ImVec2 toolbar_screen_pos = ImVec2(
|
||||||
image_screen_pos.x + recent_connection_image_width -
|
image_screen_pos.x + recent_connection_image_width -
|
||||||
recent_connection_toolbar_width - recent_connection_toolbar_padding,
|
recent_connection_toolbar_width - recent_connection_toolbar_padding,
|
||||||
image_screen_pos.y + recent_connection_toolbar_padding);
|
image_screen_pos.y + recent_connection_image_height +
|
||||||
|
(recent_connection_footer_height -
|
||||||
|
recent_connection_button_height) *
|
||||||
|
0.5f);
|
||||||
|
|
||||||
const ImVec2 toolbar_screen_end =
|
const ImVec2 toolbar_screen_end =
|
||||||
ImVec2(toolbar_screen_pos.x + recent_connection_toolbar_width,
|
ImVec2(toolbar_screen_pos.x + recent_connection_toolbar_width,
|
||||||
@@ -214,11 +230,20 @@ int Render::ShowRecentConnections() {
|
|||||||
const bool show_image_tooltip = image_item_hovered && !toolbar_hovered;
|
const bool show_image_tooltip = image_item_hovered && !toolbar_hovered;
|
||||||
|
|
||||||
if (show_image_tooltip) {
|
if (show_image_tooltip) {
|
||||||
|
const ImVec2 mouse_pos = ImGui::GetMousePos();
|
||||||
|
const bool place_tooltip_on_left = mouse_pos.x > io.DisplaySize.x * 0.7f;
|
||||||
|
ImGui::SetNextWindowPos(
|
||||||
|
ImVec2(mouse_pos.x + (place_tooltip_on_left ? -12.0f : 12.0f),
|
||||||
|
mouse_pos.y - 8.0f),
|
||||||
|
ImGuiCond_Always, ImVec2(place_tooltip_on_left ? 1.0f : 0.0f, 1.0f));
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.4f);
|
||||||
|
|
||||||
ImGui::Text("%s", display_name.c_str());
|
ImGui::Text(
|
||||||
|
"%s: %s",
|
||||||
|
localization::device_name[localization_language_index_].c_str(),
|
||||||
|
display_name.c_str());
|
||||||
|
|
||||||
if (!it.second.remote_host_name.empty() &&
|
if (!it.second.remote_host_name.empty() &&
|
||||||
it.second.remote_host_name != display_name) {
|
it.second.remote_host_name != display_name) {
|
||||||
@@ -278,8 +303,8 @@ int Render::ShowRecentConnections() {
|
|||||||
const float t = static_cast<float>(i) / halo_layers;
|
const float t = static_cast<float>(i) / halo_layers;
|
||||||
const float r = dot_radius + (halo_radius - dot_radius) * t;
|
const float r = dot_radius + (halo_radius - dot_radius) * t;
|
||||||
const int alpha = static_cast<int>(14.0f * (1.0f - t) + 4.0f);
|
const int alpha = static_cast<int>(14.0f * (1.0f - t) + 4.0f);
|
||||||
draw_list->AddCircleFilled(
|
draw_list->AddCircleFilled(dot_center, r,
|
||||||
dot_center, r, IM_COL32(74, 222, 128, alpha));
|
IM_COL32(74, 222, 128, alpha));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_list->AddCircleFilled(dot_center, dot_radius, dot_color);
|
draw_list->AddCircleFilled(dot_center, dot_radius, dot_color);
|
||||||
@@ -289,9 +314,11 @@ int Render::ShowRecentConnections() {
|
|||||||
ImVec2 text_min =
|
ImVec2 text_min =
|
||||||
ImVec2(status_block_end_x + status_gap, footer_screen_pos.y);
|
ImVec2(status_block_end_x + status_gap, footer_screen_pos.y);
|
||||||
|
|
||||||
ImVec2 text_max =
|
ImVec2 text_max = ImVec2(
|
||||||
ImVec2(footer_screen_end.x - recent_connection_name_width * 0.05f,
|
card_hovered
|
||||||
footer_screen_end.y);
|
? toolbar_screen_pos.x - status_gap
|
||||||
|
: footer_screen_end.x - recent_connection_name_width * 0.05f,
|
||||||
|
footer_screen_end.y);
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(0.52f);
|
ImGui::SetWindowFontScale(0.52f);
|
||||||
|
|
||||||
@@ -301,7 +328,7 @@ int Render::ShowRecentConnections() {
|
|||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// toolbar / three buttons
|
// Toolbar / three buttons, right-aligned in the connection name footer.
|
||||||
if (card_hovered) {
|
if (card_hovered) {
|
||||||
float toolbar_rounding = recent_connection_button_height * 0.22f;
|
float toolbar_rounding = recent_connection_button_height * 0.22f;
|
||||||
|
|
||||||
@@ -311,7 +338,7 @@ int Render::ShowRecentConnections() {
|
|||||||
IM_COL32(0, 0, 0, 70), toolbar_rounding);
|
IM_COL32(0, 0, 0, 70), toolbar_rounding);
|
||||||
|
|
||||||
draw_list->AddRectFilled(toolbar_screen_pos, toolbar_screen_end,
|
draw_list->AddRectFilled(toolbar_screen_pos, toolbar_screen_end,
|
||||||
IM_COL32(20, 24, 30, 170), toolbar_rounding);
|
IM_COL32(96, 100, 106, 140), toolbar_rounding);
|
||||||
|
|
||||||
draw_list->AddRect(toolbar_screen_pos, toolbar_screen_end,
|
draw_list->AddRect(toolbar_screen_pos, toolbar_screen_end,
|
||||||
IM_COL32(255, 255, 255, 48), toolbar_rounding);
|
IM_COL32(255, 255, 255, 48), toolbar_rounding);
|
||||||
@@ -404,20 +431,6 @@ int Render::ShowRecentConnections() {
|
|||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count != recent_connections_count - 1) {
|
|
||||||
ImVec2 line_start =
|
|
||||||
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.19f,
|
|
||||||
image_screen_pos.y);
|
|
||||||
|
|
||||||
ImVec2 line_end =
|
|
||||||
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.19f,
|
|
||||||
image_screen_pos.y + recent_connection_image_height +
|
|
||||||
recent_connection_footer_height);
|
|
||||||
|
|
||||||
ImGui::GetWindowDrawList()->AddLine(line_start, line_end,
|
|
||||||
IM_COL32(0, 0, 0, 122), 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delete_connection_ && delete_connection_name_ == it.first) {
|
if (delete_connection_ && delete_connection_name_ == it.first) {
|
||||||
if (!thumbnail_->DeleteThumbnail(it.first)) {
|
if (!thumbnail_->DeleteThumbnail(it.first)) {
|
||||||
recent_connection_aliases_.erase(it.second.remote_id);
|
recent_connection_aliases_.erase(it.second.remote_id);
|
||||||
@@ -431,10 +444,10 @@ int Render::ShowRecentConnections() {
|
|||||||
|
|
||||||
if (count != recent_connections_count - 1) {
|
if (count != recent_connections_count - 1) {
|
||||||
ImVec2 line_start =
|
ImVec2 line_start =
|
||||||
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.19f,
|
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.18f,
|
||||||
image_screen_pos.y);
|
image_screen_pos.y);
|
||||||
ImVec2 line_end =
|
ImVec2 line_end =
|
||||||
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.19f,
|
ImVec2(image_screen_pos.x + recent_connection_image_width * 1.18f,
|
||||||
image_screen_pos.y + recent_connection_image_height +
|
image_screen_pos.y + recent_connection_image_height +
|
||||||
recent_connection_footer_height);
|
recent_connection_footer_height);
|
||||||
ImGui::GetWindowDrawList()->AddLine(line_start, line_end,
|
ImGui::GetWindowDrawList()->AddLine(line_start, line_end,
|
||||||
@@ -443,7 +456,7 @@ int Render::ShowRecentConnections() {
|
|||||||
|
|
||||||
count++;
|
count++;
|
||||||
ImGui::SameLine(0, count != recent_connections_count
|
ImGui::SameLine(0, count != recent_connections_count
|
||||||
? (recent_connection_image_width * 0.165f)
|
? recent_connection_spacing
|
||||||
: 0.0f);
|
: 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-21
@@ -742,10 +742,9 @@ void Render::BeginEditRecentConnectionAlias(
|
|||||||
memset(edit_connection_alias_, 0, sizeof(edit_connection_alias_));
|
memset(edit_connection_alias_, 0, sizeof(edit_connection_alias_));
|
||||||
|
|
||||||
const auto alias_it = recent_connection_aliases_.find(connection.remote_id);
|
const auto alias_it = recent_connection_aliases_.find(connection.remote_id);
|
||||||
std::string alias =
|
std::string alias = alias_it != recent_connection_aliases_.end()
|
||||||
alias_it != recent_connection_aliases_.end()
|
? alias_it->second
|
||||||
? alias_it->second
|
: GetRecentConnectionDisplayName(connection);
|
||||||
: GetRecentConnectionDisplayName(connection);
|
|
||||||
|
|
||||||
if (!alias.empty()) {
|
if (!alias.empty()) {
|
||||||
strncpy(edit_connection_alias_, alias.c_str(),
|
strncpy(edit_connection_alias_, alias.c_str(),
|
||||||
@@ -781,21 +780,17 @@ int Render::ScreenCapturerInit() {
|
|||||||
fps,
|
fps,
|
||||||
[this, fps](unsigned char* data, int size, int width, int height,
|
[this, fps](unsigned char* data, int size, int width, int height,
|
||||||
const char* display_name) -> void {
|
const char* display_name) -> void {
|
||||||
const auto now_time =
|
const auto now_time = static_cast<uint64_t>(
|
||||||
static_cast<uint64_t>(std::chrono::duration_cast<
|
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::milliseconds>(
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
std::chrono::steady_clock::now()
|
.count());
|
||||||
.time_since_epoch())
|
|
||||||
.count());
|
|
||||||
auto duration = now_time - last_frame_time_;
|
auto duration = now_time - last_frame_time_;
|
||||||
if (duration * fps >= 1000) { // ~60 FPS
|
if (duration * fps >= 1000) { // ~60 FPS
|
||||||
const std::string stream_id = display_name ? display_name : "";
|
const std::string stream_id = display_name ? display_name : "";
|
||||||
const bool resumed_after_gap =
|
const bool resumed_after_gap =
|
||||||
last_frame_time_ != 0 &&
|
last_frame_time_ != 0 && duration >= kCaptureResumeKeyFrameGapMs;
|
||||||
duration >= kCaptureResumeKeyFrameGapMs;
|
const bool stream_changed = !last_video_frame_stream_id_.empty() &&
|
||||||
const bool stream_changed =
|
last_video_frame_stream_id_ != stream_id;
|
||||||
!last_video_frame_stream_id_.empty() &&
|
|
||||||
last_video_frame_stream_id_ != stream_id;
|
|
||||||
if (resumed_after_gap || stream_changed) {
|
if (resumed_after_gap || stream_changed) {
|
||||||
if (RequestVideoKeyFrame(peer_, stream_id.c_str()) == 0) {
|
if (RequestVideoKeyFrame(peer_, stream_id.c_str()) == 0) {
|
||||||
LOG_INFO(
|
LOG_INFO(
|
||||||
@@ -1151,7 +1146,7 @@ int Render::CreateConnectionPeer() {
|
|||||||
ConfigCenter::VIDEO_ENCODE_FORMAT::AV1
|
ConfigCenter::VIDEO_ENCODE_FORMAT::AV1
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
params_.enable_turn = config_center_->IsEnableTurn();
|
params_.turn_mode = static_cast<TurnMode>(config_center_->GetTurnMode());
|
||||||
params_.enable_srtp = config_center_->IsEnableSrtp();
|
params_.enable_srtp = config_center_->IsEnableSrtp();
|
||||||
params_.video_quality =
|
params_.video_quality =
|
||||||
static_cast<VideoQuality>(config_center_->GetVideoQuality());
|
static_cast<VideoQuality>(config_center_->GetVideoQuality());
|
||||||
@@ -1385,9 +1380,8 @@ int Render::CreateMainWindow() {
|
|||||||
tray_ = std::make_unique<MacTray>(main_window_, "CrossDesk",
|
tray_ = std::make_unique<MacTray>(main_window_, "CrossDesk",
|
||||||
localization_language_index_);
|
localization_language_index_);
|
||||||
#elif defined(__linux__) && !defined(__APPLE__)
|
#elif defined(__linux__) && !defined(__APPLE__)
|
||||||
tray_ = std::make_unique<LinuxTray>(main_window_, "CrossDesk",
|
tray_ = std::make_unique<LinuxTray>(
|
||||||
localization_language_index_,
|
main_window_, "CrossDesk", localization_language_index_, APP_EXIT_EVENT);
|
||||||
APP_EXIT_EVENT);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ImGui_ImplSDL3_InitForSDLRenderer(main_window_, main_renderer_);
|
ImGui_ImplSDL3_InitForSDLRenderer(main_window_, main_renderer_);
|
||||||
@@ -1936,7 +1930,9 @@ int Render::Run() {
|
|||||||
} else {
|
} else {
|
||||||
latest_version_ = "";
|
latest_version_ = "";
|
||||||
update_available_ = false;
|
update_available_ = false;
|
||||||
LOG_WARN("Update check skipped: version.json is empty or missing latest_version");
|
LOG_WARN(
|
||||||
|
"Update check skipped: version.json is empty or missing "
|
||||||
|
"latest_version");
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeSettings();
|
InitializeSettings();
|
||||||
@@ -2291,7 +2287,8 @@ void Render::HandleWindowsServiceIntegration() {
|
|||||||
last_logged_service_error_code = 0;
|
last_logged_service_error_code = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteAction remote_action = BuildWindowsServiceStatusAction(broadcast_status);
|
RemoteAction remote_action =
|
||||||
|
BuildWindowsServiceStatusAction(broadcast_status);
|
||||||
std::string msg = remote_action.to_json();
|
std::string msg = remote_action.to_json();
|
||||||
int ret = SendReliableDataFrame(peer_, msg.data(), msg.size(),
|
int ret = SendReliableDataFrame(peer_, msg.data(), msg.size(),
|
||||||
control_data_label_.c_str());
|
control_data_label_.c_str());
|
||||||
|
|||||||
+1
-1
Submodule submodules/minirtc updated: 9e5ce698df...658768547f
Reference in New Issue
Block a user