Skip to content

Commit c960369

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

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

editor/project_manager/engine_update_label.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@
3333
#include "core/io/json.h"
3434
#include "editor/editor_string_names.h"
3535
#include "editor/settings/editor_settings.h"
36+
#include "project_dialog.h"
37+
#include "scene/gui/texture_rect.h"
3638
#include "scene/main/http_request.h"
3739

40+
void EngineUpdateLabel::set_link_icon(TextureRect *p_icon) {
41+
icon = p_icon;
42+
}
43+
3844
bool EngineUpdateLabel::_can_check_updates() const {
3945
return int(EDITOR_GET("network/connection/network_mode")) == EditorSettings::NETWORK_ONLINE &&
4046
UpdateMode(int(EDITOR_GET("network/connection/check_for_updates"))) != UpdateMode::DISABLED;
@@ -171,6 +177,7 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
171177
if (status == UpdateStatus::BUSY || status == UpdateStatus::UP_TO_DATE) {
172178
// Hide the label to prevent unnecessary distraction.
173179
hide();
180+
icon->hide();
174181
return;
175182
} else {
176183
show();
@@ -186,19 +193,22 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) {
186193
}
187194
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_OFF);
188195
set_tooltip_text("");
196+
icon->hide();
189197
break;
190198
}
191199

192200
case UpdateStatus::ERROR: {
193201
set_disabled(false);
194202
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE);
195203
set_tooltip_text(TTR("An error has occurred. Click to try again."));
204+
icon->hide();
196205
} break;
197206

198207
case UpdateStatus::UPDATE_AVAILABLE: {
199208
set_disabled(false);
200209
set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE);
201210
set_tooltip_text(TTR("Click to open download page."));
211+
icon->show();
202212
} break;
203213

204214
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)