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 Align = alClient
CacheOnDisk = True CacheOnDisk = True
CachePath = 'cache/' CachePath = 'cache/'
DownloadEngine = MapView.BuiltIn
InactiveColor = clWhite InactiveColor = clWhite
MapProvider = 'OpenStreetMap Mapnik' MapProvider = 'OpenStreetMap Mapnik'
UseThreads = True UseThreads = True

View File

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

View File

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