1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-30 18:34:23 +02:00

Compare commits

..

38 Commits

Author SHA1 Message Date
436cf0d14c Qt5 compatability module is not needed anymore 2024-01-21 18:44:42 +01:00
0e83bd89d1 Use Qt 6.6.1 for the Mac OS Qt6 CI build 2024-01-21 18:26:11 +01:00
536d12469a Use the canonical file name also for the "already open" check 2024-01-21 17:50:56 +01:00
c9f44506e7 Fixed minimal Windows version check for Qt6 builds 2024-01-21 16:04:59 +01:00
bc4bffdfe7 Fixed NSIS command line parameters 2024-01-21 12:26:04 +01:00
eda35b6762 Made the Windows installer more modular
Enable separately selecting the Qt6, OpenSSL or ANGLE options.
Added ICU option for Qt builds with ICU enabled/required.
2024-01-21 12:01:27 +01:00
b05e7b15fe Use ISO-8859-1 as the fallback encoding rather than UTF-8 2024-01-19 09:56:56 +01:00
ed2fc0c627 Fixed missing sdkmanager in path 2024-01-18 22:39:56 +01:00
60f58592b2 Try to use older cmdline-tools 2024-01-18 22:37:08 +01:00
80abb6f604 Trying to fix the android CI build... 2024-01-18 22:27:57 +01:00
19c4aa1c34 Try another Java 11 version instead of the now broken azul build 2024-01-18 22:15:48 +01:00
578045108f Removed now unused Qt5 compatability module 2024-01-18 22:13:54 +01:00
796c2e7eaf Removed unused header include 2024-01-18 22:13:05 +01:00
c08d3b7159 Fixed indent 2024-01-18 22:12:23 +01:00
7f7de87e99 Drop Qt5Compat dependency
Use QStringConverter instead of QTextCodec on Qt > 6.5.
Qt6 builds now require Qt build with ICU support for the non-UTF encodings to
work!
2024-01-18 10:04:38 +01:00
9cacf1906e Do not duplicate the same paths in the "open recent" menu 2024-01-18 09:53:50 +01:00
cedca8725b Supress windows build warnings 2024-01-18 09:52:22 +01:00
c493f8cf16 Make the popup layout more resistant to broken HTML content 2024-01-17 08:57:08 +01:00
866b2c27ca Consistently initialize all stuff in constructor 2024-01-05 00:20:05 +01:00
07614a8f74 Added missing header includes 2024-01-04 18:53:43 +01:00
bc7d965a49 Version++ 2024-01-02 22:05:56 +01:00
e383a35c65 Year++ in copyright notices 2024-01-02 22:04:30 +01:00
6b4990a204 Fixed error handling 2024-01-02 19:11:04 +01:00
7a7a331b58 The codec is always set when reading the GPI header 2024-01-02 09:48:13 +01:00
a1e10c395a Some more code cleanup 2024-01-01 13:02:42 +01:00
c97561add4 Code cleanup 2024-01-01 10:58:23 +01:00
d994fae4ce Fixed the change that has broken non-TAR maps
Do not fail on the first image read error - there may be files with a "_%u_%u."
file name match that are not image tiles.
2024-01-01 10:48:16 +01:00
789606cf86 Silenced some more clazy warnings 2023-12-31 13:57:43 +01:00
542b3e920e Fixed read error check 2023-12-31 13:24:36 +01:00
0248ecb254 Improved tile file check 2023-12-31 13:20:04 +01:00
acc9d07a22 Properly associate .gmi files 2023-12-31 10:48:26 +01:00
7860ce8acc Use the info we already have for calibration file type distinction 2023-12-31 10:05:02 +01:00
2541797e7d Improved error reporting 2023-12-31 01:12:46 +01:00
e13d6dfc4b Fixed broken image dimensions checks 2023-12-29 18:01:28 +01:00
9e1e960c93 Use a file name that allows QFileInfo::completeSuffix() to match 2023-12-27 22:41:56 +01:00
d18537733f Added mtbmap.cz as replacement for 4Umaps
While having a much lower topographic quality than 4Umaps, there is apparently
no other freely accessible map with the same MTB/hiking info out there. So let's
provide at least what we have...
2023-12-27 22:17:35 +01:00
c6a37594ae Code cleanup 2023-12-27 15:26:39 +01:00
bcfd51276f Use QNetworkRequest::setTransferTimeout where available 2023-12-27 15:12:53 +01:00
45 changed files with 364 additions and 174 deletions

View File

@ -1,4 +1,4 @@
version: 13.14.{build} version: 13.15.{build}
configuration: configuration:
- Release - Release
@ -11,11 +11,10 @@ environment:
matrix: matrix:
- QTDIR: C:\Qt\5.15\msvc2019_64 - QTDIR: C:\Qt\5.15\msvc2019_64
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
OPENSSLVERSION: 1_1 NSISDEF: /DOPENSSL /DANGLE
- QTDIR: C:\Qt\6.5\msvc2019_64 - QTDIR: C:\Qt\6.5\msvc2019_64
OPENSSLDIR: C:\OpenSSL-v30-Win64\bin OPENSSLDIR: C:\OpenSSL-v30-Win64\bin
OPENSSLVERSION: 3 NSISDEF: /DQT6 /DOPENSSL
NSISDEF: /DQT6
install: install:
- cmd: |- - cmd: |-
@ -37,8 +36,8 @@ build_script:
xcopy lang\*.qm installer\translations\ /sy xcopy lang\*.qm installer\translations\ /sy
xcopy icons\symbols installer\symbols /i xcopy icons\symbols installer\symbols /i
copy licence.txt installer copy licence.txt installer
copy %OPENSSLDIR%\libcrypto-%OPENSSLVERSION%-x64.dll installer copy %OPENSSLDIR%\libcrypto-*-x64.dll installer
copy %OPENSSLDIR%\libssl-%OPENSSLVERSION%-x64.dll installer copy %OPENSSLDIR%\libssl-*-x64.dll installer
makensis.exe %NSISDEF% installer\gpxsee64.nsi makensis.exe %NSISDEF% installer\gpxsee64.nsi

View File

@ -15,14 +15,14 @@ jobs:
- name: set up JDK 11 - name: set up JDK 11
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: 'zulu' distribution: 'temurin'
java-version: '11' java-version: '11'
- name: Setup Android SDK - name: Setup Android SDK
uses: android-actions/setup-android@v2 uses: android-actions/setup-android@v3
- name: Run sdkmanager update with:
run: ${ANDROID_HOME}/tools/bin/sdkmanager --update cmdline-tools-version: 9862592
- name: Install android platform, platform-tools, build-tools and ndk - name: Install android platform, build-tools and ndk
run: ${ANDROID_HOME}/tools/bin/sdkmanager --install "cmdline-tools;latest" "platform-tools" "platforms;android-33" "build-tools;33.0.0" "ndk;23.1.7779620" run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-33" "build-tools;33.0.0" "ndk;23.1.7779620"
- name: Setup NDK path - name: Setup NDK path
run: echo "ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk/23.1.7779620/" >> $GITHUB_ENV run: echo "ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk/23.1.7779620/" >> $GITHUB_ENV
- name: Install Qt (Desktop) - name: Install Qt (Desktop)

View File

@ -39,8 +39,8 @@ jobs:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
with: with:
version: '6.5.1' version: '6.6.1'
modules: qtpositioning qt5compat qtserialport modules: qtpositioning qtserialport
- name: Create localization - name: Create localization
run: lrelease gpxsee.pro run: lrelease gpxsee.pro
- name: Configure build - name: Configure build

6
data/maps/mtbmap-cz.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.gpxsee.org/map/1.4">
<name>mtbmap.cz</name>
<url>https://tile.mtbmap.cz/mtbmap_tiles/$z/$x/$y.png</url>
<copyright>Map data: OpenStreetMap, USGS | Rendering: Martin Tesař</copyright>
</map>

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else { } else {
TARGET = GPXSee TARGET = GPXSee
} }
VERSION = 13.14 VERSION = 13.15
QT += core \ QT += core \
@ -18,8 +18,10 @@ QT += core \
svg \ svg \
serialport serialport
greaterThan(QT_MAJOR_VERSION, 5) { greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets \ QT += openglwidgets
core5compat lessThan(QT_MINOR_VERSION, 5) {
QT += core5compat
}
} }
CONFIG += object_parallel_to_source CONFIG += object_parallel_to_source
@ -510,10 +512,11 @@ macx {
} }
win32 { win32 {
CONFIG += no_batch
RESOURCES += theme-color.qrc RESOURCES += theme-color.qrc
QMAKE_TARGET_DESCRIPTION = GPXSee QMAKE_TARGET_DESCRIPTION = GPXSee
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2023 Martin Tuma QMAKE_TARGET_COPYRIGHT = Copyright (c) 2015-2024 Martin Tuma
RC_ICONS = icons/app/gpxsee.ico \ RC_ICONS = icons/app/gpxsee.ico \
icons/formats/gpx.ico \ icons/formats/gpx.ico \
icons/formats/tcx.ico \ icons/formats/tcx.ico \

View File

@ -111,5 +111,6 @@
<mimetype>application/vnd.iho.s57-data</mimetype> <mimetype>application/vnd.iho.s57-data</mimetype>
<mimetype>application/vnd.iho.s57-catalogue</mimetype> <mimetype>application/vnd.iho.s57-catalogue</mimetype>
<mimetype>application/vnd.gpsdump.wpt</mimetype> <mimetype>application/vnd.gpsdump.wpt</mimetype>
<mimetype>application/vnd.gpstuner.gmi</mimetype>
</mimetypes> </mimetypes>
</component> </component>

View File

@ -16,4 +16,4 @@ Icon=gpxsee
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Graphics;Viewer;Education;Geography;Maps;Sports;Qt Categories=Graphics;Viewer;Education;Geography;Maps;Sports;Qt
MimeType=application/gpx+xml;application/vnd.garmin.tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/vnd.groundspeak.loc+xml;application/vnd.sigma.slf+xml;application/geo+json;application/vnd.naviter.seeyou.cup;application/vnd.garmin.gpi;application/vnd.suunto.sml+xml;image/jpeg;text/csv;application/vnd.garmin.img;application/vnd.garmin.jnx;application/vnd.garmin.gmap+xml;image/vnd.maptech.kap;application/vnd.oziexplorer.map;application/vnd.mapbox.mbtiles;application/vnd.twonav.rmap;application/vnd.trekbuddy.tba;application/vnd.gpxsee.map+xml;application/x-tar;image/tiff;application/vnd.google-earth.kmz;application/vnd.alpinequest.aqm;application/vnd.cgtk.gemf;application/vnd.rmaps.sqlite;application/vnd.osmdroid.sqlite;application/vnd.mapsforge.map;application/vnd.tomtom.ov2;application/vnd.tomtom.itn;application/vnd.esri.wld;application/vnd.onmove.omd;application/vnd.onmove.ghp;application/vnd.memory-map.qct;application/vnd.twonav.trk;application/vnd.twonav.rte;application/vnd.twonav.wpt;application/vnd.orux.map+xml;application/vnd.iho.s57-data;application/vnd.iho.s57-catalogue;application/vnd.gpsdump.wpt MimeType=application/gpx+xml;application/vnd.garmin.tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/vnd.groundspeak.loc+xml;application/vnd.sigma.slf+xml;application/geo+json;application/vnd.naviter.seeyou.cup;application/vnd.garmin.gpi;application/vnd.suunto.sml+xml;image/jpeg;text/csv;application/vnd.garmin.img;application/vnd.garmin.jnx;application/vnd.garmin.gmap+xml;image/vnd.maptech.kap;application/vnd.oziexplorer.map;application/vnd.mapbox.mbtiles;application/vnd.twonav.rmap;application/vnd.trekbuddy.tba;application/vnd.gpxsee.map+xml;application/x-tar;image/tiff;application/vnd.google-earth.kmz;application/vnd.alpinequest.aqm;application/vnd.cgtk.gemf;application/vnd.rmaps.sqlite;application/vnd.osmdroid.sqlite;application/vnd.mapsforge.map;application/vnd.tomtom.ov2;application/vnd.tomtom.itn;application/vnd.esri.wld;application/vnd.onmove.omd;application/vnd.onmove.ghp;application/vnd.memory-map.qct;application/vnd.twonav.trk;application/vnd.twonav.rte;application/vnd.twonav.wpt;application/vnd.orux.map+xml;application/vnd.iho.s57-data;application/vnd.iho.s57-catalogue;application/vnd.gpsdump.wpt;application/vnd.gpstuner.gmi

View File

@ -363,4 +363,14 @@
<glob pattern="*.031"/> <glob pattern="*.031"/>
</mime-type> </mime-type>
<mime-type type="application/vnd.gpstuner.gmi">
<comment>GPS Tuner Map Calibration File</comment>
<sub-class-of type="text/plain"/>
<generic-icon name="text/plain"/>
<magic>
<match type="string" offset="0" value="Map Calibration data file"/>
</magic>
<glob pattern="*.gmi"/>
</mime-type>
</mime-info> </mime-info>

View File

@ -417,6 +417,22 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Viewer</string> <string>Viewer</string>
</dict> </dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>gmi</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.gpstuner.gmi</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>icons/map.icns</string>
<key>CFBundleTypeName</key>
<string>GPS Tuner Map Calibration File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
@ -1252,6 +1268,29 @@
<string>application/vnd.oziexplorer.map</string> <string>application/vnd.oziexplorer.map</string>
</dict> </dict>
</dict> </dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.gpstuner.gmi</string>
<key>UTTypeReferenceURL</key>
<string>https://github.com/tumic0/GPXSee/blob/master/src/map/gmifile.cpp</string>
<key>UTTypeDescription</key>
<string>GPS Tuner Map Calibration File</string>
<key>UTTypeIconFile</key>
<string>icons/map.icns</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gmi</string>
</array>
<key>public.mime-type</key>
<string>application/vnd.gpstuner.gmi</string>
</dict>
</dict>
<dict> <dict>
<key>UTTypeIdentifier</key> <key>UTTypeIdentifier</key>
<string>com.mapbox.mbtiles</string> <string>com.mapbox.mbtiles</string>

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "13.14" !define VERSION "13.15"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}_x64.exe" OutFile "GPXSee-${VERSION}_x64.exe"
@ -58,7 +58,7 @@ VIProductVersion "${VERSION}.0.0"
VIAddVersionKey "ProductVersion" ${VERSION} VIAddVersionKey "ProductVersion" ${VERSION}
VIAddVersionKey "FileVersion" "${VERSION}.0.0" VIAddVersionKey "FileVersion" "${VERSION}.0.0"
VIAddVersionKey "ProductName" "GPXSee" VIAddVersionKey "ProductName" "GPXSee"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2023 Martin Tůma" VIAddVersionKey "LegalCopyright" "Copyright (c) 2015-2024 Martin Tůma"
VIAddVersionKey "FileDescription" "GPXSee installer (x64)" VIAddVersionKey "FileDescription" "GPXSee installer (x64)"
; Registry key to check for directory (so if you install again, it will ; Registry key to check for directory (so if you install again, it will
@ -95,10 +95,17 @@ Var StartMenuFolder
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
Function .onInit Function .onInit
!ifdef QT6
${IfNot} ${AtLeastWin10}
MessageBox MB_OK "GPXSee can only be installed on Windows 10 or later."
Abort
${EndIf}
!else
${IfNot} ${AtLeastWin7} ${IfNot} ${AtLeastWin7}
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later." MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
Abort Abort
${EndIf} ${EndIf}
!endif
${If} ${RunningX64} ${If} ${RunningX64}
SetRegView 64 SetRegView 64
@ -163,6 +170,7 @@ Section "GPXSee" SEC_APP
!insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10 !insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10
!insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11 !insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11
!insertmacro FILE_ASSOCIATION_ADD "map" "OziExplorer Map File" 12 !insertmacro FILE_ASSOCIATION_ADD "map" "OziExplorer Map File" 12
!insertmacro FILE_ASSOCIATION_ADD "gmi" "GPS Tuner Map Calibration File" 12
!insertmacro FILE_ASSOCIATION_ADD "mbtiles" "MBTiles Map File" 13 !insertmacro FILE_ASSOCIATION_ADD "mbtiles" "MBTiles Map File" 13
!insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14 !insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14
!insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15 !insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15
@ -218,6 +226,7 @@ Section "GPXSee" SEC_APP
WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".gmi\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" ""
@ -247,7 +256,7 @@ Section "GPXSee" SEC_APP
SectionEnd SectionEnd
Section "QT framework" SEC_QT Section "Qt framework" SEC_QT
SectionIn RO SectionIn RO
@ -262,7 +271,6 @@ Section "QT framework" SEC_QT
File "Qt6Sql.dll" File "Qt6Sql.dll"
File "Qt6Svg.dll" File "Qt6Svg.dll"
File "Qt6Widgets.dll" File "Qt6Widgets.dll"
File "Qt6Core5Compat.dll"
File "Qt6Positioning.dll" File "Qt6Positioning.dll"
File "Qt6SerialPort.dll" File "Qt6SerialPort.dll"
File /r "tls" File /r "tls"
@ -280,6 +288,7 @@ Section "QT framework" SEC_QT
File /r "printsupport" File /r "printsupport"
!endif !endif
File /r "platforms" File /r "platforms"
File /r "iconengines"
File /r "imageformats" File /r "imageformats"
File /r "styles" File /r "styles"
File /r "sqldrivers" File /r "sqldrivers"
@ -298,21 +307,30 @@ Section "MSVC runtime" SEC_MSVC
SectionEnd SectionEnd
!ifdef ICU
Section "ICU" SEC_ICU
SectionIn RO
File "icudt*.dll"
File "icuin*.dll"
File "icuuc*.dll"
SectionEnd
!endif
!ifdef OPENSSL
Section "OpenSSL" SEC_OPENSSL Section "OpenSSL" SEC_OPENSSL
SectionIn RO SectionIn RO
!ifdef QT6 File "libcrypto-*-x64.dll"
File "libcrypto-3-x64.dll" File "libssl-*-x64.dll"
File "libssl-3-x64.dll"
!else
File "libcrypto-1_1-x64.dll"
File "libssl-1_1-x64.dll"
!endif
SectionEnd SectionEnd
!endif
!ifndef QT6 !ifdef ANGLE
Section "ANGLE" SEC_ANGLE Section "ANGLE" SEC_ANGLE
File "libGLESv2.dll" File "libGLESv2.dll"
@ -384,6 +402,7 @@ Section "Uninstall"
!insertmacro FILE_ASSOCIATION_REMOVE "jnx" !insertmacro FILE_ASSOCIATION_REMOVE "jnx"
!insertmacro FILE_ASSOCIATION_REMOVE "kap" !insertmacro FILE_ASSOCIATION_REMOVE "kap"
!insertmacro FILE_ASSOCIATION_REMOVE "map" !insertmacro FILE_ASSOCIATION_REMOVE "map"
!insertmacro FILE_ASSOCIATION_REMOVE "gmi"
!insertmacro FILE_ASSOCIATION_REMOVE "mbtiles" !insertmacro FILE_ASSOCIATION_REMOVE "mbtiles"
!insertmacro FILE_ASSOCIATION_REMOVE "rmap" !insertmacro FILE_ASSOCIATION_REMOVE "rmap"
!insertmacro FILE_ASSOCIATION_REMOVE "tba" !insertmacro FILE_ASSOCIATION_REMOVE "tba"
@ -431,6 +450,7 @@ Section "Uninstall"
DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".gmi\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe"
@ -466,13 +486,24 @@ SectionEnd
; Descriptions ; Descriptions
; Language strings ; Language strings
!ifdef QT6
LangString DESC_QT ${LANG_ENGLISH} \ LangString DESC_QT ${LANG_ENGLISH} \
"QT cross-platform application framework." "Qt6 cross-platform application framework."
!else
LangString DESC_QT ${LANG_ENGLISH} \
"Qt5 cross-platform application framework."
!endif
LangString DESC_MSVC ${LANG_ENGLISH} \ LangString DESC_MSVC ${LANG_ENGLISH} \
"Microsoft Visual C++ 2019 runtime. If already installed, will be skipped." "Microsoft Visual C++ runtime. If already installed, will be skipped."
!ifdef ICU
LangString DESC_ICU ${LANG_ENGLISH} \
"ICU library. Required for character set/encoding conversions."
!endif
!ifdef OPENSSL
LangString DESC_OPENSSL ${LANG_ENGLISH} \ LangString DESC_OPENSSL ${LANG_ENGLISH} \
"OpenSSL library. Required for HTTPS to work." "OpenSSL library. Qt SSL/TLS backend for HTTPS."
!ifndef QT6 !endif
!ifdef ANGLE
LangString DESC_ANGLE ${LANG_ENGLISH} \ LangString DESC_ANGLE ${LANG_ENGLISH} \
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers." "ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
!endif !endif
@ -484,8 +515,13 @@ LangString DESC_LOCALIZATION ${LANG_ENGLISH} \
; Assign language strings to sections ; Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
!ifdef ICU
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ICU} $(DESC_ICU)
!endif
!ifdef OPENSSL
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
!ifndef QT6 !endif
!ifdef ANGLE
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
!endif !endif
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)

View File

@ -4,6 +4,7 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QVector> #include <QVector>
#include <QLocale> #include <QLocale>
#include <QFont>
#include "common/range.h" #include "common/range.h"
class AxisItem : public QGraphicsItem class AxisItem : public QGraphicsItem

View File

@ -1028,13 +1028,16 @@ void GUI::openDir()
bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError) bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
{ {
if (_files.contains(fileName)) QFileInfo fi(fileName);
QString canonicalFileName(fi.canonicalFilePath());
if (_files.contains(canonicalFileName))
return true; return true;
if (!loadFile(fileName, tryUnknown, showError)) if (!loadFile(fileName, tryUnknown, showError))
return false; return false;
_files.append(fileName); _files.append(canonicalFileName);
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
_browser->setCurrent(fileName); _browser->setCurrent(fileName);
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
@ -1047,7 +1050,7 @@ bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle(); updateWindowTitle();
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
updateRecentFiles(fileName); updateRecentFiles(canonicalFileName);
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
return true; return true;

View File

@ -3,6 +3,7 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QList> #include <QList>
#include <QFont>
#include "common/kv.h" #include "common/kv.h"
class InfoItem : public QGraphicsItem class InfoItem : public QGraphicsItem

View File

@ -2,6 +2,7 @@
#define MOTIONINFOITEM_H #define MOTIONINFOITEM_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QFont>
#include "units.h" #include "units.h"
class MotionInfoItem : public QGraphicsItem class MotionInfoItem : public QGraphicsItem

View File

@ -3,6 +3,7 @@
#include <QFont> #include <QFont>
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QtMath>
#include "graphicsscene.h" #include "graphicsscene.h"
class PathTickItem : public GraphicsItem class PathTickItem : public GraphicsItem
@ -16,7 +17,7 @@ public:
void setPos(const QPointF &pos); void setPos(const QPointF &pos);
void setColor(const QColor &color) {_brush = QBrush(color);} void setColor(const QColor &color) {_brush = QBrush(color);}
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));} void setDigitalZoom(int zoom) {setScale(qPow(2, -zoom));}
int type() const {return parentItem()->type();} int type() const {return parentItem()->type();}
ToolTip info() const ToolTip info() const

View File

@ -7,6 +7,7 @@
#include <QBasicTimer> #include <QBasicTimer>
#include <QScreen> #include <QScreen>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QFormLayout>
#include <QApplication> #include <QApplication>
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
#include <QDesktopWidget> #include <QDesktopWidget>
@ -93,21 +94,29 @@ void PopupFrame::createLayout(const ToolTip &content)
} }
if (!content.list().isEmpty()) { if (!content.list().isEmpty()) {
QString html = "<table>"; QFormLayout *textLayout = new QFormLayout();
for (int i = 0; i < content.list().count(); i++) textLayout->setLabelAlignment(Qt::AlignRight);
html += "<tr><td align=\"right\"><b>" + content.list().at(i).key() textLayout->setHorizontalSpacing(5);
+ ":&nbsp;</b></td><td>" + content.list().at(i).value() textLayout->setVerticalSpacing(2);
+ "</td></tr>";
html += "</table>";
QLabel *label = new QLabel(html); for (int i = 0; i < content.list().count(); i++) {
label->setAlignment(Qt::AlignLeft); QLabel *key = new QLabel(content.list().at(i).key() + ":");
label->setIndent(1); key->setTextFormat(Qt::PlainText);
label->setTextInteractionFlags(Qt::TextBrowserInteraction); key->setAlignment(Qt::AlignTop);
label->setOpenExternalLinks(true); key->setStyleSheet("font-weight: bold");
label->setWordWrap(true); QLabel *value = new QLabel(content.list().at(i).value());
value->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Preferred);
value->setTextFormat(Qt::RichText);
value->setAlignment(Qt::AlignTop);
value->setTextInteractionFlags(Qt::TextBrowserInteraction);
value->setOpenExternalLinks(true);
value->setWordWrap(true);
layout->addWidget(label); textLayout->addRow(key, value);
}
layout->addLayout(textLayout);
} }
setLayout(layout); setLayout(layout);

View File

@ -2,6 +2,7 @@
#define SCALEITEM_H #define SCALEITEM_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QFont>
#include "units.h" #include "units.h"
class ScaleItem : public QGraphicsItem class ScaleItem : public QGraphicsItem

View File

@ -2,6 +2,7 @@
#define SLIDERINFOITEM_H #define SLIDERINFOITEM_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QFont>
class SliderInfoItem : public QGraphicsItem class SliderInfoItem : public QGraphicsItem
{ {

View File

@ -1,5 +1,4 @@
#include <QFile> #include <QFile>
#include <QFileInfo>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QDir> #include <QDir>
#include <QTimerEvent> #include <QTimerEvent>
@ -56,6 +55,7 @@ Authorization::Authorization(const QString &username, const QString &password)
_header = HTTPHeader("Authorization", "Basic " + data); _header = HTTPHeader("Authorization", "Basic " + data);
} }
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
NetworkTimeout::NetworkTimeout(int timeout, QNetworkReply *reply) NetworkTimeout::NetworkTimeout(int timeout, QNetworkReply *reply)
: QObject(reply), _timeout(timeout) : QObject(reply), _timeout(timeout)
{ {
@ -77,6 +77,7 @@ void NetworkTimeout::timerEvent(QTimerEvent *ev)
reply->abort(); reply->abort();
_timer.stop(); _timer.stop();
} }
#endif // QT 5.15
QNetworkAccessManager *Downloader::_manager = 0; QNetworkAccessManager *Downloader::_manager = 0;
@ -104,11 +105,15 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
request.setAttribute(ATTR_REDIRECT_POLICY, request.setAttribute(ATTR_REDIRECT_POLICY,
QNetworkRequest::NoLessSafeRedirectPolicy); QNetworkRequest::NoLessSafeRedirectPolicy);
request.setAttribute(ATTR_HTTP2_ALLOWED, QVariant(_http2)); request.setAttribute(ATTR_HTTP2_ALLOWED, QVariant(_http2));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
request.setTransferTimeout(_timeout * 1000);
#endif // QT 5.15
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
const HTTPHeader &hdr = headers.at(i); const HTTPHeader &hdr = headers.at(i);
request.setRawHeader(hdr.key(), hdr.value()); request.setRawHeader(hdr.key(), hdr.value());
if (hdr.key() == "User-Agent") // QByteArray::compare() not available in Qt < 5.12
if (!QString(hdr.key()).compare("User-Agent", Qt::CaseInsensitive))
userAgent = true; userAgent = true;
} }
if (!userAgent) if (!userAgent)
@ -128,9 +133,9 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
_currentDownloads.insert(url, file); _currentDownloads.insert(url, file);
if (reply->isRunning()) { if (reply->isRunning()) {
/* Starting with Qt 5.15 this can be replaced by #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QNetworkRequest::setTransferTimeout() */
new NetworkTimeout(_timeout, reply); new NetworkTimeout(_timeout, reply);
#endif // QT 5.15
connect(reply, &QIODevice::readyRead, this, &Downloader::emitReadReady); connect(reply, &QIODevice::readyRead, this, &Downloader::emitReadReady);
connect(reply, &QNetworkReply::finished, this, &Downloader::emitFinished); connect(reply, &QNetworkReply::finished, this, &Downloader::emitFinished);
} else { } else {

View File

@ -3,7 +3,9 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
#include <QBasicTimer> #include <QBasicTimer>
#endif // QT 5.15
#include <QUrl> #include <QUrl>
#include <QList> #include <QList>
#include <QHash> #include <QHash>
@ -39,6 +41,7 @@ private:
HTTPHeader _header; HTTPHeader _header;
}; };
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
class NetworkTimeout : public QObject class NetworkTimeout : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -55,6 +58,7 @@ private:
QBasicTimer _timer; QBasicTimer _timer;
int _timeout; int _timeout;
}; };
#endif // QT 5.15
class Downloader : public QObject class Downloader : public QObject
{ {
@ -79,8 +83,6 @@ private slots:
void emitReadReady(); void emitReadReady();
private: private:
class ReplyTimeout;
void insertError(const QUrl &url, QNetworkReply::NetworkError error); void insertError(const QUrl &url, QNetworkReply::NetworkError error);
bool doDownload(const Download &dl, const QList<HTTPHeader> &headers); bool doDownload(const Download &dl, const QList<HTTPHeader> &headers);
void downloadFinished(QNetworkReply *reply); void downloadFinished(QNetworkReply *reply);

View File

@ -2,9 +2,12 @@
#define HASH_H #define HASH_H
#include <QtGlobal> #include <QtGlobal>
#include <QPoint>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QPoint>
#include <QPair>
#include <QHash>
#define HASH_T uint #define HASH_T uint
inline uint qHash(const QPoint &p) inline uint qHash(const QPoint &p)

View File

@ -1,15 +1,20 @@
#include <QTextCodec>
#include "textcodec.h" #include "textcodec.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
static QTextCodec *codec(int mib) static QTextCodec *codec(int mib)
{ {
QTextCodec *c = QTextCodec::codecForMib(mib); QTextCodec *c = QTextCodec::codecForMib(mib);
if (!c) if (!c)
qWarning("MIB-%d: No such QTextCodec, using UTF-8", mib); qWarning("MIB-%d: No such QTextCodec, using ISO-8859-1", mib);
return c; return c;
} }
TextCodec::TextCodec() : _codec(0)
{
}
TextCodec::TextCodec(int codepage) TextCodec::TextCodec(int codepage)
{ {
switch (codepage) { switch (codepage) {
@ -56,15 +61,40 @@ TextCodec::TextCodec(int codepage)
_codec = codec(2258); _codec = codec(2258);
break; break;
case 65001: case 65001:
_codec = 0; _codec = codec(106);
break; break;
default: default:
qWarning("%d: Unknown codepage, using UTF-8", codepage); qWarning("%d: Unknown codepage, using ISO-8859-1", codepage);
_codec = 0; _codec = 0;
} }
} }
QString TextCodec::toString(const QByteArray &ba) const QString TextCodec::toString(const QByteArray &ba)
{ {
return _codec ? _codec->toUnicode(ba) : QString::fromUtf8(ba); return _codec ? _codec->toUnicode(ba) : QString::fromLatin1(ba);
} }
#else // QT 6.5
TextCodec::TextCodec()
{
}
TextCodec::TextCodec(int codepage)
{
if (codepage == 65001)
_decoder = QStringDecoder(QStringDecoder::Utf8);
else {
QByteArray cp(QByteArray("CP") + QByteArray::number(codepage));
_decoder = QStringDecoder(cp.constData());
if (!_decoder.isValid())
qWarning("%d: Unknown codepage, using ISO-8859-1", codepage);
}
}
QString TextCodec::toString(const QByteArray &ba)
{
return _decoder.isValid() ? _decoder.decode(ba) : QString::fromLatin1(ba);
}
#endif // QT 6.5

View File

@ -2,20 +2,26 @@
#define TEXTCODEC_H #define TEXTCODEC_H
#include <QString> #include <QString>
#include <QMap> #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
#include <QTextCodec>
class QTextCodec; #else // QT 6.5
#include <QStringDecoder>
#endif // QT 6.5
class TextCodec class TextCodec
{ {
public: public:
TextCodec() : _codec(0) {} TextCodec();
TextCodec(int codepage); TextCodec(int codepage);
QString toString(const QByteArray &ba) const; QString toString(const QByteArray &ba);
private: private:
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
QTextCodec *_codec; QTextCodec *_codec;
#else // QT 6.5
QStringDecoder _decoder;
#endif // QT 6.5
}; };
#endif // TEXTCODEC_H #endif // TEXTCODEC_H

View File

@ -148,9 +148,9 @@ qreal DEM::elevation(const Coordinates &c)
QList<Area> DEM::tiles() QList<Area> DEM::tiles()
{ {
static const QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
QDir dir(_dir); QDir dir(_dir);
QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable)); QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable));
QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
QLocale l(QLocale::system()); QLocale l(QLocale::system());
QList<Area> list; QList<Area> list;

View File

@ -128,7 +128,7 @@ qint64 CryptDevice::readData(char *data, qint64 maxSize)
class DataStream : public QDataStream class DataStream : public QDataStream
{ {
public: public:
DataStream(QIODevice *d) : QDataStream(d), _codec(1252) {} DataStream(QIODevice *d) : QDataStream(d) {}
void setCodepage(quint16 codepage) {_codec = TextCodec(codepage);} void setCodepage(quint16 codepage) {_codec = TextCodec(codepage);}

View File

@ -88,6 +88,7 @@ static Coordinates parseUTM(const QString &zone, const QString &easting,
bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks, bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
QList<RouteData> &routes, QList<Area> &polygons, QVector<Waypoint> &waypoints) QList<RouteData> &routes, QList<Area> &polygons, QVector<Waypoint> &waypoints)
{ {
static const QRegularExpression dm("[ ]{2,}");
Q_UNUSED(tracks); Q_UNUSED(tracks);
Q_UNUSED(routes); Q_UNUSED(routes);
Q_UNUSED(polygons); Q_UNUSED(polygons);
@ -95,7 +96,6 @@ bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
_errorLine = 1; _errorLine = 1;
_errorString.clear(); _errorString.clear();
Type type = Unknown; Type type = Unknown;
QRegularExpression dm("[ ]{2,}");
while (!file->atEnd()) { while (!file->atEnd()) {
QByteArray ba(file->readLine(4096).trimmed()); QByteArray ba(file->readLine(4096).trimmed());

View File

@ -52,8 +52,10 @@ bool GMAPData::readXML(const QString &path, QString &dataDir, QString &typFile)
{ {
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly | QFile::Text)) if (!file.open(QFile::ReadOnly | QFile::Text)) {
_errorString = file.errorString();
return false; return false;
}
QXmlStreamReader reader(&file); QXmlStreamReader reader(&file);
if (reader.readNextStartElement()) { if (reader.readNextStartElement()) {

View File

@ -138,7 +138,7 @@ void LBLFile::clear()
} }
Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize, Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const bool convert)
{ {
Shield::Type shieldType = Shield::None; Shield::Type shieldType = Shield::None;
QByteArray label, shieldLabel; QByteArray label, shieldLabel;
@ -247,7 +247,7 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, quint32 size,
} }
Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, quint32 size, Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const bool capitalize, bool convert)
{ {
QVector<quint8> str; QVector<quint8> str;
quint8 c; quint8 c;
@ -264,7 +264,7 @@ Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, quint32 size,
} }
Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl, Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const quint32 size, bool capitalize, bool convert)
{ {
QVector<quint8> str; QVector<quint8> str;
@ -305,7 +305,7 @@ Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
} }
Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize, Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
bool convert) const bool convert)
{ {
quint32 labelOffset; quint32 labelOffset;
if (poi) { if (poi) {
@ -328,7 +328,7 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
} }
Label LBLFile::label(Handle &hdl, const SubFile *file, Handle &fileHdl, Label LBLFile::label(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const quint32 size, bool capitalize, bool convert)
{ {
switch (_encoding) { switch (_encoding) {
case 6: case 6:

View File

@ -30,9 +30,9 @@ public:
void clear(); void clear();
Label label(Handle &hdl, quint32 offset, bool poi = false, Label label(Handle &hdl, quint32 offset, bool poi = false,
bool capitalize = true, bool convert = false) const; bool capitalize = true, bool convert = false);
Label label(Handle &hdl, const SubFile *file, Handle &fileHdl, Label label(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize = true, bool convert = false) const; quint32 size, bool capitalize = true, bool convert = false);
quint8 imageIdSize() const {return _imgIdSize;} quint8 imageIdSize() const {return _imgIdSize;}
QPixmap image(Handle &hdl, quint32 id) const; QPixmap image(Handle &hdl, quint32 id) const;
@ -44,13 +44,13 @@ private:
}; };
Label str2label(const QVector<quint8> &str, bool capitalize, Label str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const; bool convert);
Label label6b(const SubFile *file, Handle &fileHdl, quint32 size, Label label6b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const; bool capitalize, bool convert) const;
Label label8b(const SubFile *file, Handle &fileHdl, quint32 size, Label label8b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const; bool capitalize, bool convert);
Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl, Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const; quint32 size, bool capitalize, bool convert);
bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size, bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size,
quint32 recordSize); quint32 recordSize);

View File

@ -329,7 +329,7 @@ bool NETFile::readShape(const NODFile *nod, SubFile::Handle &nodHdl,
} }
bool NETFile::linkLabel(Handle &hdl, quint32 offset, bool NETFile::linkLabel(Handle &hdl, quint32 offset,
const LBLFile *lbl, Handle &lblHdl, Label &label) const LBLFile *lbl, Handle &lblHdl, Label &label) const
{ {
if (!seek(hdl, offset)) if (!seek(hdl, offset))
return false; return false;
@ -392,7 +392,7 @@ NETFile::~NETFile()
} }
bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl, bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl, const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId, Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const quint8 lineId, QList<MapData::Poly> *lines) const
{ {

View File

@ -30,13 +30,13 @@ public:
bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset) const; bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset) const;
bool link(const SubDiv *subdiv, quint32 shift, Handle &hdl, bool link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl, const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId, Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const; quint8 lineId, QList<MapData::Poly> *lines) const;
bool hasLinks() const {return (_links.size > 0);} bool hasLinks() const {return (_links.size > 0);}
private: private:
bool linkLabel(Handle &hdl, quint32 offset, const LBLFile *lbl, bool linkLabel(Handle &hdl, quint32 offset, LBLFile *lbl,
Handle &lblHdl, Label &label) const; Handle &lblHdl, Label &label) const;
bool readShape(const NODFile *nod, SubFile::Handle &nodHdl, bool readShape(const NODFile *nod, SubFile::Handle &nodHdl,
NODFile::AdjacencyInfo &adj, BitStream4R &bs, const SubDiv *subdiv, NODFile::AdjacencyInfo &adj, BitStream4R &bs, const SubDiv *subdiv,

View File

@ -107,7 +107,7 @@ bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
return true; return true;
} }
bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl, bool RGNFile::readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const quint8 flags, quint32 size, MapData::Point *point) const
{ {
if (!(flags & 1)) if (!(flags & 1))
@ -122,7 +122,7 @@ bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
} }
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const void *object, LBLFile *lbl, Handle &lblHdl) const
{ {
quint8 flags; quint8 flags;
quint32 rs = 0; quint32 rs = 0;
@ -257,7 +257,7 @@ void RGNFile::clear()
} }
bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv, bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl, NETFile *net, SegmentType segmentType, LBLFile *lbl, Handle &lblHdl, NETFile *net,
Handle &netHdl, QList<MapData::Poly> *polys) const Handle &netHdl, QList<MapData::Poly> *polys) const
{ {
const SubDiv::Segment &segment = (segmentType == Line) const SubDiv::Segment &segment = (segmentType == Line)
@ -340,7 +340,7 @@ bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
} }
bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift, bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl, SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *polys) const QList<MapData::Poly> *polys) const
{ {
quint32 labelPtr, len; quint32 labelPtr, len;
@ -457,7 +457,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
} }
bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv, bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl, SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Point> *points) const QList<MapData::Point> *points) const
{ {
const SubDiv::Segment &segment = (segmentType == IndexedPoint) const SubDiv::Segment &segment = (segmentType == IndexedPoint)
@ -502,7 +502,7 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
} }
bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv, bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const
{ {
const SubDiv::Segment &segment = subdiv->extPoints(); const SubDiv::Segment &segment = subdiv->extPoints();
@ -554,7 +554,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
bool RGNFile::links(Handle &hdl, const SubDiv *subdiv, quint32 shift, bool RGNFile::links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl, const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl, Handle &nodHdl2, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const QList<MapData::Poly> *lines) const
{ {
quint32 size, blockIndexId; quint32 size, blockIndexId;

View File

@ -33,18 +33,18 @@ public:
bool load(Handle &hdl); bool load(Handle &hdl);
bool polyObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType, bool polyObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType,
const LBLFile *lbl, Handle &lblHdl, NETFile *net, Handle &netHdl, LBLFile *lbl, Handle &lblHdl, NETFile *net, Handle &netHdl,
QList<MapData::Poly> *polys) const; QList<MapData::Poly> *polys) const;
bool pointObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType, bool pointObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const; LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const;
bool extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift, bool extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl, SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *polys) const; QList<MapData::Poly> *polys) const;
bool extPointObjects(Handle &hdl, const SubDiv *subdiv, const LBLFile *lbl, bool extPointObjects(Handle &hdl, const SubDiv *subdiv, LBLFile *lbl,
Handle &lblHdl, QList<MapData::Point> *points) const; Handle &lblHdl, QList<MapData::Point> *points) const;
bool links(Handle &hdl, const SubDiv *subdiv, quint32 shift, bool links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl, const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl, Handle &nodHdl2, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const; QList<MapData::Poly> *lines) const;
bool subdivInit(Handle &hdl, SubDiv *subdiv) const; bool subdivInit(Handle &hdl, SubDiv *subdiv) const;
@ -55,7 +55,7 @@ public:
private: private:
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const; bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object, bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
const LBLFile *lbl, Handle &lblHdl) const; LBLFile *lbl, Handle &lblHdl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const; bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const; bool skipGblFields(Handle &hdl, quint32 flags) const;
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size, bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
@ -64,7 +64,7 @@ private:
MapData::Point *point) const; MapData::Point *point) const;
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size, bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const; MapData::Point *point) const;
bool readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl, bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const; quint8 flags, quint32 size, MapData::Point *point) const;
HuffmanTable *_huffmanTable; HuffmanTable *_huffmanTable;

View File

@ -2,6 +2,7 @@
#define IMG_SHIELD_H #define IMG_SHIELD_H
#include <QString> #include <QString>
#include <QDebug>
#include "common/hash.h" #include "common/hash.h"
#define FIRST_SHIELD Shield::USInterstate #define FIRST_SHIELD Shield::USInterstate

View File

@ -27,19 +27,25 @@ static bool yCmp(OziMap *m1, OziMap *m2)
return TL(m1).y() > TL(m2).y(); return TL(m1).y() > TL(m2).y();
} }
static QString calibrationFile(const QString &path) static QString calibrationFile(const QString &path, OziMap::CalibrationType &type)
{ {
QDir dir(path); QDir dir(path);
QFileInfoList files = dir.entryInfoList(QDir::Files); QFileInfoList files(dir.entryInfoList(QDir::Files));
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
const QFileInfo &fi = files.at(i); const QFileInfo &fi = files.at(i);
QString suffix(fi.suffix().toLower()); QString suffix(fi.suffix().toLower());
if (suffix == "map" || suffix == "gmi") if (suffix == "map") {
type = OziMap::MAP;
return fi.absoluteFilePath(); return fi.absoluteFilePath();
} else if (suffix == "gmi") {
type = OziMap::GMI;
return fi.absoluteFilePath();
}
} }
type = OziMap::Unknown;
return QString(); return QString();
} }
@ -141,16 +147,19 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
QFileInfoList maps = zdir.entryInfoList(QDir::Dirs QFileInfoList maps = zdir.entryInfoList(QDir::Dirs
| QDir::NoDotAndDotDot); | QDir::NoDotAndDotDot);
for (int i = 0; i < maps.count(); i++) { for (int i = 0; i < maps.count(); i++) {
QString path(maps.at(i).absoluteFilePath());
OziMap *map; OziMap *map;
if (TAR) if (TAR)
map = new OziMap(maps.at(i).absoluteFilePath(), tar, proj, this); map = new OziMap(path, tar, proj, this);
else { else {
QString cf(calibrationFile(maps.at(i).absoluteFilePath())); OziMap::CalibrationType type;
QString cf(calibrationFile(path, type));
if (cf.isNull()) { if (cf.isNull()) {
_errorString = "No calibration file found"; qWarning("%s: no calibration file found", qPrintable(path));
return; continue;
} }
map = new OziMap(cf, proj, this); map = new OziMap(cf, type, proj, this);
} }
if (map->isValid()) if (map->isValid())

View File

@ -395,7 +395,7 @@ BSBMap::BSBMap(const QString &fileName, QObject *parent)
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
_errorString = fileName + ": " + file.errorString(); _errorString = file.errorString();
return; return;
} }

View File

@ -9,7 +9,8 @@
class Ellipsoid class Ellipsoid
{ {
public: public:
Ellipsoid() : _radius(NAN), _flattening(NAN), _es(NAN), _b(NAN) {} Ellipsoid()
: _radius(NAN), _flattening(NAN), _es(NAN), _e2s(NAN), _b(NAN) {}
Ellipsoid(double radius, double flattening); Ellipsoid(double radius, double flattening);
double radius() const {return _radius;} double radius() const {return _radius;}

View File

@ -24,11 +24,6 @@ bool GmiFile::parse(QIODevice &device)
int width, height; int width, height;
bool ok; bool ok;
if (!device.open(QIODevice::ReadOnly)) {
_errorString = device.errorString();
return false;
}
while (!device.atEnd()) { while (!device.atEnd()) {
QByteArray line = device.readLine(4096); QByteArray line = device.readLine(4096);
@ -41,14 +36,14 @@ bool GmiFile::parse(QIODevice &device)
_image = line.trimmed(); _image = line.trimmed();
else if (ln == 3) { else if (ln == 3) {
width = line.toInt(&ok); width = line.toInt(&ok);
if (!ok || ok <= 0) { if (!ok || width <= 0) {
_errorString = "Invalid image width"; _errorString = line + ": invalid image width";
return false; return false;
} }
} else if (ln == 4) { } else if (ln == 4) {
height = line.toInt(&ok); height = line.toInt(&ok);
if (!ok || ok <= 0) { if (!ok || height <= 0) {
_errorString = "Invalid image height"; _errorString = line + ": invalid image height";
return false; return false;
} }
_size = QSize(width, height); _size = QSize(width, height);
@ -56,19 +51,34 @@ bool GmiFile::parse(QIODevice &device)
CalibrationPoint cp(calibrationPoint(line)); CalibrationPoint cp(calibrationPoint(line));
if (cp.isValid()) if (cp.isValid())
_points.append(cp); _points.append(cp);
else else {
break; if (_points.size() < 2) {
_errorString = line + ": invalid calibration point";
return false;
} else
break;
}
} }
ln++; ln++;
} }
device.close(); if (ln < 6) {
_errorString = "Unexpected EOF";
return false;
}
return (_points.size() >= 2); return true;
} }
GmiFile::GmiFile(QIODevice &file) GmiFile::GmiFile(QIODevice &file) : _valid(false)
{ {
if (!file.open(QIODevice::ReadOnly)) {
_errorString = file.errorString();
return;
}
_valid = parse(file); _valid = parse(file);
file.close();
} }

View File

@ -43,7 +43,7 @@ MapList::ParserMap MapList::parsers()
map.insert("rtmap", &RMap::create); map.insert("rtmap", &RMap::create);
map.insert("map", &MapsforgeMap::create); map.insert("map", &MapsforgeMap::create);
map.insert("map", &OziMap::createMAP); map.insert("map", &OziMap::createMAP);
map.insert("gmi", &OziMap::createMAP); map.insert("gmi", &OziMap::createGMI);
map.insert("kap", &BSBMap::create); map.insert("kap", &BSBMap::create);
map.insert("kmz", &KMZMap::create); map.insert("kmz", &KMZMap::create);
map.insert("aqm", &AQMMap::create); map.insert("aqm", &AQMMap::create);

View File

@ -366,8 +366,10 @@ bool OruxMap::readXML(const QString &path, const QString &dir)
{ {
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly | QFile::Text)) if (!file.open(QFile::ReadOnly | QFile::Text)) {
_errorString = file.errorString();
return false; return false;
}
QXmlStreamReader reader(&file); QXmlStreamReader reader(&file);
if (reader.readNextStartElement()) { if (reader.readNextStartElement()) {

View File

@ -54,19 +54,15 @@ QString OziMap::calibrationFile(const QStringList &files, const QString path,
return QString(); return QString();
} }
OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent) OziMap::OziMap(const QString &fileName, CalibrationType type,
: Map(fileName, parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), const Projection &proj, QObject *parent) : Map(fileName, parent), _img(0),
_valid(false) _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), _valid(false)
{ {
QFileInfo fi(fileName); // TAR maps
QString suffix(fi.suffix().toLower()); if (type == Unknown) {
if (suffix == "tar") {
CalibrationType type;
_tar = new Tar(fileName); _tar = new Tar(fileName);
if (!_tar->open()) { if (!_tar->open()) {
_errorString = "Error reading tar file: " + _tar->errorString(); _errorString = _tar->errorString();
return; return;
} }
QStringList files(_tar->files()); QStringList files(_tar->files());
@ -110,10 +106,12 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
return; return;
_tar->close(); _tar->close();
// regular MAP or GMI maps
} else { } else {
QFile file(fileName); QFile file(fileName);
if (suffix == "map") { if (type == MAP) {
MapFile mf(file); MapFile mf(file);
if (!mf.isValid()) { if (!mf.isValid()) {
_errorString = mf.errorString(); _errorString = mf.errorString();
@ -125,7 +123,7 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
_projection = mf.projection(); _projection = mf.projection();
_transform = mf.transform(); _transform = mf.transform();
} }
} else if (suffix == "gmi") { } else if (type == GMI) {
GmiFile gmi(file); GmiFile gmi(file);
if (!gmi.isValid()) { if (!gmi.isValid()) {
_errorString = gmi.errorString(); _errorString = gmi.errorString();
@ -138,11 +136,9 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
_projection = proj; _projection = proj;
computeTransform(); computeTransform();
} }
} else {
_errorString = "Unknown file type";
return;
} }
QFileInfo fi(fileName);
QDir set(fi.absolutePath() + "/" + "set"); QDir set(fi.absolutePath() + "/" + "set");
if (set.exists()) { if (set.exists()) {
if (!setTileInfo(set.entryList(), set.absolutePath())) if (!setTileInfo(set.entryList(), set.absolutePath()))
@ -266,32 +262,33 @@ bool OziMap::setImageInfo(const QString &path)
bool OziMap::setTileInfo(const QStringList &tiles, const QString &path) bool OziMap::setTileInfo(const QStringList &tiles, const QString &path)
{ {
static const QRegularExpression rx("_[0-9]+_[0-9]+\\.");
if (!_map.size.isValid()) { if (!_map.size.isValid()) {
_errorString = "Missing total image size (IWH)"; _errorString = "Missing total image size (IWH)";
return false; return false;
} }
QRegularExpression rx("_[0-9]+_[0-9]+\\.");
for (int i = 0; i < tiles.size(); i++) { for (int i = 0; i < tiles.size(); i++) {
if (tiles.at(i).contains(rx)) { const QString &tile = tiles.at(i);
_tile.path = QString(tiles.at(i)).replace(rx, "_%1_%2.");
if (tile.contains(rx)) {
QString pattern(QString(tile).replace(rx, "_%1_%2."));
if (_tar) { if (_tar) {
QByteArray ba = _tar->file(tiles.at(i)); QByteArray ba(_tar->file(tile));
QBuffer buffer(&ba); QBuffer buffer(&ba);
_tile.path = pattern;
_tile.size = QImageReader(&buffer).size(); _tile.size = QImageReader(&buffer).size();
} else { } else {
_tile.path = path + "/" + _tile.path; _tile.path = path + "/" + pattern;
_tile.size = QImageReader(path + "/" + tiles.at(i)).size(); _tile.size = QImageReader(path + "/" + tile).size();
}
if (!_tile.size.isValid()) {
_errorString = QString("Error retrieving tile size: "
"%1: Invalid image").arg(QFileInfo(tiles.at(i)).fileName());
return false;
} }
_map.path = QString(); if (_tile.size.isValid())
return true; return true;
else
qWarning("%s: error reading tile image", qPrintable(tile));
} }
} }
@ -373,8 +370,7 @@ void OziMap::drawTiled(QPainter *painter, const QRectF &rect) const
pixmap = QPixmap(tileName); pixmap = QPixmap(tileName);
if (pixmap.isNull()) if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable( qWarning("%s: error loading tile image", qPrintable(tileName));
_tile.path.arg(QString::number(x), QString::number(y))));
else { else {
pixmap.setDevicePixelRatio(_mapRatio); pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height()); QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());
@ -398,8 +394,9 @@ void OziMap::drawOZF(QPainter *painter, const QRectF &rect) const
int y = round(tl.y() * _mapRatio + j * _ozf->tileSize().height()); int y = round(tl.y() * _mapRatio + j * _ozf->tileSize().height());
QPixmap pixmap; QPixmap pixmap;
QString key = _ozf->fileName() + "/" + QString::number(_zoom) + "_" QString key(_ozf->fileName() + "/" + QString::number(_zoom) + "_"
+ QString::number(x) + "_" + QString::number(y); + QString::number(x) + "_" + QString::number(y));
if (!QPixmapCache::find(key, &pixmap)) { if (!QPixmapCache::find(key, &pixmap)) {
pixmap = _ozf->tile(_zoom, x, y); pixmap = _ozf->tile(_zoom, x, y);
if (!pixmap.isNull()) if (!pixmap.isNull())
@ -512,7 +509,7 @@ Map *OziMap::createTAR(const QString &path, const Projection &proj, bool *isDir)
if (isDir) if (isDir)
*isDir = false; *isDir = false;
return new OziMap(path, proj); return new OziMap(path, Unknown, proj);
} }
Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir) Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
@ -520,5 +517,13 @@ Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
if (isDir) if (isDir)
*isDir = false; *isDir = false;
return new OziMap(path, proj); return new OziMap(path, MAP, proj);
}
Map *OziMap::createGMI(const QString &path, const Projection &proj, bool *isDir)
{
if (isDir)
*isDir = false;
return new OziMap(path, GMI, proj);
} }

View File

@ -15,7 +15,11 @@ class OziMap : public Map
Q_OBJECT Q_OBJECT
public: public:
OziMap(const QString &fileName, const Projection &proj, enum CalibrationType {
Unknown, MAP, GMI
};
OziMap(const QString &fileName, CalibrationType type, const Projection &proj,
QObject *parent = 0); QObject *parent = 0);
OziMap(const QString &dirName, Tar &tar, const Projection &proj, OziMap(const QString &dirName, Tar &tar, const Projection &proj,
QObject *parent = 0); QObject *parent = 0);
@ -54,12 +58,10 @@ public:
bool *isDir); bool *isDir);
static Map *createMAP(const QString &path, const Projection &proj, static Map *createMAP(const QString &path, const Projection &proj,
bool *isDir); bool *isDir);
static Map *createGMI(const QString &path, const Projection &proj,
bool *isDir);
private: private:
enum CalibrationType {
Unknown, MAP, GMI
};
struct ImageInfo { struct ImageInfo {
QSize size; QSize size;
QString path; QString path;

View File

@ -327,7 +327,7 @@ QCTMap::QCTMap(const QString &fileName, QObject *parent)
_mapRatio(1.0), _valid(false) _mapRatio(1.0), _valid(false)
{ {
if (!_file.open(QIODevice::ReadOnly)) { if (!_file.open(QIODevice::ReadOnly)) {
_errorString = fileName + ": " + _file.errorString(); _errorString = _file.errorString();
return; return;
} }

View File

@ -97,10 +97,10 @@ static Projection parseProjection(const QString &str, const GCS &gcs)
bool RMap::parseIMP(const QByteArray &data) bool RMap::parseIMP(const QByteArray &data)
{ {
QStringList lines = QString(data).split("\r\n"); static const QRegularExpression re("^P[0-9]+=");
QStringList lines(QString(data).split("\r\n"));
QVector<CalibrationPoint> calibrationPoints; QVector<CalibrationPoint> calibrationPoints;
QString projection, datum; QString projection, datum;
QRegularExpression re("^P[0-9]+=");
for (int i = 0; i < lines.count(); i++) { for (int i = 0; i < lines.count(); i++) {
const QString &line = lines.at(i); const QString &line = lines.at(i);

View File

@ -70,11 +70,11 @@ bool Tar::loadTar()
quint64 size; quint64 size;
qint64 ret; qint64 ret;
while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) { while ((ret = _file.read(buffer, BLOCKSIZE))) {
if (ret < BLOCKSIZE) { if (ret < BLOCKSIZE) {
_file.close(); _file.close();
_index.clear(); _index.clear();
_errorString = "Error reading header block"; _errorString = "Error reading TAR header block";
return false; return false;
} }
size = number(hdr->size, sizeof(hdr->size)); size = number(hdr->size, sizeof(hdr->size));
@ -100,7 +100,7 @@ bool Tar::loadTmi(const QString &path)
return false; return false;
while (!file.atEnd()) { while (!file.atEnd()) {
QByteArray line = file.readLine(4096); QByteArray line(file.readLine(4096));
int pos = line.indexOf(':'); int pos = line.indexOf(':');
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) { if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
qWarning("%s:%d: syntax error", qPrintable(path), ln); qWarning("%s:%d: syntax error", qPrintable(path), ln);