[Bf-blender-cvs] [c9e7c6bef82] filebrowser_redesign: Merge date and time column
Julian Eisel
noreply at git.blender.org
Thu Jul 25 00:26:05 CEST 2019
Commit: c9e7c6bef821f5390c665a28645c144eba579f44
Author: Julian Eisel
Date: Wed Jul 24 21:26:53 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBc9e7c6bef821f5390c665a28645c144eba579f44
Merge date and time column
===================================================================
M release/scripts/startup/bl_ui/space_filebrowser.py
M source/blender/editors/include/ED_fileselect.h
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/filesel.c
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 633a194d9df..ab62fe1eb55 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -44,8 +44,7 @@ class FILEBROWSER_HT_header(Header):
row = layout.row(align=True)
row.prop(params, "show_details_size", text="Size")
- row.prop(params, "show_details_date", text="Date")
- row.prop(params, "show_details_time", text="Time")
+ row.prop(params, "show_details_datetime", text="Date")
layout.separator_spacer()
@@ -115,8 +114,7 @@ class FILEBROWSER_PT_filter(Panel):
layout.label(text="Show Details:")
row = layout.row(align=True)
row.prop(params, "show_details_size", text="Size")
- row.prop(params, "show_details_date", text="Date")
- row.prop(params, "show_details_time", text="Time")
+ row.prop(params, "show_details_datetime", text="Date")
layout.separator()
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index c593575e39a..e1a7c319c9a 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -37,8 +37,7 @@ struct wmWindowManager;
typedef enum FileListColumns {
COLUMN_NONE = -1,
COLUMN_NAME = 0,
- COLUMN_DATE,
- COLUMN_TIME,
+ COLUMN_DATETIME,
COLUMN_SIZE,
COLUMN_MAX
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index da18b7679a0..7f9fac21558 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -782,15 +782,16 @@ static const char *filelist_get_details_column_string(FileListColumns column,
const bool update_stat_strings)
{
switch (column) {
- case COLUMN_DATE:
- case COLUMN_TIME:
+ case COLUMN_DATETIME:
if (!(file->typeflag & FILE_TYPE_BLENDERLIB) && !FILENAME_IS_CURRPAR(file->relpath)) {
- if ((file->entry->date_str[0] == '\0') || update_stat_strings) {
- BLI_filelist_entry_datetime_to_string(
- NULL, file->entry->time, small_size, file->entry->time_str, file->entry->date_str);
+ if ((file->entry->datetime_str[0] == '\0') || update_stat_strings) {
+ char date[16], time[8];
+ BLI_filelist_entry_datetime_to_string(NULL, file->entry->time, small_size, time, date);
+ BLI_snprintf(
+ file->entry->datetime_str, sizeof(file->entry->datetime_str), "%s %s", date, time);
}
- return (column == COLUMN_DATE) ? file->entry->date_str : file->entry->time_str;
+ return file->entry->datetime_str;
}
break;
case COLUMN_SIZE:
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 95f4060d15a..8503cabfdc7 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -522,10 +522,8 @@ bool file_column_type_enabled(const FileSelectParams *params, FileListColumns co
case COLUMN_NAME:
/* Always enabled */
return true;
- case COLUMN_DATE:
- return (params->details_flags & FILE_DETAILS_DATE) != 0;
- case COLUMN_TIME:
- return (params->details_flags & FILE_DETAILS_TIME) != 0;
+ case COLUMN_DATETIME:
+ return (params->details_flags & FILE_DETAILS_DATETIME) != 0;
case COLUMN_SIZE:
return (params->details_flags & FILE_DETAILS_SIZE) != 0;
default:
@@ -621,8 +619,8 @@ static void details_columns_widths(const FileSelectParams *params, FileLayout *l
columns[COLUMN_NAME].width = ((float)params->thumbnail_size / 8.0f) * UI_UNIT_X;
/* Biggest possible reasonable values... */
- columns[COLUMN_DATE].width = file_string_width(small_size ? "23/08/89" : "23-Dec-89") + pad;
- columns[COLUMN_TIME].width = file_string_width("23:59") + pad;
+ columns[COLUMN_DATETIME].width = file_string_width(small_size ? "23/08/89" : "23-Dec-89 23:59") +
+ pad;
columns[COLUMN_SIZE].width = file_string_width(small_size ? "98.7 M" : "98.7 MiB") + pad;
}
@@ -632,10 +630,8 @@ static void details_columns_init(const FileSelectParams *params, FileLayout *lay
layout->details_columns[COLUMN_NAME].name = "Name";
layout->details_columns[COLUMN_NAME].sort_type = FILE_SORT_ALPHA;
- layout->details_columns[COLUMN_DATE].name = "Date";
- layout->details_columns[COLUMN_DATE].sort_type = FILE_SORT_TIME;
- layout->details_columns[COLUMN_TIME].name = "Time";
- layout->details_columns[COLUMN_TIME].sort_type = FILE_SORT_NONE;
+ layout->details_columns[COLUMN_DATETIME].name = "Date Modified";
+ layout->details_columns[COLUMN_DATETIME].sort_type = FILE_SORT_TIME;
layout->details_columns[COLUMN_SIZE].name = "Size";
layout->details_columns[COLUMN_SIZE].sort_type = FILE_SORT_SIZE;
}
@@ -732,8 +728,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
(int)layout->details_columns[COLUMN_NAME].width + column_space +
- (int)layout->details_columns[COLUMN_DATE].width + column_space +
- (int)layout->details_columns[COLUMN_TIME].width + column_space +
+ (int)layout->details_columns[COLUMN_DATETIME].width + column_space +
(int)layout->details_columns[COLUMN_SIZE].width + column_space;
layout->tile_w = maxlen;
if (layout->rows > 0) {
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 16c768280f4..97965b1f313 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -748,8 +748,7 @@ enum eFileSortType {
/* FileSelectParams.details_flags */
enum eFileDetails {
FILE_DETAILS_SIZE = (1 << 0),
- FILE_DETAILS_DATE = (1 << 1),
- FILE_DETAILS_TIME = (1 << 2)
+ FILE_DETAILS_DATETIME = (1 << 1),
};
/* these values need to be hardcoded in structs, dna does not recognize defines */
@@ -884,8 +883,7 @@ typedef struct FileDirEntryRevision {
int64_t time;
/* Temp caching of UI-generated strings... */
char size_str[16];
- char time_str[8];
- char date_str[16];
+ char datetime_str[16 + 8];
} FileDirEntryRevision;
/* Container for a variant, only relevant in asset context.
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index ef8788226f5..4ef4d6c3146 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -5312,18 +5312,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "File Size", "Draw a column listing the size of each file");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
- prop = RNA_def_property(srna, "show_details_date", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "details_flags", FILE_DETAILS_DATE);
- RNA_def_property_ui_text(prop,
- "File Modification Date",
- "Draw a column listing the date of modification for each file");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "show_details_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "details_flags", FILE_DETAILS_TIME);
- RNA_def_property_ui_text(prop,
- "File Modification Time",
- "Draw a column listing the time of modification for each file");
+ prop = RNA_def_property(srna, "show_details_datetime", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "details_flags", FILE_DETAILS_DATETIME);
+ RNA_def_property_ui_text(
+ prop,
+ "File Modification Date",
+ "Draw a column listing the date and time of modification for each file");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
More information about the Bf-blender-cvs
mailing list