mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #36152 from Calinou/project-manager-rename-last-modified
Rename the "Last Modified" project list sorting option to "Last Edited"
This commit is contained in:
commit
57dca8b8cc
@ -628,7 +628,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||
/* Extra config */
|
||||
|
||||
_initial_set("project_manager/sorting_order", 0);
|
||||
hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Path,Last Modified");
|
||||
hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Path,Last Edited");
|
||||
|
||||
if (p_extra_config.is_valid()) {
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ public:
|
||||
String path;
|
||||
String icon;
|
||||
String main_scene;
|
||||
uint64_t last_modified;
|
||||
uint64_t last_edited;
|
||||
bool favorite;
|
||||
bool grayed;
|
||||
bool missing;
|
||||
@ -1017,7 +1017,7 @@ public:
|
||||
const String &p_path,
|
||||
const String &p_icon,
|
||||
const String &p_main_scene,
|
||||
uint64_t p_last_modified,
|
||||
uint64_t p_last_edited,
|
||||
bool p_favorite,
|
||||
bool p_grayed,
|
||||
bool p_missing,
|
||||
@ -1029,7 +1029,7 @@ public:
|
||||
path = p_path;
|
||||
icon = p_icon;
|
||||
main_scene = p_main_scene;
|
||||
last_modified = p_last_modified;
|
||||
last_edited = p_last_edited;
|
||||
favorite = p_favorite;
|
||||
grayed = p_grayed;
|
||||
missing = p_missing;
|
||||
@ -1104,8 +1104,8 @@ struct ProjectListComparator {
|
||||
switch (order_option) {
|
||||
case ProjectListFilter::FILTER_PATH:
|
||||
return a.project_key < b.project_key;
|
||||
case ProjectListFilter::FILTER_MODIFIED:
|
||||
return a.last_modified > b.last_modified;
|
||||
case ProjectListFilter::FILTER_EDIT_DATE:
|
||||
return a.last_edited > b.last_edited;
|
||||
default:
|
||||
return a.project_name < b.project_name;
|
||||
}
|
||||
@ -1113,7 +1113,7 @@ struct ProjectListComparator {
|
||||
};
|
||||
|
||||
ProjectList::ProjectList() {
|
||||
_order_option = ProjectListFilter::FILTER_MODIFIED;
|
||||
_order_option = ProjectListFilter::FILTER_EDIT_DATE;
|
||||
|
||||
_scroll_children = memnew(VBoxContainer);
|
||||
_scroll_children->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
@ -1200,15 +1200,18 @@ void ProjectList::load_project_data(const String &p_property_key, Item &p_item,
|
||||
String icon = cf->get_value("application", "config/icon", "");
|
||||
String main_scene = cf->get_value("application", "run/main_scene", "");
|
||||
|
||||
uint64_t last_modified = 0;
|
||||
uint64_t last_edited = 0;
|
||||
if (FileAccess::exists(conf)) {
|
||||
last_modified = FileAccess::get_modified_time(conf);
|
||||
// The modification date marks the date the project was last edited.
|
||||
// This is because the `project.godot` file will always be modified
|
||||
// when editing a project (but not when running it).
|
||||
last_edited = FileAccess::get_modified_time(conf);
|
||||
|
||||
String fscache = path.plus_file(".fscache");
|
||||
if (FileAccess::exists(fscache)) {
|
||||
uint64_t cache_modified = FileAccess::get_modified_time(fscache);
|
||||
if (cache_modified > last_modified)
|
||||
last_modified = cache_modified;
|
||||
if (cache_modified > last_edited)
|
||||
last_edited = cache_modified;
|
||||
}
|
||||
} else {
|
||||
grayed = true;
|
||||
@ -1218,7 +1221,7 @@ void ProjectList::load_project_data(const String &p_property_key, Item &p_item,
|
||||
|
||||
String project_key = p_property_key.get_slice("/", 1);
|
||||
|
||||
p_item = Item(project_key, project_name, description, path, icon, main_scene, last_modified, p_favorite, grayed, missing, config_version);
|
||||
p_item = Item(project_key, project_name, description, path, icon, main_scene, last_edited, p_favorite, grayed, missing, config_version);
|
||||
}
|
||||
|
||||
void ProjectList::load_projects() {
|
||||
@ -2515,7 +2518,7 @@ ProjectManager::ProjectManager() {
|
||||
Vector<String> sort_filter_titles;
|
||||
sort_filter_titles.push_back(TTR("Name"));
|
||||
sort_filter_titles.push_back(TTR("Path"));
|
||||
sort_filter_titles.push_back(TTR("Last Modified"));
|
||||
sort_filter_titles.push_back(TTR("Last Edited"));
|
||||
project_order_filter = memnew(ProjectListFilter);
|
||||
project_order_filter->add_filter_option();
|
||||
project_order_filter->_setup_filters(sort_filter_titles);
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
enum FilterOption {
|
||||
FILTER_NAME,
|
||||
FILTER_PATH,
|
||||
FILTER_MODIFIED,
|
||||
FILTER_EDIT_DATE,
|
||||
};
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user