12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- unit unit_createhd;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, Forms, Controls, Graphics, LCLIntf, Dialogs, StdCtrls,
- Buttons, EditBtn, ComCtrls, Spin;
- type
- { TfrmCreateHD }
- TfrmCreateHD = class(TForm)
- btnRef1: TBitBtn;
- btnOK: TBitBtn;
- btnCancel: TBitBtn;
- cmbHDImageType: TComboBox;
- edtHDFile: TFileNameEdit;
- GroupBox1: TGroupBox;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- spnHDSize: TSpinEdit;
- trkHDSize: TTrackBar;
- procedure btnCancelClick(Sender: TObject);
- procedure btnOKClick(Sender: TObject);
- procedure btnRef1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure spnHDSizeChange(Sender: TObject);
- procedure trkHDSizeChange(Sender: TObject);
- private
- public
- end;
- var
- frmCreateHD: TfrmCreateHD;
- implementation
- uses
- Unit1;
- {$R *.lfm}
- { TfrmCreateHD }
- procedure TfrmCreateHD.FormCreate(Sender: TObject);
- begin
- end;
- procedure TfrmCreateHD.btnOKClick(Sender: TObject);
- var
- ret:string;
- begin
- ret:=Form1.GetCommandOutput('qemu-img create -q -f '+cmbHDImageType.Text+' '+edtHDFile.Text+' '+inttostr(trkHDSize.Position)+'G' );
- if ret <> '' then
- ShowMessage('QEMU image creation error: '+ret)
- else
- ModalResult:=mrOK;
- end;
- procedure TfrmCreateHD.btnRef1Click(Sender: TObject);
- begin
- OpenURL('https://en.wikibooks.org/wiki/QEMU/Images#Image_types');
- end;
- procedure TfrmCreateHD.btnCancelClick(Sender: TObject);
- begin
- ModalResult:=mrCancel;
- end;
- procedure TfrmCreateHD.spnHDSizeChange(Sender: TObject);
- begin
- if spnHDSize.Focused then
- trkHDSize.Position := spnHDSize.Value;
- end;
- procedure TfrmCreateHD.trkHDSizeChange(Sender: TObject);
- begin
- if trkHDSize.Focused then
- spnHDSize.Value := trkHDSize.Position;
- end;
- end.
|