Index: CHANGES.txt ================================================================== --- CHANGES.txt +++ CHANGES.txt @@ -1,8 +1,11 @@ -Version [next] +Version 0.11.0 +2022-03-12 +[Feature] The update check was made optional (default: false). [Changed] Rearranged the build options panel so it won't look as misaligned as it actually was. +[Changed] The required SSL libraries are shipped with the Windows package now. ------------------------------- Version 0.10.1 2022-03-10 Index: src/groffstudio.lpi ================================================================== --- src/groffstudio.lpi +++ src/groffstudio.lpi @@ -20,12 +20,11 @@ - - + Index: src/unit1.lfm ================================================================== --- src/unit1.lfm +++ src/unit1.lfm @@ -778,14 +778,22 @@ TabOrder = 1 end object Label14: TLabel Left = 0 Height = 15 - Top = 48 + Top = 80 Width = 129 Caption = 'Yes, that''s all for now. :-)' ParentColor = False + end + object chkUpdateCheckOnStart: TCheckBox + Left = 0 + Height = 19 + Top = 40 + Width = 171 + Caption = 'Check for updates on startup' + TabOrder = 2 end end object tsGroff: TTabSheet Caption = 'groff version' ClientHeight = 631 Index: src/unit1.pas ================================================================== --- src/unit1.pas +++ src/unit1.pas @@ -40,10 +40,11 @@ btnSaveGroff: TButton; btnLoadGroff: TButton; btnBuild: TButton; btnDownloadGroffWindows: TButton; btnSaveSettings: TButton; + chkUpdateCheckOnStart: TCheckBox; chkLogFile: TCheckBox; chkAutoSaveBuildSettings: TCheckBox; chkPdfMark: TCheckBox; chkRefer: TCheckBox; chkChem: TCheckBox; @@ -112,10 +113,11 @@ var unsavedChanges: Boolean; {$IFDEF WINDOWS} var latestGroffWindowsUrl: String; {$ENDIF} var storeBuildSettings: Boolean; + var updateCheck: Boolean; public end; var @@ -169,10 +171,13 @@ // Restore the settings iniStorage.Restore; storeBuildSettings := iniStorage.ReadBoolean('AutoSaveBuildSettings', False); chkAutoSaveBuildSettings.Checked := storeBuildSettings; + updateCheck := iniStorage.ReadBoolean('UpdateCheckOnStart', False); + chkUpdateCheckOnStart.Checked := updateCheck; + if storeBuildSettings then begin chkLogFile.Checked := iniStorage.ReadBoolean('BuildLogFile', False); cmbMacro.Text := iniStorage.ReadString('BuildChosenMacro', '[ select ]'); chkChem.Checked := iniStorage.ReadBoolean('BuildUseChem', False); @@ -194,53 +199,68 @@ edtGroffStudioInstalledVersion.Text := FileVerInfo.VersionStrings.Values['FileVersion']; lblAboutProductName.Caption := FileVerInfo.VersionStrings.Values['ProductName'] + ' ' + FileVerInfo.VersionStrings.Values['FileVersion']; MainStatusBar.Panels[2].Text := ''; {$IFDEF WINDOWS} - OnlineVersionsFile := TFPCustomHTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt'); - reGroffVersion := TRegExpr.Create('groff-win ([\d\.]+) (.*)$'); - reGroffVersion.ModifierM := True; - if reGroffVersion.Exec(OnlineVersionsFile) then - begin - edtOnlineGroffVersionWindows.Text := reGroffVersion.Match[1]; - latestGroffWindowsUrl := reGroffVersion.Match[2]; - end else begin - edtOnlineGroffVersionWindows.Text := 'error'; - btnDownloadGroffWindows.Enabled := False; - end; - - reGroffStudioVersion := TRegExpr.Create('studio-win ([\d\.]+) (.*)$'); - reGroffStudioVersion.ModifierM := True; - if reGroffStudioVersion.Exec(OnlineVersionsFile) then - begin - // Compare the two versions - ours and the online one: - GroffHelpers.VerStrCompare(reGroffStudioVersion.Match[1], FileVerInfo.VersionStrings.Values['FileVersion'], HasVersionUpdate); - if HasVersionUpdate > 0 then - MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available'; + if updateCheck then + begin + OnlineVersionsFile := TFPCustomHTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt'); + + // 1. groff update check + reGroffVersion := TRegExpr.Create('groff-win ([\d\.]+) (.*)$'); + reGroffVersion.ModifierM := True; + if reGroffVersion.Exec(OnlineVersionsFile) then + begin + edtOnlineGroffVersionWindows.Text := reGroffVersion.Match[1]; + latestGroffWindowsUrl := reGroffVersion.Match[2]; + end else begin + edtOnlineGroffVersionWindows.Text := 'error'; + btnDownloadGroffWindows.Enabled := False; + end; + + // 2. groffstudio update check + reGroffStudioVersion := TRegExpr.Create('studio-win ([\d\.]+) (.*)$'); + reGroffStudioVersion.ModifierM := True; + if reGroffStudioVersion.Exec(OnlineVersionsFile) then + begin + // Compare the two versions - ours and the online one: + GroffHelpers.VerStrCompare(reGroffStudioVersion.Match[1], FileVerInfo.VersionStrings.Values['FileVersion'], HasVersionUpdate); + if HasVersionUpdate > 0 then + MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available'; + end; + end else begin + edtOnlineGroffVersionWindows.Text := 'n/a'; + btnDownloadGroffWindows.Enabled := False; end; {$ELSE} // Non-Windows platforms won't need some of that. {$IFDEF DARWIN} // What's the latest available version? try - HTTPClient := TFPHTTPClient.Create(Nil); - HTTPClient.OnGetSocketHandler := @GetSocketHandler; - OnlineVersionsFile := HTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt'); - - reGroffStudioVersion := TRegExpr.Create('studio-macos ([\d\.]+) (.*)$'); - reGroffStudioVersion.ModifierM := True; - if reGroffStudioVersion.Exec(OnlineVersionsFile) then + if updateCheck then begin - // Compare the two versions - ours and the online one: - GroffHelpers.VerStrCompare(reGroffStudioVersion.Match[1], FileVerInfo.VersionStrings.Values['FileVersion'], HasVersionUpdate); - if HasVersionUpdate > 0 then - MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available' - else - MainStatusBar.Panels[2].Text := IntToStr(HasVersionUpdate); + HTTPClient := TFPHTTPClient.Create(Nil); + HTTPClient.OnGetSocketHandler := @GetSocketHandler; + OnlineVersionsFile := HTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt'); + + reGroffStudioVersion := TRegExpr.Create('studio-macos ([\d\.]+) (.*)$'); + reGroffStudioVersion.ModifierM := True; + if reGroffStudioVersion.Exec(OnlineVersionsFile) then + begin + // Compare the two versions - ours and the online one: + GroffHelpers.VerStrCompare(reGroffStudioVersion.Match[1], FileVerInfo.VersionStrings.Values['FileVersion'], HasVersionUpdate); + if HasVersionUpdate > 0 then + MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available' + else + MainStatusBar.Panels[2].Text := IntToStr(HasVersionUpdate); + end; + end else begin + edtOnlineGroffVersionWindows.Text := 'n/a'; + btnDownloadGroffWindows.Enabled := False; end; finally - HTTPClient.Free; + if updateCheck then HTTPClient.Free; end; {$ENDIF} edtOnlineGroffVersionWindows.Text := 'n/a'; btnDownloadGroffWindows.Enabled := False; {$ENDIF} @@ -418,10 +438,11 @@ iniStorage.WriteBoolean('BuildToPostscript', rdPs.Checked); iniStorage.WriteBoolean('BuildToPDF', rdPDF.Checked); // Store the IDE settings: iniStorage.WriteBoolean('AutoSaveBuildSettings', chkAutoSaveBuildSettings.Checked); + iniStorage.WriteBoolean('AutoUpdateCheck', chkUpdateCheckOnStart.Checked); iniStorage.Save; end; procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);