Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Project Manager] Replace titlebar logo with help menu. #89989

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 2 additions & 102 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
#include "editor/editor_run_native.h"
#include "editor/editor_settings.h"
#include "editor/editor_settings_dialog.h"
#include "editor/editor_sysinfo.h"
#include "editor/editor_translation_parser.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/export/editor_export.h"
Expand Down Expand Up @@ -3068,7 +3069,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues");
} break;
case HELP_COPY_SYSTEM_INFO: {
String info = _get_system_info();
String info = get_system_info();
DisplayServer::get_singleton()->clipboard_set(info);
} break;
case HELP_SUGGEST_A_FEATURE: {
Expand Down Expand Up @@ -4660,107 +4661,6 @@ void EditorNode::progress_end_task_bg(const String &p_task) {
singleton->progress_hb->end_task(p_task);
}

String EditorNode::_get_system_info() const {
String distribution_name = OS::get_singleton()->get_distribution_name();
if (distribution_name.is_empty()) {
distribution_name = OS::get_singleton()->get_name();
}
if (distribution_name.is_empty()) {
distribution_name = "Other";
}
const String distribution_version = OS::get_singleton()->get_version();

String godot_version = "Godot v" + String(VERSION_FULL_CONFIG);
if (String(VERSION_BUILD) != "official") {
String hash = String(VERSION_HASH);
hash = hash.is_empty() ? String("unknown") : vformat("(%s)", hash.left(9));
godot_version += " " + hash;
}

#ifdef LINUXBSD_ENABLED
const String display_server = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").capitalize().replace(" ", ""); // `replace` is necessary, because `capitalize` introduces a whitespace between "x" and "11".
#endif // LINUXBSD_ENABLED
String driver_name = GLOBAL_GET("rendering/rendering_device/driver");
String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method");

const String rendering_device_name = RenderingServer::get_singleton()->get_video_adapter_name();

RenderingDevice::DeviceType device_type = RenderingServer::get_singleton()->get_video_adapter_type();
String device_type_string;
switch (device_type) {
case RenderingDevice::DeviceType::DEVICE_TYPE_INTEGRATED_GPU:
device_type_string = "integrated";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_DISCRETE_GPU:
device_type_string = "dedicated";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_VIRTUAL_GPU:
device_type_string = "virtual";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_CPU:
device_type_string = "(software emulation on CPU)";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_OTHER:
case RenderingDevice::DeviceType::DEVICE_TYPE_MAX:
break; // Can't happen, but silences warning for DEVICE_TYPE_MAX
}

const Vector<String> video_adapter_driver_info = OS::get_singleton()->get_video_adapter_driver_info();

const String processor_name = OS::get_singleton()->get_processor_name();
const int processor_count = OS::get_singleton()->get_processor_count();

// Prettify
if (rendering_method == "forward_plus") {
rendering_method = "Forward+";
} else if (rendering_method == "mobile") {
rendering_method = "Mobile";
} else if (rendering_method == "gl_compatibility") {
rendering_method = "Compatibility";
driver_name = GLOBAL_GET("rendering/gl_compatibility/driver");
}
if (driver_name == "vulkan") {
driver_name = "Vulkan";
} else if (driver_name.begins_with("opengl3")) {
driver_name = "GLES3";
}

// Join info.
Vector<String> info;
info.push_back(godot_version);
if (!distribution_version.is_empty()) {
info.push_back(distribution_name + " " + distribution_version);
} else {
info.push_back(distribution_name);
}
#ifdef LINUXBSD_ENABLED
if (!display_server.is_empty()) {
info.push_back(display_server);
}
#endif // LINUXBSD_ENABLED
info.push_back(vformat("%s (%s)", driver_name, rendering_method));

String graphics;
if (!device_type_string.is_empty()) {
graphics = device_type_string + " ";
}
graphics += rendering_device_name;
if (video_adapter_driver_info.size() == 2) { // This vector is always either of length 0 or 2.
const String &vad_name = video_adapter_driver_info[0];
const String &vad_version = video_adapter_driver_info[1]; // Version could be potentially empty on Linux/BSD.
if (!vad_version.is_empty()) {
graphics += vformat(" (%s; %s)", vad_name, vad_version);
} else {
graphics += vformat(" (%s)", vad_name);
}
}
info.push_back(graphics);

info.push_back(vformat("%s (%d Threads)", processor_name, processor_count));

return String(" - ").join(info);
}

bool EditorNode::_should_display_update_spinner() const {
#ifdef DEV_ENABLED
const bool in_dev = true;
Expand Down
2 changes: 0 additions & 2 deletions editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,6 @@ class EditorNode : public Node {
static int plugin_init_callback_count;
static Vector<EditorNodeInitCallback> _init_callbacks;

String _get_system_info() const;

bool _should_display_update_spinner() const;

static void _dependency_error_report(const String &p_path, const String &p_dep, const String &p_type) {
Expand Down
137 changes: 137 additions & 0 deletions editor/editor_sysinfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/**************************************************************************/
/* editor_sysinfo.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#include "editor_sysinfo.h"

#include "core/config/project_settings.h"
#include "core/os/os.h"
#include "core/version.h"
#include "servers/rendering_server.h"

String get_system_info() {
String distribution_name = OS::get_singleton()->get_distribution_name();
if (distribution_name.is_empty()) {
distribution_name = OS::get_singleton()->get_name();
}
if (distribution_name.is_empty()) {
distribution_name = "Other";
}
const String distribution_version = OS::get_singleton()->get_version();

String godot_version = "Godot v" + String(VERSION_FULL_CONFIG);
if (String(VERSION_BUILD) != "official") {
String hash = String(VERSION_HASH);
hash = hash.is_empty() ? String("unknown") : vformat("(%s)", hash.left(9));
godot_version += " " + hash;
}

#ifdef LINUXBSD_ENABLED
const String display_server = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").capitalize().replace(" ", ""); // `replace` is necessary, because `capitalize` introduces a whitespace between "x" and "11".
#endif // LINUXBSD_ENABLED
String driver_name = GLOBAL_GET("rendering/rendering_device/driver");
String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method");

const String rendering_device_name = RenderingServer::get_singleton()->get_video_adapter_name();

RenderingDevice::DeviceType device_type = RenderingServer::get_singleton()->get_video_adapter_type();
String device_type_string;
switch (device_type) {
case RenderingDevice::DeviceType::DEVICE_TYPE_INTEGRATED_GPU:
device_type_string = "integrated";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_DISCRETE_GPU:
device_type_string = "dedicated";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_VIRTUAL_GPU:
device_type_string = "virtual";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_CPU:
device_type_string = "(software emulation on CPU)";
break;
case RenderingDevice::DeviceType::DEVICE_TYPE_OTHER:
case RenderingDevice::DeviceType::DEVICE_TYPE_MAX:
break; // Can't happen, but silences warning for DEVICE_TYPE_MAX
}

const Vector<String> video_adapter_driver_info = OS::get_singleton()->get_video_adapter_driver_info();

const String processor_name = OS::get_singleton()->get_processor_name();
const int processor_count = OS::get_singleton()->get_processor_count();

// Prettify
if (rendering_method == "forward_plus") {
rendering_method = "Forward+";
} else if (rendering_method == "mobile") {
rendering_method = "Mobile";
} else if (rendering_method == "gl_compatibility") {
rendering_method = "Compatibility";
driver_name = GLOBAL_GET("rendering/gl_compatibility/driver");
}
if (driver_name == "vulkan") {
driver_name = "Vulkan";
} else if (driver_name.begins_with("opengl3")) {
driver_name = "GLES3";
}

// Join info.
Vector<String> info;
info.push_back(godot_version);
if (!distribution_version.is_empty()) {
info.push_back(distribution_name + " " + distribution_version);
} else {
info.push_back(distribution_name);
}
#ifdef LINUXBSD_ENABLED
if (!display_server.is_empty()) {
info.push_back(display_server);
}
#endif // LINUXBSD_ENABLED
info.push_back(vformat("%s (%s)", driver_name, rendering_method));

String graphics;
if (!device_type_string.is_empty()) {
graphics = device_type_string + " ";
}
graphics += rendering_device_name;
if (video_adapter_driver_info.size() == 2) { // This vector is always either of length 0 or 2.
const String &vad_name = video_adapter_driver_info[0];
const String &vad_version = video_adapter_driver_info[1]; // Version could be potentially empty on Linux/BSD.
if (!vad_version.is_empty()) {
graphics += vformat(" (%s; %s)", vad_name, vad_version);
} else {
graphics += vformat(" (%s)", vad_name);
}
}
info.push_back(graphics);

info.push_back(vformat("%s (%d Threads)", processor_name, processor_count));

return String(" - ").join(info);
}
38 changes: 38 additions & 0 deletions editor/editor_sysinfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**************************************************************************/
/* editor_sysinfo.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef EDITOR_SYSINFO_H
#define EDITOR_SYSINFO_H

#include "core/string/ustring.h"

String get_system_info();

#endif // EDITOR_SYSINFO_H
Loading
Loading