Changeset 4 for trunk/UFormMain.pas


Ignore:
Timestamp:
Mar 29, 2016, 10:52:51 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Show drive size and I/O speed with proper units.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r3 r4  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  Menus, ComCtrls, ExtCtrls, ActnList, dateutils, syncobjs, UProject,
    10   UDriveScan;
     10  UDriveScan, UPrefixMultiplier;
    1111
    1212type
     
    6161    procedure Timer1Timer(Sender: TObject);
    6262  private
     63    PrefixMultiplier: TPrefixMultiplier;
    6364    LastBlockPos: Integer;
    6465    ScanThread: TScanThread;
     
    101102procedure TFormMain.FormCreate(Sender: TObject);
    102103begin
     104  PrefixMultiplier := TPrefixMultiplier.Create;
    103105  DriveScan := TDriveScan.Create;
    104106  DriveScan.OnChange := DriveScanChange;
     
    107109  ScanThread.Form := Self;
    108110  Project := TProject.Create;
    109   EditDrive.Text := '/dev/sda';
     111  EditDrive.Text := '/dev/sdb';
    110112end;
    111113
     
    156158  FreeAndNil(ScanThread);
    157159  FreeAndNil(DriveScan);
     160  FreeAndNil(PrefixMultiplier);
    158161end;
    159162
     
    178181        Picture.Bitmap.EndUpdate;
    179182      end;
    180       LabelSize.Caption := IntToStr(DriveScan.BlockMap.SectorCount * DriveScan.SectorSize) + ' bytes';
     183      LabelSize.Caption := PrefixMultiplier.Add(DriveScan.BlockMap.SectorCount * DriveScan.SectorSize,
     184        BasePrefixMultipliers, 'bytes');
    181185      LabelSectorPerBlock.Caption := IntToStr(DriveScan.BlockMap.SectorPerBlock);
    182186      LabelBlockSize.Caption := IntToStr(DriveScan.SectorSize) + ' bytes';
     
    195199      LabelEstimatedTime.Caption := TimeToStr((Now - DriveScan.TimeStart) /
    196200        DriveScan.SectorCurrent * (DriveScan.BlockMap.SectorCount - DriveScan.SectorCurrent));
    197       LabelIOSpeed.Caption := IntToStr(Trunc((DriveScan.SectorCurrent - LastBlockPos) *
    198         DriveScan.SectorSize / (1024 * 1024) / (Timer1.Interval / 1000))) + ' MB/s';
     201      LabelIOSpeed.Caption := PrefixMultiplier.Add((DriveScan.SectorCurrent - LastBlockPos) *
     202        DriveScan.SectorSize / (Timer1.Interval / 1000), BasePrefixMultipliers, 'B/s');
    199203      LastBlockPos := DriveScan.SectorCurrent;
    200204    end else begin
Note: See TracChangeset for help on using the changeset viewer.