Merge pull request #92984 from adamscott/reveal-me
Customize the file manager label for each platform
This commit is contained in:
commit
371282b28e
11 changed files with 62 additions and 13 deletions
16
core/os/os.h
16
core/os/os.h
|
|
@ -69,6 +69,11 @@ public:
|
|||
RENDERING_SOURCE_FALLBACK
|
||||
};
|
||||
|
||||
enum PlatformString {
|
||||
PLATFORM_STRING_FILE_MANAGER_OPEN,
|
||||
PLATFORM_STRING_FILE_MANAGER_SHOW,
|
||||
};
|
||||
|
||||
private:
|
||||
static OS *singleton;
|
||||
static uint64_t target_ticks;
|
||||
|
|
@ -391,6 +396,17 @@ public:
|
|||
// This is invoked by the GDExtensionManager after loading GDExtensions specified by the project.
|
||||
virtual void load_platform_gdextensions() const {}
|
||||
|
||||
virtual String get_platform_string(PlatformString p_platform_string) const {
|
||||
switch (p_platform_string) {
|
||||
case PlatformString::PLATFORM_STRING_FILE_MANAGER_OPEN:
|
||||
return ETR("Open in File Manager");
|
||||
case PlatformString::PLATFORM_STRING_FILE_MANAGER_SHOW:
|
||||
return ETR("Show in File Manager");
|
||||
default:
|
||||
ERR_FAIL_V_MSG("", vformat("Couldn't find a string for platform string: %d.", p_platform_string));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
// Tests OpenGL context and Rendering Device simultaneous creation. This function is expected to crash on some NVIDIA drivers.
|
||||
virtual bool _test_create_rendering_device_and_gl(const String &p_display_driver) const { return true; }
|
||||
|
|
|
|||
|
|
@ -144,6 +144,17 @@ public:
|
|||
|
||||
virtual bool request_permission(const String &p_name) override;
|
||||
virtual Vector<String> get_granted_permissions() const override;
|
||||
|
||||
virtual String get_platform_string(PlatformString p_platform_string) const override {
|
||||
switch (p_platform_string) {
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_OPEN:
|
||||
return ETR("Open in Files");
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_SHOW:
|
||||
return ETR("Show in Files");
|
||||
default:
|
||||
return OS::get_platform_string(p_platform_string);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // APPLE_EMBEDDED_ENABLED
|
||||
|
|
|
|||
|
|
@ -2440,7 +2440,7 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
|
|||
vmem_item_menu = memnew(PopupMenu);
|
||||
vmem_item_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditorDebugger::_vmem_item_menu_id_pressed));
|
||||
vmem_item_menu->add_item(TTRC("Show in FileSystem"), VMEM_MENU_SHOW_IN_FILESYSTEM);
|
||||
vmem_item_menu->add_item(TTRC("Show in File Manager"), VMEM_MENU_SHOW_IN_EXPLORER);
|
||||
vmem_item_menu->add_item(OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_SHOW), VMEM_MENU_SHOW_IN_EXPLORER);
|
||||
vmem_item_menu->add_item(TTRC("View Owners..."), VMEM_MENU_OWNERS);
|
||||
add_child(vmem_item_menu);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3652,7 +3652,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
|
|||
}
|
||||
|
||||
p_popup->add_icon_shortcut(get_editor_theme_icon(SNAME("Filesystem")), ED_GET_SHORTCUT("filesystem_dock/show_in_explorer"), FILE_MENU_SHOW_IN_EXPLORER);
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_MENU_SHOW_IN_EXPLORER), is_directory ? TTRC("Open in File Manager") : TTRC("Show in File Manager"));
|
||||
p_popup->set_item_text(p_popup->get_item_index(FILE_MENU_SHOW_IN_EXPLORER), is_directory ? OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN) : OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_SHOW));
|
||||
#endif
|
||||
|
||||
current_path = fpath;
|
||||
|
|
|
|||
|
|
@ -9193,7 +9193,7 @@ EditorNode::EditorNode() {
|
|||
}
|
||||
|
||||
remove_android_build_template = memnew(ConfirmationDialog);
|
||||
remove_android_build_template->set_ok_button_text(TTR("Show in File Manager"));
|
||||
remove_android_build_template->set_ok_button_text(OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN));
|
||||
remove_android_build_template->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_android_explore_build_templates));
|
||||
gui_base->add_child(remove_android_build_template);
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ QuickOpenResultContainer::QuickOpenResultContainer() {
|
|||
|
||||
file_context_menu = memnew(PopupMenu);
|
||||
file_context_menu->add_item(TTR("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
|
||||
file_context_menu->add_item(TTR("Show in File Manager"), FILE_SHOW_IN_FILE_MANAGER);
|
||||
file_context_menu->add_item(OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_SHOW), FILE_SHOW_IN_FILE_MANAGER);
|
||||
file_context_menu->connect(SceneStringName(id_pressed), callable_mp(this, &QuickOpenResultContainer::_menu_option));
|
||||
file_context_menu->hide();
|
||||
scroll_container->add_child(file_context_menu);
|
||||
|
|
|
|||
|
|
@ -331,13 +331,13 @@ void ProjectListItemControl::set_is_missing(bool p_missing) {
|
|||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("FileBroken")));
|
||||
explore_button->set_tooltip_text(TTRC("Error: Project is missing on the filesystem."));
|
||||
} else {
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));
|
||||
explore_button->set_tooltip_text(TTRC("Show in File Manager"));
|
||||
#else
|
||||
#if defined(ANDROID_ENABLED) || defined(WEB_ENABLED)
|
||||
// Opening the system file manager is not supported on the Android and web editors.
|
||||
explore_button->hide();
|
||||
#endif
|
||||
#else // !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));
|
||||
explore_button->set_tooltip_text(OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN));
|
||||
#endif // defined(ANDROID_ENABLED) || defined(WEB_ENABLED)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1211,8 +1211,8 @@ void ProjectList::_open_menu(const Vector2 &p_at, Control *p_hb) {
|
|||
project_context_menu->add_item(TTRC("Run Project"), MENU_RUN);
|
||||
project_context_menu->add_separator();
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
project_context_menu->add_item(TTRC("Show in File Manager"), MENU_SHOW_IN_FILE_MANAGER);
|
||||
#endif
|
||||
project_context_menu->add_item(OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN), MENU_SHOW_IN_FILE_MANAGER);
|
||||
#endif // !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
project_context_menu->add_item(TTRC("Copy Path"), MENU_COPY_PATH);
|
||||
project_context_menu->add_separator();
|
||||
project_context_menu->add_item(TTRC("Rename"), MENU_RENAME);
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ void ObjectDBProfilerPanel::_snapshot_rmb(const Vector2 &p_pos, MouseButton p_bu
|
|||
rmb_menu->clear(false);
|
||||
|
||||
rmb_menu->add_icon_item(get_editor_theme_icon(SNAME("Rename")), TTRC("Rename"), OdbProfilerMenuOptions::ODB_MENU_RENAME);
|
||||
rmb_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), TTRC("Show in File Manager"), OdbProfilerMenuOptions::ODB_MENU_SHOW_IN_FOLDER);
|
||||
rmb_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN), OdbProfilerMenuOptions::ODB_MENU_SHOW_IN_FOLDER);
|
||||
rmb_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTRC("Delete"), OdbProfilerMenuOptions::ODB_MENU_DELETE);
|
||||
|
||||
rmb_menu->set_position(snapshot_list->get_screen_position() + p_pos);
|
||||
|
|
|
|||
|
|
@ -167,6 +167,17 @@ public:
|
|||
|
||||
virtual void run() = 0;
|
||||
|
||||
virtual String get_platform_string(PlatformString p_platform_string) const override {
|
||||
switch (p_platform_string) {
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_OPEN:
|
||||
return ETR("Open in Finder");
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_SHOW:
|
||||
return ETR("Show in Finder");
|
||||
default:
|
||||
return OS::get_platform_string(p_platform_string);
|
||||
}
|
||||
}
|
||||
|
||||
OS_MacOS(const char *p_execpath, int p_argc, char **p_argv);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,17 @@ public:
|
|||
|
||||
void set_main_window(HWND p_main_window) { main_window = p_main_window; }
|
||||
|
||||
virtual String get_platform_string(PlatformString p_platform_string) const override {
|
||||
switch (p_platform_string) {
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_OPEN:
|
||||
return ETR("Open in File Explorer");
|
||||
case OS::PlatformString::PLATFORM_STRING_FILE_MANAGER_SHOW:
|
||||
return ETR("Show in File Explorer");
|
||||
default:
|
||||
return OS::get_platform_string(p_platform_string);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual bool _test_create_rendering_device_and_gl(const String &p_display_driver) const override;
|
||||
virtual bool _test_create_rendering_device(const String &p_display_driver) const override;
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ void FileDialog::_popup_menu(const Vector2 &p_pos, int p_for_item) {
|
|||
meta = file_list->get_item_metadata(p_for_item);
|
||||
}
|
||||
|
||||
item_menu->add_item((p_for_item == -1 || meta["dir"]) ? ETR("Open in File Manager") : ETR("Show in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->add_item((p_for_item == -1 || meta["dir"]) ? OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_OPEN) : OS::get_singleton()->get_platform_string(OS::PLATFORM_STRING_FILE_MANAGER_SHOW), ITEM_MENU_SHOW_IN_EXPLORER);
|
||||
item_menu->set_item_icon(-1, theme_cache.menu_show_in_file_manager);
|
||||
if (meta["bundle"]) {
|
||||
item_menu->add_item(ETR("Show Package Contents"), ITEM_MENU_SHOW_BUNDLE_CONTENT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue