|
@@ -30,6 +30,7 @@
|
|
|
|
|
|
#include "history_dock.h"
|
|
|
|
|
|
+#include "core/io/config_file.h"
|
|
|
#include "editor/editor_node.h"
|
|
|
#include "editor/editor_settings.h"
|
|
|
#include "editor/editor_string_names.h"
|
|
@@ -172,6 +173,17 @@ void HistoryDock::refresh_version() {
|
|
|
action_list->set_current(idx);
|
|
|
}
|
|
|
|
|
|
+void HistoryDock::_save_layout_to_config(Ref<ConfigFile> p_layout, const String &p_section) const {
|
|
|
+ p_layout->set_value(p_section, "dock_history_include_scene", current_scene_checkbox->is_pressed());
|
|
|
+ p_layout->set_value(p_section, "dock_history_include_global", global_history_checkbox->is_pressed());
|
|
|
+}
|
|
|
+
|
|
|
+void HistoryDock::_load_layout_from_config(Ref<ConfigFile> p_layout, const String &p_section) {
|
|
|
+ current_scene_checkbox->set_pressed_no_signal(p_layout->get_value(p_section, "dock_history_include_scene", true));
|
|
|
+ global_history_checkbox->set_pressed_no_signal(p_layout->get_value(p_section, "dock_history_include_global", true));
|
|
|
+ refresh_history();
|
|
|
+}
|
|
|
+
|
|
|
void HistoryDock::seek_history(int p_index) {
|
|
|
bool include_scene = current_scene_checkbox->is_pressed();
|
|
|
bool include_global = global_history_checkbox->is_pressed();
|
|
@@ -220,9 +232,9 @@ void HistoryDock::_notification(int p_notification) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void HistoryDock::save_options() {
|
|
|
- EditorSettings::get_singleton()->set_project_metadata("history", "include_scene", current_scene_checkbox->is_pressed());
|
|
|
- EditorSettings::get_singleton()->set_project_metadata("history", "include_global", global_history_checkbox->is_pressed());
|
|
|
+void HistoryDock::_bind_methods() {
|
|
|
+ ClassDB::bind_method(D_METHOD("_save_layout_to_config"), &HistoryDock::_save_layout_to_config);
|
|
|
+ ClassDB::bind_method(D_METHOD("_load_layout_from_config"), &HistoryDock::_load_layout_from_config);
|
|
|
}
|
|
|
|
|
|
HistoryDock::HistoryDock() {
|
|
@@ -235,28 +247,21 @@ HistoryDock::HistoryDock() {
|
|
|
HBoxContainer *mode_hb = memnew(HBoxContainer);
|
|
|
add_child(mode_hb);
|
|
|
|
|
|
- bool include_scene = EditorSettings::get_singleton()->get_project_metadata("history", "include_scene", true);
|
|
|
- bool include_global = EditorSettings::get_singleton()->get_project_metadata("history", "include_global", true);
|
|
|
-
|
|
|
current_scene_checkbox = memnew(CheckBox);
|
|
|
mode_hb->add_child(current_scene_checkbox);
|
|
|
current_scene_checkbox->set_flat(true);
|
|
|
- current_scene_checkbox->set_pressed(include_scene);
|
|
|
current_scene_checkbox->set_text(TTR("Scene"));
|
|
|
current_scene_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
current_scene_checkbox->set_clip_text(true);
|
|
|
current_scene_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
|
|
- current_scene_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::save_options).unbind(1));
|
|
|
|
|
|
global_history_checkbox = memnew(CheckBox);
|
|
|
mode_hb->add_child(global_history_checkbox);
|
|
|
global_history_checkbox->set_flat(true);
|
|
|
- global_history_checkbox->set_pressed(include_global);
|
|
|
global_history_checkbox->set_text(TTR("Global"));
|
|
|
global_history_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
global_history_checkbox->set_clip_text(true);
|
|
|
global_history_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
|
|
- global_history_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::save_options).unbind(1));
|
|
|
|
|
|
action_list = memnew(ItemList);
|
|
|
action_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|