mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-02 22:09:16 +02:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
531edc4862 | |||
e0c807beeb | |||
7d6f70cfd3 | |||
d2fbe4324b | |||
dcf98ef025 | |||
96bf7bd41a | |||
fe3c3dce60 | |||
8d61ed72c6 | |||
b23cc0a4cc | |||
310a113e25 | |||
f83e320f85 | |||
644c854328 | |||
369b12a406 | |||
fcb3abfc76 | |||
0c7508f759 | |||
ad364de7fd | |||
59070c1412 | |||
09aefd1cc1 | |||
442625232c | |||
6b70f4a958 | |||
f810117cbe | |||
7fe82b12fe | |||
94e2d58805 | |||
8046d06e32 | |||
532bd39bc2 | |||
c487d9c66b | |||
37dddbb18c | |||
37a4f80fbb | |||
a531b7859b | |||
ccfda7ca7f | |||
8e867851e9 | |||
5e36d564aa |
@ -1,4 +1,4 @@
|
||||
version: 9.9.{build}
|
||||
version: 9.11.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
@ -8,31 +8,16 @@ image:
|
||||
|
||||
environment:
|
||||
NSISDIR: C:\Program Files (x86)\NSIS
|
||||
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
|
||||
matrix:
|
||||
- QTDIR: C:\Qt\5.15\msvc2019
|
||||
NSI: gpxsee.nsi
|
||||
VCVARS: vcvars32.bat
|
||||
OPENSSLDIR: C:\OpenSSL-v111-Win32\bin
|
||||
LIBCRYPTO: libssl-1_1.dll
|
||||
LIBSSL: libcrypto-1_1.dll
|
||||
- QTDIR: C:\Qt\5.15\msvc2019_64
|
||||
NSI: gpxsee64.nsi
|
||||
VCVARS: vcvars64.bat
|
||||
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
|
||||
LIBCRYPTO: libssl-1_1-x64.dll
|
||||
LIBSSL: libcrypto-1_1-x64.dll
|
||||
- QTDIR: C:\Qt\6.0\msvc2019_64
|
||||
NSI: gpxsee64.nsi
|
||||
VCVARS: vcvars64.bat
|
||||
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
|
||||
LIBCRYPTO: libssl-1_1-x64.dll
|
||||
LIBSSL: libcrypto-1_1-x64.dll
|
||||
- QTDIR: C:\Qt\6.2\msvc2019_64
|
||||
NSISDEF: /DQT6
|
||||
|
||||
install:
|
||||
- cmd: |-
|
||||
set PATH=%QTDIR%\bin;%NSISDIR%;%PATH%
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\"%VCVARS%
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||
|
||||
build_script:
|
||||
- cmd: |-
|
||||
@ -43,17 +28,16 @@ build_script:
|
||||
md installer
|
||||
copy release\GPXSee.exe installer
|
||||
windeployqt --release installer\GPXSee.exe
|
||||
copy pkg\%NSI% installer
|
||||
copy pkg\macros.nsh installer
|
||||
copy pkg\gpxsee64.nsi installer
|
||||
xcopy pkg\csv installer\csv /i
|
||||
xcopy pkg\maps installer\maps /i
|
||||
xcopy lang\*.qm installer\translations\ /sy
|
||||
xcopy icons\symbols installer\symbols /i
|
||||
copy licence.txt installer
|
||||
copy %OPENSSLDIR%\%LIBCRYPTO% installer
|
||||
copy %OPENSSLDIR%\%LIBSSL% installer
|
||||
copy %OPENSSLDIR%\libcrypto-1_1-x64.dll installer
|
||||
copy %OPENSSLDIR%\libssl-1_1-x64.dll installer
|
||||
|
||||
makensis.exe %NSISDEF% installer\%NSI%
|
||||
makensis.exe %NSISDEF% installer\gpxsee64.nsi
|
||||
|
||||
artifacts:
|
||||
- path: installer\GPXSee-*.exe
|
||||
|
31
.github/workflows/osx.yml
vendored
Normal file
31
.github/workflows/osx.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: OS X
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: GPXSee
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- name: Set environment variables
|
||||
run: echo "PATH=/usr/local/opt/qt@5/bin:$PATH" >> $GITHUB_ENV
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: brew install qt5
|
||||
- name: Create localization
|
||||
run: lrelease gpxsee.pro
|
||||
- name: Configure build
|
||||
run: qmake gpxsee.pro
|
||||
- name: Build project
|
||||
run: make -j3
|
||||
- name: Create DMG
|
||||
run: macdeployqt GPXSee.app -dmg
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: GPXSee.dmg
|
||||
path: GPXSee.dmg
|
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
||||
language: c++
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
dist: focal
|
||||
osx_image: xcode12.5
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
|
||||
before_cache:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cleanup; fi
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- qt
|
||||
apt:
|
||||
packages:
|
||||
- qtbase5-dev
|
||||
- qtbase5-private-dev
|
||||
- libqt5opengl5-dev
|
||||
- qttools5-dev-tools
|
||||
|
||||
script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH=/usr/local/opt/qt/bin/:${PATH}; fi
|
||||
- lrelease gpxsee.pro
|
||||
- qmake gpxsee.pro
|
||||
- make
|
@ -18,7 +18,7 @@ GPXSee is a Qt-based GPS log file viewer and analyzer that supports all common G
|
||||
|
||||
## Build
|
||||
Build requirements:
|
||||
* Qt5 >= 5.11 or Qt 6.x
|
||||
* Qt5 >= 5.11 or Qt 6.x*
|
||||
* C++11 or newer compiler (tested: msvc2017, gcc 7.5.0, clang/Apple LLVM version 10.0.0)
|
||||
|
||||
Build steps:
|
||||
@ -28,6 +28,9 @@ qmake gpxsee.pro
|
||||
make # nmake on windows
|
||||
```
|
||||
|
||||
_* Qt6 builds do not support other encodings than UTF-X and iso8859-1 in XML files as support
|
||||
for such files was dropped in Qt6._
|
||||
|
||||
## Download
|
||||
* [Windows & OS X builds](http://sourceforge.net/projects/gpxsee)
|
||||
* [Linux packages](http://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee)
|
||||
|
@ -3,7 +3,7 @@ unix:!macx {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 9.9
|
||||
VERSION = 9.11
|
||||
|
||||
QT += core \
|
||||
gui \
|
||||
@ -13,7 +13,10 @@ QT += core \
|
||||
concurrent \
|
||||
widgets \
|
||||
printsupport
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {QT += openglwidgets}
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
QT += openglwidgets \
|
||||
core5compat
|
||||
}
|
||||
|
||||
CONFIG += object_parallel_to_source
|
||||
INCLUDEPATH += ./src
|
||||
|
400
pkg/gpxsee.nsi
400
pkg/gpxsee.nsi
@ -1,400 +0,0 @@
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "macros.nsh"
|
||||
|
||||
|
||||
Unicode true
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "9.9"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
; Compression method
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
; Required execution level
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; Don't let the OS scale(blur) the installer GUI
|
||||
ManifestDPIAware true
|
||||
|
||||
; The default installation directory
|
||||
InstallDir "$PROGRAMFILES\GPXSee"
|
||||
|
||||
; Installer executable info
|
||||
VIProductVersion "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductVersion" ${VERSION}
|
||||
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
|
||||
VIAddVersionKey "ProductName" "GPXSee"
|
||||
VIAddVersionKey "LegalCopyright" "GPXSee project"
|
||||
VIAddVersionKey "FileDescription" "GPXSee installer"
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||
|
||||
; Registry key for uninstaller
|
||||
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
||||
|
||||
; Start menu page configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\GPXSee"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "GPXSee"
|
||||
|
||||
Var StartMenuFolder
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "licence.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Function .onInit
|
||||
${IfNot} ${AtLeastWin7}
|
||||
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; The stuff to install
|
||||
Section "GPXSee" SEC_APP
|
||||
|
||||
SectionIn RO
|
||||
|
||||
; Set output path to the installation directory
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File /r "maps"
|
||||
File /r "csv"
|
||||
File /r "symbols"
|
||||
|
||||
; Create the uninstaller
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
; Write the installation path into the registry
|
||||
DetailPrint "Registering application..."
|
||||
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
||||
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tůma"
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegStr HKLM "${REGENTRY}" "DisplayIcon" '"$INSTDIR\gpxsee.exe"'
|
||||
WriteRegStr HKLM "${REGENTRY}" "InstallLocation" '"$INSTDIR"'
|
||||
WriteRegStr HKLM "${REGENTRY}" "URLInfoAbout" "https://www.gpxsee.org"
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||
|
||||
; Associate file formats
|
||||
DetailPrint "Associating file types..."
|
||||
!insertmacro FILE_ASSOCIATION_ADD "wpt" "OziExplorer Waypoint File" 1
|
||||
!insertmacro FILE_ASSOCIATION_ADD "loc" "Geocaching.com Waypoint File" 2
|
||||
!insertmacro FILE_ASSOCIATION_ADD "slf" "Sigma Log File" 3
|
||||
!insertmacro FILE_ASSOCIATION_ADD "geojson" "GeoJSON" 4
|
||||
!insertmacro FILE_ASSOCIATION_ADD "cup" "SeeYou CUP File" 5
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gpi" "Garmin POI File" 6
|
||||
!insertmacro FILE_ASSOCIATION_ADD "sml" "Suunto Markup Language" 7
|
||||
!insertmacro FILE_ASSOCIATION_ADD "img" "Garmin IMG Map" 8
|
||||
!insertmacro FILE_ASSOCIATION_ADD "jnx" "Garmin JNX Map" 9
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11
|
||||
!insertmacro FILE_ASSOCIATION_ADD "map" "OziExplorer Map File" 12
|
||||
!insertmacro FILE_ASSOCIATION_ADD "mbtiles" "MBTiles Map File" 13
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14
|
||||
!insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15
|
||||
!insertmacro FILE_ASSOCIATION_ADD "aqm" "AlpineQuest Map File" 16
|
||||
!insertmacro FILE_ASSOCIATION_ADD "sqlitedb" "RMaps SQLite Map File" 17
|
||||
!insertmacro FILE_ASSOCIATION_ADD "ov2" "TomTom POI File" 18
|
||||
!insertmacro FILE_ASSOCIATION_ADD "itn" "TomTom Route File" 19
|
||||
!insertmacro FILE_ASSOCIATION_ADD "wld" "ESRI World File" 20
|
||||
!insertmacro FILE_ASSOCIATION_ADD "jgw" "ESRI World File" 20
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gfw" "ESRI World File" 20
|
||||
!insertmacro FILE_ASSOCIATION_ADD "pgw" "ESRI World File" 20
|
||||
!insertmacro FILE_ASSOCIATION_ADD "tfw" "ESRI World File" 20
|
||||
!insertmacro FILE_ASSOCIATION_ADD "omd" "ONmove Log File" 21
|
||||
!insertmacro FILE_ASSOCIATION_ADD "tcx" "Training Center XML" 22
|
||||
!insertmacro FILE_ASSOCIATION_ADD "ghp" "ONmove Log File" 23
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 24
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kmz" "KML geographic compressed data" 24
|
||||
!insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 25
|
||||
!insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 26
|
||||
!insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 Data" 27
|
||||
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 28
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 29
|
||||
|
||||
WriteRegStr HKCR "Applications\GPXSee.exe\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
WriteRegStr HKCR ".gpx\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tcx\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".kml\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".fit\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".igc\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".nmea\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".plt\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".rte\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".wpt\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".loc\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".slf\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".geojson\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".cup\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".gpi\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".sml\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".ov2\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".itn\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".csv\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".json\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".jpg\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".jpeg\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".img\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tar\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tba\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tif\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tiff\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".xml\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".kmz\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".aqm\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".sqlitedb\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".wld\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".jgw\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".gfw\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".pgw\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tfw\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".omd\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".ghp\OpenWithList" "GPXSee.exe" ""
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "QT framework" SEC_QT
|
||||
|
||||
SectionIn RO
|
||||
|
||||
File "Qt5Core.dll"
|
||||
File "Qt5Gui.dll"
|
||||
File "Qt5Widgets.dll"
|
||||
File "Qt5PrintSupport.dll"
|
||||
File "Qt5Network.dll"
|
||||
File "Qt5Sql.dll"
|
||||
File "Qt5Svg.dll"
|
||||
File "Qt5Concurrent.dll"
|
||||
File /r "platforms"
|
||||
File /r "imageformats"
|
||||
File /r "printsupport"
|
||||
File /r "styles"
|
||||
File /r "sqldrivers"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "MSVC runtime" SEC_MSVC
|
||||
|
||||
SectionIn RO
|
||||
|
||||
SetOutPath $TEMP
|
||||
File "vc_redist.x86.exe"
|
||||
ExecWait '"$TEMP\vc_redist.x86.exe" /install /quiet /norestart'
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "OpenSSL" SEC_OPENSSL
|
||||
|
||||
SectionIn RO
|
||||
|
||||
File "libcrypto-1_1.dll"
|
||||
File "libssl-1_1.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "ANGLE" SEC_ANGLE
|
||||
|
||||
File "libGLESv2.dll"
|
||||
File "libEGL.dll"
|
||||
File "D3DCompiler_47.dll"
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroup "Localization" SEC_LOCALIZATION
|
||||
!insertmacro LOCALIZATION "Chinese (Simplified)" "zh"
|
||||
!insertmacro LOCALIZATION "Czech" "cs"
|
||||
!insertmacro LOCALIZATION "Danish" "da"
|
||||
!insertmacro LOCALIZATION "Esperanto" "eo"
|
||||
!insertmacro LOCALIZATION "Finnish" "fi"
|
||||
!insertmacro LOCALIZATION "French" "fr"
|
||||
!insertmacro LOCALIZATION "German" "de"
|
||||
!insertmacro LOCALIZATION "Hungarian" "hu"
|
||||
!insertmacro LOCALIZATION "Italian" "it"
|
||||
!insertmacro LOCALIZATION "Norwegian" "nb"
|
||||
!insertmacro LOCALIZATION "Polish" "pl"
|
||||
!insertmacro LOCALIZATION "Portuguese (Brazil)" "pt_BR"
|
||||
!insertmacro LOCALIZATION "Russian" "ru"
|
||||
!insertmacro LOCALIZATION "Spanish" "es"
|
||||
!insertmacro LOCALIZATION "Swedish" "sv"
|
||||
!insertmacro LOCALIZATION "Turkish" "tr"
|
||||
!insertmacro LOCALIZATION "Ukrainian" "uk"
|
||||
SectionGroupEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; Remove registry keys
|
||||
DeleteRegKey HKLM "${REGENTRY}"
|
||||
DeleteRegKey HKLM SOFTWARE\GPXSee
|
||||
|
||||
; Remove directories used
|
||||
RMDir /r "$INSTDIR"
|
||||
|
||||
; Remove Start menu entries
|
||||
SetShellVarContext all
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
; Remove file associations
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "gpx"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "tcx"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "kml"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "fit"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "igc"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "nmea"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "plt"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "rte"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "wpt"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "loc"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "slf"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "geojson"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "cup"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "gpi"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "sml"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "img"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "jnx"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "kap"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "map"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "mbtiles"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "rmap"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "tba"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "kmz"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "aqm"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "sqlitedb"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "ov2"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "itn"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "wld"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "jgw"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "gfw"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "pgw"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "tfw"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "omd"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "ghp"
|
||||
|
||||
DeleteRegValue HKCR ".gpx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tcx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kml\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".fit\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".igc\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".nmea\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".plt\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".rte\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".wpt\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".loc\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".slf\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".geojson\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".cup\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".gpi\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".sml\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".ov2\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".itn\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".csv\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".json\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".jpg\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".jpeg\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".img\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tar\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tba\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tif\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tiff\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".xml\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kmz\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".aqm\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".sqlitedb\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".wld\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".jgw\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".gfw\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".pgw\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tfw\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".omd\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".ghp\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegKey HKCR "Applications\GPXSee.exe"
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
SectionEnd
|
||||
|
||||
;-------------------------------
|
||||
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_QT ${LANG_ENGLISH} \
|
||||
"QT cross-platform application framework."
|
||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||
"Microsoft Visual C++ 2017 runtime. If already installed, will be skipped."
|
||||
LangString DESC_OPENSSL ${LANG_ENGLISH} \
|
||||
"OpenSSL library. Required for HTTPS to work."
|
||||
LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
LangString DESC_LOCALIZATION ${LANG_ENGLISH} \
|
||||
"Localization"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALIZATION} $(DESC_LOCALIZATION)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
@ -1,15 +1,43 @@
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "macros.nsh"
|
||||
|
||||
|
||||
; Macros
|
||||
|
||||
; File association
|
||||
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
|
||||
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
!macroend
|
||||
|
||||
!macro FILE_ASSOCIATION_REMOVE EXT
|
||||
DeleteRegKey HKCR "GPXSee.${EXT}"
|
||||
DeleteRegKey HKCR ".${EXT}"
|
||||
!macroend
|
||||
|
||||
; Translations
|
||||
!macro LOCALIZATION LANG CODE
|
||||
Section "${LANG}"
|
||||
IfFileExists "$INSTDIR\translations" +2 0
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
|
||||
!if /FileExists translations\qt_${CODE}.qm
|
||||
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
|
||||
!endif
|
||||
SectionEnd
|
||||
!macroend
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Unicode true
|
||||
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "9.9"
|
||||
!define VERSION "9.11"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
@ -221,6 +249,7 @@ Section "QT framework" SEC_QT
|
||||
File "Qt6Sql.dll"
|
||||
File "Qt6Svg.dll"
|
||||
File "Qt6Widgets.dll"
|
||||
File "Qt6Core5Compat.dll"
|
||||
!else
|
||||
File "Qt5Core.dll"
|
||||
File "Qt5Gui.dll"
|
||||
|
@ -1,24 +0,0 @@
|
||||
; File association
|
||||
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
|
||||
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
|
||||
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
!macroend
|
||||
|
||||
!macro FILE_ASSOCIATION_REMOVE EXT
|
||||
DeleteRegKey HKCR "GPXSee.${EXT}"
|
||||
DeleteRegKey HKCR ".${EXT}"
|
||||
!macroend
|
||||
|
||||
; Translations
|
||||
!macro LOCALIZATION LANG CODE
|
||||
Section "${LANG}"
|
||||
IfFileExists "$INSTDIR\translations" +2 0
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
|
||||
!if /FileExists translations\qt_${CODE}.qm
|
||||
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
|
||||
!endif
|
||||
SectionEnd
|
||||
!macroend
|
@ -104,8 +104,12 @@ void WaypointItem::updateCache()
|
||||
_labelBB = fm.tightBoundingRect(_waypoint.name());
|
||||
|
||||
if (_showIcon && _icon) {
|
||||
p.addRect(-_icon->width()/2.0, -_icon->height(), _icon->width(),
|
||||
_icon->height());
|
||||
if (_font.bold())
|
||||
p.addRect(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
_icon->width() * 1.25, _icon->height() * 1.25);
|
||||
else
|
||||
p.addRect(-_icon->width()/2.0, -_icon->height(), _icon->width(),
|
||||
_icon->height());
|
||||
p.addRect(0, 0, _labelBB.width(), _labelBB.height() + fm.descent());
|
||||
} else {
|
||||
p.addRect(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
@ -113,10 +117,14 @@ void WaypointItem::updateCache()
|
||||
_labelBB.height() + fm.descent());
|
||||
}
|
||||
} else {
|
||||
if (_showIcon && _icon)
|
||||
p.addRect(-_icon->width()/2, -_icon->height(), _icon->width(),
|
||||
_icon->height());
|
||||
else
|
||||
if (_showIcon && _icon) {
|
||||
if (_font.bold())
|
||||
p.addRect(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
_icon->width() * 1.25, _icon->height() * 1.25);
|
||||
else
|
||||
p.addRect(-_icon->width()/2, -_icon->height(), _icon->width(),
|
||||
_icon->height());
|
||||
} else
|
||||
p.addRect(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
}
|
||||
|
||||
@ -143,16 +151,19 @@ void WaypointItem::paint(QPainter *painter,
|
||||
}
|
||||
|
||||
painter->setBrush(QBrush(_color, Qt::SolidPattern));
|
||||
if (_showIcon && _icon)
|
||||
painter->drawPixmap(-_icon->width()/2.0, -_icon->height(), *_icon);
|
||||
else
|
||||
if (_showIcon && _icon) {
|
||||
if (_font.bold())
|
||||
painter->drawPixmap(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
_icon->scaled(_icon->width() * 1.25, _icon->height() * 1.25,
|
||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
else
|
||||
painter->drawPixmap(-_icon->width()/2.0, -_icon->height(), *_icon);
|
||||
} else
|
||||
painter->drawEllipse(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
|
||||
/*
|
||||
painter->setPen(Qt::red);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawPath(_shape);
|
||||
*/
|
||||
//painter->setPen(Qt::red);
|
||||
//painter->setBrush(Qt::NoBrush);
|
||||
//painter->drawPath(_shape);
|
||||
}
|
||||
|
||||
void WaypointItem::setSize(int size)
|
||||
|
@ -1,11 +1,41 @@
|
||||
#include "greatcircle.h"
|
||||
|
||||
#define DELTA 1e-5
|
||||
|
||||
static bool antipodes(const Coordinates &c1, const Coordinates &c2)
|
||||
{
|
||||
return ((qAbs(c1.lat() + c2.lat()) < DELTA)
|
||||
&& (qAbs(180.0 - qAbs(c1.lon() - c2.lon())) < DELTA));
|
||||
}
|
||||
|
||||
GreatCircle::GreatCircle(const Coordinates &c1, const Coordinates &c2)
|
||||
{
|
||||
double lat1 = deg2rad(c1.lat());
|
||||
double lon1 = deg2rad(c1.lon());
|
||||
double lat2 = deg2rad(c2.lat());
|
||||
double lon2 = deg2rad(c2.lon());
|
||||
double lat1, lon1, lat2, lon2;
|
||||
|
||||
if (antipodes(c1, c2)) {
|
||||
/* In case of antipodes (which would lead to garbage output without
|
||||
this hack), move the points DELTA degrees closer to each other in
|
||||
a way that the route never crosses the antimeridian. */
|
||||
if (c1.lon() < c2.lon()) {
|
||||
lon1 = deg2rad(c1.lon() + DELTA);
|
||||
lon2 = deg2rad(c2.lon() - DELTA);
|
||||
} else {
|
||||
lon1 = deg2rad(c1.lon() - DELTA);
|
||||
lon2 = deg2rad(c2.lon() + DELTA);
|
||||
}
|
||||
if (c1.lat() < c2.lat()) {
|
||||
lat1 = deg2rad(c1.lat() + DELTA);
|
||||
lat2 = deg2rad(c2.lat() - DELTA);
|
||||
} else {
|
||||
lat1 = deg2rad(c1.lat() - DELTA);
|
||||
lat2 = deg2rad(c2.lat() + DELTA);
|
||||
}
|
||||
} else {
|
||||
lat1 = deg2rad(c1.lat());
|
||||
lon1 = deg2rad(c1.lon());
|
||||
lat2 = deg2rad(c2.lat());
|
||||
lon2 = deg2rad(c2.lon());
|
||||
}
|
||||
|
||||
double cosLat1 = cos(lat1);
|
||||
double cosLat2 = cos(lat2);
|
||||
|
@ -1,214 +1,59 @@
|
||||
#include <QVector>
|
||||
#include <QTextCodec>
|
||||
#include "textcodec.h"
|
||||
|
||||
static const char32_t cp1250[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
|
||||
0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
|
||||
0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
|
||||
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
|
||||
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
|
||||
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
|
||||
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
|
||||
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
|
||||
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
|
||||
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
|
||||
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9
|
||||
};
|
||||
|
||||
static const char32_t cp1251[] = {
|
||||
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
|
||||
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
|
||||
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,
|
||||
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
|
||||
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F
|
||||
};
|
||||
|
||||
static const char32_t cp1252[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
|
||||
};
|
||||
|
||||
static const char32_t cp1253[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
|
||||
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
||||
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
|
||||
0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
|
||||
0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
|
||||
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
|
||||
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
|
||||
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
|
||||
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000
|
||||
};
|
||||
|
||||
static const char32_t cp1254[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF
|
||||
};
|
||||
|
||||
static const char32_t cp1255[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7,
|
||||
0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
|
||||
0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3,
|
||||
0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
||||
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
||||
0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000
|
||||
};
|
||||
|
||||
static const char32_t cp1256[] = {
|
||||
0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
|
||||
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
|
||||
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
|
||||
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
|
||||
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
|
||||
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
|
||||
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
|
||||
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2,
|
||||
};
|
||||
|
||||
static const char32_t cp1257[] = {
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000,
|
||||
0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7,
|
||||
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
||||
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
||||
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
||||
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
||||
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
||||
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
||||
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9,
|
||||
};
|
||||
|
||||
TextCodec::TextCodec() : _table(cp1252)
|
||||
TextCodec::TextCodec()
|
||||
{
|
||||
|
||||
_codec = QTextCodec::codecForName("Windows-1252");
|
||||
}
|
||||
|
||||
TextCodec::TextCodec(int codepage)
|
||||
{
|
||||
switch (codepage) {
|
||||
case 65001:
|
||||
_table = 0;
|
||||
_codec = 0;
|
||||
break;
|
||||
case 932:
|
||||
_codec = QTextCodec::codecForName("Shift-JIS");
|
||||
break;
|
||||
case 936:
|
||||
_codec = QTextCodec::codecForName("GB18030");
|
||||
break;
|
||||
case 949:
|
||||
_codec = QTextCodec::codecForName("EUC-KR");
|
||||
break;
|
||||
case 950:
|
||||
_codec = QTextCodec::codecForName("Big5");
|
||||
break;
|
||||
case 1250:
|
||||
_table = cp1250;
|
||||
_codec = QTextCodec::codecForName("Windows-1250");
|
||||
break;
|
||||
case 1251:
|
||||
_table = cp1251;
|
||||
_codec = QTextCodec::codecForName("Windows-1251");
|
||||
break;
|
||||
case 1253:
|
||||
_table = cp1253;
|
||||
_codec = QTextCodec::codecForName("Windows-1253");
|
||||
break;
|
||||
case 1254:
|
||||
_table = cp1254;
|
||||
_codec = QTextCodec::codecForName("Windows-1254");
|
||||
break;
|
||||
case 1255:
|
||||
_table = cp1255;
|
||||
_codec = QTextCodec::codecForName("Windows-1255");
|
||||
break;
|
||||
case 1256:
|
||||
_table = cp1256;
|
||||
_codec = QTextCodec::codecForName("Windows-1256");
|
||||
break;
|
||||
case 1257:
|
||||
_table = cp1257;
|
||||
_codec = QTextCodec::codecForName("Windows-1257");
|
||||
break;
|
||||
case 1258:
|
||||
_codec = QTextCodec::codecForName("Windows-1258");
|
||||
break;
|
||||
default:
|
||||
_table = cp1252;
|
||||
_codec = QTextCodec::codecForName("Windows-1252");
|
||||
}
|
||||
}
|
||||
|
||||
QString TextCodec::toString(const QByteArray &ba) const
|
||||
{
|
||||
if (_table)
|
||||
return from8bCp(ba);
|
||||
else
|
||||
return QString::fromUtf8(ba);
|
||||
}
|
||||
|
||||
QString TextCodec::from8bCp(const QByteArray &ba) const
|
||||
{
|
||||
QVector<char32_t> ucs4(ba.size());
|
||||
|
||||
for (int i = 0; i < ba.size(); i++) {
|
||||
quint8 c = (quint8)ba.at(i);
|
||||
if (c < 0x80)
|
||||
ucs4[i] = (char32_t)c;
|
||||
else
|
||||
ucs4[i] = _table[c - 0x80];
|
||||
}
|
||||
|
||||
return QString::fromUcs4(ucs4.constData(), ucs4.size());
|
||||
return _codec ? _codec->toUnicode(ba) : QString::fromUtf8(ba);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QTextCodec;
|
||||
|
||||
class TextCodec
|
||||
{
|
||||
public:
|
||||
@ -12,9 +14,7 @@ public:
|
||||
QString toString(const QByteArray &ba) const;
|
||||
|
||||
private:
|
||||
QString from8bCp(const QByteArray &ba) const;
|
||||
|
||||
const char32_t *_table;
|
||||
QTextCodec *_codec;
|
||||
};
|
||||
|
||||
#endif // TEXTCODEC_H
|
||||
|
@ -537,7 +537,7 @@ static quint32 readPOI(DataStream &stream, QVector<Waypoint> &waypoints,
|
||||
quint8 rs;
|
||||
quint32 ds;
|
||||
qint32 lat, lon;
|
||||
quint16 s3, id;
|
||||
quint16 s3, iconId = 0;
|
||||
QList<TranslatedString> obj;
|
||||
|
||||
rs = stream.readRecordHeader(rh);
|
||||
@ -553,8 +553,7 @@ static quint32 readPOI(DataStream &stream, QVector<Waypoint> &waypoints,
|
||||
while (stream.status() == QDataStream::Ok && ds < rh.size) {
|
||||
switch (stream.nextHeaderType()) {
|
||||
case 4:
|
||||
ds += readIconId(stream, id);
|
||||
icons.append(QPair<int, quint16>(waypoints.size() - 1, id));
|
||||
ds += readIconId(stream, iconId);
|
||||
break;
|
||||
case 10:
|
||||
ds += readDescription(stream, waypoints.last());
|
||||
@ -576,6 +575,8 @@ static quint32 readPOI(DataStream &stream, QVector<Waypoint> &waypoints,
|
||||
}
|
||||
}
|
||||
|
||||
icons.append(QPair<int, quint16>(waypoints.size() - 1, iconId));
|
||||
|
||||
if (ds != rh.size)
|
||||
stream.setStatus(QDataStream::ReadCorruptData);
|
||||
|
||||
@ -659,11 +660,16 @@ static quint32 readSymbol(DataStream &stream, QPixmap &pixmap)
|
||||
img.setColorTable(palette);
|
||||
} else
|
||||
img = QImage((uchar*)data.data(), width, height, lineSize,
|
||||
QImage::Format_RGB32);
|
||||
QImage::Format_RGBX8888).rgbSwapped();
|
||||
pixmap = QPixmap::fromImage(img);
|
||||
|
||||
if (ds != rh.size)
|
||||
/* There should be no more data left in the record, but broken GPI files
|
||||
generated by pinns.co.uk tools exist in the wild so we read out
|
||||
the record as a workaround for such files. */
|
||||
if (ds > rh.size)
|
||||
stream.setStatus(QDataStream::ReadCorruptData);
|
||||
else if (ds < rh.size)
|
||||
stream.skipRawData(rh.size - ds);
|
||||
|
||||
return rs + rh.size;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
}
|
||||
|
||||
bool atEnd() const
|
||||
{return _symbolDataSize + _bs.bitsAvailable() < _table.maxSymbolSize();}
|
||||
{return _symbolDataSize + _bs.bitsAvailable() < _table.symBits();}
|
||||
bool flush() {return _bs.flush();}
|
||||
|
||||
protected:
|
||||
|
@ -8,8 +8,8 @@ static inline quint32 readVUint32(const quint8 *buffer, quint32 bytes)
|
||||
{
|
||||
quint32 val = 0;
|
||||
|
||||
for (quint32 i = bytes; i; i--)
|
||||
val |= ((quint32)*(buffer + i)) << ((i-1) * 8);
|
||||
for (quint32 i = 0; i < bytes; i++)
|
||||
val |= ((quint32)*(buffer + i)) << (i * 8);
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -19,89 +19,83 @@ bool HuffmanTable::load(const RGNFile *rgn, SubFile::Handle &rgnHdl)
|
||||
if (!_buffer.load(rgn, rgnHdl))
|
||||
return false;
|
||||
|
||||
_s0 = (quint8)_buffer.at(0) & 0x0F;
|
||||
_s1e = (quint8)_buffer.at(0) & 0x10;
|
||||
_s2 = (quint8)_buffer.at(1);
|
||||
_s3 = bs(_s2);
|
||||
_s1d = (quint8)_buffer.at(2);
|
||||
_s1f = (quint8)_buffer.at(3);
|
||||
_s20 = bs(_s1f);
|
||||
_s1 = _s20 + 1;
|
||||
_s22 = vs(_buffer.at(4));
|
||||
_s1c = _s3 + 1 + _s22;
|
||||
_s14 = (quint8*)(_buffer.data()) + 4 + _s22;
|
||||
_s10 = _s14 + _s1c * _s1d;
|
||||
_s18 = _s10 + (_s1 << _s0);
|
||||
_aclBits = (quint8)_buffer.at(0) & 0x0F;
|
||||
_huffman = (quint8)_buffer.at(0) & 0x10;
|
||||
_symBits = (quint8)_buffer.at(1);
|
||||
_symBytes = bs(_symBits);
|
||||
_bsrchEntries = (quint8)_buffer.at(2);
|
||||
_symbolBits = (quint8)_buffer.at(3);
|
||||
_symbolBytes = bs(_symbolBits);
|
||||
_aclEntryBytes = _symbolBytes + 1;
|
||||
_indexBytes = vs(_buffer.at(4));
|
||||
_bsrchEntryBytes = _symBytes + _indexBytes + 1;
|
||||
_bsrchTable = (const quint8*)(_buffer.constData()) + 4 + _indexBytes;
|
||||
_aclTable = _bsrchTable + _bsrchEntryBytes * _bsrchEntries;
|
||||
_huffmanTable = _aclTable + (_aclEntryBytes << _aclBits);
|
||||
|
||||
return true;
|
||||
return (_symBits <= 32 && _symbolBits <= 32);
|
||||
}
|
||||
|
||||
quint32 HuffmanTable::symbol(quint32 data, quint8 &size) const
|
||||
{
|
||||
quint32 ss, sym;
|
||||
quint8 *tp;
|
||||
quint32 lo, hi;
|
||||
const quint8 *tp;
|
||||
|
||||
|
||||
if (_s0 == 0) {
|
||||
sym = _s1d - 1;
|
||||
ss = 0;
|
||||
if (!_aclBits) {
|
||||
hi = _bsrchEntries - 1;
|
||||
lo = 0;
|
||||
} else {
|
||||
quint32 offset = _s1 * (data >> (0x20U - _s0));
|
||||
tp = _s10 + offset;
|
||||
quint32 offset = _aclEntryBytes * (data >> (32 - _aclBits));
|
||||
tp = _aclTable + offset;
|
||||
|
||||
if ((*tp & 1) != 0) {
|
||||
sym = readVUint32(tp, _s20);
|
||||
if (*tp & 1) {
|
||||
size = *tp >> 1;
|
||||
return sym;
|
||||
return readVUint32(tp + 1, _symbolBytes);;
|
||||
}
|
||||
|
||||
ss = *tp >> 1;
|
||||
sym = tp[1];
|
||||
lo = *tp >> 1;
|
||||
hi = *(tp + 1);
|
||||
}
|
||||
|
||||
tp = ss * _s1c + _s14;
|
||||
data = data >> (0x20U - _s2);
|
||||
tp = _bsrchTable + (lo * _bsrchEntryBytes);
|
||||
data >>= 32 - _symBits;
|
||||
|
||||
quint8 *prev = tp;
|
||||
while (ss < sym) {
|
||||
quint32 cnt = (ss + 1 + sym) >> 1;
|
||||
tp = _s14 + (cnt * _s1c);
|
||||
quint32 nd = readVUint32(tp - 1, _s3);
|
||||
while (lo < hi) {
|
||||
const quint8 *prev = tp;
|
||||
quint32 m = (lo + 1 + hi) >> 1;
|
||||
tp = _bsrchTable + (m * _bsrchEntryBytes);
|
||||
quint32 nd = readVUint32(tp, _symBytes);
|
||||
|
||||
if (data <= nd) {
|
||||
if (data == nd)
|
||||
ss = cnt;
|
||||
else
|
||||
tp = prev;
|
||||
|
||||
sym = cnt - (data < nd);
|
||||
cnt = ss;
|
||||
if (data < nd) {
|
||||
tp = prev;
|
||||
hi = m - 1;
|
||||
} else if (data > nd) {
|
||||
lo = m;
|
||||
} else {
|
||||
lo = m;
|
||||
hi = m;
|
||||
}
|
||||
ss = cnt;
|
||||
prev = tp;
|
||||
}
|
||||
|
||||
sym = readVUint32(tp - 1, _s3);
|
||||
tp = tp + _s3;
|
||||
ss = readVUint32(tp, _s22);
|
||||
quint32 i = readVUint32(tp, _symBytes);
|
||||
tp = tp + _symBytes;
|
||||
size = *tp;
|
||||
sym = (data - sym) >> (_s2 - *tp);
|
||||
|
||||
if (!_s1e)
|
||||
sym = readVUint32(tp, _s20);
|
||||
if (!_huffman)
|
||||
return readVUint32(tp + 1, _symbolBytes);
|
||||
else {
|
||||
sym = (sym + ss) * _s1f;
|
||||
ss = sym >> 3;
|
||||
sym = sym & 7;
|
||||
quint32 shift = 8 - sym;
|
||||
sym = *(_s18 + ss) >> sym;
|
||||
quint32 bi = readVUint32(tp + 1, _indexBytes);
|
||||
quint32 ci = (data - i) >> (_symBits - size);
|
||||
quint32 si = (ci + bi) * _symbolBits;
|
||||
quint32 sbi = si & 7;
|
||||
quint32 shift = 8 - sbi;
|
||||
tp = _huffmanTable + (si >> 3);
|
||||
|
||||
if (shift < _s1f) {
|
||||
tp = _s18 + ss;
|
||||
ss = readVUint32(tp, ((_s1f + 7) - shift) >> 3);
|
||||
sym = (ss << shift) | sym;
|
||||
}
|
||||
if (shift < _symbolBits) {
|
||||
quint32 val = readVUint32(tp + 1, bs(_symbolBits - shift));
|
||||
return (val << shift) | (*tp >> sbi);
|
||||
} else
|
||||
return (*tp >> sbi);
|
||||
}
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
@ -12,18 +12,19 @@ public:
|
||||
HuffmanTable(quint8 id) : _buffer(id) {}
|
||||
|
||||
bool load(const RGNFile *rgn, SubFile::Handle &rgnHdl);
|
||||
quint8 maxSymbolSize() const {return _s2;}
|
||||
quint32 symbol(quint32 data, quint8 &size) const;
|
||||
|
||||
quint32 symbol(quint32 data, quint8 &size) const;
|
||||
quint8 id() const {return _buffer.id();}
|
||||
|
||||
quint8 symBits() const {return _symBits;}
|
||||
quint8 symbolBits() const {return _symbolBits;}
|
||||
|
||||
private:
|
||||
HuffmanBuffer _buffer;
|
||||
quint8 _s0, _s1, _s2, _s3;
|
||||
quint8 *_s10, *_s14, *_s18;
|
||||
quint8 _s1c, _s1d, _s1f, _s20;
|
||||
quint16 _s22;
|
||||
bool _s1e;
|
||||
const quint8 *_aclTable, *_bsrchTable, *_huffmanTable;
|
||||
quint8 _aclBits, _aclEntryBytes, _symBits, _symBytes, _indexBytes,
|
||||
_bsrchEntryBytes, _bsrchEntries, _symbolBits, _symbolBytes;
|
||||
bool _huffman;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,64 +1,30 @@
|
||||
#include "common/garmin.h"
|
||||
#include "subfile.h"
|
||||
#include "huffmantext.h"
|
||||
|
||||
using namespace Garmin;
|
||||
using namespace IMG;
|
||||
|
||||
static inline quint32 readVUint32(const quint8 *buffer, quint32 bytes)
|
||||
{
|
||||
quint32 val = 0;
|
||||
|
||||
for (quint32 i = 0; i < bytes; i++)
|
||||
val = val | (quint32)*(buffer - i) << ((bytes - i - 1) << 3);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
bool HuffmanText::load(const RGNFile *rgn, SubFile::Handle &rgnHdl)
|
||||
{
|
||||
if (!_buffer.load(rgn, rgnHdl))
|
||||
return false;
|
||||
|
||||
quint8 *buffer = (quint8 *)_buffer.constData();
|
||||
_b0 = buffer[0];
|
||||
_b1 = buffer[1];
|
||||
_b2 = buffer[2];
|
||||
_b3 = buffer[3];
|
||||
_vs = vs(buffer[4]);
|
||||
_bs3 = bs(_b3);
|
||||
_bs1 = bs(_b1);
|
||||
_mul = _bs1 + 1 + _vs;
|
||||
_bp1 = buffer + _vs + 4;
|
||||
_bp2 = _bp1 + _mul * _b2;
|
||||
_bp3 = _bp2 + ((_bs3 + 1) << (_b0 & 0xf));
|
||||
_bp4 = _bp3 - 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HuffmanText::fetch(const SubFile *file, SubFile::Handle &hdl,
|
||||
quint32 &data, quint32 &bits, quint32 &usedBits, quint32 &usedData) const
|
||||
{
|
||||
quint32 rs, ls, old;
|
||||
|
||||
bits = _b1 - bits;
|
||||
bits = _table.symBits() - bits;
|
||||
|
||||
if (usedBits < bits) {
|
||||
old = usedBits ? usedData >> (0x20 - usedBits) : 0;
|
||||
old = usedBits ? usedData >> (32 - usedBits) : 0;
|
||||
if (!file->readVUInt32SW(hdl, 4, usedData))
|
||||
return false;
|
||||
ls = bits - usedBits;
|
||||
rs = 0x20 - (bits - usedBits);
|
||||
rs = 32 - (bits - usedBits);
|
||||
old = usedData >> rs | old << ls;
|
||||
} else {
|
||||
ls = bits;
|
||||
rs = usedBits - bits;
|
||||
old = usedData >> (0x20 - bits);
|
||||
old = usedData >> (32 - bits);
|
||||
}
|
||||
|
||||
usedData = usedData << ls;
|
||||
data = data | old << (0x20 - _b1);
|
||||
data = data | old << (32 - _table.symBits());
|
||||
usedBits = rs;
|
||||
|
||||
return true;
|
||||
@ -71,101 +37,29 @@ bool HuffmanText::decode(const SubFile *file, SubFile::Handle &hdl,
|
||||
quint32 data = 0;
|
||||
quint32 usedBits = 0;
|
||||
quint32 usedData = 0;
|
||||
quint32 ls = 8;
|
||||
quint32 lo = _vs * 8 - 8;
|
||||
|
||||
|
||||
while (true) {
|
||||
if (!fetch(file, hdl, data, bits, usedBits, usedData))
|
||||
return false;
|
||||
|
||||
quint32 off = (data >> (0x20 - (_b0 & 0xf))) * (_bs3 + 1);
|
||||
quint32 sb = _bp2[off];
|
||||
quint32 ss = 0;
|
||||
quint32 sym = _b2 - 1;
|
||||
quint32 size;
|
||||
quint8 size;
|
||||
quint32 sym = _table.symbol(data, size);
|
||||
|
||||
if ((_b0 & 0xf) == 0 || (sb & 1) == 0) {
|
||||
if ((_b0 & 0xf) != 0) {
|
||||
ss = sb >> 1;
|
||||
sym = _bp2[off + 1];
|
||||
}
|
||||
|
||||
quint8 *tp = _bp1 + ss * _mul;
|
||||
quint32 sd = data >> (0x20 - _b1);
|
||||
while (ss < sym) {
|
||||
quint32 cnt = (sym + 1 + ss) >> 1;
|
||||
quint8 *prev = _bp1 + cnt * _mul;
|
||||
quint32 nd = readVUint32(prev + _bs1 - 1, _bs1);
|
||||
|
||||
if (sd <= nd) {
|
||||
sym = cnt - (sd < nd);
|
||||
if (sd < nd) {
|
||||
prev = tp;
|
||||
cnt = ss;
|
||||
}
|
||||
}
|
||||
tp = prev;
|
||||
ss = cnt;
|
||||
}
|
||||
|
||||
quint32 o1 = readVUint32(tp + _bs1 - 1, _bs1);
|
||||
tp = tp + _bs1;
|
||||
quint32 o2 = readVUint32(tp + _vs, _vs);
|
||||
size = tp[0];
|
||||
quint32 os = (sd - o1) >> (_b1 - size);
|
||||
|
||||
if ((_b0 & 0x10) == 0) {
|
||||
sym = readVUint32(_bp4 + (o2 + 1 + os) * _bs3, _bs3);
|
||||
} else {
|
||||
quint32 v = (os + o2) * _b3;
|
||||
quint32 idx = v >> 3;
|
||||
quint32 r = v & 7;
|
||||
quint32 shift = 8 - r;
|
||||
sym = _bp3[idx] >> r;
|
||||
if (shift < _b3) {
|
||||
quint32 sz = bs(_b3 - shift);
|
||||
quint32 val = readVUint32(_bp3 + idx + sz, sz);
|
||||
sym = sym | val << shift;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sym = readVUint32(_bp2 + off + _bs3, _bs3);
|
||||
size = (sb >> 1);
|
||||
}
|
||||
|
||||
if (_b1 < size)
|
||||
if (_table.symBits() < size)
|
||||
return false;
|
||||
data = data << size;
|
||||
bits = _b1 - size;
|
||||
bits = _table.symBits() - size;
|
||||
|
||||
if ((_b3 & 7) == 0) {
|
||||
for (quint32 i = 0; i < (_b3 >> 3); i++) {
|
||||
if (!(_table.symbolBits() & 7)) {
|
||||
for (quint32 i = 0; i < (_table.symbolBits() >> 3); i++) {
|
||||
str.append((quint8)sym);
|
||||
if (((quint8)sym == '\0'))
|
||||
return true;
|
||||
sym = sym >> 8;
|
||||
}
|
||||
} else {
|
||||
quint32 cnt = _b3;
|
||||
|
||||
if (ls <= _b3) {
|
||||
do {
|
||||
quint32 shift = ls;
|
||||
lo = sym << (8 - shift) | (quint32)((quint8)lo >> shift);
|
||||
sym = sym >> shift;
|
||||
str.append((uchar)lo);
|
||||
if (((uchar)lo == '\0'))
|
||||
return true;
|
||||
cnt = cnt - ls;
|
||||
ls = 8;
|
||||
} while (7 < cnt);
|
||||
ls = 8;
|
||||
}
|
||||
if (cnt != 0) {
|
||||
lo = sym << (8 - cnt) | (quint32)((quint8)lo >> cnt);
|
||||
ls = ls - cnt;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
#ifndef IMG_HUFFMANTEXT_H
|
||||
#define IMG_HUFFMANTEXT_H
|
||||
|
||||
#include "huffmanbuffer.h"
|
||||
#include "huffmantable.h"
|
||||
|
||||
namespace IMG {
|
||||
|
||||
class HuffmanText
|
||||
{
|
||||
public:
|
||||
HuffmanText() : _buffer(0) {}
|
||||
HuffmanText() : _table(0) {}
|
||||
|
||||
bool load(const RGNFile *rgn, SubFile::Handle &rgnHdl);
|
||||
bool load(const RGNFile *rgn, SubFile::Handle &rgnHdl)
|
||||
{return _table.load(rgn, rgnHdl);}
|
||||
bool decode(const SubFile *file, SubFile::Handle &hdl,
|
||||
QVector<quint8> &str) const;
|
||||
|
||||
@ -18,20 +19,7 @@ private:
|
||||
bool fetch(const SubFile *file, SubFile::Handle &hdl, quint32 &data,
|
||||
quint32 &bits, quint32 &usedBits, quint32 &usedData) const;
|
||||
|
||||
HuffmanBuffer _buffer;
|
||||
|
||||
quint32 _b0;
|
||||
quint32 _b1;
|
||||
quint32 _b2;
|
||||
quint32 _b3;
|
||||
quint32 _vs;
|
||||
quint32 _bs3;
|
||||
quint32 _bs1;
|
||||
quint32 _mul;
|
||||
quint8 *_bp1;
|
||||
quint8 *_bp2;
|
||||
quint8 *_bp3;
|
||||
quint8 *_bp4;
|
||||
HuffmanTable _table;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize,
|
||||
for (int i = 0; i < str.size(); i++) {
|
||||
const quint8 &c = str.at(i);
|
||||
|
||||
if (c == 0 || c == 0x1d)
|
||||
if (c == 0 || c == 0x1d || c == 0x07)
|
||||
break;
|
||||
|
||||
if (c == 0x1c)
|
||||
|
@ -162,10 +162,12 @@ void RasterTile::render()
|
||||
drawPolygons(&painter);
|
||||
drawLines(&painter);
|
||||
drawTextItems(&painter, textItems);
|
||||
//painter.setPen(Qt::red);
|
||||
//painter.drawRect(QRect(_xy, _img.size()));
|
||||
|
||||
qDeleteAll(textItems);
|
||||
|
||||
//painter.setPen(Qt::red);
|
||||
//painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
//painter.drawRect(QRect(_xy, _pixmap.size()));
|
||||
}
|
||||
|
||||
void RasterTile::ll2xy(QList<MapData::Poly> &polys)
|
||||
|
@ -581,10 +581,9 @@ bool RGNFile::segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) cons
|
||||
|
||||
bool RGNFile::subdivInit(Handle &hdl, SubDiv *subdiv) const
|
||||
{
|
||||
SubDiv::Segment seg[5];
|
||||
SubDiv::Segment extPoints, extLines, extPolygons;
|
||||
SubDiv::Segment std[5], extPoints, extLines, extPolygons;
|
||||
|
||||
if (!segments(hdl, subdiv, seg))
|
||||
if (!segments(hdl, subdiv, std))
|
||||
return false;
|
||||
|
||||
if (subdiv->extPointsOffset() != subdiv->extPointsEnd()) {
|
||||
@ -609,8 +608,8 @@ bool RGNFile::subdivInit(Handle &hdl, SubDiv *subdiv) const
|
||||
extLines = SubDiv::Segment(start, end);
|
||||
}
|
||||
|
||||
subdiv->init(seg[Point], seg[IndexedPoint], seg[Line], seg[Polygon],
|
||||
seg[RoadReference], extPoints, extLines, extPolygons);
|
||||
subdiv->init(std[Point], std[IndexedPoint], std[Line], std[Polygon],
|
||||
std[RoadReference], extPoints, extLines, extPolygons);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define IMG_SUBDIV_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include "common/coordinates.h"
|
||||
#include "common/garmin.h"
|
||||
|
||||
namespace IMG {
|
||||
|
||||
|
Reference in New Issue
Block a user