mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-16 20:17:10 +08:00
[fix] fix version check issue
This commit is contained in:
@@ -908,6 +908,7 @@ int Render::DrawStreamWindow() {
|
|||||||
|
|
||||||
int Render::Run() {
|
int Render::Run() {
|
||||||
latest_version_ = CheckUpdate();
|
latest_version_ = CheckUpdate();
|
||||||
|
update_available_ = IsNewerVersion(CROSSDESK_VERSION, latest_version_);
|
||||||
|
|
||||||
path_manager_ = std::make_unique<PathManager>("CrossDesk");
|
path_manager_ = std::make_unique<PathManager>("CrossDesk");
|
||||||
if (path_manager_) {
|
if (path_manager_) {
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ class Render {
|
|||||||
|
|
||||||
// main window properties
|
// main window properties
|
||||||
std::string latest_version_ = "";
|
std::string latest_version_ = "";
|
||||||
|
bool update_available_ = false;
|
||||||
bool start_mouse_controller_ = false;
|
bool start_mouse_controller_ = false;
|
||||||
bool mouse_controller_is_started_ = false;
|
bool mouse_controller_is_started_ = false;
|
||||||
bool start_screen_capturer_ = false;
|
bool start_screen_capturer_ = false;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int Render::TitleBar(bool main_window) {
|
|||||||
|
|
||||||
std::string about_str =
|
std::string about_str =
|
||||||
localization::about[localization_language_index_];
|
localization::about[localization_language_index_];
|
||||||
if (!latest_version_.empty()) {
|
if (update_available_) {
|
||||||
auto now_time =
|
auto now_time =
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
@@ -75,7 +75,7 @@ int Render::TitleBar(bool main_window) {
|
|||||||
show_about_window_ = true;
|
show_about_window_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!latest_version_.empty() && ImGui::IsItemHovered()) {
|
if (update_available_ && ImGui::IsItemHovered()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
std::string new_version_available_str =
|
std::string new_version_available_str =
|
||||||
@@ -104,7 +104,7 @@ int Render::TitleBar(bool main_window) {
|
|||||||
ImVec2(bar_pos_x + menu_bar_line_size, bar_pos_y + 6),
|
ImVec2(bar_pos_x + menu_bar_line_size, bar_pos_y + 6),
|
||||||
IM_COL32(0, 0, 0, 255));
|
IM_COL32(0, 0, 0, 255));
|
||||||
|
|
||||||
if (!latest_version_.empty() && show_new_version_icon_in_menu_) {
|
if (update_available_ && show_new_version_icon_in_menu_) {
|
||||||
auto now_time = std::chrono::duration_cast<std::chrono::milliseconds>(
|
auto now_time = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int Render::AboutWindow() {
|
|||||||
": CrossDesk v" + version;
|
": CrossDesk v" + version;
|
||||||
ImGui::Text("%s", text.c_str());
|
ImGui::Text("%s", text.c_str());
|
||||||
|
|
||||||
if (!latest_version_.empty()) {
|
if (update_available_) {
|
||||||
std::string latest_version =
|
std::string latest_version =
|
||||||
localization::new_version_available[localization_language_index_] +
|
localization::new_version_available[localization_language_index_] +
|
||||||
": " + latest_version_;
|
": " + latest_version_;
|
||||||
|
|||||||
Reference in New Issue
Block a user