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
|
{ IDE options frame for pas2js options
Author: Mattias Gaertner
}
unit fraTestInsightOpts;
{$mode objfpc}{$H+}
{$Inline on}
interface
uses
Classes, SysUtils,
// LCL
Forms, StdCtrls, Dialogs, Spin,
// LazUtils
LazFileCache, LazFileUtils, FileUtil,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils,
// FPCUnit
TestInsightController, StrTestCaseOpts;
Type
{ TTestInsightOptionsFrame }
TTestInsightOptionsFrame = class(TAbstractIDEOptionsEditor)
cbServerBasePath: TComboBox;
cbAutoFetch: TCheckBox;
lblBaseURL: TLabel;
lblServerPort: TLabel;
seServerPort: TSpinEdit;
private
FDialog: TAbstractOptionsEditorDialog;
public
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
{$R *.lfm}
{ TTestInsightOptionsFrame }
function TTestInsightOptionsFrame.GetTitle: String;
begin
Result := rsTestInsightTitle;
end;
procedure TTestInsightOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
FDialog:=aDialog;
seServerPort.Value:=DefaultPort;
cbServerBasePath.Items.Add(DefaultBasePath);
cbServerBasePath.ItemIndex:=0;
lblServerPort.Caption:=rsServerPort;
lblBaseURL.Caption:=rsServerPath;
cbAutoFetch.Caption:=rsAutomaticallyFetchTestListOnOpen;
end;
procedure TTestInsightOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
O : TTestInsightOptions;
begin
O:=gTestInsightController.Options;
SetComboBoxText(cbServerBasePath,O.BasePath,cstCaseInsensitive);
seServerPort.Value:=O.Port;
cbAutoFetch.Checked:=O.AutoFetchTests;
end;
procedure TTestInsightOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
var
O : TTestInsightOptions;
T : String;
begin
O:=gTestInsightController.Options;
T:=cbServerBasePath.Text;
If (T='') then
T:=DefaultBasePath
else if T[1]<>'/' then
T:='/'+T;
O.BasePath:=T;
O.Port:=seServerPort.Value;
O.AutoFetchTests:=cbAutoFetch.Checked;
gTestInsightController.Options.SaveToFile(TestInsightConfig);
end;
class function TTestInsightOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result:=IDEEditorGroups.GetByIndex(GroupEnvironment)^.GroupClass;
end;
end.
|