1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
unit AdminStartupVariablesInnoDBDatafiles;
interface
uses
Windows, Messages, SysUtils, Variants, TntClasses, Graphics, Controls,
Forms, TntForms,
TntDialogs, TntStdCtrls, AuxFuncs, TeEngine, Series, ExtCtrls,
TeeProcs, Chart, ComCtrls, TntComCtrls, StdCtrls, Classes ;
type
TAdminStartupVariablesInnoDBDatafilesForm = class(TTntForm)
DriveInfoCBox: TTntGroupBox;
Label1: TTntLabel;
Label2: TTntLabel;
Label4: TTntLabel;
VolumeNameLbl: TTntLabel;
FileSystemLbl: TTntLabel;
Label6: TTntLabel;
FreeSpaceLbl: TTntLabel;
Label8: TTntLabel;
TotalSizeLbl: TTntLabel;
OKBtn: TTntButton;
CancelBtn: TTntButton;
TableSpaceGBox: TTntGroupBox;
Label7: TTntLabel;
SizeEd: TTntEdit;
SizeUpDown: TTntUpDown;
UnitCBox: TTntComboBox;
TablespaceEd: TTntEdit;
Label9: TTntLabel;
DiskChart: TChart;
Series1: TPieSeries;
DriveCBox: TTntComboBox;
Label3: TTntLabel;
Label5: TTntLabel;
Label10: TTntLabel;
procedure FormCreate(Sender: TObject);
procedure DriveCBoxChange(Sender: TObject);
procedure RefreshGraph;
procedure SizeEdChange(Sender: TObject);
procedure TablespaceEdChange(Sender: TObject);
private
public
FileSize: Int64;
TotalSize: Int64;
FreeSpace: int64;
end;
var
AdminStartupVariablesInnoDBDatafilesForm: TAdminStartupVariablesInnoDBDatafilesForm;
//----------------------------------------------------------------------------------------------------------------------
implementation
{$R *.dfm}
uses
gnugettext;
procedure TAdminStartupVariablesInnoDBDatafilesForm.FormCreate(Sender: TObject);
begin
InitForm(self);
FileSize := 10 * 1024 * 1024;
DriveCBox.Items.Text := GetDrives;
if DriveCBox.Items.Count > 0 then
if CompareText(DriveCBox.Items[0], 'A:') = 0 then
DriveCBox.Items.Delete(0);
if DriveCBox.Items.Count > 0 then
if CompareText(DriveCBox.Items[0], 'B:') = 0 then
DriveCBox.Items.Delete(0);
DriveCBox.ItemIndex := 0;
DriveCBoxChange(Self);
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TAdminStartupVariablesInnoDBDatafilesForm.DriveCBoxChange(Sender: TObject);
var
DriveInfo: PMYX_DRIVE_INFO;
begin
if DriveCBox.Text <> '' then
begin
DriveInfo := GetDriveInfo(DriveCBox.Text);
try
VolumeNameLbl.Caption := DriveInfo.VolumeLabel;
FileSystemLbl.Caption := DriveInfo.FileSystem;
TotalSize := DriveInfo.TotalSize;
FreeSpace := DriveInfo.FreeSpace;
TotalSizeLbl.Caption := FormatFileSize(TotalSize);
FreeSpaceLbl.Caption := FormatFileSize(FreeSpace);
RefreshGraph;
finally
dispose(DriveInfo);
end;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TAdminStartupVariablesInnoDBDatafilesForm.RefreshGraph;
begin
Series1.Clear;
if(TotalSize>0)then
begin
Series1.AddPie(TotalSize-FreeSpace - FileSize, _('Used'), $00FF0000);
Series1.AddPie(FreeSpace, _('Free'), $00FF00FF);
Series1.AddPie(FileSize, _('Table space'), $0000FF00);
end;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TAdminStartupVariablesInnoDBDatafilesForm.SizeEdChange(Sender: TObject);
begin
if(UnitCBox.ItemIndex=0)then
FileSize:=int64(ExtractNumber(SizeEd.Text)) * 1024
else
FileSize:=int64(ExtractNumber(SizeEd.Text)) * 1024 * 1024;
RefreshGraph;
end;
//----------------------------------------------------------------------------------------------------------------------
procedure TAdminStartupVariablesInnoDBDatafilesForm.TablespaceEdChange(Sender: TObject);
begin
if Copy(TablespaceEd.Text, 2, 2)=':\' then
if DriveCBox.Items.IndexOf(Copy(TablespaceEd.Text, 1, 2)) > -1 then
begin
DriveCBox.ItemIndex:= DriveCBox.Items.IndexOf(Copy(TablespaceEd.Text, 1, 2));
DriveCBoxChange(Self);
end;
end;
//----------------------------------------------------------------------------------------------------------------------
end.
|