Skip to content

Commit 266c577

Browse files
Add external link icon to update label
1 parent bfa330d commit 266c577

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

editor/project_manager/engine_update_label.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@
3030

3131
#include "engine_update_label.h"
3232

33-
#include "core/io/json.h"
3433
#include "editor/editor_string_names.h"
3534
#include "editor/settings/editor_settings.h"
35+
#include "project_dialog.h"
3636
#include "scene/main/http_request.h"
37+
#include "scene/gui/texture_rect.h"
38+
39+
void EngineUpdateLabel::set_link_icon(TextureRect *p_icon) {
40+
icon = p_icon;
41+
}
3742

3843
bool EngineUpdateLabel::_can_check_updates() const {
3944
return int(EDITOR_GET("network/connection/network_mode")) == EditorSettings::NETWORK_ONLINE &&
@@ -171,6 +176,7 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
171176
if (status == UpdateStatus::BUSY || status == UpdateStatus::UP_TO_DATE) {
172177
// Hide the label to prevent unnecessary distraction.
173178
hide();
179+
icon->hide();
174180
return;
175181
} else {
176182
show();
@@ -186,19 +192,22 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
186192
}
187193
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_OFF);
188194
set_tooltip_text("");
195+
icon->hide();
189196
break;
190197
}
191198

192199
case UpdateStatus::ERROR: {
193200
set_disabled(false);
194201
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE);
195202
set_tooltip_text(TTR("An error has occurred. Click to try again."));
203+
icon->hide();
196204
} break;
197205

198206
case UpdateStatus::UPDATE_AVAILABLE: {
199207
set_disabled(false);
200208
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE);
201209
set_tooltip_text(TTR("Click to open download page."));
210+
icon->show();
202211
} break;
203212

204213
default: {

editor/project_manager/engine_update_label.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#pragma once
3232

3333
#include "scene/gui/link_button.h"
34+
#include "scene/gui/texture_rect.h"
3435

3536
class HTTPRequest;
3637

@@ -45,6 +46,8 @@ class EngineUpdateLabel : public LinkButton {
4546
NEWEST_PATCH,
4647
};
4748

49+
void set_link_icon(TextureRect *p_icon);
50+
4851
private:
4952
static constexpr int DEV_VERSION = 9999; // Version index for unnumbered builds (assumed to always be newest).
5053

@@ -74,6 +77,7 @@ class EngineUpdateLabel : public LinkButton {
7477
} theme_cache;
7578

7679
HTTPRequest *http = nullptr;
80+
TextureRect *icon = nullptr;
7781

7882
UpdateStatus status = UpdateStatus::NONE;
7983
bool checked_update = false;

editor/project_manager/project_manager.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,12 @@ ProjectManager::ProjectManager() {
16701670
EngineUpdateLabel *update_label = memnew(EngineUpdateLabel);
16711671
footer_bar->add_child(update_label);
16721672
update_label->connect("offline_clicked", callable_mp(this, &ProjectManager::_show_quick_settings));
1673+
1674+
TextureRect *link_icon = memnew(TextureRect);
1675+
link_icon->set_texture(get_editor_theme_icon(SNAME("ExternalLink")));
1676+
link_icon->hide();
1677+
update_label->set_link_icon(link_icon);
1678+
footer_bar->add_child(link_icon);
16731679
#endif
16741680

16751681
EditorVersionButton *version_btn = memnew(EditorVersionButton(EditorVersionButton::FORMAT_WITH_BUILD));

0 commit comments

Comments
 (0)