UPD: Use same size format everywhere

This commit is contained in:
Alexander Koblov 2023-05-15 20:00:03 +03:00
commit afd829613d

View file

@ -141,6 +141,7 @@ type
procedure ShowExecutable;
procedure ShowPermissions(Mode: TFileAttrs);
function GetModeFromForm(out ExcludeAttrs: TFileAttrs): TFileAttrs;
function FormatSize(ASize: Int64): String;
procedure ShowMany;
procedure ShowFile(iIndex:Integer);
procedure StartCalcFolderSize;
@ -165,7 +166,7 @@ uses
uDefaultFilePropertyFormatter, uMyUnix, DCFileAttributes, uGlobs, uWdxModule,
uFileSourceOperationTypes, uFileSystemFileSource, uOperationsManager, WdxPlugin,
uFileSourceOperationOptions, uKeyboard, DCStrUtils, uPixMapManager,
uFileSourceProperty, DCDateTimeUtils;
uFileSourceProperty, DCDateTimeUtils, uTypes;
procedure ShowFileProperties(aFileSource: IFileSource; const aFiles: TFiles);
begin
@ -317,6 +318,11 @@ begin
end;
end;
function TfrmFileProperties.FormatSize(ASize: Int64): String;
begin
Result:= Format('%s (%s)', [cnvFormatFileSize(ASize, fsfFloat, gFileSizeDigits), IntToStrTS(ASize)]);
end;
procedure TfrmFileProperties.ShowMany;
var
ASize: Int64;
@ -353,7 +359,7 @@ begin
if (Directories = 0) then
begin
lblSize.Caption := Format('%s (%s)', [cnvFormatFileSize(ASize), IntToStrTS(ASize)]);
lblSize.Caption := FormatSize(ASize);
end
else if (fsoCalcStatistics in FFileSource.GetOperationsTypes) then
begin
@ -567,7 +573,7 @@ begin
if IsDirectory and (fsoCalcStatistics in FFileSource.GetOperationsTypes) then
StartCalcFolderSize // Start calculate folder size operation
else
lblSize.Caption := Properties[fpSize].Format(FPropertyFormatter);
lblSize.Caption := FormatSize(Size);
end;
lblSize.Visible := hasSize;
lblSizeStr.Visible := hasSize;
@ -581,7 +587,7 @@ begin
if hasSize then
begin
ASize:= FFileAttr.FindData.st_blocks * 512;
lblSizeOnDisk.Caption:= Format('%s (%s)', [cnvFormatFileSize(ASize), IntToStrTS(ASize)]);
lblSizeOnDisk.Caption:= FormatSize(ASize);
end;
lblSizeOnDisk.Visible:= hasSize;
lblSizeOnDiskStr.Visible:= hasSize;
@ -778,7 +784,7 @@ begin
if Assigned(FFileSourceCalcStatisticsOperation) then
with FFileSourceCalcStatisticsOperation.RetrieveStatistics do
begin
lblSize.Caption := Format('%s (%s)', [cnvFormatFileSize(Size), IntToStrTS(Size)]);
lblSize.Caption := FormatSize(Size);
lblContains.Caption := Format(rsPropsContains, [Files, Directories]);
end;
end;