To V0.0.2.0 TrayIcon added

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5574 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2016-12-30 07:28:09 +00:00
parent bc99461287
commit 0dcb581438
10 changed files with 220 additions and 76 deletions

View File

@ -1,6 +1,6 @@
unit foobot_utility;
{ Foobot Interrogator Utilities
{ Foobot Utilities
Copyright (C)2016 Gordon Bamber minsadorada@charcodelvalle.com

View File

@ -19,7 +19,8 @@
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<RevisionNr Value="1"/>
<RevisionNr Value="2"/>
<StringTable ProductVersion="0.0.1.0"/>
</VersionInfo>
<BuildModes Count="6">
<Item1 Name="Debug" Default="True"/>

View File

@ -3,14 +3,14 @@
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="win64"/>
<Units Count="19">
<BuildModes Active="linux64"/>
<Units Count="18">
<Unit0>
<Filename Value="foobotmonitor.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="7"/>
<EditorIndex Value="6"/>
<CursorPos X="33" Y="25"/>
<UsageCount Value="38"/>
<UsageCount Value="39"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -19,9 +19,8 @@
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="80"/>
<CursorPos X="54" Y="105"/>
<UsageCount Value="38"/>
<CursorPos Y="20"/>
<UsageCount Value="39"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -32,9 +31,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="1"/>
<TopLine Value="80"/>
<CursorPos X="23" Y="92"/>
<UsageCount Value="28"/>
<CursorPos X="2" Y="20"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
@ -44,7 +42,7 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
</Unit3>
<Unit4>
<Filename Value="..\foobot_objects.pas"/>
@ -53,15 +51,15 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
</Unit4>
<Unit5>
<Filename Value="..\foobot_utility.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos X="21" Y="138"/>
<UsageCount Value="20"/>
<EditorIndex Value="4"/>
<CursorPos Y="27"/>
<UsageCount Value="39"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="..\ugenericcollection.pas"/>
@ -70,168 +68,208 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
</Unit6>
<Unit7>
<Filename Value="..\latest_stable\foobot_httpclient.pas"/>
<EditorIndex Value="3"/>
<TopLine Value="260"/>
<CursorPos X="8" Y="1048"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="47" Y="13"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="..\latest_stable\foobot_objects.pas"/>
<EditorIndex Value="6"/>
<EditorIndex Value="5"/>
<CursorPos X="32" Y="61"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="..\foobot_utility.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="5"/>
<TopLine Value="85"/>
<CursorPos X="72" Y="104"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="..\latest_stable\ugenericcollection.pas"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="38"/>
</Unit10>
<Unit11>
</Unit9>
<Unit10>
<Filename Value="..\latest_stable\umainform.lfm"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit11>
<Unit12>
</Unit10>
<Unit11>
<Filename Value="..\latest_stable\umainform.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="10"/>
<CursorPos X="57" Y="36"/>
<UsageCount Value="10"/>
</Unit12>
<Unit13>
</Unit11>
<Unit12>
<Filename Value="..\udataform.pas"/>
<EditorIndex Value="8"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos Y="96"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit13>
<Unit14>
</Unit12>
<Unit13>
<Filename Value="..\umainform.pas"/>
<EditorIndex Value="4"/>
<EditorIndex Value="3"/>
<TopLine Value="134"/>
<CursorPos X="25" Y="154"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit14>
<Unit15>
</Unit13>
<Unit14>
<Filename Value="C:\trunklatest\lazarus\lcl\lclmessageglue.pas"/>
<UnitName Value="LCLMessageGlue"/>
<EditorIndex Value="-1"/>
<TopLine Value="93"/>
<CursorPos Y="114"/>
<UsageCount Value="10"/>
</Unit15>
<Unit16>
</Unit14>
<Unit15>
<Filename Value="..\ulogin.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="65"/>
<EditorIndex Value="-1"/>
<CursorPos Y="108"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit16>
<Unit17>
</Unit15>
<Unit16>
<Filename Value="..\..\..\components\cryptini\latest_stable\ucryptini.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="906"/>
<CursorPos X="8" Y="939"/>
<UsageCount Value="11"/>
</Unit17>
<Unit18>
</Unit16>
<Unit17>
<Filename Value="..\backup\foobot_utility.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="7"/>
<UsageCount Value="10"/>
</Unit18>
</Unit17>
</Units>
<JumpHistory Count="17" HistoryIndex="16">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="umainform.pas"/>
<Caret Line="7" Column="9"/>
<Caret Line="189" Column="3" TopLine="187"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="188" Column="3" TopLine="186"/>
<Caret Line="190" Column="3" TopLine="188"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="189" Column="3" TopLine="187"/>
<Caret Line="191" Column="3" TopLine="189"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="190" Column="3" TopLine="188"/>
<Caret Line="192" Column="3" TopLine="190"/>
</Position4>
<Position5>
<Filename Value="umainform.pas"/>
<Caret Line="191" Column="3" TopLine="189"/>
<Caret Line="193" Column="3" TopLine="191"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="192" Column="3" TopLine="190"/>
<Caret Line="15" Column="3" TopLine="4"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="193" Column="3" TopLine="191"/>
<Caret Line="13" Column="15"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="15" Column="3" TopLine="4"/>
<Caret Line="14" Column="6"/>
</Position8>
<Position9>
<Filename Value="umainform.pas"/>
<Caret Line="13" Column="15"/>
<Caret Line="208" TopLine="204"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="14" Column="6"/>
<Caret Line="216" TopLine="212"/>
</Position10>
<Position11>
<Filename Value="umainform.pas"/>
<Caret Line="208" TopLine="204"/>
<Caret Line="223" Column="28" TopLine="220"/>
</Position11>
<Position12>
<Filename Value="umainform.pas"/>
<Caret Line="216" TopLine="212"/>
<Caret Line="236" Column="29" TopLine="233"/>
</Position12>
<Position13>
<Filename Value="umainform.pas"/>
<Caret Line="223" Column="28" TopLine="220"/>
<Caret Line="163" Column="48" TopLine="143"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="236" Column="29" TopLine="233"/>
<Caret Line="165" Column="48" TopLine="145"/>
</Position14>
<Position15>
<Filename Value="umainform.pas"/>
<Caret Line="163" Column="48" TopLine="143"/>
<Caret Line="153" Column="47" TopLine="132"/>
</Position15>
<Position16>
<Filename Value="umainform.pas"/>
<Caret Line="165" Column="48" TopLine="145"/>
<Caret Line="105" Column="54" TopLine="80"/>
</Position16>
<Position17>
<Filename Value="umainform.pas"/>
<Caret Line="153" Column="47" TopLine="132"/>
<Caret Line="106" Column="54" TopLine="81"/>
</Position17>
<Position18>
<Filename Value="umainform.pas"/>
<Caret Line="107" Column="54" TopLine="82"/>
</Position18>
<Position19>
<Filename Value="umainform.pas"/>
<Caret Line="127" Column="37" TopLine="93"/>
</Position19>
<Position20>
<Filename Value="umainform.pas"/>
<Caret Line="202" Column="22" TopLine="197"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="127" Column="17" TopLine="105"/>
</Position21>
<Position22>
<Filename Value="umainform.pas"/>
<Caret Line="207" Column="44" TopLine="184"/>
</Position22>
<Position23>
<Filename Value="umainform.pas"/>
<Caret Line="289" Column="22" TopLine="286"/>
</Position23>
<Position24>
<Filename Value="umainform.pas"/>
<Caret Line="216" Column="38" TopLine="194"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="130" Column="22" TopLine="107"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="131" Column="22" TopLine="108"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="132" Column="22" TopLine="109"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="134" Column="22" TopLine="111"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="216" Column="17" TopLine="205"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="134" TopLine="113"/>
</Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -9,7 +9,7 @@
[Setup]
AppName=Foobot Monitor
AppVersion=0.1.0.0
AppVersion=0.0.2.0
DefaultDirName={pf}\foobotmonitor
DefaultGroupName=Foobot
UninstallDisplayIcon={app}\foobotmonitor.exe

View File

@ -1,5 +1,23 @@
unit uconfigform;
{ Foobot Monitor
Copyright (C)2016 Gordon Bamber minsadorada@charcodelvalle.com
This source is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This code is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available on the World Wide Web
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
}
{$mode objfpc}{$H+}
interface

View File

@ -3,8 +3,8 @@ object mainform: Tmainform
Height = 262
Top = 154
Width = 782
BorderIcons = [biSystemMenu]
BorderStyle = bsToolWindow
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'mainform'
ClientHeight = 242
ClientWidth = 782
@ -14,7 +14,9 @@ object mainform: Tmainform
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
OnWindowStateChange = FormWindowStateChange
Position = poWorkAreaCenter
ShowInTaskBar = stNever
LCLVersion = '1.7'
Scaled = True
object grp_sensorDisplay: TGroupBox
@ -378,6 +380,29 @@ object mainform: Tmainform
Checked = True
OnClick = mnu_optionsSaveHighLowsClick
end
object mnu_optionsMinimiseToTray: TMenuItem
Caption = 'Minimise to tray'
OnClick = mnu_optionsMinimiseToTrayClick
end
end
end
object TrayIcon1: TTrayIcon
PopUpMenu = traypopup
Visible = True
OnClick = TrayIcon1Click
Left = 96
Top = 8
end
object traypopup: TPopupMenu
Left = 136
Top = 8
object mnupopup_fileRestore: TMenuItem
Caption = '&Restore'
OnClick = mnupopup_fileRestoreClick
end
object mnu_pupupClose: TMenuItem
Caption = '&Close'
OnClick = mnu_fileExitClick
end
end
end

View File

@ -1,4 +1,29 @@
unit umainform;
{ Foobot Monitor
Copyright (C)2016 Gordon Bamber minsadorada@charcodelvalle.com
This source is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This code is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available on the World Wide Web
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
VERSION HISTORY
===============
V0.0.1.0: Initial commit
V0.0.2.0: Trayicon added
V0.0.3.0: ??
}
{$mode objfpc}{$H+}
@ -50,6 +75,9 @@ type
lbl_voclow: TLabel;
lbl_allpollulow: TLabel;
MainMenu1: TMainMenu;
mnupopup_fileRestore: TMenuItem;
mnu_pupupClose: TMenuItem;
mnu_optionsMinimiseToTray: TMenuItem;
mnu_optionsSaveHighLows: TMenuItem;
mnu_SampleEvery24Hours: TMenuItem;
mnu_SampleEvery8Hours: TMenuItem;
@ -62,12 +90,17 @@ type
mnu_options: TMenuItem;
mnu_fileExit: TMenuItem;
mnu_file: TMenuItem;
traypopup: TPopupMenu;
tmr_foobot: TTimer;
TrayIcon1: TTrayIcon;
procedure FormActivate(Sender: TObject);
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_optionsMinimiseToTrayClick(Sender: TObject);
procedure mnu_optionsSaveHighLowsClick(Sender: TObject);
procedure mnu_optionsShowHighsAndLowsClick(Sender: TObject);
procedure mnu_optionsTakeReadingNowClick(Sender: TObject);
@ -77,6 +110,7 @@ type
procedure mnu_SampleEvery4HoursClick(Sender: TObject);
procedure mnu_SampleEvery8HoursClick(Sender: TObject);
procedure tmr_foobotTimer(Sender: TObject);
procedure TrayIcon1Click(Sender: TObject);
private
sSecretKey, sFoobotUserName, sUUID: string;
bShowHighsAndLows: boolean;
@ -120,6 +154,8 @@ begin
iFudgeFactor := 20;
ClientHeight := grp_sensorDisplay.Height + grp_highlow.Height + iFudgeFactor;
bShowHighsAndLows := True;
TrayIcon1.Icon:=Application.Icon;
TrayIcon1.Hint:=Application.Title;
end;
procedure Tmainform.FormActivate(Sender: TObject);
@ -189,11 +225,32 @@ procedure Tmainform.FormShow(Sender: TObject);
begin
end;
procedure Tmainform.FormWindowStateChange(Sender: TObject);
begin
if mainform.WindowState = wsMinimized then
begin
mainform.WindowState := wsNormal;
mainform.Hide;
mainform.ShowInTaskBar := stNever;
end;
end;
procedure Tmainform.mnupopup_fileRestoreClick(Sender: TObject);
begin
mainform.show;
end;
procedure Tmainform.mnu_fileExitClick(Sender: TObject);
begin
Close;
end;
procedure Tmainform.mnu_optionsMinimiseToTrayClick(Sender: TObject);
begin
mainform.WindowState:=wsMinimized;
mainform.FormWindowStateChange(Self);
end;
procedure Tmainform.mnu_optionsSaveHighLowsClick(Sender: TObject);
begin
SaveLoadHighLows:=mnu_optionsSaveHighLows.Checked;
@ -261,6 +318,11 @@ begin
DisplayReadings;
end;
procedure Tmainform.TrayIcon1Click(Sender: TObject);
begin
mainform.show;
end;
procedure Tmainform.UpdateHighLow(SensorNumber: integer);
begin
case SensorNumber of