From 385d4ec4b74f9aeaa11cd75f9bf59a68deca22c3 Mon Sep 17 00:00:00 2001 From: gbamber Date: Tue, 10 Jan 2017 13:44:23 +0000 Subject: [PATCH] V0.2.4.0: Added built-in help (via embedded resource) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5622 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/foobot/monitor/foobotmonitor.lpi | 5 +- applications/foobot/monitor/foobotmonitor.lps | 160 +++++++++--------- applications/foobot/monitor/foobotmonitor.res | Bin 71024 -> 77052 bytes .../foobot/monitor/foobotmonitorhelp.htm | 106 ++++++++++++ applications/foobot/monitor/umainform.lfm | 4 + applications/foobot/monitor/umainform.pas | 37 +++- 6 files changed, 232 insertions(+), 80 deletions(-) create mode 100644 applications/foobot/monitor/foobotmonitorhelp.htm diff --git a/applications/foobot/monitor/foobotmonitor.lpi b/applications/foobot/monitor/foobotmonitor.lpi index 30aadfe86..724e5e82d 100644 --- a/applications/foobot/monitor/foobotmonitor.lpi +++ b/applications/foobot/monitor/foobotmonitor.lpi @@ -16,14 +16,15 @@ - + + - + diff --git a/applications/foobot/monitor/foobotmonitor.lps b/applications/foobot/monitor/foobotmonitor.lps index 6c3782b31..6a4729395 100644 --- a/applications/foobot/monitor/foobotmonitor.lps +++ b/applications/foobot/monitor/foobotmonitor.lps @@ -4,13 +4,14 @@ - + - - - + + + + @@ -19,10 +20,9 @@ - - - - + + + @@ -32,20 +32,20 @@ - + - + - + - + @@ -55,15 +55,15 @@ - + - + - + @@ -73,7 +73,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,9 +89,9 @@ - + - + @@ -101,27 +101,27 @@ - + - + - + - + - + - + @@ -189,10 +189,10 @@ - + - + @@ -218,17 +218,17 @@ - + - + - + - + @@ -269,10 +269,10 @@ - + - + @@ -283,127 +283,135 @@ + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + diff --git a/applications/foobot/monitor/foobotmonitor.res b/applications/foobot/monitor/foobotmonitor.res index bc789116fe1991bf0a1ebc69c9074fd9c1217470..111e45bdc5f8a041ab0b4e081b08d622d7743e06 100644 GIT binary patch delta 6072 zcma)A%WfOV6{QVl5EH{-cG+Z6VK9yzh-}L?0$Zkt$dYVpqE{^09wQEnVt0|OsM*z1 zRV|7G1dXh-oSz7?N-&EovdA{8WSy@_J|KW|ZdEneB4uN2NFuwtZr#T@=ici7{^`d5 z{(a-m|NP|Ijc@<;$zQHtd+_b=Z~pXs`Na<#jbAhxjrZ@Hji-$x{C|R<)5ZaQA2#;z z>8SCd@w~Cy*l!%;Ir{h6XZ|n!{?Fh3-uv;+(e~+^<6Snklaw95e6qi{&DxzPdVPO8 zigr$S*q6^w5BAx5_bxltJTuZtmGLx+cFV&yYmcqXH=<}dopz`9yGoCu(-+YN8C$2- z;bX_vmUa`HwEL}Q&uw`zNi(x~g`M?Bj~@BuZRQ@@INxj+I@>VuSWLL-eDjCvKlt=~ zl2*6XH^007qf!lrG8P;D4{bvm37*h~6Ja?5wRuN;RY;iIR+$xTWj8njvT(RHV@yuQYYi_%6E)?*frxi-RX7IxTq80=VSQ_+7e(wq&IW>1wGD9a91 zCau!F$lr#aQE(U^2P&C`AlCcK3&!i@UEY5!(pXIdvx=3MpJ5%wSt87tRXO8%p30b0 z0qN01nmpw*CNnrQ@t22MO<1crQ$^+8ZF8sFi*mowl5uGmKj$*#gH*VPUdu8|)YP#1 z_c{Y<8P5{-^9SyuNE~v^n!CtTqp;7u%!-STJlwsN4NU%+?OBGs5MvHEX|t)cWA1l(45-h+}SIo;p`#DztaRJ@!?>({xtWp5NzRb6ps=x3gOXLLtW@iv`8=?06sL z!`@m9Jp&A=B(m;Qp2-{uJ zUc~z$Zz#0Ya!^>2P_RRUG38oRWgXw^|EiGj*@@-a0(4MuS5r4c&gfGMGZXKd?ukNr~2DmU^9-lia&3RGqO zjI+kGS>=M7A`{Gxxn&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Hm3}YN%Hz_fRRDYjm5{l+-qVAu#2`#RPrml^Zh_3G$;@$ritb(b0h%)!A)2UkwBzz=1Zrgt($8C&Czdt8u`~3ppt! zW|5ZVe9-aZQYz4#K9Y`zNeaj-;lHK0%&3p6c@J<-d9VBod_A|0; zO7!K*>mxRJ#M=K!LL{gL`ysm?d1m_`|v#%Jl9eB&{ zlBDmDBg2le2rqGKNNF`!<-!d#n7E;+NC2u)VsZ3$Xb+) zdM=;}z;Koe-3c`va3klzRO4XY4~%qTgh3-(yr6Y2e!qw5qtW>5AHRR?AD{joS^Esj delta 29 lcmex!ljXxImJR3F7@0SpXWPicXuP?RQ~m#T69vW-JOISS3$g$J diff --git a/applications/foobot/monitor/foobotmonitorhelp.htm b/applications/foobot/monitor/foobotmonitorhelp.htm new file mode 100644 index 000000000..4d657a928 --- /dev/null +++ b/applications/foobot/monitor/foobotmonitorhelp.htm @@ -0,0 +1,106 @@ + + + + + + +Help for Foobot Monitor + + + + +

Foobot Monitor

+

Welcome to Foobot Monitor - a desktop application to display information from +your Foobot(s).

+

Foobot Monitor is available for Windows 32-bit and 64-bit editions, and also +Linux 32-bit and 64-bit editions.  It is compatible with Windows Vista, +Windows 8 and Windows 10.   It was written as a hobby project using +the excellent FreePascal compiler with the equally excellent Lazarus IDE.  +Licence is GPL +(information +here) It is distributed as freeware.

+

QuickStart

+

On first startup, Foobot Monitor will present a dialog asking for your Foobot +Username and an API Key.

+

Foobot supplies an API Key for any Foobot owner that requests it from their +site. Go to the Foobot API page, +and you will see easy-to-follow instructions for obtaining your own API Key.  +Once you have it, save it to a text file, and when the FM dialog comes up you +can Copy/Paste it into the dialog.  Once that is done, you need to restart +Foobot Monitor and it will automatically use the information you entered every +time it starts.

+

Foobot Monitor stores the information in an encrypted configuration file.  +In Windows, this file is located in %APPDATA%\username\local\foobotmonitor\foobotmonitor.cfg.  +In Linux it is located in your home directory/-conf/foobotmonitor.cfg.

+

 If for some reason you wish to change/update your login and/or API Key, +there are two ways of doing it:

+
    +
  1. Delete the cfg file, and resart  Foobot Monitor.  You will be + prompted with the login dialog as before.  As a consequence you will + lose any saved settings you had before.
  2. +
  3. +

    Open the foobotmonitor.cfg file
    + Make a new entry thus, then save the file. (using your values instead of the + example <..> ones)

    +
    +
    +
    [Config]
    +Foobot User=<username>
    +Secret Key=<Secret API Key>
    +
    +
    + Next time Foobot Monitor is run, these values are read, then encrypted and + the plaintext is deleted
    + You can do this as many times as you like
  4. +
+

Once running,Foobot Monitor should locate your Foobot(s) and display current +readings, as well as a graph showing the last 48 hours of readings.  By +default, Foobot Monitor will fetch a new reading every hour and add it to the +graph.

+

* Notice the status bar at the bottom of the window. Running your mouse over +the various parts of Foobot Monitor panels will display useful information.

+
+

Foobot Menus

+

The File menu contains one item: Exit.

+

The Foobot menu has a list of your Foobots.  Click the +Foobot name to change the Foobot the application uses.  It also takes an +instant reading.

+

The Help menu has links to the Foobot Monitor home page, +Foobot's API page and an 'About' dialog.

+

The Options menu

+

The Options menu is where you can customise Foobot Monitor to your liking.

+

Minimise to Tray: Foobot Monitor can run as a System Tray +icon when you need more screen space.  Just click the tray icon to restore +Foobot Monitor. You can also right-click the tray icon to show a small menu.

+

Take Reading Now: This will update Foobot Monitor instantly +when clicked.

+

Sample Every...: By default, Foobot Monitor fetches a fresh +reading every hour, but this can be changed via this submenu,

+

Display... Minimal View: This will collapse/expand Foobot +Monitor to a smaller screen footprint.

+

Display... Recommended Values:  This will show yellow +lines on the gauges corresponding to the 'recommended values'.  The +recommended values can be tweaked via the 'Set Triggers and Recommended Values' +dialog (see below)

+

Display... Session Maximums: This will show red lines on the +gauges corresponding to the maximum values read whilst Foobot Monitor has been +running.  These are reset when Foobot Monitor is restarted.

+

 Record All-time High/Lows: (Default=ON)  This +setting controls the 'All-time Highs and Lows' panel - whether it updates or +not.

+

Reset All-time Highs and Lows: Clicking this zeros out the +'All-time Highs and Lows' panel.  Depending on the 'Record..' menu it will +then populate itself as Foobot Monitor runs.

+

Foobot Triggers and Recommended Values.. Set Trigger and Recommended +Values: This opens a dialog where you can change any or all the values +Foobot Monitor uses.  This information takes effect immediately and is also +used next time Foobot Monitor starts.

+

Foobot Triggers and Recommended Values.. Set Triggers On/off: +Recommended Values apply to all Foobots you have in your system, whereas +Triggers are set on a per-Foobot basis.

+
+

 

+ + + + diff --git a/applications/foobot/monitor/umainform.lfm b/applications/foobot/monitor/umainform.lfm index ccf9a9081..caf7a8322 100644 --- a/applications/foobot/monitor/umainform.lfm +++ b/applications/foobot/monitor/umainform.lfm @@ -860,6 +860,10 @@ object mainform: Tmainform end object mnu_help: TMenuItem Caption = '&Help' + object mnu_helpHelpHTML: TMenuItem + Caption = 'Help...' + OnClick = mnu_helpHelpHTMLClick + end object mnu_optionsHomePage: TMenuItem Caption = 'Home Page' OnClick = mnu_optionsHomePageClick diff --git a/applications/foobot/monitor/umainform.pas b/applications/foobot/monitor/umainform.pas index cc1de7952..82daf9faa 100644 --- a/applications/foobot/monitor/umainform.pas +++ b/applications/foobot/monitor/umainform.pas @@ -40,9 +40,10 @@ V0.2.3.0: ?? interface uses // If Lazarus auto-inserts 'sensors' in the clause then delete it - SysUtils, TAGraph, TAIntervalSources, TASeries, foobot_sensors, + SysUtils, LazFileUtils, TAGraph, TAIntervalSources, TASeries, foobot_sensors, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus, lclIntf, - ComCtrls, foobot_utility, uCryptIni, dateutils, uconfigform, utriggersform; + ComCtrls, foobot_utility, uCryptIni, dateutils, uconfigform, utriggersform, + Classes; const // Timer milliseconds @@ -137,6 +138,7 @@ type lbl_voclow: TLabel; lbl_allpollulow: TLabel; MainMenu1: TMainMenu; + mnu_helpHelpHTML: TMenuItem; mnu_helpFoobotAPIPage: TMenuItem; mnu_options_triggersActivateTriggers: TMenuItem; mnu_options_triggersSetTriggers: TMenuItem; @@ -191,6 +193,7 @@ type procedure mnu_fileExitClick(Sender: TObject); procedure mnu_helpAboutClick(Sender: TObject); procedure mnu_helpFoobotAPIPageClick(Sender: TObject); + procedure mnu_helpHelpHTMLClick(Sender: TObject); procedure mnu_optionsDisplayGuagesOnlyClick(Sender: TObject); procedure mnu_optionsDisplayRedLinesClick(Sender: TObject); procedure mnu_optionsDisplayYellowLinesClick(Sender: TObject); @@ -242,6 +245,10 @@ type var mainform: Tmainform; + // Used in extracting the help html file + sHelpFilePath:String; + S: TResourceStream; + F: TFileStream; implementation @@ -755,6 +762,14 @@ begin OpenURL('http://api.foobot.io/apidoc/index.html'); end; +procedure Tmainform.mnu_helpHelpHTMLClick(Sender: TObject); +Var s:String; +begin + If FileExists(sHelpFilePath) then + OpenURL('file://' + sHelpFilePath) + else ShowMessageFmt('Sorry, the help file %s is missing',[sHelpFilePath]); +end; + procedure Tmainform.mnu_optionsDisplayGuagesOnlyClick(Sender: TObject); begin bDisplayGuagesOnly := mnu_optionsDisplayGuagesOnly.Checked; @@ -1313,5 +1328,23 @@ procedure Tmainform.ShowHintInStatusBar(Sender:TObject); begin sts.SimpleText := GetLongHint(Application.Hint); end; +initialization +sHelpFilePath:=GetCurrentDir + DirectorySeparator + '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 + S := TResourceStream.Create(HInstance, 'FOOBOTMONITORHELP', MakeIntResource(10)); + try + F := TFileStream.Create(sHelpFilePath, fmCreate); + try + F.CopyFrom(S, S.Size); // copy data from the resource stream to file stream + finally + F.Free; // destroy the file stream + end; + finally + S.Free; // destroy the resource stream + end; +end; end.