View Issue Details

IDProjectCategoryView StatusLast Update
0000376Double CommanderGraphical user interfacepublic2014-01-14 22:56
Reporterluis Assigned ToAlexx2000  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
ProjectionnoneETAnone 
Target Version0.5.5Fixed in Version0.5.5 
Summary0000376: Improvement to the "short file size" option
DescriptionImprovement to the "short file size".
Currently the "short file size" option does not let the user specify a fixed unit to be used. It would be nice if the user could choose to display all the file sizes in KB, for example, including for very big files.
The big advantage in this is that by scrolling a file listing, the user would immediately notice the big files, since their size has more digits than the smaller files. With the current "short file size" option, the sizes 12 KB, 12 MB and 12 GB are less easily distinguishable at first sight. Please, make things more visually immediate and easier on the eyes (I would have to strain my eyes to distinguish KB from MB from GB for every file!)


TagsNo tags attached.
Attached Files
optfsf.zip (4,239 bytes)
filesize.zip (3,421 bytes)
filesize1.patch (12,466 bytes)   
Index: language/doublecmd.po
===================================================================
--- language/doublecmd.po	(revision 4956)
+++ language/doublecmd.po	(working copy)
@@ -4105,10 +4105,6 @@
 msgid "Load icons af&ter file list"
 msgstr ""
 
-#: tfrmoptionsfilesviews.cbshortfilesizeformat.caption
-msgid "Short file si&ze format"
-msgstr ""
-
 #: tfrmoptionsfilesviews.cbshowsystemfiles.caption
 msgctxt "TFRMOPTIONSFILESVIEWS.CBSHOWSYSTEMFILES.CAPTION"
 msgid "Show s&ystem and hidden files"
@@ -4138,6 +4134,10 @@
 msgid "&Date and time format:"
 msgstr ""
 
+#: tfrmoptionsfilesviews.lblfilesizeformat.caption
+msgid "File si&ze format:"
+msgstr ""
+
 #: tfrmoptionsfilesviews.lblnewfilesposition.caption
 msgid "&Insert new files"
 msgstr ""
@@ -7376,6 +7376,10 @@
 msgid "separate window;minimized separate window;operations panel"
 msgstr ""
 
+#: ulng.rsoptfilesizeformat
+msgid "float;B;K;M;G"
+msgstr ""
+
 #: ulng.rsopthotkeysadddeleteshortcutlong
 msgid "Shortcut %s for cm_Delete will be registered, so it can be used to reverse this setting."
 msgstr ""
Index: language/doublecmd.ru.po
===================================================================
--- language/doublecmd.ru.po	(revision 4956)
+++ language/doublecmd.ru.po	(working copy)
@@ -4153,11 +4153,6 @@
 msgid "Load icons af&ter file list"
 msgstr "За&гружать иконки после списка файлов"
 
-#: tfrmoptionsfilesviews.cbshortfilesizeformat.caption
-msgctxt "TFRMOPTIONSFILESVIEWS.CBSHORTFILESIZEFORMAT.CAPTION"
-msgid "Short file si&ze format"
-msgstr "Короткий ра&змер файла"
-
 #: tfrmoptionsfilesviews.cbshowsystemfiles.caption
 msgid "Show s&ystem and hidden files"
 msgstr "Показывать систе&мные файлы"
@@ -4189,6 +4184,10 @@
 msgid "&Date and time format:"
 msgstr "&Формат даты и времени:"
 
+#: tfrmoptionsfilesviews.lblfilesizeformat.caption
+msgid "File si&ze format:"
+msgstr "Формат ра&змера файла:"
+
 #: tfrmoptionsfilesviews.lblnewfilesposition.caption
 msgid "&Insert new files"
 msgstr "&Вставлять новые файлы"
@@ -7456,6 +7455,10 @@
 msgid "separate window;minimized separate window;operations panel"
 msgstr "отдельное окно;минимизировать отдельное окно;панель операций"
 
+#: ulng.rsoptfilesizeformat
+msgid "float;B;K;M;G"
+msgstr "плавающий;B;K;M;G"
+
 #: ulng.rsopthotkeysadddeleteshortcutlong
 msgid "Shortcut %s for cm_Delete will be registered, so it can be used to reverse this setting."
 msgstr ""
Index: src/frames/foptionsfilesviews.lfm
===================================================================
--- src/frames/foptionsfilesviews.lfm	(revision 4956)
+++ src/frames/foptionsfilesviews.lfm	(working copy)
@@ -323,17 +323,31 @@
       OnChange = cbDateTimeFormatChange
       TabOrder = 0
     end
-    object cbShortFileSizeFormat: TCheckBox
-      AnchorSideLeft.Control = gbFormatting
-      AnchorSideTop.Control = cbDateTimeFormat
-      AnchorSideTop.Side = asrBottom
-      Left = 6
-      Height = 17
-      Top = 33
-      Width = 117
-      BorderSpacing.Top = 6
-      Caption = 'Short file si&ze format'
+    object cbFileSizeFormat: TComboBox
+      AnchorSideLeft.Control = lblFileSizeFormat
+      AnchorSideLeft.Side = asrBottom
+      AnchorSideTop.Control = lblFileSizeFormat
+      AnchorSideTop.Side = asrCenter
+      AnchorSideRight.Control = gbFormatting
+      AnchorSideRight.Side = asrBottom
+      Left = 124
+      Height = 23
+      Top = 35
+      Width = 488
+      Anchors = [akTop, akLeft, akRight]
+      BorderSpacing.Left = 10
+      ItemHeight = 15
+      Style = csDropDownList
       TabOrder = 1
     end
+    object lblFileSizeFormat: TLabel
+      Left = 8
+      Height = 16
+      Top = 38
+      Width = 83
+      Caption = 'File si&ze format:'
+      FocusControl = cbFileSizeFormat
+      ParentColor = False
+    end
   end
 end
Index: src/frames/foptionsfilesviews.lrt
===================================================================
--- src/frames/foptionsfilesviews.lrt	(revision 4956)
+++ src/frames/foptionsfilesviews.lrt	(working copy)
@@ -14,4 +14,4 @@
 TFRMOPTIONSFILESVIEWS.GBFORMATTING.CAPTION=Formatting
 TFRMOPTIONSFILESVIEWS.LBLDATETIMEFORMAT.CAPTION=&Date and time format:
 TFRMOPTIONSFILESVIEWS.LBLDATETIMEEXAMPLE.CAPTION=Incorrect format
-TFRMOPTIONSFILESVIEWS.CBSHORTFILESIZEFORMAT.CAPTION=Short file si&ze format
+TFRMOPTIONSFILESVIEWS.LBLFILESIZEFORMAT.CAPTION=File si&ze format:
Index: src/frames/foptionsfilesviews.pas
===================================================================
--- src/frames/foptionsfilesviews.pas	(revision 4956)
+++ src/frames/foptionsfilesviews.pas	(working copy)
@@ -42,13 +42,13 @@
     cbLoadIconsSeparately: TCheckBox;
     cbDelayLoadingTabs: TCheckBox;
     cbUpdatedFilesPosition: TComboBox;
-    cbShortFileSizeFormat: TCheckBox;
     cbShowSystemFiles: TCheckBox;
     cbNewFilesPosition: TComboBox;
     cbSortMethod: TComboBox;
     cbSpaceMovesDown: TCheckBox;
     cbCaseSensitivity: TComboBox;
     cbSortFolderMode: TComboBox;
+    cbFileSizeFormat: TComboBox;
     gbFormatting: TGroupBox;
     gbSorting: TGroupBox;
     gbMisc: TGroupBox;
@@ -59,6 +59,7 @@
     lblDateTimeFormat: TLabel;
     lblNewFilesPosition: TLabel;
     lblSortMethod: TLabel;
+    lblFileSizeFormat: TLabel;
     procedure cbDateTimeFormatChange(Sender: TObject);
   private
     FIncorrectFormatMessage: string;
@@ -102,6 +103,7 @@
   ParseLineToList(rsOptSortFolderMode, cbSortFolderMode.Items);
   ParseLineToList(rsOptNewFilesPosition, cbNewFilesPosition.Items);
   ParseLineToList(rsOptUpdatedFilesPosition, cbUpdatedFilesPosition.Items);
+  ParseLineToList(rsOptFileSizeFormat, cbFileSizeFormat.Items);
 end;
 
 procedure TfrmOptionsFilesViews.Load;
@@ -131,7 +133,7 @@
     ufpSameAsNewFiles: cbUpdatedFilesPosition.ItemIndex := 1;
     ufpSortedPosition: cbUpdatedFilesPosition.ItemIndex := 2;
   end;
-  cbShortFileSizeFormat.Checked :=gShortFileSizeFormat;
+  cbFileSizeFormat.ItemIndex := Ord(gFileSizeFormat);
   cbDateTimeFormat.Text := gDateTimeFormat;
   lblDateTimeExample.Caption:= FormatDateTime(cbDateTimeFormat.Text, Now);
   cbSpaceMovesDown.Checked := gSpaceMovesDown;
@@ -173,7 +175,7 @@
     1: gUpdatedFilesPosition := ufpSameAsNewFiles;
     2: gUpdatedFilesPosition := ufpSortedPosition;
   end;
-  gShortFileSizeFormat := cbShortFileSizeFormat.Checked;
+  gFileSizeFormat := TFileSizeFormat(cbFileSizeFormat.ItemIndex);
 
   gDateTimeFormat := GetValidDateTimeFormat(cbDateTimeFormat.Text, gDateTimeFormat);
 
Index: src/udcutils.pas
===================================================================
--- src/udcutils.pas	(revision 4956)
+++ src/udcutils.pas	(working copy)
@@ -73,7 +73,8 @@
                       otherwise long format (bytes) is used.)
    @returns(File size in string representation)
 }
-function cnvFormatFileSize(iSize: Int64; ShortFormat: Boolean): String;
+function cnvFormatFileSize(iSize: Int64; FSF: TFileSizeFormat): String;
+function cnvFormatFileSize(iSize: Int64; FSF: Boolean): String;
 function cnvFormatFileSize(iSize: Int64): String; inline;
 {en
    Minimize file path
@@ -292,11 +293,12 @@
     Result:= ExpandFileName(Result);
 end;
 
-function cnvFormatFileSize(iSize: Int64; ShortFormat: Boolean): String;
+function cnvFormatFileSize(iSize: Int64; FSF: TFileSizeFormat): String;
 var
   d: Double;
 begin
-  if ShortFormat then
+  case FSF of
+  fsfFloat:
   begin
     if iSize div (1024*1024*1024) > 0 then
     begin
@@ -314,17 +316,35 @@
     end
     else
       Result:=IntToStr(iSize);
-  end
-  else
+  end;
+  fsfB:
   begin
     d:=iSize;
     Result:=Format('%8.0n',[d]);
   end;
+  fsfK:
+  begin
+    Result:=FloatToStrF((iSize*10 div 1024)/10, ffFixed, 15, 1)+' K'
+  end;
+  fsfM:
+  begin
+    Result:=FloatToStrF((iSize*10 div (1024*1024))/10, ffFixed, 15, 1)+' M'
+  end;
+  fsfG:
+  begin
+    Result:=FloatToStrF((iSize*16 div (1024*1024*1024))/16, ffFixed, 15, 1)+' G'
+  end;
+  end;
 end;
 
+function cnvFormatFileSize(iSize: Int64; FSF: Boolean): String;
+begin
+  Result := cnvFormatFileSize(iSize, fsfFloat);
+end;
+
 function cnvFormatFileSize(iSize: Int64): String;
 begin
-  Result := cnvFormatFileSize(iSize, gShortFileSizeFormat);
+  Result := cnvFormatFileSize(iSize, gFileSizeFormat);
 end;
 
 {
Index: src/uglobs.pas
===================================================================
--- src/uglobs.pas	(revision 4956)
+++ src/uglobs.pas	(working copy)
@@ -192,7 +192,7 @@
   gWheelScrollLines: Integer;
   gAlwaysShowTrayIcon: Boolean;
   gMinimizeToTray: Boolean;
-  gShortFileSizeFormat:Boolean;
+  gFileSizeFormat: TFileSizeFormat;
   gDateTimeFormat : String;
   gDriveBlackList: String;
   gDriveBlackListUnmounted: Boolean; // Automatically black list unmounted devices
@@ -764,7 +764,7 @@
   gSortFolderMode := sfmSortNameShowFirst;
   gNewFilesPosition := nfpSortedPosition;
   gUpdatedFilesPosition := ufpNoChange;
-  gShortFileSizeFormat := True;
+  gFileSizeFormat := fsfFloat;
   gMinimizeToTray := False;
   gAlwaysShowTrayIcon := False;
   gMouseSelectionEnabled := True;
@@ -1266,7 +1266,7 @@
   else
     gSortCaseSensitivity := cstLocale;
   gLynxLike := gIni.ReadBool('Configuration', 'LynxLike', True);
-  gShortFileSizeFormat := gIni.ReadBool('Configuration', 'ShortFileSizeFormat', True);
+  gFileSizeFormat := TFileSizeFormat(gIni.ReadInteger('Configuration', 'FileSizeFormat', Ord(fsfFloat)));
   gScrollMode := TScrollMode(gIni.ReadInteger('Configuration', 'ScrollMode', Integer(gScrollMode)));
   gMinimizeToTray := gIni.ReadBool('Configuration', 'MinimizeToTray', False);
   gAlwaysShowTrayIcon := gIni.ReadBool('Configuration', 'AlwaysShowTrayIcon', False);
@@ -1447,7 +1447,7 @@
     gIni.WriteBool('Configuration', 'CaseSensitiveSort', True);
   gIni.WriteBool('Configuration', 'LynxLike', gLynxLike);
 
-  gIni.WriteBool('Configuration', 'ShortFileSizeFormat', gShortFileSizeFormat);
+  gIni.WriteInteger('Configuration', 'FileSizeFormat', Ord(gFileSizeFormat));
   gIni.WriteInteger('Configuration', 'ScrollMode', Integer(gScrollMode));
   gIni.WriteBool('Configuration', 'MinimizeToTray', gMinimizeToTray);
   gIni.WriteBool('Configuration', 'AlwaysShowTrayIcon', gAlwaysShowTrayIcon);
@@ -1638,7 +1638,7 @@
           gSortCaseSensitivity := cstLocale;
         gSortNatural := GetValue(Node, 'SortNatural', gSortNatural);
       end;
-      gShortFileSizeFormat := GetValue(Node, 'ShortFileSizeFormat', gShortFileSizeFormat);
+      gFileSizeFormat := TFileSizeFormat(GetValue(Node, 'FileSizeFormat', Ord(gFileSizeFormat)));
       gMinimizeToTray := GetValue(Node, 'MinimizeToTray', gMinimizeToTray);
       gAlwaysShowTrayIcon := GetValue(Node, 'AlwaysShowTrayIcon', gAlwaysShowTrayIcon);
       gMouseSelectionEnabled := GetAttr(Node, 'Mouse/Selection/Enabled', gMouseSelectionEnabled);
@@ -2004,7 +2004,7 @@
     SetValue(Node, 'RunTerminal', gRunTerm);
     SetValue(Node, 'OnlyOneAppInstance', gOnlyOneAppInstance);
     SetValue(Node, 'LynxLike', gLynxLike);
-    SetValue(Node, 'ShortFileSizeFormat', gShortFileSizeFormat);
+    SetValue(Node, 'FileSizeFormat', Ord(gFileSizeFormat));
     SetValue(Node, 'MinimizeToTray', gMinimizeToTray);
     SetValue(Node, 'AlwaysShowTrayIcon', gAlwaysShowTrayIcon);
     SubNode := FindNode(Node, 'Mouse', True);
Index: src/ulng.pas
===================================================================
--- src/ulng.pas	(revision 4956)
+++ src/ulng.pas	(working copy)
@@ -456,6 +456,7 @@
   rsOptNewFilesPosition = 'at the top of the file list;after directories (if directories are sorted before files);at sorted position;at the bottom of the file list';
   rsOptUpdatedFilesPosition = 'don''t change position;use the same setting as for new files;to sorted position';
   rsOptFileOperationsProgressKind = 'separate window;minimized separate window;operations panel';
+  rsOptFileSizeFormat = 'float;B;K;M;G';
   // Keyboard
   rsOptLetters = 'None;Command Line;Quick Search;Quick Filter';
 
Index: src/utypes.pas
===================================================================
--- src/utypes.pas	(revision 4956)
+++ src/utypes.pas	(working copy)
@@ -44,6 +44,8 @@
     Last: Integer;
   end;
 
+  TFileSizeFormat = (fsfFloat, fsfB, fsfK, fsfM, fsfG);
+
 implementation
 
 end.
filesize1.patch (12,466 bytes)   
Fixed in Revision4962
Operating system
Widgetset
Architecture

Relationships

related to 0000127 closedcobines Select unit for file size (b, kB, MB, ..., dynamic) 

Activities

luis

2012-03-14 02:13

reporter   ~0000452

Ok, I just saw that the shortened forms are K, M, and G (instead of KB, MB and GB). But this does not change much the matter. It stil does not intuitively convey the 'bigness' of the file as well as using a fixed unit, e.g. K.
So my request ramains.

luis

2012-08-03 21:31

reporter   ~0000858

Please implement this feature soon. It really improves visual usability. Thanks.

luis

2012-08-25 23:15

reporter   ~0000866

Any chance of seeing this included into the 0.5.5 release?

pktfag

2012-09-05 01:07

reporter   ~0000876

Last edited: 2012-09-05 01:09

See the patch optfsf.zip to 4951r

pktfag

2012-09-10 12:07

reporter   ~0000884

Updated th patch filesize.zip to 4956r

pktfag

2012-09-12 12:21

reporter   ~0000902

Fixed bindings filesize1.patch

Alexx2000

2012-09-14 11:17

administrator   ~0000914

Thanks, I applied patch with small changes in controls alignment.

Issue History

Date Modified Username Field Change
2012-03-14 01:56 luis New Issue
2012-03-14 02:13 luis Note Added: 0000452
2012-08-03 21:31 luis Note Added: 0000858
2012-08-25 23:15 luis Note Added: 0000866
2012-09-01 20:50 Alexx2000 Relationship added related to 0000127
2012-09-05 01:07 pktfag File Added: optfsf.zip
2012-09-05 01:07 pktfag Note Added: 0000876
2012-09-05 01:09 pktfag Note Edited: 0000876
2012-09-10 12:07 pktfag File Added: filesize.zip
2012-09-10 12:07 pktfag Note Added: 0000884
2012-09-12 12:21 pktfag Note Added: 0000902
2012-09-12 12:22 pktfag File Added: filesize1.patch
2012-09-14 11:07 Alexx2000 Assigned To => Alexx2000
2012-09-14 11:07 Alexx2000 Status new => assigned
2012-09-14 11:07 Alexx2000 Target Version => 0.5.5
2012-09-14 11:17 Alexx2000 Fixed in Revision => 4962
2012-09-14 11:17 Alexx2000 Note Added: 0000914
2012-09-14 11:17 Alexx2000 Status assigned => resolved
2012-09-14 11:17 Alexx2000 Fixed in Version => 0.5.5
2012-09-14 11:17 Alexx2000 Resolution open => fixed
2014-01-14 22:56 Alexx2000 Status resolved => closed