| 175 | } |
| 176 | |
| 177 | void PluginConfigDialog::config(const String &p_config_path) { |
| 178 | if (!p_config_path.is_empty()) { |
| 179 | Ref<ConfigFile> cf = memnew(ConfigFile); |
| 180 | Error err = cf->load(p_config_path); |
| 181 | ERR_FAIL_COND_MSG(err != OK, "Cannot load config file from path '" + p_config_path + "'."); |
| 182 | |
| 183 | name_edit->set_text(cf->get_value("plugin", "name", "")); |
| 184 | subfolder_edit->set_text(p_config_path.get_base_dir().get_file()); |
| 185 | desc_edit->set_text(cf->get_value("plugin", "description", "")); |
| 186 | author_edit->set_text(cf->get_value("plugin", "author", "")); |
| 187 | version_edit->set_text(cf->get_value("plugin", "version", "")); |
| 188 | script_edit->set_text(cf->get_value("plugin", "script", "")); |
| 189 | |
| 190 | _edit_mode = true; |
| 191 | set_title(TTR("Edit a Plugin")); |
| 192 | } else { |
| 193 | _clear_fields(); |
| 194 | _edit_mode = false; |
| 195 | set_title(TTR("Create a Plugin")); |
| 196 | } |
| 197 | |
| 198 | for (Control *control : plugin_edit_hidden_controls) { |
| 199 | control->set_visible(!_edit_mode); |
| 200 | } |
| 201 | |
| 202 | validation_panel->update(); |
| 203 | |
| 204 | get_ok_button()->set_disabled(!_edit_mode); |
| 205 | set_ok_button_text(_edit_mode ? TTR("Update") : TTR("Create")); |
| 206 | } |
| 207 | |
| 208 | void PluginConfigDialog::_bind_methods() { |
| 209 | ADD_SIGNAL(MethodInfo("plugin_ready", PropertyInfo(Variant::STRING, "script_path", PROPERTY_HINT_NONE, ""), PropertyInfo(Variant::STRING, "activate_name"))); |
no test coverage detected