IDE: started setup dialog

git-svn-id: trunk@29895 -
This commit is contained in:
mattias 2011-03-17 21:45:16 +00:00
parent 7aedcc1b99
commit 40bc5733f4
2 changed files with 207 additions and 3 deletions

View File

@ -104,10 +104,10 @@ object InitialSetupDialog: TInitialSetupDialog
Height = 284
Top = 54
Width = 444
ActivePage = LazarusTabSheet
ActivePage = LanguageTabSheet
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 6
TabIndex = 0
TabIndex = 3
TabOrder = 3
OnChange = PropertiesPageControlChange
Options = [nboHidePageListPopup]
@ -178,12 +178,151 @@ object InitialSetupDialog: TInitialSetupDialog
end
object CompilerTabSheet: TTabSheet
Caption = 'CompilerTabSheet'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 251
ClientWidth = 440
object CompilerLabel: TLabel
Left = 6
Height = 18
Top = 6
Width = 428
Align = alTop
Caption = 'CompilerLabel'
ParentColor = False
WordWrap = True
end
object CompilerComboBox: TComboBox
AnchorSideLeft.Control = CompilerTabSheet
AnchorSideTop.Control = CompilerLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompilerTabSheet
AnchorSideRight.Side = asrBottom
Left = 6
Height = 27
Top = 30
Width = 428
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
TabOrder = 0
Text = 'CompilerComboBox'
end
object CompilerBrowseButton: TButton
AnchorSideLeft.Control = CompilerTabSheet
AnchorSideTop.Control = CompilerComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 27
Top = 63
Width = 179
AutoSize = True
Caption = 'CompilerBrowseButton'
TabOrder = 1
end
object CompilerMemo: TMemo
AnchorSideLeft.Control = CompilerTabSheet
AnchorSideTop.Control = CompilerBrowseButton
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CompilerTabSheet
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CompilerTabSheet
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 149
Top = 96
Width = 428
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (
'CompilerMemo'
)
TabOrder = 2
end
end
object FPCSourcesTabSheet: TTabSheet
Caption = 'FPCSourcesTabSheet'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 251
ClientWidth = 440
object FPCSrcDirLabel: TLabel
Left = 6
Height = 18
Top = 6
Width = 428
Align = alTop
Caption = 'FPCSrcDirLabel'
ParentColor = False
WordWrap = True
end
object FPCSrcDirComboBox: TComboBox
Left = 6
Height = 27
Top = 30
Width = 428
Align = alTop
ItemHeight = 0
TabOrder = 0
Text = 'FPCSrcDirComboBox'
end
object FPCSrcDirBrowseButton: TButton
AnchorSideLeft.Control = FPCSourcesTabSheet
AnchorSideTop.Control = FPCSrcDirComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 27
Top = 63
Width = 185
AutoSize = True
Caption = 'FPCSrcDirBrowseButton'
TabOrder = 1
end
object FPCSrcDirMemo: TMemo
AnchorSideTop.Control = FPCSrcDirBrowseButton
AnchorSideTop.Side = asrBottom
Left = 6
Height = 149
Top = 96
Width = 428
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (
'FPCSrcDirMemo'
)
TabOrder = 2
end
end
object LanguageTabSheet: TTabSheet
Caption = 'LanguageTabSheet'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 251
ClientWidth = 440
object LangLabel: TLabel
Left = 6
Height = 18
Top = 6
Width = 428
Align = alTop
Caption = 'LangLabel'
ParentColor = False
WordWrap = True
end
object LangComboBox: TComboBox
Left = 6
Height = 27
Top = 30
Width = 428
Align = alTop
ItemHeight = 0
TabOrder = 0
Text = 'LangComboBox'
end
end
end
object WelcomePaintBox: TPaintBox

View File

@ -69,7 +69,17 @@ type
TInitialSetupDialog = class(TForm)
BtnPanel: TPanel;
CompilerBrowseButton: TButton;
CompilerComboBox: TComboBox;
CompilerLabel: TLabel;
CompilerMemo: TMemo;
FPCSrcDirBrowseButton: TButton;
FPCSrcDirComboBox: TComboBox;
FPCSrcDirLabel: TLabel;
FPCSrcDirMemo: TMemo;
ImageList1: TImageList;
LangComboBox: TComboBox;
LangLabel: TLabel;
LazDirBrowseButton: TButton;
LazDirLabel: TLabel;
LazDirComboBox: TComboBox;
@ -121,6 +131,10 @@ function CheckLazarusDirectoryQuality(ADirectory: string;
out Note: string): TSDFilenameQuality;
function SearchLazarusDirectoryCandidates(StopIfFits: boolean): TObjectList;
function CheckCompilerQuality(AFilename: string;
out Note: string): TSDFilenameQuality;
function SearchCompilerCandidates(StopIfFits: boolean): TObjectList;
function GetValueFromPrimaryConfig(OptionFilename, Path: string): string;
function GetValueFromSecondaryConfig(OptionFilename, Path: string): string;
function GetValueFromIDEConfig(OptionFilename, Path: string): string;
@ -285,7 +299,8 @@ var
Version: String;
begin
Result:=sddqInvalid;
if not DirPathExists(ADirectory) then begin
ADirectory:=TrimFilename(ADirectory);
if not DirPathExistsCached(ADirectory) then begin
Note:='Directory not found';
exit;
end;
@ -397,6 +412,56 @@ begin
if CheckDir(Dirs[i],Result) then exit;
end;
function CheckCompilerQuality(AFilename: string; out Note: string
): TSDFilenameQuality;
begin
Result:=sddqInvalid;
AFilename:=TrimFilename(AFilename);
if not FileExistsCached(AFilename) then begin
Note:='File not found';
exit;
end;
if not FileIsExecutableCached(AFilename) then begin
Note:='File is not executable';
exit;
end;
end;
function SearchCompilerCandidates(StopIfFits: boolean): TObjectList;
function CheckFile(AFilename: string; var List: TObjectList): boolean;
var
Item: TSDFileInfo;
i: Integer;
begin
Result:=false;
AFilename:=TrimFilename(AFilename);
if AFilename='' then exit;
AFilename:=ExpandFileNameUTF8(AFilename);
// check if already checked
if List<>nil then begin
for i:=0 to List.Count-1 do
if CompareFilenames(AFilename,TSDFileInfo(List[i]).Filename)=0 then exit;
end;
// check if exists
if not FileExistsCached(AFilename) then exit;
// add to list and check quality
Item:=TSDFileInfo.Create;
Item.Filename:=AFilename;
Item.Quality:=CheckCompilerQuality(AFilename,Item.Note);
Item.Caption:=AFilename;
if List=nil then
List:=TObjectList.create(true);
List.Add(Item);
Result:=(Item.Quality=sddqCompatible) and StopIfFits;
end;
begin
Result:=nil;
end;
function GetValueFromPrimaryConfig(OptionFilename, Path: string): string;
begin
if not FilenameIsAbsolute(OptionFilename) then