From 8e677477d9cc1cf41680f1c34abdcb824ffd33ab Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 20 Jun 2012 12:21:15 +0000 Subject: [PATCH] IDE: setup dialog: show fpc source directory release version as warning instead of error git-svn-id: trunk@37704 - --- ide/initialsetupdlgs.pas | 45 +++++++++++++++++++++++-------------- ide/lazarusidestrconsts.pas | 2 ++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ide/initialsetupdlgs.pas b/ide/initialsetupdlgs.pas index 8bc90bd0f7..443f8dcfa1 100644 --- a/ide/initialsetupdlgs.pas +++ b/ide/initialsetupdlgs.pas @@ -116,6 +116,7 @@ type fLastParsedFPCSrcDir: string; FIdleConnected: boolean; ImgIDError: LongInt; + ImgIDWarning: LongInt; FHeadGraphic: TPortableNetworkGraphic; FSelectingPage: boolean; FCandidates: array[TSDFilenameType] of TObjectList; // list of TSDFileInfo @@ -134,6 +135,7 @@ type function GetFPCVer: string; function GetFirstCandidate(Candidates: TObjectList; MinQuality: TSDFilenameQuality = sddqCompatible): TSDFileInfo; + function QualityToImgIndex(Quality: TSDFilenameQuality): integer; public TVNodeLazarus: TTreeNode; TVNodeCompiler: TTreeNode; @@ -701,8 +703,11 @@ begin if SrcVer<>FPCVer then begin Note:=Format(lisFoundVersionExpected, [SrcVer, FPCVer]); - - Result:=sddqWrongVersion; + SrcVer:=VersionNr+'.'+ReleaseNr+'.'; + if LeftStr(FPCVer,length(SrcVer))=SrcVer then + Result:=sddqWrongMinorVersion + else + Result:=sddqWrongVersion; exit; end; except @@ -1101,6 +1106,7 @@ begin TVNodeCompiler:=PropertiesTreeView.Items.Add(nil,CompilerTabSheet.Caption); TVNodeFPCSources:=PropertiesTreeView.Items.Add(nil,FPCSourcesTabSheet.Caption); ImgIDError := ImageList1.AddLazarusResource('state_error'); + ImgIDWarning := ImageList1.AddLazarusResource('state_warning'); LazDirBrowseButton.Caption:=lisPathEditBrowse; LazDirLabel.Caption:=Format( @@ -1389,13 +1395,11 @@ begin end; if EnvironmentOptions.LazarusDirectory<>EnvironmentOptions.GetParsedLazarusDirectory then - s:='Directory: '+EnvironmentOptions.GetParsedLazarusDirectory+LineEnding+LineEnding+s; + s:=lisDirectory+EnvironmentOptions.GetParsedLazarusDirectory+LineEnding+ + LineEnding+s; LazDirMemo.Text:=s+Note; - if Quality=sddqCompatible then - ImageIndex:=-1 - else - ImageIndex:=ImgIDError; + ImageIndex:=QualityToImgIndex(Quality); TVNodeLazarus.ImageIndex:=ImageIndex; TVNodeLazarus.SelectedIndex:=ImageIndex; @@ -1431,13 +1435,11 @@ begin end; if EnvironmentOptions.CompilerFilename<>EnvironmentOptions.GetParsedCompilerFilename then - s:='File: '+EnvironmentOptions.GetParsedCompilerFilename+LineEnding+LineEnding+s; + s:=lisFile2+EnvironmentOptions.GetParsedCompilerFilename+LineEnding+ + LineEnding+s; CompilerMemo.Text:=s+Note; - if Quality=sddqCompatible then - ImageIndex:=-1 - else - ImageIndex:=ImgIDError; + ImageIndex:=QualityToImgIndex(Quality); TVNodeCompiler.ImageIndex:=ImageIndex; TVNodeCompiler.SelectedIndex:=ImageIndex; @@ -1468,13 +1470,11 @@ begin end; if EnvironmentOptions.FPCSourceDirectory<>EnvironmentOptions.GetParsedFPCSourceDirectory then - s:='Directory: '+EnvironmentOptions.GetParsedFPCSourceDirectory+LineEnding+LineEnding+s; + s:=lisDirectory+EnvironmentOptions.GetParsedFPCSourceDirectory+LineEnding+ + LineEnding+s; FPCSrcDirMemo.Text:=s+Note; - if Quality=sddqCompatible then - ImageIndex:=-1 - else - ImageIndex:=ImgIDError; + ImageIndex:=QualityToImgIndex(Quality); TVNodeFPCSources.ImageIndex:=ImageIndex; TVNodeFPCSources.SelectedIndex:=ImageIndex; end; @@ -1511,6 +1511,17 @@ begin Result:=nil; end; +function TInitialSetupDialog.QualityToImgIndex(Quality: TSDFilenameQuality + ): integer; +begin + if Quality=sddqCompatible then + Result:=-1 + else if Quality=sddqWrongMinorVersion then + Result:=ImgIDWarning + else + Result:=ImgIDError; +end; + procedure TInitialSetupDialog.Init; var Node: TTreeNode; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index c5bdf33830..0ebde2a736 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -808,6 +808,8 @@ resourcestring lisSeeMessages = 'See messages.'; lisError = 'Error: '; lisWarning = 'Warning: '; + lisFile2 = 'File: '; + lisDirectory = 'Directory: '; lisSaveChanges = 'Save changes?'; lisSaveFileBeforeClosingForm = 'Save file %s%s%s%sbefore closing form %s%s%s?'; lisUnableToRenameFormInSource = 'Unable to rename form in source.';