Test application for LazAutoUpdate. WIP.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5639 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber 2017-01-13 18:59:49 +00:00
parent cc51baeebc
commit c59e08c3d7
7 changed files with 750 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Test App for LazAutoUpdate component"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
<TextName Value="minesadorada.Lazarus.TestApp"/>
<TextDesc Value="Test App for lazautoupdate"/>
</XPManifest>
<Icon Value="0"/>
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<RevisionNr Value="1"/>
<StringTable ProductVersion="0.0.0.0"/>
</VersionInfo>
<BuildModes Count="5">
<Item1 Name="Win32Debug" Default="True"/>
<Item2 Name="Win32">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\win32\testappwin32"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Win64">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\win64\testappwin64"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
<Item4 Name="Linux32">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\linux32\testapplinux32"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item4>
<Item5 Name="Linux64">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\linux64\testapplinux64"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item5>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="lazupdate"/>
<MinVersion Minor="2" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="testapp.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\win32debug\testappwin32debug"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,50 @@
program testapp;
{ Test App for LazAutoUpdate
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.
}
{$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING}
{$ifdef CPUARM}
//if GUI, then uncomment
//{$linklib GLESv2}
{$endif}
{$linklib libc_nonshared.a}
{$endif}
{$endif}
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umainform
{ you can add units after this };
{$R *.res}
begin
Application.Title:='Test App for LazAutoUpdate component';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(Tmainform, mainform);
Application.Run;
end.

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="Win32"/>
<Units Count="11">
<Unit0>
<Filename Value="testapp.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="4"/>
<CursorPos X="33" Y="27"/>
<UsageCount Value="28"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="53"/>
<CursorPos X="29" Y="72"/>
<UsageCount Value="28"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\lazautoupdate_httpclient.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="251"/>
<CursorPos X="27" Y="282"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\ulazautoupdate.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
<TopLine Value="130"/>
<CursorPos X="58" Y="134"/>
<ExtraEditorCount Value="1"/>
<ExtraEditor1>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
</ExtraEditor1>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="C:\trunklatest\lazarus\ide\lazarus.pp"/>
<UnitName Value="Lazarus"/>
<EditorIndex Value="-1"/>
<TopLine Value="101"/>
<CursorPos Y="154"/>
<UsageCount Value="10"/>
</Unit4>
<Unit5>
<Filename Value="..\..\..\..\applications\foobot\monitor\foobot_sensors.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="76"/>
<CursorPos X="75" Y="77"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="..\..\..\..\applications\foobot\foobot.lpr"/>
<EditorIndex Value="-1"/>
<CursorPos Y="21"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="C:\trunklatest\lazarus\lcl\asyncprocess.pp"/>
<UnitName Value="AsyncProcess"/>
<EditorIndex Value="-1"/>
<TopLine Value="22"/>
<CursorPos X="31" Y="31"/>
<UsageCount Value="12"/>
</Unit7>
<Unit8>
<Filename Value="C:\trunklatest\lazarus\components\lazutils\utf8process.pp"/>
<UnitName Value="UTF8Process"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="85"/>
<UsageCount Value="12"/>
</Unit8>
<Unit9>
<Filename Value="..\..\..\..\applications\foobot\monitor\umainform.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="25"/>
<CursorPos X="25" Y="55"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="C:\trunklatest\fpc\rtl\objpas\sysutils\osutilsh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="10" Y="20"/>
<UsageCount Value="11"/>
</Unit10>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1703" Column="86" TopLine="1678"/>
</Position1>
<Position2>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1702" Column="93" TopLine="1682"/>
</Position2>
<Position3>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1736" Column="47" TopLine="1709"/>
</Position3>
<Position4>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1723" Column="17" TopLine="1716"/>
</Position4>
<Position5>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1721" Column="21" TopLine="1683"/>
</Position5>
<Position6>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="47" Column="34" TopLine="21"/>
</Position6>
<Position7>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1722" Column="21" TopLine="1702"/>
</Position7>
<Position8>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1763" Column="53" TopLine="1733"/>
</Position8>
<Position9>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1651" Column="39" TopLine="1637"/>
</Position9>
<Position10>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1652" Column="42" TopLine="1626"/>
</Position10>
<Position11>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1663" Column="16" TopLine="1638"/>
</Position11>
<Position12>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1730" Column="5" TopLine="1698"/>
</Position12>
<Position13>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="47" Column="27"/>
</Position13>
<Position14>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1355" Column="25" TopLine="1330"/>
</Position14>
<Position15>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1361" Column="14" TopLine="1319"/>
</Position15>
<Position16>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1360" Column="49" TopLine="1337"/>
</Position16>
<Position17>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1354" Column="15" TopLine="1330"/>
</Position17>
<Position18>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1670" Column="5" TopLine="1646"/>
</Position18>
<Position19>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1354" Column="16" TopLine="1330"/>
</Position19>
<Position20>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1361" Column="15" TopLine="1337"/>
</Position20>
<Position21>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1354" Column="17" TopLine="1330"/>
</Position21>
<Position22>
<Filename Value="umainform.pas"/>
<Caret Line="9" Column="11"/>
</Position22>
<Position23>
<Filename Value="umainform.pas"/>
<Caret Line="117" Column="65" TopLine="93"/>
</Position23>
<Position24>
<Filename Value="umainform.pas"/>
<Caret Line="114" TopLine="91"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="113" TopLine="90"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="88" TopLine="86"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="87" TopLine="85"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="45" TopLine="30"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="78" Column="29" TopLine="58"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="77" Column="6" TopLine="53"/>
</Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,114 @@
object mainform: Tmainform
Left = 716
Height = 209
Top = 296
Width = 335
BorderIcons = [biSystemMenu]
Caption = 'mainform'
ClientHeight = 209
ClientWidth = 335
OnActivate = FormActivate
OnCreate = FormCreate
Position = poDesktopCenter
LCLVersion = '1.7'
object StatusBar1: TStatusBar
Left = 0
Height = 23
Top = 186
Width = 335
Panels = <>
end
object cmd_close: TBitBtn
Left = 248
Height = 30
Top = 16
Width = 75
DefaultCaption = True
Kind = bkClose
ModalResult = 11
TabOrder = 1
end
object cmd_NewVersionAvailable: TButton
Left = 24
Height = 25
Top = 16
Width = 143
AutoSize = True
Caption = 'New Version Available'
OnClick = cmd_NewVersionAvailableClick
TabOrder = 2
end
object cmd_DownloadNewVersion: TButton
Left = 24
Height = 25
Top = 48
Width = 149
AutoSize = True
Caption = 'Download New Version'
OnClick = cmd_DownloadNewVersionClick
TabOrder = 3
end
object cmd_updateToNewVersion: TButton
Left = 24
Height = 25
Top = 80
Width = 147
AutoSize = True
Caption = 'Update to New Version'
OnClick = cmd_updateToNewVersionClick
TabOrder = 4
end
object cmd_AutoUpdate: TButton
Left = 24
Height = 25
Top = 112
Width = 93
AutoSize = True
Caption = 'Auto Update'
OnClick = cmd_AutoUpdateClick
TabOrder = 5
end
object lbl_Version: TLabel
Left = 24
Height = 15
Top = 152
Width = 298
Alignment = taCenter
AutoSize = False
Caption = 'Version: '
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object LazAutoUpdate1: TLazAutoUpdate
About.Description.Strings = (
'A component for updating your application'#13#10'Designed for projects hosted by SourceForge'#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.2.0'
About.Authorname = 'Gordon Bamber'
About.Organisation = 'Public Domain'
About.AuthorEmail = 'minesadorada@gmail.com'
About.ComponentName = 'Laz Auto-update v0.2.0'
About.LicenseType = abModifiedGPL
OnNewVersionAvailable = LazAutoUpdate1NewVersionAvailable
OnDownloaded = LazAutoUpdate1Downloaded
OnDebugEvent = LazAutoUpdate1DebugEvent
SFProjectName = 'lazautoupdate'
CopyTree = False
UpdatesFolder = 'updates'
VersionsININame = 'testapp.ini'
ShowUpdateInCaption = True
ShowDialogs = True
VersionCountLimit = 1000000
DownloadCountLimit = 10000000
ZipfileName = 'testapp.zip'
Left = 200
Top = 24
end
end

View File

@ -0,0 +1,130 @@
unit umainform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, ComCtrls,
Buttons, StdCtrls,ulazautoupdate;
CONST
{$IFDEF WINDOWS}
{$IFDEF CPU32}
C_VERSIONSINNAME = 'testappwin32.ini';
C_ZIPFILENAME = 'testappwin32.zip';
{$ENDIF}
{$IFDEF CPU64}
C_VERSIONSINNAME = 'testappwin64.ini';
C_ZIPFILENAME = 'testappwin64.zip';
{$ENDIF}
{$ENDIF}
{$IFDEF LINUX}
{$IFDEF CPU32}
C_VERSIONSINNAME = 'testapplinux32.ini';
C_ZIPFILENAME = 'testapplinux32.zip';
{$ENDIF}
{$IFDEF CPU64}
C_VERSIONSINNAME = 'testapplinux64.ini';
C_ZIPFILENAME = 'testapplinux64.zip';
{$ENDIF}
{$ENDIF}
type
{ Tmainform }
Tmainform = class(TForm)
cmd_AutoUpdate: TButton;
cmd_updateToNewVersion: TButton;
cmd_DownloadNewVersion: TButton;
cmd_NewVersionAvailable: TButton;
cmd_close: TBitBtn;
lbl_Version: TLabel;
LazAutoUpdate1: TLazAutoUpdate;
StatusBar1: TStatusBar;
procedure cmd_AutoUpdateClick(Sender: TObject);
procedure cmd_DownloadNewVersionClick(Sender: TObject);
procedure cmd_NewVersionAvailableClick(Sender: TObject);
procedure cmd_updateToNewVersionClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
lauMessage: string);
procedure LazAutoUpdate1Downloaded(Sender: TObject; ResultCode,
BytesDownloaded: integer);
procedure LazAutoUpdate1NewVersionAvailable(Sender: TObject;
Newer: boolean; OnlineVersion: string);
private
public
end;
var
mainform: Tmainform;
implementation
{$R *.lfm}
{ Tmainform }
procedure Tmainform.FormCreate(Sender: TObject);
begin
LazAutoUpdate1.DebugMode:=TRUE;
LazAutoUpdate1.VersionsININame:=C_VERSIONSINNAME;
LazAutoUpdate1.ZipfileName:=C_ZIPFILENAME;
lbl_Version.Caption:='Version: ' + LazAutoUpdate1.AppVersion;
Caption:=Application.Title;
end;
procedure Tmainform.cmd_NewVersionAvailableClick(Sender: TObject);
begin
LazAutoUpdate1.NewVersionAvailable;
end;
procedure Tmainform.cmd_updateToNewVersionClick(Sender: TObject);
begin
LazAutoUpdate1.UpdateToNewVersion;
end;
procedure Tmainform.FormActivate(Sender: TObject);
begin
LazAutoUpdate1.ShowWhatsNewIfAvailable;
end;
procedure Tmainform.cmd_DownloadNewVersionClick(Sender: TObject);
begin
LazAutoUpdate1.DownloadNewVersion;
end;
procedure Tmainform.cmd_AutoUpdateClick(Sender: TObject);
begin
LazAutoUpdate1.AutoUpdate;
end;
procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
lauMessage: string);
begin
StatusBar1.SimpleText:='Debug Message: (' + lauMethodName + ') ' + lauMessage;
end;
procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode,
BytesDownloaded: integer);
begin
StatusBar1.SimpleText:=Format('Downloaded. StatusCode=%d BytesDownloaded=%d',
[ResultCode,BytesDownloaded]);
end;
procedure Tmainform.LazAutoUpdate1NewVersionAvailable(Sender: TObject;
Newer: boolean; OnlineVersion: string);
begin
If Newer then
StatusBar1.SimpleText:='New version available. Online Version is ' + OnlineVersion
else
StatusBar1.SimpleText:='Online version is not newer. Online Version is ' + OnlineVersion
end;
end.