LazMapViewer: Fix compilation with FPC 3.2

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6835 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2019-03-22 23:15:55 +00:00
parent 9f7de9f224
commit 0c3c974b0e
3 changed files with 23 additions and 13 deletions

View File

@ -387,6 +387,7 @@ object MainForm: TMainForm
Align = alClient
CacheOnDisk = True
CachePath = 'cache/'
DownloadEngine = MapView.BuiltIn
InactiveColor = clWhite
MapProvider = 'OpenStreetMap Mapnik'
UseThreads = True

View File

@ -4,12 +4,11 @@
unit lazMapViewerPkg;
{$warn 5023 off : no warning about unused units}
interface
uses
mvCache, mvDownloadEngine, mvdragobj, mvEngine, mvGeoNames, mvgpsobj,
mvJobQueue, mvJobs, mvMapProvider, mvtypes, mvmapviewer, mvextradata,
mvCache, mvDownloadEngine, mvDragObj, mvEngine, mvGeoNames, mvGpsObj,
mvJobQueue, mvJobs, mvMapProvider, mvTypes, mvMapViewer, mvExtraData,
mvDLEFpc, mvMapViewerReg, LazarusPackageIntf;
implementation

View File

@ -36,16 +36,24 @@ type
{ TMVDEFPC }
TMVDEFPC = class(TMvCustomDownloadEngine)
{$IF FPC_FullVersion >= 30101}
private
FUseProxy: Boolean;
FProxyHost: string;
FProxyPort: Word;
FProxyUserName: String;
FProxyPassWord: String;
{$IFEND}
public
procedure DownloadFile(const Url: string; AStream: TStream); override;
{$IF FPC_FullVersion >= 30101}
published
property UseProxy;
property ProxyHost;
property ProxyPort;
property ProxyUsername;
property ProxyPassword;
{$ENDIF}
property UseProxy: Boolean read FUseProxy write FUseProxy default false;
property ProxyHost: String read FProxyHost write FProxyHost;
property ProxyPort: Word read FProxyPort write FProxyPort;
property ProxyUsername: String read FProxyUserName write FProxyUserName;
property ProxyPassword: String read FProxyPassword write FProxyPassword;
{$IFEND}
end;
@ -63,14 +71,16 @@ begin
inherited;
http := TFpHttpClient.Create(nil);
try
{$IF FPC_FullVersion >= 30000}
http.AllowRedirect := true;
{$IFEND}
http.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
{$IF FPC_FullVersion >= 30101}
if UseProxy then begin
http.Proxy.Host := ProxyHost;
http.Proxy.Port := ProxyPort;
http.Proxy.UserName := ProxyUserName;
http.Proxy.Password := ProxyPassword;
http.Proxy.Host := FProxyHost;
http.Proxy.Port := FProxyPort;
http.Proxy.UserName := FProxyUserName;
http.Proxy.Password := FProxyPassword;
end;
{$ENDIF}
http.Get(Url, AStream);