1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-04 22:59:29 +02:00

Compare commits

...

4 Commits
5.8 ... 5.9

Author SHA1 Message Date
cb09ea0681 Version++ 2018-04-19 19:50:04 +02:00
e5d566807a Fixed HTTP redirects (+addded support for relative URLs)
Fixes #104
2018-04-19 19:46:56 +02:00
0ce2cfd13c Update gpxsee_sv.ts (#102)
* Update gpxsee_sv.ts

* Fixed typo

Sorry! I edited online, on a borrowed windows machine.  :(
2018-04-18 22:03:26 +02:00
e1532b978f The true cause of the map switch offset... 2018-04-18 22:02:24 +02:00
7 changed files with 33 additions and 22 deletions

View File

@ -1,4 +1,4 @@
version: 5.8.{build} version: 5.9.{build}
configuration: Release configuration: Release
platform: Any CPU platform: Any CPU
environment: environment:

View File

@ -1,5 +1,5 @@
TARGET = GPXSee TARGET = GPXSee
VERSION = 5.8 VERSION = 5.9
QT += core \ QT += core \
gui \ gui \
network network

View File

@ -84,7 +84,7 @@
<message> <message>
<location filename="../src/data/data.cpp" line="117"/> <location filename="../src/data/data.cpp" line="117"/>
<source>OziExplorer files</source> <source>OziExplorer files</source>
<translation type="unfinished"></translation> <translation>OziExplorer-filer</translation>
</message> </message>
<message> <message>
<location filename="../src/data/data.cpp" line="118"/> <location filename="../src/data/data.cpp" line="118"/>
@ -1155,7 +1155,7 @@
<message> <message>
<location filename="../src/GUI/optionsdialog.cpp" line="315"/> <location filename="../src/GUI/optionsdialog.cpp" line="315"/>
<source>Filtering</source> <source>Filtering</source>
<translation>Filtrerar</translation> <translation>Filtrering</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/optionsdialog.cpp" line="316"/> <location filename="../src/GUI/optionsdialog.cpp" line="316"/>

View File

@ -5,7 +5,7 @@
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "5.8" !define VERSION "5.9"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}.exe" OutFile "GPXSee-${VERSION}.exe"

View File

@ -5,7 +5,7 @@
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "5.8" !define VERSION "5.9"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}_x64.exe" OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -287,10 +287,9 @@ void MapView::setMap(Map *map)
it.value()->setMap(_map); it.value()->setMap(_map);
updatePOIVisibility(); updatePOIVisibility();
QPointF oc = vr.center(); QPointF nc = QRectF(_map->ll2xy(cr.topLeft()),
QPointF nc = _map->ll2xy(cr.center()); _map->ll2xy(cr.bottomRight())).center();
if (qAbs(oc.x() - nc.x()) >= 1.0 || qAbs(oc.y() - nc.y()) >= 1.0) centerOn(nc);
centerOn(nc);
resetCachedContent(); resetCachedContent();
QPixmapCache::clear(); QPixmapCache::clear();

View File

@ -91,9 +91,14 @@ bool Downloader::doDownload(const Download &dl,
{ {
QUrl url(dl.url()); QUrl url(dl.url());
if (!url.isValid() || !(url.scheme() == "http" || url.scheme() == "https")) {
qWarning("%s: Invalid URL\n", qPrintable(url.toString()));
return false;
}
if (_errorDownloads.contains(url)) if (_errorDownloads.contains(url))
return false; return false;
if (_currentDownloads.contains(url)) if (_currentDownloads.contains(url) && !redirect)
return false; return false;
QNetworkRequest request(url); QNetworkRequest request(url);
@ -107,10 +112,12 @@ bool Downloader::doDownload(const Download &dl,
request.setRawHeader("Authorization", authorization); request.setRawHeader("Authorization", authorization);
QNetworkReply *reply = _manager.get(request); QNetworkReply *reply = _manager.get(request);
if (reply) { if (reply && reply->isRunning()) {
_currentDownloads.insert(url); _currentDownloads.insert(url);
ReplyTimeout::setTimeout(reply, TIMEOUT); ReplyTimeout::setTimeout(reply, TIMEOUT);
} else } else if (reply)
downloadFinished(reply);
else
return false; return false;
return true; return true;
@ -157,20 +164,25 @@ void Downloader::downloadFinished(QNetworkReply *reply)
QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl(); QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl();
int level = reply->request().attribute(ATTR_LEVEL).toInt(); int level = reply->request().attribute(ATTR_LEVEL).toInt();
if (location == url) { if (level >= MAX_REDIRECT_LEVEL) {
_errorDownloads.insert(url);
qWarning("Error downloading file: %s: "
"redirect loop\n", url.toEncoded().constData());
} else if (level >= MAX_REDIRECT_LEVEL) {
_errorDownloads.insert(origin); _errorDownloads.insert(origin);
qWarning("Error downloading file: %s: " qWarning("Error downloading file: %s: "
"redirect level limit reached\n", "redirect level limit reached (redirect loop?)\n",
origin.toEncoded().constData()); origin.toEncoded().constData());
} else { } else {
QUrl redirectUrl;
if (location.isRelative()) {
QString path = QDir::isAbsolutePath(location.path())
? location.path() : "/" + location.path();
redirectUrl = QUrl(url.scheme() + "://" + url.host() + path);
} else
redirectUrl = location;
Redirect redirect(origin.isEmpty() ? url : origin, level + 1); Redirect redirect(origin.isEmpty() ? url : origin, level + 1);
Download dl(location, filename); Download dl(redirectUrl, filename);
doDownload(dl, reply->request().rawHeader("Authorization"), if (!doDownload(dl, reply->request().rawHeader("Authorization"),
&redirect); &redirect))
_errorDownloads.insert(origin.isEmpty() ? url : origin);
} }
} else } else
if (!saveToDisk(filename, reply)) if (!saveToDisk(filename, reply))