Path: blob/master/editor/translations/localization_editor.h
21344 views
/**************************************************************************/1/* localization_editor.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "editor/translations/editor_locale_dialog.h"33#include "scene/gui/check_box.h"34#include "scene/gui/tree.h"3536class EditorFileDialog;37class FileSystemDock;3839class LocalizationEditor : public VBoxContainer {40GDCLASS(LocalizationEditor, VBoxContainer);4142Tree *translation_list = nullptr;4344EditorLocaleDialog *locale_select = nullptr;45EditorFileDialog *translation_file_open = nullptr;4647Button *translation_res_option_add_button = nullptr;48EditorFileDialog *translation_res_file_open_dialog = nullptr;49EditorFileDialog *translation_res_option_file_open_dialog = nullptr;50Tree *translation_remap = nullptr;51Tree *translation_remap_options = nullptr;5253Tree *template_source_list = nullptr;54CheckBox *template_add_builtin = nullptr;55EditorFileDialog *template_source_open_dialog = nullptr;56EditorFileDialog *template_generate_dialog = nullptr;57Button *template_generate_button = nullptr;5859bool updating_translations = false;60String localization_changed;6162LocalVector<Tree *> trees;63HashMap<Tree *, String> tree_data_types;64HashMap<Tree *, StringName> tree_settings;6566void _translation_file_open();67void _translation_add(const PackedStringArray &p_paths);68void _translation_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);6970void _translation_res_file_open();71void _translation_res_add(const PackedStringArray &p_paths);72void _translation_res_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);73void _translation_res_select();74void _translation_res_option_file_open();75void _translation_res_option_add(const PackedStringArray &p_paths);76void _translation_res_option_changed();77void _translation_res_option_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);78void _translation_res_option_popup(bool p_arrow_clicked);79void _translation_res_option_selected(const String &p_locale);8081void _template_source_add(const PackedStringArray &p_paths);82void _template_source_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);83void _template_source_file_open();84void _template_generate_open();85void _template_add_builtin_toggled();86void _template_generate(const String &p_file);87void _update_template_source_file_extensions();8889void _filesystem_files_moved(const String &p_old_file, const String &p_new_file);90void _filesystem_file_removed(const String &p_file);9192Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);93bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;94void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);9596protected:97void _notification(int p_what);98static void _bind_methods();99100public:101void add_translation(const String &p_translation);102void update_translations();103void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock);104105LocalizationEditor();106};107108109