diff --git a/applications/foobot/monitor/foobotmonitor.lpi b/applications/foobot/monitor/foobotmonitor.lpi index 18761b040..57b9f559c 100644 --- a/applications/foobot/monitor/foobotmonitor.lpi +++ b/applications/foobot/monitor/foobotmonitor.lpi @@ -12,6 +12,7 @@ + @@ -25,8 +26,7 @@ - - + @@ -45,6 +45,11 @@ + + + + + @@ -62,11 +67,6 @@ - - - - - @@ -221,16 +221,22 @@ - + - + - + - + + + + + + + @@ -268,22 +274,22 @@ - - - - - - + + + + + + diff --git a/applications/foobot/monitor/foobotmonitor.lpr b/applications/foobot/monitor/foobotmonitor.lpr index 865f336e4..f747af0c0 100644 --- a/applications/foobot/monitor/foobotmonitor.lpr +++ b/applications/foobot/monitor/foobotmonitor.lpr @@ -46,7 +46,7 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, usplash, tachartlazaruspkg, umainform, uconfigform, foobot_sensors, + Forms, usplash, tachartlazaruspkg, umainform, uconfigform, utriggersform { you can add units after this }; diff --git a/applications/foobot/monitor/foobotmonitor.lps b/applications/foobot/monitor/foobotmonitor.lps index a1378974f..7bc011a65 100644 --- a/applications/foobot/monitor/foobotmonitor.lps +++ b/applications/foobot/monitor/foobotmonitor.lps @@ -4,15 +4,14 @@ - + - - - - - + + + + @@ -20,11 +19,11 @@ - - - + + + + - @@ -32,21 +31,18 @@ - + - - - + - + - - + @@ -55,16 +51,15 @@ - + - + - - + @@ -73,209 +68,199 @@ - + - - - - - - - - - - - + - - - - - + + + - - + + - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + - - + + - - + + - - + + - - + + - - + + - - - - - - - + + + + + + - - + + - - + + - - + + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - @@ -293,73 +278,59 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/applications/foobot/monitor/foobotmonitor.res b/applications/foobot/monitor/foobotmonitor.res index 7a52aecb2..e925ef957 100644 Binary files a/applications/foobot/monitor/foobotmonitor.res and b/applications/foobot/monitor/foobotmonitor.res differ diff --git a/applications/foobot/monitor/uconfigform.lfm b/applications/foobot/monitor/uconfigform.lfm index af0ed430c..3e54327ff 100644 --- a/applications/foobot/monitor/uconfigform.lfm +++ b/applications/foobot/monitor/uconfigform.lfm @@ -1,7 +1,7 @@ object configform: Tconfigform - Left = 654 + Left = 1461 Height = 197 - Top = 285 + Top = 603 Width = 592 BorderIcons = [] BorderStyle = bsToolWindow diff --git a/applications/foobot/monitor/umainform.lfm b/applications/foobot/monitor/umainform.lfm index a07c135d3..66c867099 100644 --- a/applications/foobot/monitor/umainform.lfm +++ b/applications/foobot/monitor/umainform.lfm @@ -1,7 +1,7 @@ object mainform: Tmainform - Left = 673 + Left = 455 Height = 504 - Top = 270 + Top = 180 Width = 784 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle @@ -13,14 +13,15 @@ object mainform: Tmainform Menu = MainMenu1 OnActivate = FormActivate OnClose = FormClose + OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy + OnShow = FormShow OnWindowStateChange = FormWindowStateChange Position = poWorkAreaCenter ShowHint = True ShowInTaskBar = stNever - LCLVersion = '1.7' - Scaled = True + LCLVersion = '1.9.0.0' object grp_sensorDisplay: TGroupBox Left = 0 Height = 120 @@ -864,6 +865,10 @@ object mainform: Tmainform Caption = 'Help...' OnClick = mnu_helpHelpHTMLClick end + object mnu_helpCheckForUpdates: TMenuItem + Caption = 'Check for Updates' + OnClick = mnu_helpCheckForUpdatesClick + end object mnu_optionsHomePage: TMenuItem Caption = 'Home Page' OnClick = mnu_optionsHomePageClick @@ -902,4 +907,32 @@ object mainform: Tmainform Left = 174 Top = 325 end + object LazAutoUpdate1: TLazAutoUpdate + About.Description.Strings = ( + 'A component for updating your application'#13#10'Designed for projects hosted by SourceForge and GitHub'#13#10#13#10'Main methods:'#13#10'Procedure AutoUpdate'#13#10'Function NewVersionAvailable: Boolean'#13#10'Function DownloadNewVersion: Boolean'#13#10'Function UpdateToNewVersion: Boolean'#13#10'Procedure ShowWhatsNewIfAvailable'#13#10'For troubleshooting, set DebugMode=TRUE' + ) + About.Title = 'About LazAutoUpdate' + About.Height = 450 + About.Width = 400 + About.Font.Color = clNavy + About.Font.Height = -13 + About.BackGroundColor = clWindow + About.Version = '0.3.9.0' + About.Authorname = 'Gordon Bamber' + About.Organisation = 'Public Domain' + About.AuthorEmail = 'minesadorada@charcodelvalle.com' + About.ComponentName = 'Laz Auto-update v0.3.9.0' + About.LicenseType = abModifiedGPL + SFProjectName = 'lazautoupdate' + UpdatesFolder = 'updates' + VersionsININame = 'foobotmonitor.ini' + VersionCountLimit = 1000000 + DownloadCountLimit = 10000000 + ZipfileName = 'foobotmonitor.zip' + WorkingMode = lauUpdate + ShortCut.ShortcutName = 'MyShortcutName' + ShortCut.Category = scAudioVideo + Left = 232 + Top = 8 + end end diff --git a/applications/foobot/monitor/umainform.pas b/applications/foobot/monitor/umainform.pas index 0d4949a79..d5893bdca 100644 --- a/applications/foobot/monitor/umainform.pas +++ b/applications/foobot/monitor/umainform.pas @@ -54,8 +54,8 @@ interface uses // If Lazarus auto-inserts 'sensors' in the clause then delete it SysUtils, LazFileUtils, TAGraph, TAIntervalSources, TASeries, foobot_sensors, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus, lclIntf, - ComCtrls, foobot_utility, uCryptIni, dateutils, uconfigform, utriggersform, - Classes; + ComCtrls, foobot_utility, uCryptIni, ulazautoupdate, dateutils, + uconfigform, utriggersform, Classes; const // Timer milliseconds @@ -104,6 +104,7 @@ type Chart1: TChart; DateTimeIntervalChartSource1: TDateTimeIntervalChartSource; grp_health: TGroupBox; + LazAutoUpdate1: TLazAutoUpdate; lbl_greenlighttmp: TLabel; lbl_greenlighthum: TLabel; lbl_greenlightco2: TLabel; @@ -150,6 +151,7 @@ type lbl_voclow: TLabel; lbl_allpollulow: TLabel; MainMenu1: TMainMenu; + mnu_helpCheckForUpdates: TMenuItem; mnu_helpHelpHTML: TMenuItem; mnu_helpFoobotAPIPage: TMenuItem; mnu_options_triggersActivateTriggers: TMenuItem; @@ -198,12 +200,15 @@ type TrayIcon1: TTrayIcon; procedure FormActivate(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); + procedure FormShow(Sender: TObject); procedure FormWindowStateChange(Sender: TObject); procedure mnupopup_fileRestoreClick(Sender: TObject); procedure mnu_fileExitClick(Sender: TObject); procedure mnu_helpAboutClick(Sender: TObject); + procedure mnu_helpCheckForUpdatesClick(Sender: TObject); procedure mnu_helpFoobotAPIPageClick(Sender: TObject); procedure mnu_helpHelpHTMLClick(Sender: TObject); procedure mnu_optionsDisplayGuagesOnlyClick(Sender: TObject); @@ -336,6 +341,7 @@ procedure Tmainform.FormCreate(Sender: TObject); begin Caption := Application.Title; Icon := Application.Icon; + // Crypted INI used INI := TCryptINIfile.Create(GetAppConfigFile(False)); if INI.IsVirgin then begin @@ -350,23 +356,26 @@ begin Application.Terminate; end; INI.SectionHashing := False; - ResetHighLows; + ResetHighLows; // Read from ini file later iFudgeFactor := 20; // only needed if height set in form.create bDisplayGuagesOnly := False; - INI.PlainTextMode := True; + INI.PlainTextMode := True; // Use CryptINI in legacy mode + // Set defaults HighTriggerColor := clYellow; LowTriggerColor := clAqua; + // Read config from INI file bDisplayYellowLines := INI.ReadBool('Config', 'DisplayYellowLines', False); mnu_optionsDisplayYellowLines.Checked := bDisplayYellowLines; bDisplayRedLines := INI.ReadBool('Config', 'DisplayRedLines', False); mnu_optionsDisplayRedLines.Checked := bDisplayRedLines; - INI.PlainTextMode := False; + INI.PlainTextMode := False; // Use CryptINI in Encrypted mode SetYellowRecommendedLevels; SetRedSessionMax; + // Set up System Tray TrayIcon1.Icon := Application.Icon; TrayIcon1.Hint := Application.Title; DateTimeIntervalChartSource1.DateTimeFormat := 'hh:nn'; - LoadConfig; + LoadConfig; // Load from INI file {$IFDEF DEBUGMODE} UseTriggers := False; {$ENDIF} @@ -440,6 +449,7 @@ begin Update; Application.ProcessMessages; splashform.hide; + FreeAndNil(SplashForm); // Free memory used by SplashForm Application.ProcessMessages; end else @@ -458,6 +468,7 @@ begin // No valid cfg. Show config form Hide; splashform.Hide; + FreeAndNil(SplashForm); // Free memory used by SplashForm Application.ProcessMessages; configform.ShowModal; // If user quit without data, then bail out @@ -609,12 +620,22 @@ begin CloseAction := caFree; end; +procedure Tmainform.FormCloseQuery(Sender: TObject; var CanClose: boolean); +begin + If LazAutoUpdate1.DownloadInprogress then CanClose:=False; +end; + procedure Tmainform.FormDestroy(Sender: TObject); begin - FreeAndNil(splashform); + If Assigned (splashform) then FreeAndNil(splashform); FreeAndNil(INI); end; +procedure Tmainform.FormShow(Sender: TObject); +begin + LazAutoUpdate1.ShowWhatsNewIfAvailable; +end; + procedure Tmainform.SaveConfig; // For all Foobots begin @@ -728,6 +749,7 @@ begin end; procedure Tmainform.FormWindowStateChange(Sender: TObject); +// Systray routine begin if mainform.WindowState = wsMinimized then begin @@ -769,6 +791,11 @@ begin mtInformation, [mbOK], 0); end; +procedure Tmainform.mnu_helpCheckForUpdatesClick(Sender: TObject); +begin + LazAutoUpdate1.AutoUpdate; +end; + procedure Tmainform.mnu_helpFoobotAPIPageClick(Sender: TObject); begin OpenURL('http://api.foobot.io/apidoc/index.html'); @@ -1349,7 +1376,7 @@ sHelpFilePath:=AppendPathDelim(GetAppConfigDir(false)) + 'foobotmonitorhelp.htm' // This uses a resource file added via Project/Options (Laz 1.7+) if not FileExistsUTF8(sHelpFilePath) then begin - // create a resource stream which points to the po file + // create a resource stream which points to the help file S := TResourceStream.Create(HInstance, 'FOOBOTMONITORHELP', MakeIntResource(10)); TRY try diff --git a/applications/foobot/monitor/usplash.lfm b/applications/foobot/monitor/usplash.lfm index e0a5c10a9..6daee4d3c 100644 --- a/applications/foobot/monitor/usplash.lfm +++ b/applications/foobot/monitor/usplash.lfm @@ -1,7 +1,7 @@ object splashform: Tsplashform - Left = 669 + Left = 841 Height = 530 - Top = 171 + Top = 846 Width = 794 BorderStyle = bsNone Caption = 'splashform' @@ -14,7 +14,6 @@ object splashform: Tsplashform Position = poWorkAreaCenter ShowInTaskBar = stNever LCLVersion = '1.7' - Scaled = True object img: TImage Left = 0 Height = 530 diff --git a/applications/foobot/monitor/utriggersform.lfm b/applications/foobot/monitor/utriggersform.lfm index 9d29d69fb..18df420d7 100644 --- a/applications/foobot/monitor/utriggersform.lfm +++ b/applications/foobot/monitor/utriggersform.lfm @@ -1,7 +1,7 @@ object triggersform: Ttriggersform - Left = 2007 + Left = 1248 Height = 565 - Top = 405 + Top = 568 Width = 794 ActiveControl = edt_newrec_pm BorderIcons = [biSystemMenu] @@ -18,7 +18,6 @@ object triggersform: Ttriggersform Position = poWorkAreaCenter ShowInTaskBar = stNever LCLVersion = '1.7' - Scaled = True object grp_main: TGroupBox Left = 0 Height = 506