Skip to content

Commit

Permalink
Merge pull request godotengine#91026 from KoBeWi/YoU_ARE_uP_TO_dATE_T…
Browse files Browse the repository at this point in the history
…haNk_you_for_CHooSInG_goDOT_engiNe

Hide update status label when no action is required
  • Loading branch information
akien-mga committed Apr 22, 2024
2 parents 4eb0cea + b8ee136 commit e96c61c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
37 changes: 7 additions & 30 deletions editor/engine_update_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,15 @@ void EngineUpdateLabel::_set_message(const String &p_message, const Color &p_col

void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
status = p_status;
if (compact_mode) {
if (status != UpdateStatus::BUSY && status != UpdateStatus::UPDATE_AVAILABLE) {
hide();
return;
} else {
show();
}
if (status == UpdateStatus::DEV || status == UpdateStatus::BUSY || status == UpdateStatus::UP_TO_DATE) {
// Hide the label to prevent unnecessary distraction.
hide();
return;
} else {
show();
}

switch (status) {
case UpdateStatus::DEV: {
set_disabled(true);
_set_message(TTR("Running a development build."), theme_cache.disabled_color);
set_tooltip_text(TTR("Exact version can't be determined for update checking."));
break;
}
case UpdateStatus::OFFLINE: {
set_disabled(false);
if (int(EDITOR_GET("network/connection/network_mode")) == EditorSettings::NETWORK_OFFLINE) {
Expand All @@ -206,23 +199,12 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
set_tooltip_text("");
break;
}
case UpdateStatus::BUSY: {
set_disabled(true);
_set_message(TTR("Checking for updates..."), theme_cache.default_color);
set_tooltip_text("");
} break;

case UpdateStatus::ERROR: {
set_disabled(false);
set_tooltip_text(TTR("An error has occurred. Click to try again."));
} break;

case UpdateStatus::UP_TO_DATE: {
set_disabled(false);
_set_message(TTR("Current version up to date."), theme_cache.disabled_color);
set_tooltip_text(TTR("Click to check again."));
} break;

case UpdateStatus::UPDATE_AVAILABLE: {
set_disabled(false);
set_tooltip_text(TTR("Click to open download page."));
Expand Down Expand Up @@ -315,8 +297,7 @@ void EngineUpdateLabel::pressed() {
emit_signal("offline_clicked");
} break;

case UpdateStatus::ERROR:
case UpdateStatus::UP_TO_DATE: {
case UpdateStatus::ERROR: {
_check_update();
} break;

Expand All @@ -329,10 +310,6 @@ void EngineUpdateLabel::pressed() {
}
}

void EngineUpdateLabel::enable_compact_mode() {
compact_mode = true;
}

EngineUpdateLabel::EngineUpdateLabel() {
set_underline_mode(UNDERLINE_MODE_ON_HOVER);

Expand Down
3 changes: 0 additions & 3 deletions editor/engine_update_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class EngineUpdateLabel : public LinkButton {
} theme_cache;

HTTPRequest *http = nullptr;
bool compact_mode = false;

UpdateStatus status = UpdateStatus::NONE;
bool checked_update = false;
Expand All @@ -99,8 +98,6 @@ class EngineUpdateLabel : public LinkButton {
virtual void pressed() override;

public:
void enable_compact_mode();

EngineUpdateLabel();
};

Expand Down

0 comments on commit e96c61c

Please sign in to comment.