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
This commit is contained in:
gbamber 2017-01-10 13:44:23 +00:00
parent aeb0a0850e
commit 385d4ec4b7
6 changed files with 232 additions and 80 deletions

View File

@ -16,14 +16,15 @@
<TextDesc Value="Your application description."/>
</XPManifest>
<Icon Value="0"/>
<Resources Count="1">
<Resources Count="2">
<Resource_0 FileName="splashimage.jpg" Type="RCDATA" ResourceName="SPLASHIMAGE"/>
<Resource_1 FileName="foobotmonitorhelp.htm" Type="RCDATA" ResourceName="FOOBOTMONITORHELP"/>
</Resources>
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="2"/>
<RevisionNr Value="3"/>
<RevisionNr Value="4"/>
<StringTable Comments="Uses Foobot public API to query Foobots" FileDescription="Monitor for Foobot" InternalName="foobotmonitor" LegalCopyright="(c)2016 minesadorada@charcodelvalle.com" LegalTrademarks="Foobot" ProductName="Foobot" ProductVersion="0.0.0.0"/>
</VersionInfo>
<BuildModes Count="6">

View File

@ -4,13 +4,14 @@
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="win64"/>
<Units Count="34">
<Units Count="35">
<Unit0>
<Filename Value="foobotmonitor.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="12"/>
<CursorPos Y="35"/>
<UsageCount Value="155"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="13"/>
<CursorPos X="45" Y="19"/>
<UsageCount Value="158"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -19,10 +20,9 @@
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="241"/>
<CursorPos X="37" Y="252"/>
<UsageCount Value="155"/>
<TopLine Value="1296"/>
<CursorPos X="60" Y="1337"/>
<UsageCount Value="158"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -32,20 +32,20 @@
<ComponentName Value="configform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="7"/>
<EditorIndex Value="8"/>
<TopLine Value="33"/>
<CursorPos X="41" Y="45"/>
<UsageCount Value="145"/>
<UsageCount Value="148"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\foobot_httpclient.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<EditorIndex Value="2"/>
<TopLine Value="13"/>
<CursorPos X="49" Y="20"/>
<UsageCount Value="137"/>
<UsageCount Value="140"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@ -55,15 +55,15 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="137"/>
<UsageCount Value="140"/>
</Unit4>
<Unit5>
<Filename Value="..\foobot_utility.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="9"/>
<EditorIndex Value="10"/>
<TopLine Value="199"/>
<CursorPos X="30" Y="215"/>
<UsageCount Value="155"/>
<UsageCount Value="158"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
@ -73,7 +73,7 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="137"/>
<UsageCount Value="140"/>
</Unit6>
<Unit7>
<Filename Value="foobot_sensors.pas"/>
@ -81,7 +81,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="299"/>
<CursorPos X="14" Y="321"/>
<UsageCount Value="89"/>
<UsageCount Value="92"/>
</Unit7>
<Unit8>
<Filename Value="usplash.pas"/>
@ -89,9 +89,9 @@
<ComponentName Value="splashform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="3"/>
<EditorIndex Value="4"/>
<CursorPos X="48" Y="37"/>
<UsageCount Value="84"/>
<UsageCount Value="87"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit8>
@ -101,27 +101,27 @@
<ComponentName Value="triggersform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="2"/>
<EditorIndex Value="3"/>
<TopLine Value="382"/>
<CursorPos X="26" Y="21"/>
<UsageCount Value="75"/>
<UsageCount Value="78"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit9>
<Unit10>
<Filename Value="..\latest_stable\foobot_httpclient.pas"/>
<EditorIndex Value="8"/>
<EditorIndex Value="9"/>
<TopLine Value="43"/>
<CursorPos X="47" Y="13"/>
<UsageCount Value="92"/>
<UsageCount Value="94"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
<Filename Value="..\latest_stable\foobot_objects.pas"/>
<EditorIndex Value="11"/>
<EditorIndex Value="12"/>
<TopLine Value="141"/>
<CursorPos X="31" Y="148"/>
<UsageCount Value="92"/>
<UsageCount Value="94"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
@ -189,10 +189,10 @@
<Unit21>
<Filename Value="C:\trunklatest\lazarus\ide\lazarus.pp"/>
<UnitName Value="Lazarus"/>
<EditorIndex Value="5"/>
<EditorIndex Value="6"/>
<TopLine Value="101"/>
<CursorPos Y="154"/>
<UsageCount Value="43"/>
<UsageCount Value="45"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
@ -218,17 +218,17 @@
</Unit24>
<Unit25>
<Filename Value="C:\trunklatest\fpc\packages\rtl-objpas\src\inc\dateutil.inc"/>
<EditorIndex Value="10"/>
<EditorIndex Value="11"/>
<TopLine Value="381"/>
<CursorPos X="13" Y="384"/>
<UsageCount Value="61"/>
<UsageCount Value="63"/>
<Loaded Value="True"/>
</Unit25>
<Unit26>
<Filename Value="..\latest_stable\udataform.pas"/>
<EditorIndex Value="6"/>
<EditorIndex Value="7"/>
<TopLine Value="70"/>
<UsageCount Value="61"/>
<UsageCount Value="63"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
@ -269,10 +269,10 @@
<Unit32>
<Filename Value="C:\trunklatest\lazarus\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="4"/>
<EditorIndex Value="5"/>
<TopLine Value="1811"/>
<CursorPos X="13" Y="1834"/>
<UsageCount Value="39"/>
<UsageCount Value="41"/>
<Loaded Value="True"/>
</Unit32>
<Unit33>
@ -283,127 +283,135 @@
<UsageCount Value="6"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit33>
<Unit34>
<Filename Value="..\..\json_packager\umain.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="1440"/>
<CursorPos X="11" Y="248"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit34>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="umainform.pas"/>
<Caret Line="3" Column="7"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="287" Column="88" TopLine="245"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="30" Column="20" TopLine="28"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="275" Column="17" TopLine="260"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="883" Column="65" TopLine="852"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="161" Column="22" TopLine="150"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="1080" Column="61" TopLine="1036"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="162" Column="16" TopLine="130"/>
</Position4>
<Position5>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="277" TopLine="241"/>
<Filename Value="umainform.pas"/>
<Caret Line="318" Column="46" TopLine="313"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="476" Column="65" TopLine="457"/>
<Caret Line="779" Column="58" TopLine="769"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="448" Column="8" TopLine="445"/>
<Caret Line="786" TopLine="769"/>
</Position7>
<Position8>
<Filename Value="utriggersform.pas"/>
<Caret Line="171" Column="16" TopLine="135"/>
<Filename Value="umainform.pas"/>
<Caret Line="1194" Column="27" TopLine="1184"/>
</Position8>
<Position9>
<Filename Value="utriggersform.pas"/>
<Caret Line="285" Column="79" TopLine="244"/>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="392"/>
</Position9>
<Position10>
<Filename Value="utriggersform.pas"/>
<Caret Line="287" Column="88" TopLine="245"/>
<Filename Value="umainform.pas"/>
<Caret Line="449" Column="27" TopLine="391"/>
</Position10>
<Position11>
<Filename Value="utriggersform.pas"/>
<Caret Line="275" Column="17" TopLine="260"/>
<Filename Value="umainform.pas"/>
<Caret Line="742" Column="13" TopLine="738"/>
</Position11>
<Position12>
<Filename Value="utriggersform.pas"/>
<Caret Line="161" Column="22" TopLine="150"/>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="395"/>
</Position12>
<Position13>
<Filename Value="utriggersform.pas"/>
<Caret Line="162" Column="16" TopLine="130"/>
<Filename Value="umainform.pas"/>
<Caret Line="777" Column="42" TopLine="770"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="318" Column="46" TopLine="313"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="188" Column="46" TopLine="144"/>
</Position14>
<Position15>
<Filename Value="umainform.pas"/>
<Caret Line="779" Column="58" TopLine="769"/>
<Caret Line="212" Column="26" TopLine="200"/>
</Position15>
<Position16>
<Filename Value="umainform.pas"/>
<Caret Line="786" TopLine="769"/>
<Caret Line="213" Column="26" TopLine="201"/>
</Position16>
<Position17>
<Filename Value="umainform.pas"/>
<Caret Line="1194" Column="27" TopLine="1184"/>
<Caret Line="253" Column="3" TopLine="251"/>
</Position17>
<Position18>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="392"/>
<Caret Line="251" Column="21" TopLine="224"/>
</Position18>
<Position19>
<Filename Value="umainform.pas"/>
<Caret Line="449" Column="27" TopLine="391"/>
<Caret Line="301" Column="32" TopLine="275"/>
</Position19>
<Position20>
<Filename Value="umainform.pas"/>
<Caret Line="742" Column="13" TopLine="738"/>
<Caret Line="235" Column="50" TopLine="221"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="395"/>
<Caret Line="213" TopLine="204"/>
</Position21>
<Position22>
<Filename Value="umainform.pas"/>
<Caret Line="777" Column="42" TopLine="770"/>
<Caret Line="253" Column="22" TopLine="241"/>
</Position22>
<Position23>
<Filename Value="utriggersform.pas"/>
<Caret Line="188" Column="46" TopLine="144"/>
<Filename Value="umainform.pas"/>
<Caret Line="255" Column="22" TopLine="243"/>
</Position23>
<Position24>
<Filename Value="umainform.pas"/>
<Caret Line="212" Column="26" TopLine="200"/>
<Caret Line="762" Column="4" TopLine="735"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="213" Column="26" TopLine="201"/>
<Caret Line="12" Column="27"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="253" Column="3" TopLine="251"/>
<Caret Line="762" Column="33" TopLine="760"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="251" Column="21" TopLine="224"/>
<Caret Line="763" Column="5" TopLine="735"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="301" Column="32" TopLine="275"/>
<Caret Line="222" Column="18" TopLine="215"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="235" Column="50" TopLine="221"/>
<Caret Line="1333" Column="6" TopLine="1297"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="213" TopLine="204"/>
<Caret Line="1337" Column="60" TopLine="1296"/>
</Position30>
</JumpHistory>
</ProjectSession>

View File

@ -0,0 +1,106 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="Content-Language" content="en-gb" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Help for Foobot Monitor</title>
</head>
<body>
<h1>Foobot Monitor</h1>
<p>Welcome to Foobot Monitor - a desktop application to display information from
your Foobot(s).</p>
<p>Foobot Monitor is available for Windows 32-bit and 64-bit editions, and also
Linux 32-bit and 64-bit editions.&nbsp; It is compatible with Windows Vista,
Windows 8 and Windows 10.&nbsp;&nbsp; It was written as a hobby project using
the excellent FreePascal compiler with the equally excellent Lazarus IDE.&nbsp;
Licence is GPL
<a href="https://en.wikipedia.org/wiki/GNU_General_Public_License">(information
here)</a> It is distributed as freeware.</p>
<h2>QuickStart</h2>
<p>On first startup, Foobot Monitor will present a dialog asking for your Foobot
Username and an API Key.</p>
<p>Foobot supplies an API Key for any Foobot owner that requests it from their
site. Go to <a href="http://api.foobot.io/apidoc/index.html">the Foobot API page</a>,
and you will see easy-to-follow instructions for obtaining your own API Key.&nbsp;
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.&nbsp; Once that is done, you need to restart
Foobot Monitor and it will automatically use the information you entered every
time it starts.</p>
<p>Foobot Monitor stores the information in an encrypted configuration file.&nbsp;
In Windows, this file is located in %APPDATA%\username\local\foobotmonitor\foobotmonitor.cfg.&nbsp;
In Linux it is located in your home directory/-conf/foobotmonitor.cfg.</p>
<p>&nbsp;If for some reason you wish to change/update your login and/or API Key,
there are two ways of doing it:</p>
<ol>
<li>Delete the cfg file, and resart&nbsp; Foobot Monitor.&nbsp; You will be
prompted with the login dialog as before.&nbsp; As a consequence you will
lose any saved settings you had before.</li>
<li>
<p>Open the foobotmonitor.cfg file<br />
Make a new entry thus, then save the file. (using your values instead of the
example &lt;..&gt; ones) </p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="delphi source-delphi">
<pre class="de1"><span class="br0">[</span>Config<span class="br0">]</span>
Foobot User<span class="sy3">=</span>&lt;username&gt;
Secret Key<span class="sy3">=</span>&lt;Secret API Key&gt;</pre>
</div>
</div>
Next time Foobot Monitor is run, these values are read, then encrypted and
the plaintext is deleted <br />
You can do this as many times as you like </li>
</ol>
<p>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.&nbsp; By
default, Foobot Monitor will fetch a new reading every hour and add it to the
graph.</p>
<p>* 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.</p>
<hr />
<h2>Foobot Menus</h2>
<p><strong>The File menu</strong> contains one item: Exit.</p>
<p><strong>The Foobot men</strong>u has a list of your Foobots.&nbsp; Click the
Foobot name to change the Foobot the application uses.&nbsp; It also takes an
instant reading.</p>
<p><strong>The Help menu</strong> has links to the Foobot Monitor home page,
Foobot&#39;s API page and an &#39;About&#39; dialog.</p>
<h4>The Options menu</h4>
<p>The Options menu is where you can customise Foobot Monitor to your liking.</p>
<p><strong>Minimise to Tray:</strong> Foobot Monitor can run as a System Tray
icon when you need more screen space.&nbsp; Just click the tray icon to restore
Foobot Monitor. You can also right-click the tray icon to show a small menu.</p>
<p><strong>Take Reading Now:</strong> This will update Foobot Monitor instantly
when clicked.</p>
<p><strong>Sample Every...:</strong> By default, Foobot Monitor fetches a fresh
reading every hour, but this can be changed via this submenu,</p>
<p><strong>Display... Minimal View:</strong> This will collapse/expand Foobot
Monitor to a smaller screen footprint.</p>
<p><strong>Display... Recommended Values:</strong>&nbsp; This will show yellow
lines on the gauges corresponding to the &#39;recommended values&#39;.&nbsp; The
recommended values can be tweaked via the &#39;Set Triggers and Recommended Values&#39;
dialog (see below)</p>
<p><strong>Display... Session Maximums:</strong> This will show red lines on the
gauges corresponding to the maximum values read whilst Foobot Monitor has been
running.&nbsp; These are reset when Foobot Monitor is restarted.</p>
<p>&nbsp;<strong>Record All-time High/Lows:</strong> (Default=ON)&nbsp; This
setting controls the &#39;All-time Highs and Lows&#39; panel - whether it updates or
not.</p>
<p><strong>Reset All-time Highs and Lows:</strong> Clicking this zeros out the
&#39;All-time Highs and Lows&#39; panel.&nbsp; Depending on the &#39;Record..&#39; menu it will
then populate itself as Foobot Monitor runs.</p>
<p><strong>Foobot Triggers and Recommended Values.. Set Trigger and Recommended
Values:</strong> This opens a dialog where you can change any or all the values
Foobot Monitor uses.&nbsp; This information takes effect immediately and is also
used next time Foobot Monitor starts.</p>
<p><strong>Foobot Triggers and Recommended Values.. Set Triggers On/off:</strong>
Recommended Values apply to all Foobots you have in your system, whereas
Triggers are set on a per-Foobot basis.</p>
<hr />
<p>&nbsp;</p>
</body>
</html>

View File

@ -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

View File

@ -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.