Compare commits
247 Commits
Author | SHA1 | Date | |
---|---|---|---|
2abc9ae246 | |||
4543311c95 | |||
7bc5021989 | |||
26d2bc4f5d | |||
20f4f72999 | |||
cf62368ffc | |||
072ba10e65 | |||
76b0e9ac2f | |||
530a54e924 | |||
3b1a4f2ccb | |||
723f994527 | |||
743747979e | |||
579d8a5c6e | |||
a019ff3930 | |||
05bcbddf77 | |||
e18ac6da02 | |||
e87999573a | |||
6407dfabea | |||
f8fe454e72 | |||
ad2f108fa8 | |||
418b1a8614 | |||
a59e7a058d | |||
36b5746456 | |||
c0f2c1b7ad | |||
1921087346 | |||
a8299050c5 | |||
e8e1e98775 | |||
6768647070 | |||
de63009edd | |||
125f99e8f4 | |||
092929a967 | |||
fafe6c4b03 | |||
b156e25023 | |||
e15deccfca | |||
9b24bccfed | |||
589c602d21 | |||
b7df3cbe0e | |||
f08f5893a3 | |||
1d5f7db12f | |||
532a1eb69f | |||
1efb4e494d | |||
4653f771a6 | |||
22e5ffaa0c | |||
9a4514a464 | |||
7d47f243ea | |||
18c2613302 | |||
e2bdc1aae6 | |||
a245043573 | |||
42dbc91143 | |||
23a7c6d4eb | |||
b6b4319f89 | |||
8673c00a23 | |||
90280fb018 | |||
285022c17a | |||
e76bb40d10 | |||
bbf5c09377 | |||
e1c7ad18e6 | |||
99792f2984 | |||
6d2e6f64d3 | |||
183cb4825c | |||
7b8fff7440 | |||
a01ff33768 | |||
c3117bb3ac | |||
20fe804293 | |||
525f70f15e | |||
209df67380 | |||
6e40d8cbc7 | |||
0ef28cda0f | |||
1b83f88b27 | |||
a40ed633ae | |||
399299d192 | |||
ec68557de5 | |||
c68fc72387 | |||
3c9da66a51 | |||
22e56e06fd | |||
2e9d173f53 | |||
84b7da13f0 | |||
ed74d0c069 | |||
218eb3be56 | |||
5795395107 | |||
e8b1ce2c29 | |||
ea159a4a79 | |||
f43786e0ae | |||
cae25ba2db | |||
a0c52069c3 | |||
475ca98527 | |||
529aefdb46 | |||
312eb127c4 | |||
e9d93bcc03 | |||
c4353a04a4 | |||
bbc00eadb2 | |||
aef757521c | |||
ce35bfa196 | |||
803ed91b73 | |||
642e75074b | |||
491f9f1cae | |||
c46e656410 | |||
636752991d | |||
c4b6226f8d | |||
6cb209983f | |||
825e5e6068 | |||
2cb186e674 | |||
4f3bdb4370 | |||
91150e97db | |||
f52547dc2c | |||
377ebc0f7a | |||
3418a5ddd6 | |||
0e8760d4c7 | |||
586e2a03f9 | |||
9b135f2579 | |||
9ae771084b | |||
8b4daa43e3 | |||
efd496d38c | |||
5488f5c531 | |||
1c6c47d42d | |||
699baf14bd | |||
ce6486ecd2 | |||
c9330bf273 | |||
06f19bc77c | |||
53f1c66ab0 | |||
2a2dcb926e | |||
97fdcfdd74 | |||
1bc40cd428 | |||
90c1e52fb5 | |||
851e99cc66 | |||
c79ee01912 | |||
fc43076789 | |||
c3f94f8c1a | |||
01310944eb | |||
609596341d | |||
6c27ccf6e5 | |||
4e086ae5f6 | |||
4d74190d27 | |||
5a868e25dd | |||
e53a8b0333 | |||
50e65d95c5 | |||
46dec308f9 | |||
56a5c386ae | |||
6771344c60 | |||
a149a40221 | |||
028d87b443 | |||
74b73d8700 | |||
99365c3ac8 | |||
8dc9bca93e | |||
20fecb3e99 | |||
bec747e90a | |||
e56116b64c | |||
a94602785c | |||
d083e217f9 | |||
f370642c81 | |||
f675558014 | |||
a1167f3daa | |||
52fc890697 | |||
1366dd0f53 | |||
ca1e5d8dae | |||
f6f3741796 | |||
24584c44c3 | |||
23e8154a1f | |||
7118794b26 | |||
5af3808895 | |||
1f2e460c87 | |||
57c524e08a | |||
e35cf68309 | |||
3be8ec748a | |||
5ba00e016b | |||
0f3fea5460 | |||
e7d6c3f76a | |||
ca0089e486 | |||
c9930a7aa3 | |||
c9b06ba3cf | |||
a168d28d81 | |||
8f05346ced | |||
8e62bd83d6 | |||
471ea7a6ee | |||
353a606864 | |||
3dc998a5c0 | |||
22e25671ce | |||
6d07af868e | |||
d9f57eddf2 | |||
ad664d5299 | |||
13dc02d144 | |||
306116dbde | |||
ca1c576562 | |||
feb1650ed0 | |||
e6e41c846c | |||
20adecec89 | |||
8cb08d05ca | |||
7bd03494db | |||
7ba19b8c0a | |||
25869200db | |||
af0bb2e268 | |||
844607f6ce | |||
ba0b7c62a4 | |||
e701ad0ed0 | |||
c3ba8f1f0d | |||
b98143ef8c | |||
eb04666e38 | |||
d593748e1b | |||
a03aa81c0a | |||
d56c748983 | |||
d9de386c34 | |||
dd038deddd | |||
3b20d00386 | |||
4583869e2b | |||
b2c6a5807c | |||
e14fc6b204 | |||
71a8affdeb | |||
8ed9c7053b | |||
53b8c1c846 | |||
98a04cbafc | |||
d51b97f586 | |||
2304fb5350 | |||
8ee21a8080 | |||
2df916eb95 | |||
0121381d18 | |||
93aadb7e74 | |||
40febb8c0e | |||
1e5b18d86a | |||
8f9af0d973 | |||
208e31c6de | |||
959d08ba94 | |||
5f16f7b367 | |||
baee8b3484 | |||
c694c3e300 | |||
1458d66798 | |||
62fa0cce36 | |||
b115c041be | |||
f63c1fee1c | |||
88d9f10a78 | |||
ec06793a19 | |||
53cdc86aa0 | |||
82ea54cacc | |||
d8fb7cb41e | |||
5041d935f0 | |||
98f9aab9d9 | |||
8bc91c760a | |||
e96400e564 | |||
e088f03cf9 | |||
e3582cc5cf | |||
fc033826a1 | |||
8cf4c474f2 | |||
351a969606 | |||
2234245e81 | |||
681de81b1c | |||
a5ae41f8ad | |||
576a063dcb | |||
c5e46957a8 |
@ -1,4 +1,4 @@
|
||||
version: 10.5.{build}
|
||||
version: 11.6.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
@ -11,7 +11,7 @@ environment:
|
||||
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
|
||||
matrix:
|
||||
- QTDIR: C:\Qt\5.15\msvc2019_64
|
||||
- QTDIR: C:\Qt\6.2\msvc2019_64
|
||||
- QTDIR: C:\Qt\6.4\msvc2019_64
|
||||
NSISDEF: /DQT6
|
||||
|
||||
install:
|
||||
|
53
.github/workflows/android.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Android
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: GPXSee
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '11'
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v2
|
||||
- name: Run sdkmanager update
|
||||
run: ${ANDROID_HOME}/tools/bin/sdkmanager --update
|
||||
- name: Install android platform, platform-tools, build-tools and ndk
|
||||
run: ${ANDROID_HOME}/tools/bin/sdkmanager --install "cmdline-tools;latest" "platform-tools" "platforms;android-31" "build-tools;31.0.0" "ndk;23.1.7779620"
|
||||
- name: Setup NDK path
|
||||
run: echo "ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk/23.1.7779620/" >> $GITHUB_ENV
|
||||
- name: Install Qt (Desktop)
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
aqtversion: '==2.1.0'
|
||||
version: '6.4.0'
|
||||
- name: Install Qt (Android)
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
aqtversion: '==2.1.0'
|
||||
version: '6.4.0'
|
||||
target: 'android'
|
||||
arch: 'android_armv7'
|
||||
modules: qtpositioning qt5compat
|
||||
- name: Install Android OpenSSL
|
||||
run: git clone https://github.com/KDAB/android_openssl.git
|
||||
- name: Create localization
|
||||
run: lrelease gpxsee.pro
|
||||
- name: Configure build
|
||||
run: qmake gpxsee.pro OPENSSL_PATH=android_openssl
|
||||
- name: Build project
|
||||
run: make -j2 apk
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: GPXSee-armv7.apk
|
||||
path: android-build/build/outputs/apk/debug/android-build-debug.apk
|
2
.github/workflows/linux.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev
|
||||
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev libqt5svg5-dev
|
||||
- name: Create localization
|
||||
run: lrelease gpxsee.pro
|
||||
- name: Configure build
|
||||
|
2
.github/workflows/osx.yml
vendored
@ -8,7 +8,7 @@ on:
|
||||
jobs:
|
||||
qt5:
|
||||
name: GPXSee Qt5 build
|
||||
runs-on: macos-10.15
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Set environment variables
|
||||
run: echo "PATH=/usr/local/opt/qt@5/bin:$PATH" >> $GITHUB_ENV
|
||||
|
15
README.md
@ -11,7 +11,8 @@ GPS log file formats.
|
||||
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
|
||||
Garmin IMG/GMAP & JNX maps, TwoNav RMaps, GeoTIFF images, BSB charts, KMZ maps,
|
||||
AlpineQuest maps, Locus/OsmAnd/RMaps SQLite maps, Mapsforge vector maps,
|
||||
QCT maps, ESRI World-File georeferenced images).
|
||||
QCT maps, GEMF maps, Osmdroid SQLite maps, Orux maps,
|
||||
ESRI World-File georeferenced images).
|
||||
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts
|
||||
graphs.
|
||||
* Support for DEM files (SRTM HGT).
|
||||
@ -21,13 +22,13 @@ GPS log file formats.
|
||||
* Full-screen mode.
|
||||
* HiDPI/Retina displays & maps support.
|
||||
* Real-time GPS position.
|
||||
* Native GUI for Windows, Mac OS X and Linux.
|
||||
* Windows, macOS, Linux and Android builds.
|
||||
|
||||

|
||||
|
||||
## Build
|
||||
Build requirements:
|
||||
* Qt5 >= 5.11 or Qt 6.x*
|
||||
* Qt5 >= 5.11 or Qt6 >= 6.2 (Android builds require Qt6)
|
||||
* C++11 or newer compiler (tested: msvc2017, gcc 7.5.0, clang/Apple LLVM version
|
||||
10.0.0)
|
||||
|
||||
@ -38,12 +39,12 @@ 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)
|
||||
* [Windows & OS X builds](https://sourceforge.net/projects/gpxsee)
|
||||
* [Linux packages](https://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee)
|
||||
* [Android APKs](https://play.google.com/store/apps/details?id=org.gpxsee.gpxsee)
|
||||
|
||||
## Changelog
|
||||
[Changelog](https://build.opensuse.org/package/view_file/home:tumic:GPXSee/gpxsee/gpxsee.changes)
|
||||
|
65
gpxsee.pro
@ -1,9 +1,9 @@
|
||||
unix:!macx {
|
||||
unix:!macx:!android {
|
||||
TARGET = gpxsee
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 10.5
|
||||
VERSION = 11.6
|
||||
|
||||
QT += core \
|
||||
gui \
|
||||
@ -13,7 +13,8 @@ QT += core \
|
||||
concurrent \
|
||||
widgets \
|
||||
printsupport \
|
||||
positioning
|
||||
positioning \
|
||||
svg
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
QT += openglwidgets \
|
||||
core5compat
|
||||
@ -24,6 +25,7 @@ INCLUDEPATH += ./src
|
||||
HEADERS += src/common/config.h \
|
||||
src/GUI/crosshairitem.h \
|
||||
src/GUI/motioninfoitem.h \
|
||||
src/GUI/navigationwidget.h \
|
||||
src/GUI/pluginparameters.h \
|
||||
src/common/garmin.h \
|
||||
src/common/coordinates.h \
|
||||
@ -112,8 +114,12 @@ HEADERS += src/common/config.h \
|
||||
src/GUI/pngexportdialog.h \
|
||||
src/GUI/timezoneinfo.h \
|
||||
src/GUI/passwordedit.h \
|
||||
src/data/style.h \
|
||||
src/data/twonavparser.h \
|
||||
src/map/IMG/section.h \
|
||||
src/map/gemfmap.h \
|
||||
src/map/oruxmap.h \
|
||||
src/map/osmdroidmap.h \
|
||||
src/map/proj/polyconic.h \
|
||||
src/map/proj/webmercator.h \
|
||||
src/map/proj/transversemercator.h \
|
||||
@ -246,6 +252,7 @@ HEADERS += src/common/config.h \
|
||||
SOURCES += src/main.cpp \
|
||||
src/GUI/crosshairitem.cpp \
|
||||
src/GUI/motioninfoitem.cpp \
|
||||
src/GUI/navigationwidget.cpp \
|
||||
src/GUI/pluginparameters.cpp \
|
||||
src/common/coordinates.cpp \
|
||||
src/common/rectc.cpp \
|
||||
@ -315,6 +322,9 @@ SOURCES += src/main.cpp \
|
||||
src/GUI/projectioncombobox.cpp \
|
||||
src/GUI/passwordedit.cpp \
|
||||
src/data/twonavparser.cpp \
|
||||
src/map/gemfmap.cpp \
|
||||
src/map/oruxmap.cpp \
|
||||
src/map/osmdroidmap.cpp \
|
||||
src/map/proj/polyconic.cpp \
|
||||
src/map/proj/webmercator.cpp \
|
||||
src/map/proj/transversemercator.cpp \
|
||||
@ -448,7 +458,8 @@ TRANSLATIONS = lang/gpxsee_en.ts \
|
||||
lang/gpxsee_hu.ts \
|
||||
lang/gpxsee_it.ts \
|
||||
lang/gpxsee_eo.ts \
|
||||
lang/gpxsee_zh.ts
|
||||
lang/gpxsee_zh.ts \
|
||||
lang/gpxsee_ca.ts
|
||||
|
||||
macx {
|
||||
ICON = icons/app/gpxsee.icns
|
||||
@ -499,12 +510,13 @@ win32 {
|
||||
icons/formats/omd.ico \
|
||||
icons/formats/ghp.ico \
|
||||
icons/formats/qct.ico \
|
||||
icons/formats/trk.ico
|
||||
icons/formats/trk.ico \
|
||||
icons/formats/gemf.ico
|
||||
DEFINES += _USE_MATH_DEFINES \
|
||||
NOGDI
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
unix:!macx:!android {
|
||||
isEmpty(PREFIX):PREFIX = /usr/local
|
||||
|
||||
maps.files = $$files(pkg/maps/*)
|
||||
@ -524,3 +536,44 @@ unix:!macx {
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target maps csv symbols locale icon desktop mime
|
||||
}
|
||||
|
||||
android {
|
||||
defineReplace(versionCode) {
|
||||
segments = $$split(1, ".")
|
||||
for (segment, segments): \
|
||||
vCode = "$$first(vCode)$$format_number($$segment, width=3 zeropad)"
|
||||
contains(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
suffix = 0
|
||||
contains(ANDROID_TARGET_ARCH, arm64-v8a): \
|
||||
suffix = 1
|
||||
contains(ANDROID_TARGET_ARCH, x86): \
|
||||
suffix = 2
|
||||
contains(ANDROID_TARGET_ARCH, x86_64): \
|
||||
suffix = 3
|
||||
|
||||
return($$first(vCode)$$first(suffix))
|
||||
}
|
||||
|
||||
!include($$OPENSSL_PATH/openssl.pri) {
|
||||
message("OpenSSL not found, building without HTTPS support!")
|
||||
}
|
||||
|
||||
ANDROID_TARGET_SDK_VERSION = 31
|
||||
ANDROID_VERSION_NAME = $$VERSION
|
||||
ANDROID_VERSION_CODE = $$versionCode($$ANDROID_VERSION_NAME)
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/pkg/android
|
||||
DISTFILES += \
|
||||
pkg/android/AndroidManifest.xml \
|
||||
pkg/android/build.gradle \
|
||||
pkg/android/res/values/libs.xml
|
||||
|
||||
maps.files = $$files(pkg/maps/*)
|
||||
maps.path = /assets/maps
|
||||
csv.files = $$files(pkg/csv/*)
|
||||
csv.path = /assets/csv
|
||||
symbols.files = $$files(icons/symbols/*.png)
|
||||
symbols.path = /assets/symbols
|
||||
translations.files = $$files(lang/*.qm)
|
||||
translations.path = /assets/translations
|
||||
INSTALLS += maps csv symbols translations
|
||||
}
|
||||
|
@ -155,6 +155,11 @@
|
||||
<file alias="church.png">icons/IMG/marine/church.png</file>
|
||||
<file alias="triangulation-point.png">icons/IMG/marine/triangulation-point.png</file>
|
||||
<file alias="yacht-harbor.png">icons/IMG/marine/yacht-harbor.png</file>
|
||||
<file alias="pile.png">icons/IMG/marine/pile.png</file>
|
||||
<file alias="spar-buoy.png">icons/IMG/marine/spar-buoy.png</file>
|
||||
<file alias="mooring-buoy.png">icons/IMG/marine/mooring-buoy.png</file>
|
||||
<file alias="tower.png">icons/IMG/marine/tower.png</file>
|
||||
<file alias="chimney.png">icons/IMG/marine/chimney.png</file>
|
||||
</qresource>
|
||||
|
||||
<!-- Mapsforge rendertheme -->
|
||||
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 232 B |
BIN
icons/IMG/marine/chimney.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
icons/IMG/marine/mooring-buoy.png
Normal file
After Width: | Height: | Size: 445 B |
BIN
icons/IMG/marine/pile.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
icons/IMG/marine/spar-buoy.png
Normal file
After Width: | Height: | Size: 430 B |
BIN
icons/IMG/marine/tower.png
Normal file
After Width: | Height: | Size: 478 B |
BIN
icons/formats/gemf.icns
Normal file
BIN
icons/formats/gemf.ico
Normal file
After Width: | Height: | Size: 305 KiB |
@ -29,3 +29,4 @@ omd:#ed09cb
|
||||
ghp:#ed09cb
|
||||
qct:#370642
|
||||
trk:#cccccc
|
||||
gemf:#147085
|
||||
|
2528
lang/gpxsee_ca.ts
Normal file
2375
lang/gpxsee_ko.ts
Normal file
1015
lang/gpxsee_nb.ts
1067
lang/gpxsee_uk.ts
113
pkg/Info.plist
@ -462,6 +462,20 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>xml</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.orux.map+xml</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Orux Map File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
@ -478,6 +492,38 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>gemf</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.cgtk.gemf</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>icons/gemf.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>GEMF Map File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>sqlite</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.osmdroid.sqlite</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>icons/sqlt.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Osmdroid SQLite Map File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
@ -1235,6 +1281,52 @@
|
||||
<string>application/vnd.alpinequest.aqm</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>uk.co.cgtk.gemf</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>https://www.cgtk.co.uk/gemf</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>GEMF Map File</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>icons/gemf.icns</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>gemf</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.cgtk.gemf</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>org.osmdroid.sqlite</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>https://github.com/osmdroid/osmdroid</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Osmdroid SQLite Map File</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>icons/sqlt.icns</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>sqlite</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.osmdroid.sqlite</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.robert.maps</string>
|
||||
@ -1446,6 +1538,27 @@
|
||||
<string>application/vnd.twonav.trk</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.oruxmap.xml</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>https://www.oruxmaps.com/OruxMapsManual-9.0_en.pdf</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Orux Map File</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.xml</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>xml</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.orux.map+xml</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
|
18
pkg/android/AndroidManifest.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.gpxsee.gpxsee" android:installLocation="auto" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:versionName="-- %%INSERT_VERSION_NAME%% --">
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
|
||||
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:extractNativeLibs="true" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:icon="@drawable/icon">
|
||||
<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
||||
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
|
||||
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
78
pkg/android/build.gradle
Normal file
@ -0,0 +1,78 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
}
|
||||
|
||||
android {
|
||||
/*******************************************************
|
||||
* The following variables:
|
||||
* - androidBuildToolsVersion,
|
||||
* - androidCompileSdkVersion
|
||||
* - qtAndroidDir - holds the path to qt android files
|
||||
* needed to build any Qt application
|
||||
* on Android.
|
||||
*
|
||||
* are defined in gradle.properties file. This file is
|
||||
* updated by QtCreator and androiddeployqt tools.
|
||||
* Changing them manually might break the compilation!
|
||||
*******************************************************/
|
||||
|
||||
compileSdkVersion androidCompileSdkVersion.toInteger()
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
ndkVersion androidNdkVersion
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = [qtAndroidDir + '/src', 'src', 'java']
|
||||
aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl']
|
||||
res.srcDirs = [qtAndroidDir + '/res', 'res']
|
||||
resources.srcDirs = ['resources']
|
||||
renderscript.srcDirs = ['src']
|
||||
assets.srcDirs = ['assets']
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.incremental = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
// Do not compress Qt binary resources file
|
||||
aaptOptions {
|
||||
noCompress 'rcc'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
resConfig "en"
|
||||
minSdkVersion qtMinSdkVersion
|
||||
targetSdkVersion qtTargetSdkVersion
|
||||
ndk.abiFilters = qtTargetAbiList.split(",")
|
||||
}
|
||||
}
|
14
pkg/android/gradle.properties
Normal file
@ -0,0 +1,14 @@
|
||||
# Project-wide Gradle settings.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# Enable building projects in parallel
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Gradle caching allows reusing the build artifacts from a previous
|
||||
# build with the same inputs. However, over time, the cache size will
|
||||
# grow. Uncomment the following line to enable it.
|
||||
#org.gradle.caching=true
|
BIN
pkg/android/res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
pkg/android/res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
pkg/android/res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
pkg/android/res/drawable-xhdpi/icon.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
pkg/android/res/drawable-xxhdpi/icon.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
pkg/android/res/drawable-xxxhdpi/icon.png
Normal file
After Width: | Height: | Size: 12 KiB |
20
pkg/android/res/values/libs.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<!-- DO NOT EDIT THIS: This file is populated automatically by the deployment tool. -->
|
||||
|
||||
<array name="bundled_libs">
|
||||
<!-- %%INSERT_EXTRA_LIBS%% -->
|
||||
</array>
|
||||
|
||||
<array name="qt_libs">
|
||||
<!-- %%INSERT_QT_LIBS%% -->
|
||||
</array>
|
||||
|
||||
<array name="load_local_libs">
|
||||
<!-- %%INSERT_LOCAL_LIBS%% -->
|
||||
</array>
|
||||
|
||||
<string name="static_init_classes"><!-- %%INSERT_INIT_CLASSES%% --></string>
|
||||
<string name="use_local_qt_libs"><!-- %%USE_LOCAL_QT_LIBS%% --></string>
|
||||
<string name="bundle_local_qt_libs"><!-- %%BUNDLE_LOCAL_QT_LIBS%% --></string>
|
||||
</resources>
|
@ -21,7 +21,9 @@
|
||||
<li>Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
|
||||
TwoNav RMaps, Garmin IMG & JNX maps, GeoTIFF images,
|
||||
BSB nautical charts, KMZ maps, AlpineQuest maps,
|
||||
Mapsforge maps, QCT maps, ESRI world files).</li>
|
||||
Locus/OsmAnd/RMaps SQLite maps, Osmdroid SQLite maps,
|
||||
Mapsforge maps, QCT maps, GEMF maps, Orux maps,
|
||||
ESRI world files).</li>
|
||||
<li>Elevation, speed, heart rate, cadence, power, temperature and
|
||||
gear ratio graphs.</li>
|
||||
<li>Support for multiple tracks in one view.</li>
|
||||
@ -92,6 +94,7 @@
|
||||
<mimetype>application/vnd.google-earth.kmz</mimetype>
|
||||
<mimetype>application/vnd.alpinequest.aqm</mimetype>
|
||||
<mimetype>application/vnd.rmaps.sqlite</mimetype>
|
||||
<mimetype>application/vnd.osmdroid.sqlite</mimetype>
|
||||
<mimetype>application/vnd.mapsforge.map</mimetype>
|
||||
<mimetype>application/vnd.tomtom.ov2</mimetype>
|
||||
<mimetype>application/vnd.tomtom.itn</mimetype>
|
||||
@ -102,5 +105,7 @@
|
||||
<mimetype>application/vnd.twonav.trk</mimetype>
|
||||
<mimetype>application/vnd.twonav.rte</mimetype>
|
||||
<mimetype>application/vnd.twonav.wpt</mimetype>
|
||||
<mimetype>application/vnd.cgtk.gemf</mimetype>
|
||||
<mimetype>application/vnd.orux.map+xml</mimetype>
|
||||
</mimetypes>
|
||||
</component>
|
||||
|
@ -15,4 +15,4 @@ Icon=gpxsee
|
||||
Terminal=false
|
||||
Type=Application
|
||||
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.rmaps.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
|
||||
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
|
||||
|
@ -279,6 +279,13 @@
|
||||
<glob pattern="*.aqm"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.cgtk.gemf">
|
||||
<comment>GEMF Map File</comment>
|
||||
<sub-class-of type="application/octet-stream"/>
|
||||
<generic-icon name="application/octet-stream"/>
|
||||
<glob pattern="*.gemf"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.rmaps.sqlite">
|
||||
<comment>RMaps SQLite Map File</comment>
|
||||
<sub-class-of type="application/vnd.sqlite3"/>
|
||||
@ -286,6 +293,13 @@
|
||||
<glob pattern="*.sqlitedb"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.osmdroid.sqlite">
|
||||
<comment>Osmdroid SQLite Map File</comment>
|
||||
<sub-class-of type="application/vnd.sqlite3"/>
|
||||
<generic-icon name="application/octet-stream"/>
|
||||
<glob pattern="*.sqlite"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.mapsforge.map">
|
||||
<comment>Mapsforge Map File</comment>
|
||||
<sub-class-of type="application/octet-stream"/>
|
||||
@ -317,4 +331,12 @@
|
||||
<glob pattern="*.qct"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.orux.map+xml">
|
||||
<comment>Orux Map File</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<generic-icon name="application-xml"/>
|
||||
<root-XML namespaceURI="http://oruxtracker.com/app/res/calibration" localName="OruxTracker"/>
|
||||
<glob pattern="*.otrk2.xml"/>
|
||||
</mime-type>
|
||||
|
||||
</mime-info>
|
||||
|
@ -37,7 +37,7 @@ Unicode true
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "10.5"
|
||||
!define VERSION "11.6"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
@ -166,6 +166,7 @@ Section "GPXSee" SEC_APP
|
||||
!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 "sqlite" "Osmdroid SQLite Map File" 17
|
||||
!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
|
||||
@ -179,13 +180,14 @@ Section "GPXSee" SEC_APP
|
||||
!insertmacro FILE_ASSOCIATION_ADD "ghp" "ONmove Log File" 23
|
||||
!insertmacro FILE_ASSOCIATION_ADD "qct" "QuickChart Map File" 24
|
||||
!insertmacro FILE_ASSOCIATION_ADD "trk" "TwoNav Track File" 25
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 26
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kmz" "KML geographic compressed data" 26
|
||||
!insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 27
|
||||
!insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 28
|
||||
!insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 Data" 29
|
||||
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 30
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 31
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gemf" "GEMF Map File" 26
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 27
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kmz" "KML geographic compressed data" 27
|
||||
!insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 28
|
||||
!insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 29
|
||||
!insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 Data" 30
|
||||
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 31
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 32
|
||||
|
||||
WriteRegStr HKCR "Applications\GPXSee.exe\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
WriteRegStr HKCR ".gpx\OpenWithList" "GPXSee.exe" ""
|
||||
@ -223,6 +225,7 @@ Section "GPXSee" SEC_APP
|
||||
WriteRegStr HKCR ".xml\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".kmz\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".aqm\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".sqlite\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".sqlitedb\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".wld\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".jgw\OpenWithList" "GPXSee.exe" ""
|
||||
@ -233,6 +236,7 @@ Section "GPXSee" SEC_APP
|
||||
WriteRegStr HKCR ".ghp\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".qct\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".trk\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".gemf\OpenWithList" "GPXSee.exe" ""
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
||||
@ -309,6 +313,7 @@ SectionEnd
|
||||
!endif
|
||||
|
||||
SectionGroup "Localization" SEC_LOCALIZATION
|
||||
!insertmacro LOCALIZATION "Catalan" "ca"
|
||||
!insertmacro LOCALIZATION "Chinese (Simplified)" "zh"
|
||||
!insertmacro LOCALIZATION "Czech" "cs"
|
||||
!insertmacro LOCALIZATION "Danish" "da"
|
||||
@ -373,6 +378,7 @@ Section "Uninstall"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "tba"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "kmz"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "aqm"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "sqlite"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "sqlitedb"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "ov2"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "itn"
|
||||
@ -385,6 +391,7 @@ Section "Uninstall"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "ghp"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "qct"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "trk"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "gemf"
|
||||
|
||||
DeleteRegValue HKCR ".gpx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tcx\OpenWithList" "GPXSee.exe"
|
||||
@ -421,6 +428,7 @@ Section "Uninstall"
|
||||
DeleteRegValue HKCR ".xml\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kmz\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".aqm\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".sqlite\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".sqlitedb\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".wld\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".jgw\OpenWithList" "GPXSee.exe"
|
||||
@ -431,6 +439,7 @@ Section "Uninstall"
|
||||
DeleteRegValue HKCR ".ghp\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".qct\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".trk\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".gemf\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegKey HKCR "Applications\GPXSee.exe"
|
||||
|
||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||
|
@ -2,7 +2,7 @@
|
||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||
<name>USGS Imagery</name>
|
||||
<url>https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/$z/$y/$x</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<zoom min="2" max="16"/>
|
||||
<bounds bottom="0" top="74"/>
|
||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||
</map>
|
||||
|
@ -2,6 +2,6 @@
|
||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||
<name>USGS Topo</name>
|
||||
<url>https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/$z/$y/$x</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<zoom min="2" max="16"/>
|
||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||
</map>
|
||||
|
@ -61,6 +61,10 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
||||
Waypoint::loadSymbolIcons(ProgramPaths::symbolsDir());
|
||||
|
||||
_gui = new GUI();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
connect(this, &App::applicationStateChanged, this, &App::appStateChanged);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
App::~App()
|
||||
@ -93,6 +97,14 @@ int App::run()
|
||||
return exec();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void App::appStateChanged(Qt::ApplicationState state)
|
||||
{
|
||||
if (state == Qt::ApplicationSuspended)
|
||||
_gui->writeSettings();
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
bool App::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
class GUI;
|
||||
|
||||
class App : QApplication
|
||||
class App : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -17,6 +17,11 @@ public:
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
private slots:
|
||||
void appStateChanged(Qt::ApplicationState state);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
private:
|
||||
void loadDatums();
|
||||
void loadPCSs();
|
||||
|
@ -27,11 +27,13 @@ AreaItem::AreaItem(const Area &area, Map *map, GraphicsItem *parent)
|
||||
{
|
||||
_map = map;
|
||||
_digitalZoom = 0;
|
||||
|
||||
_width = 2;
|
||||
_opacity = 0.5;
|
||||
QBrush brush(Qt::SolidPattern);
|
||||
_pen = QPen(brush, _width);
|
||||
_color = Qt::black;
|
||||
_penStyle = Qt::SolidLine;
|
||||
|
||||
_pen = QPen(strokeColor(), width());
|
||||
_brush = QBrush(fillColor());
|
||||
|
||||
updatePainterPath();
|
||||
|
||||
@ -89,52 +91,85 @@ void AreaItem::setMap(Map *map)
|
||||
updatePainterPath();
|
||||
}
|
||||
|
||||
const QColor &AreaItem::strokeColor() const
|
||||
{
|
||||
return (_useStyle && _area.style().isValid())
|
||||
? _area.style().stroke() : _color;
|
||||
}
|
||||
|
||||
QColor AreaItem::fillColor() const
|
||||
{
|
||||
if (_useStyle && _area.style().isValid())
|
||||
return _area.style().fill();
|
||||
else {
|
||||
QColor fc(_color);
|
||||
fc.setAlphaF(_opacity * _color.alphaF());
|
||||
return fc;
|
||||
}
|
||||
}
|
||||
|
||||
void AreaItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
_color = color;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
QColor bc(color);
|
||||
bc.setAlphaF(_opacity * color.alphaF());
|
||||
|
||||
_pen.setColor(color);
|
||||
_brush = QBrush(bc);
|
||||
void AreaItem::updateColor()
|
||||
{
|
||||
_pen.setColor(strokeColor());
|
||||
_brush = QBrush(fillColor());
|
||||
update();
|
||||
}
|
||||
|
||||
void AreaItem::setOpacity(qreal opacity)
|
||||
{
|
||||
if (_opacity == opacity)
|
||||
return;
|
||||
|
||||
_opacity = opacity;
|
||||
QColor bc(_pen.color());
|
||||
bc.setAlphaF(_opacity * _pen.color().alphaF());
|
||||
_brush = QBrush(bc);
|
||||
updateColor();
|
||||
}
|
||||
|
||||
update();
|
||||
qreal AreaItem::width() const
|
||||
{
|
||||
return (_useStyle && _area.style().width() > 0)
|
||||
? _area.style().width() : _width;
|
||||
}
|
||||
|
||||
void AreaItem::setWidth(qreal width)
|
||||
{
|
||||
if (_width == width)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
updateWidth();
|
||||
}
|
||||
|
||||
void AreaItem::setStyle(Qt::PenStyle style)
|
||||
void AreaItem::updateWidth()
|
||||
{
|
||||
if (_pen.style() == style)
|
||||
return;
|
||||
prepareGeometryChange();
|
||||
|
||||
_pen.setStyle(style);
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
Qt::PenStyle AreaItem::penStyle() const
|
||||
{
|
||||
return _useStyle ? Qt::SolidLine : _penStyle;
|
||||
}
|
||||
|
||||
void AreaItem::setPenStyle(Qt::PenStyle style)
|
||||
{
|
||||
_penStyle = style;
|
||||
updatePenStyle();
|
||||
}
|
||||
|
||||
void AreaItem::updatePenStyle()
|
||||
{
|
||||
_pen.setStyle(penStyle());
|
||||
update();
|
||||
}
|
||||
|
||||
void AreaItem::updateStyle()
|
||||
{
|
||||
updateColor();
|
||||
updateWidth();
|
||||
updatePenStyle();
|
||||
}
|
||||
|
||||
void AreaItem::setDigitalZoom(int zoom)
|
||||
{
|
||||
if (_digitalZoom == zoom)
|
||||
|
@ -22,8 +22,9 @@ public:
|
||||
void setColor(const QColor &color);
|
||||
void setOpacity(qreal opacity);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setPenStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
void updateStyle();
|
||||
|
||||
ToolTip info() const;
|
||||
|
||||
@ -34,16 +35,26 @@ protected:
|
||||
private:
|
||||
QPainterPath painterPath(const Polygon &polygon);
|
||||
void updatePainterPath();
|
||||
void updateColor();
|
||||
void updateWidth();
|
||||
void updatePenStyle();
|
||||
qreal width() const;
|
||||
const QColor &strokeColor() const;
|
||||
QColor fillColor() const;
|
||||
Qt::PenStyle penStyle() const;
|
||||
|
||||
Area _area;
|
||||
|
||||
Map *_map;
|
||||
int _digitalZoom;
|
||||
|
||||
qreal _width;
|
||||
QColor _color;
|
||||
qreal _opacity;
|
||||
Qt::PenStyle _penStyle;
|
||||
int _digitalZoom;
|
||||
|
||||
QPen _pen;
|
||||
QBrush _brush;
|
||||
qreal _opacity;
|
||||
|
||||
QPainterPath _painterPath;
|
||||
};
|
||||
|
||||
|
@ -24,10 +24,17 @@ void CadenceGraph::setInfo()
|
||||
if (_showTracks) {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Avg"), l.toString(avg() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
} else
|
||||
clearInfo();
|
||||
}
|
||||
|
@ -52,17 +52,19 @@ void ColorBox::paintEvent(QPaintEvent *event)
|
||||
|
||||
void ColorBox::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
QColorDialog::ColorDialogOptions options = _alpha
|
||||
? QColorDialog::ColorDialogOptions(QColorDialog::ShowAlphaChannel)
|
||||
: QColorDialog::ColorDialogOptions();
|
||||
QColor color = QColorDialog::getColor(_color, this, QString(), options);
|
||||
if (color.isValid()) {
|
||||
_color = color;
|
||||
update();
|
||||
emit colorChanged(_color);
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
QColorDialog::ColorDialogOptions options = _alpha
|
||||
? QColorDialog::ColorDialogOptions(QColorDialog::ShowAlphaChannel)
|
||||
: QColorDialog::ColorDialogOptions();
|
||||
QColor color = QColorDialog::getColor(_color, this, QString(), options);
|
||||
if (color.isValid()) {
|
||||
_color = color;
|
||||
update();
|
||||
emit colorChanged(_color);
|
||||
}
|
||||
}
|
||||
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void ColorBox::setColor(const QColor &color)
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
DirSelectWidget::DirSelectWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
QFontMetrics fm(QApplication::font());
|
||||
_edit = new QLineEdit();
|
||||
#ifndef Q_OS_ANDROID
|
||||
QFontMetrics fm(QApplication::font());
|
||||
_edit->setMinimumWidth(fm.averageCharWidth() * (QDir::homePath().length()
|
||||
+ 12));
|
||||
#endif // Q_OS_ANDROID
|
||||
_edit->setPlaceholderText(tr("System default"));
|
||||
#ifdef Q_OS_WIN32
|
||||
_button = new QPushButton("...");
|
||||
|
@ -54,6 +54,22 @@ void ElevationGraph::setInfo()
|
||||
else {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
/*: Use an Unicode arrow (U+2197) when there is no abbreviation or
|
||||
extremly short term for "Up" in your language */
|
||||
GraphView::addInfo(tr("Up"), l.toString(ascent() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
/*: Use an Unicode arrow (U+2198) when there is no abbreviation or
|
||||
extremly short term for "Down" in your language */
|
||||
GraphView::addInfo(tr("Down"), l.toString(descent() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
/*: Use an abbreviation or a extremly short term */
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
/*: Use an abbreviation or a extremly short term */
|
||||
GraphView::addInfo(tr("Min"), l.toString(min() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Ascent"), l.toString(ascent() * yScale(),
|
||||
'f', 0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Descent"), l.toString(descent() * yScale(),
|
||||
@ -62,6 +78,7 @@ void ElevationGraph::setInfo()
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,14 +5,25 @@
|
||||
|
||||
FileBrowser::FileBrowser(QObject *parent) : QObject(parent)
|
||||
{
|
||||
#ifndef Q_OS_ANDROID
|
||||
_watcher = new QFileSystemWatcher(this);
|
||||
|
||||
connect(_watcher, &QFileSystemWatcher::directoryChanged, this,
|
||||
&FileBrowser::reloadDirectory);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void FileBrowser::setCurrentDir(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
_files = dir.entryInfoList(_filter, QDir::Files);
|
||||
_index = _files.empty() ? -1 : 0;
|
||||
|
||||
emit listChanged();
|
||||
}
|
||||
#else // Q_OS_ANDROID
|
||||
void FileBrowser::setCurrent(const QString &path)
|
||||
{
|
||||
QFileInfo file(path);
|
||||
@ -28,6 +39,7 @@ void FileBrowser::setCurrent(const QString &path)
|
||||
|
||||
_index = _files.empty() ? -1 : _files.indexOf(file);
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
void FileBrowser::setFilter(const QStringList &filter)
|
||||
{
|
||||
@ -46,6 +58,11 @@ bool FileBrowser::isFirst() const
|
||||
return (_files.size() > 0 && _index == 0);
|
||||
}
|
||||
|
||||
QString FileBrowser::current()
|
||||
{
|
||||
return (_index >= 0) ? _files.at(_index).absoluteFilePath() : QString();
|
||||
}
|
||||
|
||||
QString FileBrowser::next()
|
||||
{
|
||||
if (_index < 0 || _index == _files.size() - 1)
|
||||
|
@ -14,9 +14,14 @@ class FileBrowser : public QObject
|
||||
public:
|
||||
FileBrowser(QObject *parent = 0);
|
||||
|
||||
void setFilter(const QStringList &filter);
|
||||
#ifdef Q_OS_ANDROID
|
||||
void setCurrentDir(const QString &path);
|
||||
#else // Q_OS_ANDROID
|
||||
void setCurrent(const QString &path);
|
||||
#endif // Q_OS_ANDROID
|
||||
void setFilter(const QStringList &filter);
|
||||
|
||||
QString current();
|
||||
QString next();
|
||||
QString prev();
|
||||
QString last();
|
||||
@ -32,7 +37,9 @@ private slots:
|
||||
void reloadDirectory(const QString &path);
|
||||
|
||||
private:
|
||||
#ifndef Q_OS_ANDROID
|
||||
QFileSystemWatcher *_watcher;
|
||||
#endif // Q_OS_ANDROID
|
||||
QStringList _filter;
|
||||
QFileInfoList _files;
|
||||
int _index;
|
||||
|
@ -5,15 +5,20 @@
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
#include <QFontMetrics>
|
||||
#include "common/util.h"
|
||||
#include "fileselectwidget.h"
|
||||
|
||||
|
||||
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
QFontMetrics fm(QApplication::font());
|
||||
_edit = new QLineEdit();
|
||||
#ifdef Q_OS_ANDROID
|
||||
_edit->setDisabled(true);
|
||||
#else // Q_OS_ANDROID
|
||||
QFontMetrics fm(QApplication::font());
|
||||
_edit->setMinimumWidth(fm.averageCharWidth() * (QDir::homePath().length()
|
||||
+ 12));
|
||||
#endif // Q_OS_ANDROID
|
||||
#ifdef Q_OS_WIN32
|
||||
_button = new QPushButton("...");
|
||||
_button->setMaximumWidth(_button->sizeHint().width() / 2);
|
||||
@ -35,39 +40,44 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
void FileSelectWidget::browse()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
_fileName = QFileDialog::getSaveFileName(this, tr("Select file"));
|
||||
if (!_fileName.isEmpty())
|
||||
_edit->setText(Util::displayName(_fileName));
|
||||
#else // Q_OS_ANDROID
|
||||
QFileInfo fi(_edit->text());
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Select file"),
|
||||
fi.dir().absolutePath(), _filter);
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
_edit->setText(fileName);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
bool FileSelectWidget::checkFile(QString &error) const
|
||||
{
|
||||
if (_edit->text().isEmpty()) {
|
||||
if (file().isEmpty()) {
|
||||
error = tr("No output file selected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile file(_edit->text());
|
||||
QFileInfo fi(file);
|
||||
QFile f(file());
|
||||
QFileInfo fi(f);
|
||||
bool exists = fi.exists();
|
||||
bool opened = false;
|
||||
|
||||
if (exists && fi.isDir()) {
|
||||
error = tr("%1 is a directory.").arg(file.fileName());
|
||||
error = tr("%1 is a directory.").arg(f.fileName());
|
||||
return false;
|
||||
} else if ((exists && !fi.isWritable())
|
||||
|| !(opened = file.open(QFile::Append))) {
|
||||
error = tr("%1 is not writable.").arg(file.fileName());
|
||||
|| !(opened = f.open(QFile::Append))) {
|
||||
error = tr("%1 is not writable.").arg(f.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opened) {
|
||||
file.close();
|
||||
f.close();
|
||||
if (!exists)
|
||||
file.remove();
|
||||
f.remove();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -14,9 +14,13 @@ class FileSelectWidget : public QWidget
|
||||
public:
|
||||
FileSelectWidget(QWidget *parent = 0);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
QString file() const {return _fileName;}
|
||||
#else // Q_OS_ANDROID
|
||||
QString file() const {return _edit->text();}
|
||||
void setFile(const QString &file) {_edit->setText(file);}
|
||||
void setFilter(const QString &filter) {_filter = filter;}
|
||||
#endif // Q_OS_ANDROID
|
||||
bool checkFile(QString &error) const;
|
||||
|
||||
private slots:
|
||||
@ -29,8 +33,11 @@ private:
|
||||
#else // Q_OS_WIN32
|
||||
QToolButton *_button;
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
QString _fileName;
|
||||
#else // Q_OS_ANDROID
|
||||
QString _filter;
|
||||
#endif // Q_OS_ANDROID
|
||||
};
|
||||
|
||||
#endif // FILESELECTWIDGET_H
|
||||
|
@ -24,12 +24,21 @@ void GearRatioGraph::setInfo()
|
||||
if (_showTracks) {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Top"), l.toString(top() * yScale(), 'f', 2)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Min"), l.toString(min() * yScale(), 'f', 2)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale(), 'f', 2)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Most used"), l.toString(top() * yScale(),
|
||||
'f', 2) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
|
||||
2) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||
2) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
} else
|
||||
clearInfo();
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "graphicsscene.h"
|
||||
|
||||
|
||||
bool GraphicsItem::_useStyle = true;
|
||||
|
||||
/* Standard GraphicsScene::items() is not pixel accurate, so we use the
|
||||
following function which has the same logic as used in the original
|
||||
QGraphicsScene::helpEvent() function. */
|
||||
|
@ -12,6 +12,11 @@ public:
|
||||
|
||||
virtual ToolTip info() const = 0;
|
||||
int type() const {return QGraphicsItem::UserType + 1;}
|
||||
|
||||
static void useStyle(bool use) {_useStyle = use;}
|
||||
|
||||
protected:
|
||||
static bool _useStyle;
|
||||
};
|
||||
|
||||
class GraphicsScene : public QGraphicsScene
|
||||
|
@ -11,8 +11,11 @@ GraphItem::GraphItem(const Graph &graph, GraphType type, int width,
|
||||
Q_ASSERT(_graph.isValid());
|
||||
|
||||
_units = Metric;
|
||||
_pen = QPen(color, width, style, Qt::FlatCap);
|
||||
_sx = 0; _sy = 0;
|
||||
_color = color;
|
||||
|
||||
_pen = QPen(GraphItem::color(), width, style, Qt::FlatCap);
|
||||
|
||||
_time = _graph.hasTime();
|
||||
setZValue(2.0);
|
||||
setAcceptHoverEvents(true);
|
||||
@ -52,12 +55,21 @@ void GraphItem::setGraphType(GraphType type)
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
const QColor &GraphItem::color() const
|
||||
{
|
||||
return (_useStyle && _graph.color().isValid())
|
||||
? _graph.color() : _color;
|
||||
}
|
||||
|
||||
void GraphItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
_color = color;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
_pen.setColor(color);
|
||||
void GraphItem::updateColor()
|
||||
{
|
||||
_pen.setColor(color());
|
||||
update();
|
||||
}
|
||||
|
||||
@ -73,6 +85,13 @@ void GraphItem::setWidth(int width)
|
||||
updateShape();
|
||||
}
|
||||
|
||||
void GraphItem::updateStyle()
|
||||
{
|
||||
updateColor();
|
||||
if (_secondaryGraph)
|
||||
_secondaryGraph->updateStyle();
|
||||
}
|
||||
|
||||
const GraphSegment *GraphItem::segment(qreal x, GraphType type) const
|
||||
{
|
||||
int low = 0;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
void setColor(const QColor &color);
|
||||
void setWidth(int width);
|
||||
void setUnits(Units units) {_units = units;}
|
||||
void updateStyle();
|
||||
|
||||
GraphItem *secondaryGraph() const {return _secondaryGraph;}
|
||||
void setSecondaryGraph(GraphItem *graph) {_secondaryGraph = graph;}
|
||||
@ -63,13 +64,18 @@ private:
|
||||
void updatePath();
|
||||
void updateShape();
|
||||
void updateBounds();
|
||||
void updateColor();
|
||||
const QColor &color() const;
|
||||
|
||||
Graph _graph;
|
||||
|
||||
QColor _color;
|
||||
GraphType _type;
|
||||
qreal _sx, _sy;
|
||||
|
||||
QPainterPath _path;
|
||||
QPainterPath _shape;
|
||||
QRectF _bounds;
|
||||
qreal _sx, _sy;
|
||||
QPen _pen;
|
||||
bool _time;
|
||||
|
||||
|
276
src/GUI/gui.cpp
@ -53,6 +53,7 @@
|
||||
#include "mapitem.h"
|
||||
#include "mapaction.h"
|
||||
#include "poiaction.h"
|
||||
#include "navigationwidget.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
@ -72,7 +73,11 @@ GUI::GUI()
|
||||
createStatusBar();
|
||||
createActions();
|
||||
createMenus();
|
||||
#ifdef Q_OS_ANDROID
|
||||
createNavigation();
|
||||
#else // Q_OS_ANDROID
|
||||
createToolBars();
|
||||
#endif // Q_OS_ANDROID
|
||||
createBrowser();
|
||||
|
||||
_splitter = new QSplitter();
|
||||
@ -83,6 +88,7 @@ GUI::GUI()
|
||||
_splitter->setContentsMargins(0, 0, 0, 0);
|
||||
_splitter->setStretchFactor(0, 255);
|
||||
_splitter->setStretchFactor(1, 1);
|
||||
|
||||
setCentralWidget(_splitter);
|
||||
|
||||
setWindowIcon(QIcon(APP_ICON));
|
||||
@ -181,19 +187,23 @@ void GUI::createActions()
|
||||
_navigationActionGroup->setEnabled(false);
|
||||
|
||||
// General actions
|
||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
|
||||
_exitAction = new QAction(QIcon(QUIT_ICON), tr("Quit"), this);
|
||||
_exitAction->setShortcut(QUIT_SHORTCUT);
|
||||
_exitAction->setMenuRole(QAction::QuitRole);
|
||||
connect(_exitAction, &QAction::triggered, this, &GUI::close);
|
||||
addAction(_exitAction);
|
||||
#endif // Q_OS_MAC + Q_OS_ANDROID
|
||||
|
||||
// Help & About
|
||||
_pathsAction = new QAction(tr("Paths"), this);
|
||||
_pathsAction->setMenuRole(QAction::NoRole);
|
||||
connect(_pathsAction, &QAction::triggered, this, &GUI::paths);
|
||||
#ifndef Q_OS_ANDROID
|
||||
_keysAction = new QAction(tr("Keyboard controls"), this);
|
||||
_keysAction->setMenuRole(QAction::NoRole);
|
||||
connect(_keysAction, &QAction::triggered, this, &GUI::keys);
|
||||
#endif // Q_OS_ANDROID
|
||||
_aboutAction = new QAction(QIcon(APP_ICON), tr("About GPXSee"), this);
|
||||
_aboutAction->setMenuRole(QAction::AboutRole);
|
||||
connect(_aboutAction, &QAction::triggered, this, &GUI::about);
|
||||
@ -205,6 +215,12 @@ void GUI::createActions()
|
||||
connect(_openFileAction, &QAction::triggered, this,
|
||||
QOverload<>::of(&GUI::openFile));
|
||||
addAction(_openFileAction);
|
||||
#ifdef Q_OS_ANDROID
|
||||
_openDirAction = new QAction(QIcon(OPEN_FILE_ICON), tr("Open directory..."),
|
||||
this);
|
||||
_openDirAction->setMenuRole(QAction::NoRole);
|
||||
connect(_openDirAction, &QAction::triggered, this, &GUI::openDir);
|
||||
#endif // Q_OS_ANDROID
|
||||
_printFileAction = new QAction(QIcon(PRINT_FILE_ICON), tr("Print..."),
|
||||
this);
|
||||
_printFileAction->setMenuRole(QAction::NoRole);
|
||||
@ -413,6 +429,11 @@ void GUI::createActions()
|
||||
_showMarkerCoordinatesAction->setMenuRole(QAction::NoRole);
|
||||
_showMarkerCoordinatesAction->setCheckable(true);
|
||||
_showMarkerCoordinatesAction->setActionGroup(markerInfoGroup);
|
||||
_useStylesAction = new QAction(tr("Use styles"), this);
|
||||
_useStylesAction->setMenuRole(QAction::NoRole);
|
||||
_useStylesAction->setCheckable(true);
|
||||
connect(_useStylesAction, &QAction::triggered, _mapView,
|
||||
&MapView::useStyles);
|
||||
|
||||
// DEM actions
|
||||
_downloadDEMAction = new QAction(tr("Download DEM data"), this);
|
||||
@ -457,12 +478,21 @@ void GUI::createActions()
|
||||
_showGraphSliderInfoAction->setCheckable(true);
|
||||
connect(_showGraphSliderInfoAction, &QAction::triggered, this,
|
||||
&GUI::showGraphSliderInfo);
|
||||
#ifdef Q_OS_ANDROID
|
||||
_showGraphTabsAction = new QAction(tr("Show tabs"), this);
|
||||
_showGraphTabsAction->setMenuRole(QAction::NoRole);
|
||||
_showGraphTabsAction->setCheckable(true);
|
||||
connect(_showGraphTabsAction, &QAction::triggered, this,
|
||||
&GUI::showGraphTabs);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
// Settings actions
|
||||
#ifndef Q_OS_ANDROID
|
||||
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
||||
_showToolbarsAction->setMenuRole(QAction::NoRole);
|
||||
_showToolbarsAction->setCheckable(true);
|
||||
connect(_showToolbarsAction, &QAction::triggered, this, &GUI::showToolbars);
|
||||
#endif // Q_OS_ANDROID
|
||||
ag = new QActionGroup(this);
|
||||
ag->setExclusive(true);
|
||||
_totalTimeAction = new QAction(tr("Total time"), this);
|
||||
@ -514,6 +544,7 @@ void GUI::createActions()
|
||||
_dmsAction->setCheckable(true);
|
||||
_dmsAction->setActionGroup(ag);
|
||||
connect(_dmsAction, &QAction::triggered, this, &GUI::setDMS);
|
||||
#ifndef Q_OS_ANDROID
|
||||
_fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
|
||||
tr("Fullscreen mode"), this);
|
||||
_fullscreenAction->setMenuRole(QAction::NoRole);
|
||||
@ -521,11 +552,13 @@ void GUI::createActions()
|
||||
_fullscreenAction->setShortcut(FULLSCREEN_SHORTCUT);
|
||||
connect(_fullscreenAction, &QAction::triggered, this, &GUI::showFullscreen);
|
||||
addAction(_fullscreenAction);
|
||||
#endif // Q_OS_ANDROID
|
||||
_openOptionsAction = new QAction(tr("Options..."), this);
|
||||
_openOptionsAction->setMenuRole(QAction::PreferencesRole);
|
||||
connect(_openOptionsAction, &QAction::triggered, this, &GUI::openOptions);
|
||||
|
||||
// Navigation actions
|
||||
#ifndef Q_OS_ANDROID
|
||||
_nextAction = new QAction(QIcon(NEXT_FILE_ICON), tr("Next"), this);
|
||||
_nextAction->setActionGroup(_navigationActionGroup);
|
||||
_nextAction->setMenuRole(QAction::NoRole);
|
||||
@ -542,6 +575,7 @@ void GUI::createActions()
|
||||
_firstAction->setMenuRole(QAction::NoRole);
|
||||
_firstAction->setActionGroup(_navigationActionGroup);
|
||||
connect(_firstAction, &QAction::triggered, this, &GUI::first);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
void GUI::createMapNodeMenu(const TreeNode<MapAction*> &node, QMenu *menu,
|
||||
@ -574,8 +608,13 @@ void GUI::createMenus()
|
||||
{
|
||||
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
|
||||
fileMenu->addAction(_openFileAction);
|
||||
#ifdef Q_OS_ANDROID
|
||||
fileMenu->addAction(_openDirAction);
|
||||
#endif // Q_OS_ANDROID
|
||||
fileMenu->addSeparator();
|
||||
#ifndef Q_OS_ANDROID
|
||||
fileMenu->addAction(_printFileAction);
|
||||
#endif // Q_OS_ANDROID
|
||||
fileMenu->addAction(_exportPDFFileAction);
|
||||
fileMenu->addAction(_exportPNGFileAction);
|
||||
fileMenu->addSeparator();
|
||||
@ -583,10 +622,10 @@ void GUI::createMenus()
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(_reloadFileAction);
|
||||
fileMenu->addAction(_closeFileAction);
|
||||
#ifndef Q_OS_MAC
|
||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(_exitAction);
|
||||
#endif // Q_OS_MAC
|
||||
#endif // Q_OS_MAC + Q_OS_ANDROID
|
||||
|
||||
_mapMenu = menuBar()->addMenu(tr("&Map"));
|
||||
_mapsEnd = _mapMenu->addSeparator();
|
||||
@ -604,6 +643,9 @@ void GUI::createMenus()
|
||||
graphMenu->addSeparator();
|
||||
graphMenu->addAction(_showGraphGridAction);
|
||||
graphMenu->addAction(_showGraphSliderInfoAction);
|
||||
#ifdef Q_OS_ANDROID
|
||||
graphMenu->addAction(_showGraphTabsAction);
|
||||
#endif // Q_OS_ANDROID
|
||||
graphMenu->addSeparator();
|
||||
graphMenu->addAction(_showGraphsAction);
|
||||
|
||||
@ -618,6 +660,8 @@ void GUI::createMenus()
|
||||
markerMenu->addAction(_showMarkerDateAction);
|
||||
markerMenu->addAction(_showMarkerCoordinatesAction);
|
||||
dataMenu->addSeparator();
|
||||
dataMenu->addAction(_useStylesAction);
|
||||
dataMenu->addSeparator();
|
||||
dataMenu->addAction(_showTracksAction);
|
||||
dataMenu->addAction(_showRoutesAction);
|
||||
dataMenu->addAction(_showAreasAction);
|
||||
@ -659,18 +703,31 @@ void GUI::createMenus()
|
||||
coordinatesMenu->addAction(_degreesMinutesAction);
|
||||
coordinatesMenu->addAction(_dmsAction);
|
||||
settingsMenu->addSeparator();
|
||||
#ifndef Q_OS_ANDROID
|
||||
settingsMenu->addAction(_showToolbarsAction);
|
||||
settingsMenu->addAction(_fullscreenAction);
|
||||
settingsMenu->addSeparator();
|
||||
#endif // Q_OS_ANDROID
|
||||
settingsMenu->addAction(_openOptionsAction);
|
||||
|
||||
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(_pathsAction);
|
||||
#ifndef Q_OS_ANDROID
|
||||
helpMenu->addAction(_keysAction);
|
||||
#endif // Q_OS_ANDROID
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(_aboutAction);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void GUI::createNavigation()
|
||||
{
|
||||
_navigation = new NavigationWidget(_mapView);
|
||||
|
||||
connect(_navigation, &NavigationWidget::next, this, &GUI::next);
|
||||
connect(_navigation, &NavigationWidget::prev, this, &GUI::prev);
|
||||
}
|
||||
#else // Q_OS_ANDROID
|
||||
void GUI::createToolBars()
|
||||
{
|
||||
int is = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
|
||||
@ -706,6 +763,7 @@ void GUI::createToolBars()
|
||||
_navigationToolBar->addAction(_nextAction);
|
||||
_navigationToolBar->addAction(_lastAction);
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
void GUI::createMapView()
|
||||
{
|
||||
@ -713,7 +771,11 @@ void GUI::createMapView()
|
||||
_mapView = new MapView(_map, _poi, 0, this);
|
||||
_mapView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
|
||||
QSizePolicy::Expanding));
|
||||
#ifdef Q_OS_ANDROID
|
||||
_mapView->setMinimumHeight(100);
|
||||
#else // Q_OS_ANDROID
|
||||
_mapView->setMinimumHeight(200);
|
||||
#endif // Q_OS_ANDROID
|
||||
#ifdef Q_OS_WIN32
|
||||
_mapView->setFrameShape(QFrame::NoFrame);
|
||||
#endif // Q_OS_WIN32
|
||||
@ -765,7 +827,16 @@ void GUI::about()
|
||||
QUrl homepage(APP_HOMEPAGE);
|
||||
|
||||
msgBox.setWindowTitle(tr("About GPXSee"));
|
||||
msgBox.setText("<h2>" + QString(APP_NAME) + "</h2><p><p>" + tr("Version %1")
|
||||
#ifdef Q_OS_ANDROID
|
||||
msgBox.setText("<h2>" + QString(APP_NAME) + "</h2><p>" + tr("Version %1")
|
||||
.arg(QString(APP_VERSION) + " (" + QSysInfo::buildCpuArchitecture()
|
||||
+ ", Qt " + QT_VERSION_STR + ")") + "</p><p>"
|
||||
+ tr("GPXSee is distributed under the terms of the GNU General Public "
|
||||
"License version 3. For more info about GPXSee visit the project "
|
||||
"homepage at %1.").arg("<a href=\"" + homepage.toString() + "\">"
|
||||
+ homepage.toString(QUrl::RemoveScheme).mid(2) + "</a>") + "</p>");
|
||||
#else // Q_OS_ANDROID
|
||||
msgBox.setText("<h2>" + QString(APP_NAME) + "</h2><p>" + tr("Version %1")
|
||||
.arg(QString(APP_VERSION) + " (" + QSysInfo::buildCpuArchitecture()
|
||||
+ ", Qt " + QT_VERSION_STR + ")") + "</p>");
|
||||
msgBox.setInformativeText("<table width=\"300\"><tr><td>"
|
||||
@ -778,10 +849,12 @@ void GUI::about()
|
||||
QIcon icon = msgBox.windowIcon();
|
||||
QSize size = icon.actualSize(QSize(64, 64));
|
||||
msgBox.setIconPixmap(icon.pixmap(size));
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
void GUI::keys()
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
@ -820,12 +893,30 @@ void GUI::keys()
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
void GUI::paths()
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
|
||||
msgBox.setWindowTitle(tr("Paths"));
|
||||
#ifdef Q_OS_ANDROID
|
||||
msgBox.setText(
|
||||
+ "<small><b>" + tr("Map directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::mapDir(true)) + "<br><br><b>"
|
||||
+ tr("POI directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::poiDir(true)) + "<br><br><b>"
|
||||
+ tr("GCS/PCS directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::csvDir(true)) + "<br><br><b>"
|
||||
+ tr("DEM directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::demDir(true)) + "<br><br><b>"
|
||||
+ tr("Styles directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::styleDir(true)) + "<br><br><b>"
|
||||
+ tr("Symbols directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::symbolsDir(true)) + "<br><br><b>"
|
||||
+ tr("Tile cache directory:") + "</b><br>"
|
||||
+ QDir::cleanPath(ProgramPaths::tilesDir()) + "</small>");
|
||||
#else // Q_OS_ANDROID
|
||||
msgBox.setText("<h3>" + tr("Paths") + "</h3>");
|
||||
msgBox.setInformativeText(
|
||||
"<style>td {white-space: pre; padding-right: 1em;}</style><table><tr><td>"
|
||||
@ -844,14 +935,20 @@ void GUI::paths()
|
||||
+ tr("Tile cache directory:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(ProgramPaths::tilesDir()) + "</code></td></tr></table>"
|
||||
);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void GUI::openFile()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open file"),
|
||||
_dataDir));
|
||||
#else // Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open file"),
|
||||
_dataDir, Data::formats()));
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
for (int i = 0; i < files.size(); i++)
|
||||
openFile(files.at(i));
|
||||
@ -859,6 +956,19 @@ void GUI::openFile()
|
||||
_dataDir = QFileInfo(files.last()).path();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void GUI::openDir()
|
||||
{
|
||||
QString dir(QFileDialog::getExistingDirectory(this, tr("Open directory"),
|
||||
_dataDir));
|
||||
|
||||
if (!dir.isEmpty()) {
|
||||
_browser->setCurrentDir(dir);
|
||||
openFile(_browser->current());
|
||||
}
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
bool GUI::openFile(const QString &fileName, bool silent)
|
||||
{
|
||||
if (_files.contains(fileName))
|
||||
@ -868,7 +978,9 @@ bool GUI::openFile(const QString &fileName, bool silent)
|
||||
return false;
|
||||
|
||||
_files.append(fileName);
|
||||
#ifndef Q_OS_ANDROID
|
||||
_browser->setCurrent(fileName);
|
||||
#endif // Q_OS_ANDROID
|
||||
_fileActionGroup->setEnabled(true);
|
||||
// Explicitly enable the reload action as it may be disabled by loadMapDir()
|
||||
_reloadFileAction->setEnabled(true);
|
||||
@ -898,7 +1010,7 @@ bool GUI::loadFile(const QString &fileName, bool silent)
|
||||
_fileActionGroup->setEnabled(false);
|
||||
|
||||
QString error = tr("Error loading data file:") + "\n\n"
|
||||
+ fileName + "\n\n" + data.errorString();
|
||||
+ Util::displayName(fileName) + "\n\n" + data.errorString();
|
||||
if (data.errorLine())
|
||||
error.append("\n" + tr("Line: %1").arg(data.errorLine()));
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
@ -967,8 +1079,13 @@ void GUI::loadData(const Data &data)
|
||||
|
||||
void GUI::openPOIFile()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open POI file"),
|
||||
_poiDir));
|
||||
#else // Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open POI file"),
|
||||
_poiDir, Data::formats()));
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
for (int i = 0; i < files.size(); i++)
|
||||
openPOIFile(files.at(i));
|
||||
@ -994,7 +1111,7 @@ bool GUI::openPOIFile(const QString &fileName)
|
||||
return true;
|
||||
} else {
|
||||
QString error = tr("Error loading POI file:") + "\n\n"
|
||||
+ fileName + "\n\n" + _poi->errorString();
|
||||
+ Util::displayName(fileName) + "\n\n" + _poi->errorString();
|
||||
if (_poi->errorLine())
|
||||
error.append("\n" + tr("Line: %1").arg(_poi->errorLine()));
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
@ -1207,12 +1324,70 @@ void GUI::exportPNGFile()
|
||||
void GUI::statistics()
|
||||
{
|
||||
QLocale l(QLocale::system());
|
||||
QMessageBox msgBox(this);
|
||||
QString text;
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
if (_showTracksAction->isChecked() && _trackCount > 1)
|
||||
text.append("<b>" + tr("Tracks") + ":</b> "
|
||||
+ l.toString(_trackCount) + "<br>");
|
||||
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
||||
text.append("<b>" + tr("Routes") + ":</b> "
|
||||
+ l.toString(_routeCount) + "<br>");
|
||||
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
||||
text.append("<b>" + tr("Waypoints") + ":</b> "
|
||||
+ l.toString(_waypointCount) + "<br>");
|
||||
if (_showAreasAction->isChecked() && _areaCount > 1)
|
||||
text.append("<b>" + tr("Areas") + ":</b> "
|
||||
+ l.toString(_areaCount) + "<br>");
|
||||
|
||||
if (_dateRange.first.isValid()) {
|
||||
QString format = l.dateFormat(QLocale::ShortFormat);
|
||||
if (_dateRange.first == _dateRange.second)
|
||||
text.append("<b>" + tr("Date") + ":</b> "
|
||||
+ _dateRange.first.toString(format) + "<br>");
|
||||
else
|
||||
text.append("<b>" + tr("Date") + ":</b> "
|
||||
+ QString("%1 - %2").arg(_dateRange.first.toString(format),
|
||||
_dateRange.second.toString(format)) + "<br>");
|
||||
}
|
||||
|
||||
if (distance() > 0)
|
||||
text.append("<b>" + tr("Distance") + ":</b> "
|
||||
+ Format::distance(distance(), units()) + "<br>");
|
||||
if (time() > 0) {
|
||||
text.append("<b>" + tr("Time") + ":</b> "
|
||||
+ Format::timeSpan(time()) + "<br>");
|
||||
text.append("<b>" + tr("Moving time") + ":</b> "
|
||||
+ Format::timeSpan(movingTime()) + "<br>");
|
||||
}
|
||||
text.append("<br>");
|
||||
|
||||
for (int i = 0; i < _tabs.count(); i++) {
|
||||
const GraphTab *tab = _tabs.at(i);
|
||||
if (tab->isEmpty())
|
||||
continue;
|
||||
|
||||
text.append("<i>" + tab->label() + "</i><br>");
|
||||
for (int j = 0; j < tab->info().size(); j++) {
|
||||
const KV<QString, QString> &kv = tab->info().at(j);
|
||||
text.append("<b>" + kv.key() + ":</b> " + kv.value());
|
||||
if (j != tab->info().size() - 1)
|
||||
text.append(" | ");
|
||||
}
|
||||
if (i != _tabs.count() - 1)
|
||||
text.append("<br><br>");
|
||||
}
|
||||
|
||||
msgBox.setWindowTitle(tr("Statistics"));
|
||||
msgBox.setText(text);
|
||||
|
||||
#else // Q_OS_ANDROID
|
||||
#ifdef Q_OS_WIN32
|
||||
QString text = "<style>td {white-space: pre; padding-right: 4em;}"
|
||||
text = "<style>td {white-space: pre; padding-right: 4em;}"
|
||||
"th {text-align: left; padding-top: 0.5em;}</style><table>";
|
||||
#else // Q_OS_WIN32
|
||||
QString text = "<style>td {white-space: pre; padding-right: 2em;}"
|
||||
text = "<style>td {white-space: pre; padding-right: 2em;}"
|
||||
"th {text-align: left; padding-top: 0.5em;}</style><table>";
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
@ -1267,11 +1442,11 @@ void GUI::statistics()
|
||||
|
||||
text.append("</table>");
|
||||
|
||||
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setWindowTitle(tr("Statistics"));
|
||||
msgBox.setText("<h3>" + tr("Statistics") + "</h3>");
|
||||
msgBox.setInformativeText(text);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
@ -1430,8 +1605,10 @@ void GUI::reloadFiles()
|
||||
updateWindowTitle();
|
||||
if (_files.isEmpty())
|
||||
_fileActionGroup->setEnabled(false);
|
||||
#ifndef Q_OS_ANDROID
|
||||
else
|
||||
_browser->setCurrent(_files.last());
|
||||
#endif // Q_OS_ANDROID
|
||||
updateDEMDownloadAction();
|
||||
}
|
||||
|
||||
@ -1466,6 +1643,10 @@ void GUI::closeAll()
|
||||
updateWindowTitle();
|
||||
updateGraphTabs();
|
||||
updateDEMDownloadAction();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
_browser->setCurrentDir(QString());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
void GUI::showGraphs(bool show)
|
||||
@ -1473,6 +1654,12 @@ void GUI::showGraphs(bool show)
|
||||
_graphTabWidget->setHidden(!show);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void GUI::showGraphTabs(bool show)
|
||||
{
|
||||
_graphTabWidget->tabBar()->setVisible(show);
|
||||
}
|
||||
#else // Q_OS_ANDROID
|
||||
void GUI::showToolbars(bool show)
|
||||
{
|
||||
if (show) {
|
||||
@ -1515,6 +1702,7 @@ void GUI::showFullscreen(bool show)
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
void GUI::showTracks(bool show)
|
||||
{
|
||||
@ -1583,8 +1771,13 @@ void GUI::showPathMarkerInfo(QAction *action)
|
||||
|
||||
void GUI::loadMap()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open map file"),
|
||||
_mapDir));
|
||||
#else // Q_OS_ANDROID
|
||||
QStringList files(QFileDialog::getOpenFileNames(this, tr("Open map file"),
|
||||
_mapDir, MapList::formats()));
|
||||
#endif // Q_OS_ANDROID
|
||||
MapAction *a, *lastReady = 0;
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
@ -1627,7 +1820,8 @@ bool GUI::loadMapNode(const TreeNode<Map*> &node, MapAction *&action,
|
||||
if (!map->isValid()) {
|
||||
if (!silent)
|
||||
QMessageBox::critical(this, APP_NAME,
|
||||
tr("Error loading map:") + "\n\n" + map->path() + "\n\n"
|
||||
tr("Error loading map:") + "\n\n"
|
||||
+ Util::displayName(map->path()) + "\n\n"
|
||||
+ map->errorString());
|
||||
delete map;
|
||||
} else {
|
||||
@ -1672,8 +1866,8 @@ void GUI::mapLoaded()
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
} else {
|
||||
QString error = tr("Error loading map:") + "\n\n" + map->path() + "\n\n"
|
||||
+ map->errorString();
|
||||
QString error = tr("Error loading map:") + "\n\n"
|
||||
+ Util::displayName(map->path()) + "\n\n" + map->errorString();
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
action->deleteLater();
|
||||
}
|
||||
@ -1691,8 +1885,8 @@ void GUI::mapLoadedDir()
|
||||
actions.append(action);
|
||||
_mapView->loadMaps(actions);
|
||||
} else {
|
||||
QString error = tr("Error loading map:") + "\n\n" + map->path() + "\n\n"
|
||||
+ map->errorString();
|
||||
QString error = tr("Error loading map:") + "\n\n"
|
||||
+ Util::displayName(map->path()) + "\n\n" + map->errorString();
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
action->deleteLater();
|
||||
}
|
||||
@ -1714,7 +1908,8 @@ void GUI::loadMapDirNode(const TreeNode<Map *> &node, QList<MapAction*> &actions
|
||||
if (!(a = findMapAction(existingActions, map))) {
|
||||
if (!map->isValid()) {
|
||||
QMessageBox::critical(this, APP_NAME, tr("Error loading map:")
|
||||
+ "\n\n" + map->path() + "\n\n" + map->errorString());
|
||||
+ "\n\n" + Util::displayName(map->path()) + "\n\n"
|
||||
+ map->errorString());
|
||||
delete map;
|
||||
} else {
|
||||
a = new MapAction(map, _mapsActionGroup);
|
||||
@ -1817,7 +2012,7 @@ void GUI::updateStatusBarInfo()
|
||||
if (_files.count() == 0)
|
||||
_fileNameLabel->setText(tr("No files loaded"));
|
||||
else if (_files.count() == 1)
|
||||
_fileNameLabel->setText(_files.at(0));
|
||||
_fileNameLabel->setText(Util::displayName(_files.at(0)));
|
||||
else
|
||||
_fileNameLabel->setText(tr("%n files", "", _files.count()));
|
||||
|
||||
@ -1840,6 +2035,10 @@ void GUI::updateStatusBarInfo()
|
||||
_timeLabel->clear();
|
||||
_timeLabel->setToolTip(QString());
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
statusBar()->setVisible(!_files.isEmpty());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
void GUI::updateWindowTitle()
|
||||
@ -1929,10 +2128,17 @@ void GUI::graphChanged(int index)
|
||||
|
||||
void GUI::updateNavigationActions()
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
_navigation->enableNext(!_browser->isLast()
|
||||
&& !_browser->current().isNull());
|
||||
_navigation->enablePrev(!_browser->isFirst()
|
||||
&& !_browser->current().isNull());
|
||||
#else // Q_OS_ANDROID
|
||||
_lastAction->setEnabled(!_browser->isLast());
|
||||
_nextAction->setEnabled(!_browser->isLast());
|
||||
_firstAction->setEnabled(!_browser->isFirst());
|
||||
_prevAction->setEnabled(!_browser->isFirst());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
bool GUI::updateGraphTabs()
|
||||
@ -2042,6 +2248,7 @@ void GUI::first()
|
||||
openFile(file);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
void GUI::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QString file;
|
||||
@ -2096,11 +2303,12 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
void GUI::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
event->accept();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void GUI::dragEnterEvent(QDragEnterEvent *event)
|
||||
@ -2167,6 +2375,7 @@ void GUI::writeSettings()
|
||||
QSettings settings(qApp->applicationName(), qApp->applicationName());
|
||||
settings.clear();
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||
if (!_windowStates.isEmpty() && !_windowGeometries.isEmpty()) {
|
||||
settings.setValue(WINDOW_STATE_SETTING, _windowStates.first());
|
||||
@ -2176,6 +2385,7 @@ void GUI::writeSettings()
|
||||
settings.setValue(WINDOW_GEOMETRY_SETTING, saveGeometry());
|
||||
}
|
||||
settings.endGroup();
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||
if ((_movingTimeAction->isChecked() ? Moving : Total) !=
|
||||
@ -2190,9 +2400,11 @@ void GUI::writeSettings()
|
||||
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
||||
if (format != COORDINATES_DEFAULT)
|
||||
settings.setValue(COORDINATES_SETTING, format);
|
||||
#ifndef Q_OS_ANDROID
|
||||
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
||||
settings.setValue(SHOW_TOOLBARS_SETTING,
|
||||
_showToolbarsAction->isChecked());
|
||||
#endif // Q_OS_ANDROID
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(MAP_SETTINGS_GROUP);
|
||||
@ -2217,6 +2429,11 @@ void GUI::writeSettings()
|
||||
!= SHOW_GRAPH_SLIDER_INFO_DEFAULT)
|
||||
settings.setValue(SHOW_GRAPH_SLIDER_INFO_SETTING,
|
||||
_showGraphSliderInfoAction->isChecked());
|
||||
#ifdef Q_OS_ANDROID
|
||||
if (_showGraphTabsAction->isChecked() != SHOW_GRAPH_TABS_DEFAULT)
|
||||
settings.setValue(SHOW_GRAPH_TABS_SETTING,
|
||||
_showGraphTabsAction->isChecked());
|
||||
#endif // Q_OS_ANDROID
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(POI_SETTINGS_GROUP);
|
||||
@ -2285,8 +2502,8 @@ void GUI::writeSettings()
|
||||
settings.setValue(SHOW_TICKS_SETTING,
|
||||
_showTicksAction->isChecked());
|
||||
bool sm = _showMarkersAction->isChecked()
|
||||
| _showMarkerDateAction->isChecked()
|
||||
| _showMarkerCoordinatesAction->isChecked();
|
||||
|| _showMarkerDateAction->isChecked()
|
||||
|| _showMarkerCoordinatesAction->isChecked();
|
||||
if (sm != SHOW_MARKERS_DEFAULT)
|
||||
settings.setValue(SHOW_MARKERS_SETTING, sm);
|
||||
if (_showMarkerDateAction->isChecked()
|
||||
@ -2295,6 +2512,8 @@ void GUI::writeSettings()
|
||||
else if (_showMarkerCoordinatesAction->isChecked()
|
||||
&& SHOW_MARKER_INFO_DEFAULT != MarkerInfoItem::Position)
|
||||
settings.setValue(SHOW_MARKER_INFO_SETTING, MarkerInfoItem::Position);
|
||||
if (_useStylesAction->isChecked() != USE_STYLES_DEFAULT)
|
||||
settings.setValue(USE_STYLES_SETTING, _useStylesAction->isChecked());
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(PDF_EXPORT_SETTINGS_GROUP);
|
||||
@ -2485,10 +2704,12 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
||||
int value;
|
||||
QSettings settings(qApp->applicationName(), qApp->applicationName());
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||
restoreGeometry(settings.value(WINDOW_GEOMETRY_SETTING).toByteArray());
|
||||
restoreState(settings.value(WINDOW_STATE_SETTING).toByteArray());
|
||||
settings.endGroup();
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt() == Moving)
|
||||
@ -2512,10 +2733,12 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
||||
else
|
||||
_decimalDegreesAction->trigger();
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
|
||||
showToolbars(false);
|
||||
else
|
||||
_showToolbarsAction->setChecked(true);
|
||||
#endif // Q_OS_ANDROID
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(MAP_SETTINGS_GROUP);
|
||||
@ -2523,8 +2746,8 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
||||
_showMapAction->setChecked(true);
|
||||
else
|
||||
_mapView->showMap(false);
|
||||
if (settings.value(SHOW_CURSOR_COORDINATES_SETTING, SHOW_CURSOR_COORDINATES_DEFAULT)
|
||||
.toBool()) {
|
||||
if (settings.value(SHOW_CURSOR_COORDINATES_SETTING,
|
||||
SHOW_CURSOR_COORDINATES_DEFAULT).toBool()) {
|
||||
_showCoordinatesAction->setChecked(true);
|
||||
_mapView->showCursorCoordinates(true);
|
||||
}
|
||||
@ -2552,6 +2775,13 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
||||
showGraphSliderInfo(false);
|
||||
else
|
||||
_showGraphSliderInfoAction->setChecked(true);
|
||||
#ifdef Q_OS_ANDROID
|
||||
if (!settings.value(SHOW_GRAPH_TABS_SETTING, SHOW_GRAPH_TABS_DEFAULT)
|
||||
.toBool())
|
||||
showGraphTabs(false);
|
||||
else
|
||||
_showGraphTabsAction->setChecked(true);
|
||||
#endif // Q_OS_ANDROID
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(POI_SETTINGS_GROUP);
|
||||
@ -2631,6 +2861,10 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
||||
_showMarkersAction->trigger();
|
||||
} else
|
||||
_hideMarkersAction->trigger();
|
||||
if (settings.value(USE_STYLES_SETTING, USE_STYLES_DEFAULT).toBool()) {
|
||||
_useStylesAction->setChecked(true);
|
||||
} else
|
||||
_mapView->useStyles(false);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(PDF_EXPORT_SETTINGS_GROUP);
|
||||
|
@ -35,6 +35,7 @@ class MapAction;
|
||||
class POIAction;
|
||||
class Data;
|
||||
class DEMLoader;
|
||||
class NavigationWidget;
|
||||
|
||||
class GUI : public QMainWindow
|
||||
{
|
||||
@ -47,15 +48,21 @@ public:
|
||||
bool loadMap(const QString &fileName, MapAction *&action,
|
||||
bool silent = false);
|
||||
void show();
|
||||
void writeSettings();
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
#ifndef Q_OS_ANDROID
|
||||
void keys();
|
||||
#endif // Q_OS_ANDROID
|
||||
void paths();
|
||||
void printFile();
|
||||
void exportPDFFile();
|
||||
void exportPNGFile();
|
||||
void openFile();
|
||||
#ifdef Q_OS_ANDROID
|
||||
void openDir();
|
||||
#endif // Q_OS_ANDROID
|
||||
void closeAll();
|
||||
void reloadFiles();
|
||||
void statistics();
|
||||
@ -64,8 +71,12 @@ private slots:
|
||||
void showGraphGrids(bool show);
|
||||
void showGraphSliderInfo(bool show);
|
||||
void showPathMarkerInfo(QAction *action);
|
||||
#ifdef Q_OS_ANDROID
|
||||
void showGraphTabs(bool show);
|
||||
#else // Q_OS_ANDROID
|
||||
void showToolbars(bool show);
|
||||
void showFullscreen(bool show);
|
||||
#endif // Q_OS_ANDROID
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show);
|
||||
void showAreas(bool show);
|
||||
@ -129,7 +140,11 @@ private:
|
||||
QAction *action = 0);
|
||||
void createActions();
|
||||
void createMenus();
|
||||
#ifdef Q_OS_ANDROID
|
||||
void createNavigation();
|
||||
#else // Q_OS_ANDROID
|
||||
void createToolBars();
|
||||
#endif // Q_OS_ANDROID
|
||||
void createStatusBar();
|
||||
void createMapView();
|
||||
void createGraphTabs();
|
||||
@ -160,19 +175,24 @@ private:
|
||||
QAction *mapAction(const QString &name);
|
||||
QGeoPositionInfoSource *positionSource(const Options &options);
|
||||
void readSettings(QString &activeMap, QStringList &disabledPOIs);
|
||||
void writeSettings();
|
||||
|
||||
void loadInitialMaps(const QString &selected);
|
||||
void loadInitialPOIs(const QStringList &disabled);
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
#endif // Q_OS_ANDROID
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
NavigationWidget *_navigation;
|
||||
#else // Q_OS_ANDROID
|
||||
QToolBar *_fileToolBar;
|
||||
QToolBar *_showToolBar;
|
||||
QToolBar *_navigationToolBar;
|
||||
#endif // Q_OS_ANDROID
|
||||
QMenu *_poiMenu;
|
||||
QMenu *_mapMenu;
|
||||
|
||||
@ -180,15 +200,16 @@ private:
|
||||
QActionGroup *_navigationActionGroup;
|
||||
QActionGroup *_mapsActionGroup;
|
||||
QActionGroup *_poisActionGroup;
|
||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
|
||||
QAction *_exitAction;
|
||||
QAction *_keysAction;
|
||||
#endif // Q_OS_MAC + Q_OS_ANDROID
|
||||
QAction *_pathsAction;
|
||||
QAction *_aboutAction;
|
||||
QAction *_aboutQtAction;
|
||||
QAction *_printFileAction;
|
||||
QAction *_exportPDFFileAction;
|
||||
QAction *_exportPNGFileAction;
|
||||
QAction *_openFileAction;
|
||||
QAction *_openDirAction;
|
||||
QAction *_closeFileAction;
|
||||
QAction *_reloadFileAction;
|
||||
QAction *_statisticsAction;
|
||||
@ -204,7 +225,6 @@ private:
|
||||
QAction *_followPositionAction;
|
||||
QAction *_showPositionCoordinatesAction;
|
||||
QAction *_showMotionInfo;
|
||||
QAction *_fullscreenAction;
|
||||
QAction *_loadMapAction;
|
||||
QAction *_loadMapDirAction;
|
||||
QAction *_clearMapCacheAction;
|
||||
@ -213,11 +233,17 @@ private:
|
||||
QAction *_showGraphSliderInfoAction;
|
||||
QAction *_distanceGraphAction;
|
||||
QAction *_timeGraphAction;
|
||||
#ifdef Q_OS_ANDROID
|
||||
QAction *_showGraphTabsAction;
|
||||
#else // Q_OS_ANDROID
|
||||
QAction *_keysAction;
|
||||
QAction *_fullscreenAction;
|
||||
QAction *_showToolbarsAction;
|
||||
QAction *_nextAction;
|
||||
QAction *_prevAction;
|
||||
QAction *_lastAction;
|
||||
QAction *_firstAction;
|
||||
#endif // Q_OS_ANDROID
|
||||
QAction *_metricUnitsAction;
|
||||
QAction *_imperialUnitsAction;
|
||||
QAction *_nauticalUnitsAction;
|
||||
@ -240,6 +266,7 @@ private:
|
||||
QAction *_showMarkerDateAction;
|
||||
QAction *_showMarkerCoordinatesAction;
|
||||
QAction *_showTicksAction;
|
||||
QAction *_useStylesAction;
|
||||
QAction *_showCoordinatesAction;
|
||||
QAction *_openOptionsAction;
|
||||
QAction *_downloadDEMAction;
|
||||
@ -271,9 +298,11 @@ private:
|
||||
DateTimeRange _dateRange;
|
||||
QString _pathName;
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
QList<QByteArray> _windowStates;
|
||||
QList<QByteArray> _windowGeometries;
|
||||
int _frameStyle;
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
PDFExport _pdfExport;
|
||||
PNGExport _pngExport;
|
||||
|
@ -24,10 +24,17 @@ void HeartRateGraph::setInfo()
|
||||
if (_showTracks) {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Avg"), l.toString(avg() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
} else
|
||||
clearInfo();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ ToolTip MapItem::info() const
|
||||
if (!_name.isEmpty())
|
||||
tt.insert(tr("Name"), _name);
|
||||
if (!_fileName.isEmpty())
|
||||
tt.insert(tr("File"), _fileName);
|
||||
tt.insert(tr("File"), Util::displayName(_fileName));
|
||||
|
||||
return tt;
|
||||
}
|
||||
@ -186,7 +186,7 @@ void MapItem::setWidth(qreal width)
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
void MapItem::setStyle(Qt::PenStyle style)
|
||||
void MapItem::setPenStyle(Qt::PenStyle style)
|
||||
{
|
||||
if (_pen.style() == style)
|
||||
return;
|
||||
@ -212,6 +212,10 @@ void MapItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
update();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
Popup::show(event->screenPos(), info(), event->widget());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
void MapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
void setColor(const QColor &color);
|
||||
void setOpacity(qreal opacity);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setPenStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
ToolTip info() const;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QWheelEvent>
|
||||
#include <QGestureEvent>
|
||||
#include <QApplication>
|
||||
#include <QScrollBar>
|
||||
#include <QClipboard>
|
||||
@ -49,6 +50,8 @@ MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
|
||||
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
setResizeAnchor(QGraphicsView::AnchorViewCenter);
|
||||
setAcceptDrops(false);
|
||||
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
grabGesture(Qt::PinchGesture);
|
||||
|
||||
_mapScale = new ScaleItem();
|
||||
_mapScale->setZValue(2.0);
|
||||
@ -125,6 +128,8 @@ MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
|
||||
_opengl = false;
|
||||
_plot = false;
|
||||
_digitalZoom = 0;
|
||||
_pinchZoom = 0;
|
||||
_wheelDelta = 0;
|
||||
|
||||
_res = _map->resolution(_map->bounds());
|
||||
_scene->setSceneRect(_map->bounds());
|
||||
@ -153,7 +158,7 @@ PathItem *MapView::addTrack(const Track &track)
|
||||
_tr |= ti->path().boundingRect();
|
||||
ti->setColor(_palette.nextColor());
|
||||
ti->setWidth(_trackWidth);
|
||||
ti->setStyle(_trackStyle);
|
||||
ti->setPenStyle(_trackStyle);
|
||||
ti->setVisible(_showTracks);
|
||||
ti->setDigitalZoom(_digitalZoom);
|
||||
ti->setMarkerColor(_markerColor);
|
||||
@ -180,7 +185,7 @@ PathItem *MapView::addRoute(const Route &route)
|
||||
_rr |= ri->path().boundingRect();
|
||||
ri->setColor(_palette.nextColor());
|
||||
ri->setWidth(_routeWidth);
|
||||
ri->setStyle(_routeStyle);
|
||||
ri->setPenStyle(_routeStyle);
|
||||
ri->setVisible(_showRoutes);
|
||||
ri->showWaypoints(_showRouteWaypoints);
|
||||
ri->showWaypointLabels(_showWaypointLabels);
|
||||
@ -208,7 +213,7 @@ void MapView::addArea(const Area &area)
|
||||
AreaItem *ai = new AreaItem(area, _map);
|
||||
ai->setColor(_palette.nextColor());
|
||||
ai->setWidth(_areaWidth);
|
||||
ai->setStyle(_areaStyle);
|
||||
ai->setPenStyle(_areaStyle);
|
||||
ai->setOpacity(_areaOpacity);
|
||||
ai->setDigitalZoom(_digitalZoom);
|
||||
ai->setVisible(_showAreas);
|
||||
@ -249,7 +254,7 @@ MapItem *MapView::addMap(MapAction *map)
|
||||
MapItem *mi = new MapItem(map, _map);
|
||||
mi->setColor(_palette.nextColor());
|
||||
mi->setWidth(_areaWidth);
|
||||
mi->setStyle(_areaStyle);
|
||||
mi->setPenStyle(_areaStyle);
|
||||
mi->setOpacity(_areaOpacity);
|
||||
mi->setDigitalZoom(_digitalZoom);
|
||||
mi->setVisible(_showAreas);
|
||||
@ -536,7 +541,7 @@ void MapView::setUnits(Units units)
|
||||
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||
{
|
||||
WaypointItem::setCoordinatesFormat(format);
|
||||
PathItem::setCoordinatesFormat(format);
|
||||
MarkerInfoItem::setCoordinatesFormat(format);
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->updateMarkerInfo();
|
||||
@ -617,39 +622,49 @@ void MapView::zoom(int zoom, const QPoint &pos, bool shift)
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::pinchGesture(QPinchGesture *gesture)
|
||||
{
|
||||
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
|
||||
qreal scaleFactor = gesture->totalScaleFactor();
|
||||
|
||||
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
|
||||
int z = 0;
|
||||
|
||||
for (qreal sc = scaleFactor; sc > 1.25; sc *= 0.8)
|
||||
z += 1;
|
||||
for (qreal sc = scaleFactor; sc < 0.8; sc *= 1.25)
|
||||
z -= 1;
|
||||
|
||||
if (_pinchZoom != z) {
|
||||
zoom(z - _pinchZoom, gesture->centerPoint().toPoint(), false);
|
||||
_pinchZoom = z;
|
||||
}
|
||||
}
|
||||
if (gesture->state() == Qt::GestureFinished)
|
||||
_pinchZoom = 0;
|
||||
}
|
||||
|
||||
void MapView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
static int deg8 = 0;
|
||||
bool shift = (event->modifiers() & MODIFIER) ? true : false;
|
||||
// Shift inverts the wheel axis on OS X, so use scrolling in both axes for
|
||||
// the zoom.
|
||||
int delta = event->angleDelta().y()
|
||||
? event->angleDelta().y() : event->angleDelta().x();
|
||||
|
||||
deg8 += delta;
|
||||
if (qAbs(deg8) < (15 * 8))
|
||||
_wheelDelta += delta;
|
||||
if (qAbs(_wheelDelta) < (15 * 8))
|
||||
return;
|
||||
deg8 = deg8 % (15 * 8);
|
||||
_wheelDelta = _wheelDelta % (15 * 8);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
zoom((delta > 0) ? 1 : -1, event->pos(), shift);
|
||||
#else // QT 5.15
|
||||
zoom((delta > 0) ? 1 : -1, event->position().toPoint(), shift);
|
||||
#endif // QT 5.15
|
||||
}
|
||||
|
||||
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
bool shift = (event->modifiers() & MODIFIER) ? true : false;
|
||||
|
||||
QGraphicsView::mouseDoubleClickEvent(event);
|
||||
if (event->isAccepted())
|
||||
return;
|
||||
|
||||
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
|
||||
return;
|
||||
|
||||
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos(), shift);
|
||||
/* Do not call QGraphicsView::wheelEvent() here as this would shift the
|
||||
view ! */
|
||||
}
|
||||
|
||||
void MapView::keyPressEvent(QKeyEvent *event)
|
||||
@ -687,20 +702,11 @@ void MapView::keyReleaseEvent(QKeyEvent *event)
|
||||
QGraphicsView::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void MapView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->modifiers() & MODIFIER)
|
||||
QApplication::clipboard()->setText(Format::coordinates(
|
||||
_map->xy2ll(mapToScene(event->pos())), _cursorCoordinates->format()));
|
||||
else
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
PlotFlags flags)
|
||||
{
|
||||
QRect orig, adj;
|
||||
qreal ratio, diff, q, p;
|
||||
qreal mapRatio, ratio, diff, q, p;
|
||||
QPointF scenePos, scalePos, posPos, motionPos;
|
||||
int zoom;
|
||||
|
||||
@ -708,7 +714,6 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
// Enter plot mode
|
||||
setUpdatesEnabled(false);
|
||||
_plot = true;
|
||||
_map->setDevicePixelRatio(_deviceRatio, 1.0);
|
||||
|
||||
// Compute sizes & ratios
|
||||
orig = viewport()->rect();
|
||||
@ -727,6 +732,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
}
|
||||
|
||||
// Expand the view if plotting into a bitmap
|
||||
mapRatio = _mapRatio;
|
||||
setDevicePixelRatio(_deviceRatio, 1.0);
|
||||
|
||||
if (flags & Expand) {
|
||||
qreal xdiff = (target.width() - adj.width()) / 2.0;
|
||||
qreal ydiff = (target.height() - adj.height()) / 2.0;
|
||||
@ -779,6 +787,9 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
rescale();
|
||||
centerOn(scenePos);
|
||||
}
|
||||
|
||||
setDevicePixelRatio(_deviceRatio, mapRatio);
|
||||
|
||||
_mapScale->setDigitalZoom(_digitalZoom);
|
||||
_mapScale->setPos(scalePos);
|
||||
_positionCoordinates->setDigitalZoom(_digitalZoom);
|
||||
@ -787,7 +798,6 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
_motionInfo->setPos(motionPos);
|
||||
|
||||
// Exit plot mode
|
||||
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
||||
_plot = false;
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
@ -1024,7 +1034,7 @@ void MapView::setTrackStyle(Qt::PenStyle style)
|
||||
_trackStyle = style;
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setStyle(style);
|
||||
_tracks.at(i)->setPenStyle(style);
|
||||
}
|
||||
|
||||
void MapView::setRouteStyle(Qt::PenStyle style)
|
||||
@ -1032,7 +1042,7 @@ void MapView::setRouteStyle(Qt::PenStyle style)
|
||||
_routeStyle = style;
|
||||
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setStyle(style);
|
||||
_routes.at(i)->setPenStyle(style);
|
||||
}
|
||||
|
||||
void MapView::setAreaStyle(Qt::PenStyle style)
|
||||
@ -1040,7 +1050,7 @@ void MapView::setAreaStyle(Qt::PenStyle style)
|
||||
_areaStyle = style;
|
||||
|
||||
for (int i = 0; i < _areas.count(); i++)
|
||||
_areas.at(i)->setStyle(style);
|
||||
_areas.at(i)->setPenStyle(style);
|
||||
}
|
||||
|
||||
void MapView::setAreaOpacity(int opacity)
|
||||
@ -1170,6 +1180,12 @@ void MapView::scrollContentsBy(int dx, int dy)
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::leaveEvent(QEvent *event)
|
||||
{
|
||||
_cursorCoordinates->setCoordinates(Coordinates());
|
||||
QGraphicsView::leaveEvent(event);
|
||||
}
|
||||
|
||||
void MapView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (_cursorCoordinates->isVisible()) {
|
||||
@ -1180,10 +1196,46 @@ void MapView::mouseMoveEvent(QMouseEvent *event)
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void MapView::leaveEvent(QEvent *event)
|
||||
|
||||
void MapView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
_cursorCoordinates->setCoordinates(Coordinates());
|
||||
QGraphicsView::leaveEvent(event);
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (event->modifiers() & MODIFIER)
|
||||
QApplication::clipboard()->setText(Format::coordinates(_map->xy2ll(
|
||||
mapToScene(event->pos())), _cursorCoordinates->format()));
|
||||
#ifdef Q_OS_ANDROID
|
||||
else
|
||||
emit clicked(event->pos());
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
bool shift = (event->modifiers() & MODIFIER) ? true : false;
|
||||
|
||||
if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton)
|
||||
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos(), shift);
|
||||
|
||||
QGraphicsView::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
bool MapView::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Gesture)
|
||||
return gestureEvent(static_cast<QGestureEvent*>(event));
|
||||
|
||||
return QGraphicsView::event(event);
|
||||
}
|
||||
|
||||
bool MapView::gestureEvent(QGestureEvent *event)
|
||||
{
|
||||
if (QGesture *pinch = event->gesture(Qt::PinchGesture))
|
||||
pinchGesture(static_cast<QPinchGesture *>(pinch));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MapView::useOpenGL(bool use)
|
||||
@ -1201,6 +1253,20 @@ void MapView::useAntiAliasing(bool use)
|
||||
setRenderHint(QPainter::Antialiasing, use);
|
||||
}
|
||||
|
||||
void MapView::useStyles(bool use)
|
||||
{
|
||||
GraphicsItem::useStyle(use);
|
||||
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->updateStyle();
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->updateStyle();
|
||||
for (int i = 0; i < _areas.size(); i++)
|
||||
_areas.at(i)->updateStyle();
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->updateStyle();
|
||||
}
|
||||
|
||||
void MapView::setMarkerColor(const QColor &color)
|
||||
{
|
||||
_markerColor = color;
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
class QGeoPositionInfoSource;
|
||||
class QGeoPositionInfo;
|
||||
class QGestureEvent;
|
||||
class QPinchGesture;
|
||||
class Data;
|
||||
class POI;
|
||||
class Map;
|
||||
@ -100,6 +102,11 @@ public:
|
||||
|
||||
RectC boundingRect() const;
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
signals:
|
||||
void clicked(const QPoint &pos);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
public slots:
|
||||
void showMap(bool show);
|
||||
void showPOI(bool show);
|
||||
@ -122,6 +129,7 @@ public slots:
|
||||
void setMarkerPosition(qreal pos);
|
||||
void followPosition(bool follow);
|
||||
void showMotionInfo(bool show);
|
||||
void useStyles(bool use);
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
@ -147,6 +155,8 @@ private:
|
||||
void zoom(int zoom, const QPoint &pos, bool shift);
|
||||
void digitalZoom(int zoom);
|
||||
void updatePOIVisibility();
|
||||
bool gestureEvent(QGestureEvent *event);
|
||||
void pinchGesture(QPinchGesture *gesture);
|
||||
void skipColor() {_palette.nextColor();}
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
@ -157,9 +167,11 @@ private:
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
bool event(QEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
|
||||
GraphicsScene *_scene;
|
||||
ScaleItem *_mapScale;
|
||||
CoordinatesItem *_cursorCoordinates, *_positionCoordinates;
|
||||
@ -201,6 +213,9 @@ private:
|
||||
qreal _deviceRatio;
|
||||
qreal _mapRatio;
|
||||
bool _opengl;
|
||||
|
||||
int _pinchZoom;
|
||||
int _wheelDelta;
|
||||
};
|
||||
|
||||
#endif // MAPVIEW_H
|
||||
|
102
src/GUI/navigationwidget.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
#include <QEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QPainter>
|
||||
#include "mapview.h"
|
||||
#include "navigationwidget.h"
|
||||
|
||||
#define MARGIN 5
|
||||
#define SIZE 40
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
||||
NavigationWidget::NavigationWidget(MapView *view)
|
||||
: QWidget(view), _showPrev(false), _showNext(false)
|
||||
{
|
||||
setAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
newParent();
|
||||
|
||||
connect(view, &MapView::clicked, this, &NavigationWidget::viewClicked);
|
||||
}
|
||||
|
||||
bool NavigationWidget::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if (obj == parent()) {
|
||||
if (ev->type() == QEvent::Resize)
|
||||
resize(static_cast<QResizeEvent*>(ev)->size());
|
||||
else if (ev->type() == QEvent::ChildAdded)
|
||||
raise();
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(obj, ev);
|
||||
}
|
||||
|
||||
bool NavigationWidget::event(QEvent* ev)
|
||||
{
|
||||
if (ev->type() == QEvent::ParentAboutToChange) {
|
||||
if (parent())
|
||||
parent()->removeEventFilter(this);
|
||||
} else if (ev->type() == QEvent::ParentChange)
|
||||
newParent();
|
||||
|
||||
return QWidget::event(ev);
|
||||
}
|
||||
|
||||
void NavigationWidget::paintEvent(QPaintEvent *ev)
|
||||
{
|
||||
Q_UNUSED(ev);
|
||||
QPainter p(this);
|
||||
|
||||
QColor c(Qt::black);
|
||||
c.setAlpha(64);
|
||||
p.setBrush(c);
|
||||
p.setPen(Qt::NoPen);
|
||||
|
||||
if (_showPrev) {
|
||||
QPainterPath path;
|
||||
path.addEllipse(QRect(MARGIN, rect().center().y() - SIZE/2, SIZE, SIZE));
|
||||
path.moveTo(QPointF(MARGIN + 0.66*SIZE, rect().center().y() - SIZE/4));
|
||||
path.lineTo(QPointF(MARGIN + SIZE/4, rect().center().y()));
|
||||
path.lineTo(QPointF(MARGIN + 0.66*SIZE, rect().center().y() + SIZE/4));
|
||||
path.closeSubpath();
|
||||
p.drawPath(path);
|
||||
}
|
||||
if (_showNext) {
|
||||
QPainterPath path;
|
||||
path.addEllipse(QRect(rect().right() - (MARGIN + SIZE),
|
||||
rect().center().y() - SIZE/2, SIZE, SIZE));
|
||||
path.moveTo(QPointF(rect().right() - (MARGIN + 0.66*SIZE),
|
||||
rect().center().y() - SIZE/4));
|
||||
path.lineTo(QPointF(rect().right() - (MARGIN + SIZE/4),
|
||||
rect().center().y()));
|
||||
path.lineTo(QPointF(rect().right() - (MARGIN + 0.66*SIZE),
|
||||
rect().center().y() + SIZE/4));
|
||||
path.closeSubpath();
|
||||
p.drawPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationWidget::newParent()
|
||||
{
|
||||
if (!parent())
|
||||
return;
|
||||
|
||||
parent()->installEventFilter(this);
|
||||
raise();
|
||||
}
|
||||
|
||||
void NavigationWidget::viewClicked(const QPoint &pos)
|
||||
{
|
||||
QRect prevRect(MARGIN, rect().center().y() - SIZE/2, SIZE, SIZE);
|
||||
QRect nextRect(rect().right() - (MARGIN + SIZE), rect().center().y()
|
||||
- SIZE/2, SIZE, SIZE);
|
||||
|
||||
if (prevRect.contains(pos))
|
||||
emit prev();
|
||||
else if (nextRect.contains(pos))
|
||||
emit next();
|
||||
}
|
||||
|
||||
#endif // Q_OS_ANDROID
|
36
src/GUI/navigationwidget.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef NAVIGATIONWIDGET_H
|
||||
#define NAVIGATIONWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class MapView;
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
class NavigationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NavigationWidget(MapView *view);
|
||||
|
||||
void enableNext(bool enable) {_showNext = enable; update();}
|
||||
void enablePrev(bool enable) {_showPrev = enable; update();}
|
||||
|
||||
signals:
|
||||
void next();
|
||||
void prev();
|
||||
|
||||
private slots:
|
||||
void viewClicked(const QPoint &pos);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
bool event(QEvent *ev);
|
||||
void paintEvent(QPaintEvent *ev);
|
||||
void newParent();
|
||||
|
||||
bool _showPrev, _showNext;
|
||||
};
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
#endif // NAVIGATIONWIDGET_H
|
@ -26,8 +26,11 @@
|
||||
#include "pluginparameters.h"
|
||||
#include "optionsdialog.h"
|
||||
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#define MENU_MARGIN 0
|
||||
#else // Q_OS_ANDROID
|
||||
#define MENU_MARGIN 20
|
||||
#endif // Q_OS_ANDROID
|
||||
#define MENU_ICON_SIZE 32
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -556,7 +559,9 @@ QWidget *OptionsDialog::createPOIPage()
|
||||
QWidget *OptionsDialog::createDEMPage()
|
||||
{
|
||||
_demURL = new QLineEdit();
|
||||
#ifndef Q_OS_ANDROID
|
||||
_demURL->setMinimumWidth(300);
|
||||
#endif // Q_OS_ANDROID
|
||||
_demURL->setText(_options.demURL);
|
||||
_demAuth = new AuthenticationWidget();
|
||||
_demAuth->setUsername(_options.demUsername);
|
||||
@ -714,7 +719,7 @@ QWidget *OptionsDialog::createSystemPage()
|
||||
|
||||
_pixmapCache = new QSpinBox();
|
||||
_pixmapCache->setMinimum(16);
|
||||
_pixmapCache->setMaximum(1024);
|
||||
_pixmapCache->setMaximum(2048);
|
||||
_pixmapCache->setSuffix(UNIT_SPACE + tr("MB"));
|
||||
_pixmapCache->setValue(_options.pixmapCache);
|
||||
|
||||
@ -779,6 +784,11 @@ QWidget *OptionsDialog::createSystemPage()
|
||||
OptionsDialog::OptionsDialog(Options &options, Units units, QWidget *parent)
|
||||
: QDialog(parent), _options(options), _units(units)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
setWindowFlags(Qt::Window);
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
#endif /* Q_OS_ANDROID */
|
||||
|
||||
QStackedWidget *pages = new QStackedWidget();
|
||||
pages->addWidget(createAppearancePage());
|
||||
pages->addWidget(createMapPage());
|
||||
@ -791,16 +801,25 @@ OptionsDialog::OptionsDialog(Options &options, Units units, QWidget *parent)
|
||||
|
||||
QListWidget *menu = new QListWidget();
|
||||
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
||||
menu);
|
||||
#ifdef Q_OS_ANDROID
|
||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(MAPS_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(DATA_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(POI_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(DEM_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(POSITION_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), QString(), menu);
|
||||
new QListWidgetItem(QIcon(SYSTEM_ICON), QString(), menu);
|
||||
#else // Q_OS_ANDROID
|
||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"), menu);
|
||||
new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
|
||||
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
||||
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
||||
new QListWidgetItem(QIcon(DEM_ICON), tr("DEM"), menu);
|
||||
new QListWidgetItem(QIcon(POSITION_ICON), tr("Position"), menu);
|
||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
||||
menu);
|
||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"), menu);
|
||||
new QListWidgetItem(QIcon(SYSTEM_ICON), tr("System"), menu);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
QHBoxLayout *contentLayout = new QHBoxLayout();
|
||||
contentLayout->addWidget(menu);
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
#define GEOGRAPHICAL_MILE 1855.3248
|
||||
|
||||
Units PathItem::_units = Metric;
|
||||
QTimeZone PathItem::_timeZone = QTimeZone::utc();
|
||||
|
||||
static inline bool isValid(const QPointF &p)
|
||||
{
|
||||
return (!std::isnan(p.x()) && !std::isnan(p.y()));
|
||||
@ -29,9 +32,6 @@ static inline unsigned segments(qreal distance)
|
||||
return ceil(distance / GEOGRAPHICAL_MILE);
|
||||
}
|
||||
|
||||
Units PathItem::_units = Metric;
|
||||
QTimeZone PathItem::_timeZone = QTimeZone::utc();
|
||||
|
||||
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||
: GraphicsItem(parent), _path(path), _map(map), _graph(0)
|
||||
{
|
||||
@ -39,12 +39,14 @@ PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||
|
||||
_digitalZoom = 0;
|
||||
_width = 3;
|
||||
QBrush brush(Qt::SolidPattern);
|
||||
_pen = QPen(brush, _width);
|
||||
_color = Qt::black;
|
||||
_penStyle = Qt::SolidLine;
|
||||
_showMarker = true;
|
||||
_showTicks = false;
|
||||
_markerInfoType = MarkerInfoItem::None;
|
||||
|
||||
_pen = QPen(color(), width());
|
||||
|
||||
updatePainterPath();
|
||||
updateShape();
|
||||
updateTicks();
|
||||
@ -151,38 +153,66 @@ void PathItem::setMap(Map *map)
|
||||
_marker->setPos(pos);
|
||||
}
|
||||
|
||||
const QColor &PathItem::color() const
|
||||
{
|
||||
return (_useStyle && _path.style().color().isValid())
|
||||
? _path.style().color() : _color;
|
||||
}
|
||||
|
||||
void PathItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
_color = color;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
_pen.setColor(color);
|
||||
void PathItem::updateColor()
|
||||
{
|
||||
const QColor &c(color());
|
||||
|
||||
_pen.setColor(c);
|
||||
|
||||
for (int i = 0; i < _ticks.size(); i++)
|
||||
_ticks[i]->setColor(color);
|
||||
_ticks[i]->setColor(c);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
qreal PathItem::width() const
|
||||
{
|
||||
return (_useStyle && _path.style().width() > 0)
|
||||
? _path.style().width() : _width;
|
||||
}
|
||||
|
||||
void PathItem::setWidth(qreal width)
|
||||
{
|
||||
if (_width == width)
|
||||
return;
|
||||
_width = width;
|
||||
updateWidth();
|
||||
}
|
||||
|
||||
void PathItem::updateWidth()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
|
||||
updateShape();
|
||||
}
|
||||
|
||||
void PathItem::setStyle(Qt::PenStyle style)
|
||||
Qt::PenStyle PathItem::penStyle() const
|
||||
{
|
||||
if (_pen.style() == style)
|
||||
return;
|
||||
return (_useStyle && _path.style().style() != Qt::NoPen)
|
||||
? _path.style().style() : _penStyle;
|
||||
}
|
||||
|
||||
_pen.setStyle(style);
|
||||
void PathItem::setPenStyle(Qt::PenStyle style)
|
||||
{
|
||||
_penStyle = style;
|
||||
updatePenStyle();
|
||||
}
|
||||
|
||||
void PathItem::updatePenStyle()
|
||||
{
|
||||
_pen.setStyle(penStyle());
|
||||
update();
|
||||
}
|
||||
|
||||
@ -194,7 +224,7 @@ void PathItem::setDigitalZoom(int zoom)
|
||||
prepareGeometryChange();
|
||||
|
||||
_digitalZoom = zoom;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
_marker->setScale(pow(2, -_digitalZoom));
|
||||
for (int i = 0; i < _ticks.size(); i++)
|
||||
_ticks.at(i)->setDigitalZoom(zoom);
|
||||
@ -202,6 +232,19 @@ void PathItem::setDigitalZoom(int zoom)
|
||||
updateShape();
|
||||
}
|
||||
|
||||
void PathItem::updateStyle()
|
||||
{
|
||||
updateColor();
|
||||
updateWidth();
|
||||
updatePenStyle();
|
||||
|
||||
for (int i = 0; i < _graphs.size(); i++) {
|
||||
GraphItem *graph = _graphs.at(i);
|
||||
if (graph)
|
||||
graph->updateStyle();
|
||||
}
|
||||
}
|
||||
|
||||
const PathSegment *PathItem::segment(qreal x) const
|
||||
{
|
||||
for (int i = 0; i < _path.size(); i++)
|
||||
@ -319,10 +362,10 @@ void PathItem::setMarkerColor(const QColor &color)
|
||||
void PathItem::hover(bool hover)
|
||||
{
|
||||
if (hover) {
|
||||
_pen.setWidth((_width + 1) * pow(2, -_digitalZoom));
|
||||
_pen.setWidth((width() + 1) * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() + 1.0);
|
||||
} else {
|
||||
_pen.setWidth(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidth(width() * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() - 1.0);
|
||||
}
|
||||
|
||||
@ -413,6 +456,12 @@ void PathItem::addGraph(GraphItem *graph)
|
||||
if (graph) {
|
||||
connect(this, &PathItem::selected, graph, &GraphItem::hover);
|
||||
connect(graph, &GraphItem::selected, this, &PathItem::hover);
|
||||
if (graph->secondaryGraph()) {
|
||||
connect(this, &PathItem::selected, graph->secondaryGraph(),
|
||||
&GraphItem::hover);
|
||||
connect(graph->secondaryGraph(), &GraphItem::selected, this,
|
||||
&PathItem::hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -425,7 +474,7 @@ void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF((width() + 1) * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() + 1.0);
|
||||
update();
|
||||
|
||||
@ -436,7 +485,7 @@ void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_pen.setWidthF(width() * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() - 1.0);
|
||||
update();
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef PATHITEM_H
|
||||
#define PATHITEM_H
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QPen>
|
||||
#include <QTimeZone>
|
||||
#include "data/path.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "markerinfoitem.h"
|
||||
#include "format.h"
|
||||
#include "units.h"
|
||||
|
||||
class Map;
|
||||
@ -38,7 +38,7 @@ public:
|
||||
|
||||
void setColor(const QColor &color);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setPenStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
void setMarkerColor(const QColor &color);
|
||||
void showMarker(bool show);
|
||||
@ -49,11 +49,10 @@ public:
|
||||
|
||||
void updateTicks();
|
||||
void updateMarkerInfo();
|
||||
void updateStyle();
|
||||
|
||||
static void setUnits(Units units) {_units = units;}
|
||||
static void setTimeZone(const QTimeZone &zone) {_timeZone = zone;}
|
||||
static void setCoordinatesFormat(const CoordinatesFormat &format)
|
||||
{MarkerInfoItem::setCoordinatesFormat(format);}
|
||||
|
||||
public slots:
|
||||
void hover(bool hover);
|
||||
@ -76,28 +75,37 @@ private:
|
||||
void updateShape();
|
||||
void addSegment(const Coordinates &c1, const Coordinates &c2);
|
||||
void setMarkerInfo(qreal pos);
|
||||
void updateColor();
|
||||
void updateWidth();
|
||||
void updatePenStyle();
|
||||
qreal width() const;
|
||||
const QColor &color() const;
|
||||
Qt::PenStyle penStyle() const;
|
||||
|
||||
qreal xInM() const;
|
||||
unsigned tickSize() const;
|
||||
|
||||
Path _path;
|
||||
|
||||
Map *_map;
|
||||
QList<GraphItem *> _graphs;
|
||||
GraphItem *_graph;
|
||||
qreal _markerDistance;
|
||||
int _digitalZoom;
|
||||
|
||||
qreal _width;
|
||||
QPen _pen;
|
||||
QPainterPath _shape;
|
||||
QPainterPath _painterPath;
|
||||
bool _showMarker;
|
||||
bool _showTicks;
|
||||
MarkerInfoItem::Type _markerInfoType;
|
||||
|
||||
MarkerItem *_marker;
|
||||
MarkerInfoItem *_markerInfo;
|
||||
QVector<PathTickItem*> _ticks;
|
||||
|
||||
QPen _pen;
|
||||
QPainterPath _shape;
|
||||
QPainterPath _painterPath;
|
||||
|
||||
qreal _width;
|
||||
QColor _color;
|
||||
Qt::PenStyle _penStyle;
|
||||
bool _showMarker;
|
||||
bool _showTicks;
|
||||
MarkerInfoItem::Type _markerInfoType;
|
||||
qreal _markerDistance;
|
||||
int _digitalZoom;
|
||||
};
|
||||
|
||||
#endif // PATHITEM_H
|
||||
|
@ -18,10 +18,17 @@ PDFExportDialog::PDFExportDialog(PDFExport &exp, Units units, QWidget *parent)
|
||||
{
|
||||
int index;
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
setWindowFlags(Qt::Window);
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
#endif /* Q_OS_ANDROID */
|
||||
|
||||
_fileSelect = new FileSelectWidget();
|
||||
#ifndef Q_OS_ANDROID
|
||||
_fileSelect->setFilter(tr("PDF files") + " (*.pdf);;" + tr("All files")
|
||||
+ " (*)");
|
||||
_fileSelect->setFile(_export.fileName);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
_paperSize = new QComboBox();
|
||||
_paperSize->addItem("A2", QPageSize::PageSizeId::A2);
|
||||
@ -102,6 +109,9 @@ PDFExportDialog::PDFExportDialog(PDFExport &exp, Units units, QWidget *parent)
|
||||
#else // Q_OS_MAC
|
||||
layout->addWidget(pageSetupBox);
|
||||
layout->addWidget(outputFileBox);
|
||||
#ifdef Q_OS_ANDROID
|
||||
layout->addStretch();
|
||||
#endif // Q_OS_ANDROID
|
||||
#endif // Q_OS_MAC
|
||||
layout->addWidget(buttonBox);
|
||||
setLayout(layout);
|
||||
|
@ -17,8 +17,9 @@ public:
|
||||
virtual void setColor(const QColor &color) = 0;
|
||||
virtual void setOpacity(qreal opacity) = 0;
|
||||
virtual void setWidth(qreal width) = 0;
|
||||
virtual void setStyle(Qt::PenStyle style) = 0;
|
||||
virtual void setPenStyle(Qt::PenStyle style) = 0;
|
||||
virtual void setDigitalZoom(int zoom) = 0;
|
||||
virtual void updateStyle() {}
|
||||
};
|
||||
|
||||
#endif // PLANEITEM_H
|
||||
|
@ -15,10 +15,17 @@
|
||||
PNGExportDialog::PNGExportDialog(PNGExport &exp, QWidget *parent)
|
||||
: QDialog(parent), _export(exp)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
setWindowFlags(Qt::Window);
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
#endif /* Q_OS_ANDROID */
|
||||
|
||||
_fileSelect = new FileSelectWidget();
|
||||
#ifndef Q_OS_ANDROID
|
||||
_fileSelect->setFilter(tr("PNG files") + " (*.png);;" + tr("All files")
|
||||
+ " (*)");
|
||||
_fileSelect->setFile(_export.fileName);
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
_width = new QSpinBox();
|
||||
_width->setMinimum(256);
|
||||
@ -78,6 +85,9 @@ PNGExportDialog::PNGExportDialog(PNGExport &exp, QWidget *parent)
|
||||
#else // Q_OS_MAC
|
||||
layout->addWidget(pageSetupBox);
|
||||
layout->addWidget(outputFileBox);
|
||||
#ifdef Q_OS_ANDROID
|
||||
layout->addStretch();
|
||||
#endif // Q_OS_ANDROID
|
||||
#endif // Q_OS_MAC
|
||||
layout->addWidget(buttonBox);
|
||||
setLayout(layout);
|
||||
|
@ -24,10 +24,17 @@ void PowerGraph::setInfo()
|
||||
if (_showTracks) {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Avg"), l.toString(avg() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
} else
|
||||
clearInfo();
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ private:
|
||||
QString _desc;
|
||||
QString _comment;
|
||||
QVector<Link> _links;
|
||||
|
||||
QVector<WaypointItem*> _waypoints;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#define IMPERIAL_UNITS() \
|
||||
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
|
||||
#define POSITION_PLUGIN() \
|
||||
@ -30,6 +32,8 @@
|
||||
#define SHOW_GRAPH_GRIDS_DEFAULT true
|
||||
#define SHOW_GRAPH_SLIDER_INFO_SETTING "sliderInfo"
|
||||
#define SHOW_GRAPH_SLIDER_INFO_DEFAULT true
|
||||
#define SHOW_GRAPH_TABS_SETTING "tabs"
|
||||
#define SHOW_GRAPH_TABS_DEFAULT true
|
||||
#define SHOW_TICKS_SETTING "pathTicks"
|
||||
#define SHOW_TICKS_DEFAULT false
|
||||
|
||||
@ -82,6 +86,8 @@
|
||||
#define SHOW_MARKERS_DEFAULT true
|
||||
#define SHOW_MARKER_INFO_SETTING "markerInfo"
|
||||
#define SHOW_MARKER_INFO_DEFAULT MarkerInfoItem::None
|
||||
#define USE_STYLES_SETTING "styles"
|
||||
#define USE_STYLES_DEFAULT true
|
||||
|
||||
#define PDF_EXPORT_SETTINGS_GROUP "Export"
|
||||
#define PAPER_ORIENTATION_SETTING "orientation"
|
||||
@ -215,7 +221,11 @@
|
||||
#define ENABLE_HTTP2_SETTING "enableHTTP2"
|
||||
#define ENABLE_HTTP2_DEFAULT true
|
||||
#define PIXMAP_CACHE_SETTING "pixmapCache"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#define PIXMAP_CACHE_DEFAULT 256 /* MB */
|
||||
#else // Q_OS_ANDROID
|
||||
#define PIXMAP_CACHE_DEFAULT 512 /* MB */
|
||||
#endif // Q_OS_ANDROID
|
||||
#define CONNECTION_TIMEOUT_SETTING "connectionTimeout"
|
||||
#define CONNECTION_TIMEOUT_DEFAULT 30 /* s */
|
||||
#define HIRES_PRINT_SETTING "hiresPrint"
|
||||
|
@ -31,10 +31,17 @@ void SpeedGraph::setInfo()
|
||||
QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ?
|
||||
tr("min/mi") : tr("min/nmi");
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Avg"), l.toString(avg() * yScale(), 'f', 1)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale(), 'f', 1)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f',
|
||||
1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||
1) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Pace"), pace + UNIT_SPACE + pu);
|
||||
} else
|
||||
clearInfo();
|
||||
|
@ -24,12 +24,21 @@ void TemperatureGraph::setInfo()
|
||||
if (_showTracks) {
|
||||
QLocale l(QLocale::system());
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Avg"), l.toString(avg() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Min"), l.toString(min() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Max"), l.toString(max() * yScale() + yOffset(),
|
||||
'f', 1) + UNIT_SPACE + yUnits());
|
||||
#else // Q_OS_ANDROID
|
||||
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||
#endif // Q_OS_ANDROID
|
||||
} else
|
||||
clearInfo();
|
||||
}
|
||||
|
@ -32,11 +32,21 @@ Thumbnail::Thumbnail(const QString &path, int limit, QWidget *parent)
|
||||
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
_path = path;
|
||||
#else //Q_OS_ANDROID
|
||||
_path = QFileInfo(path).absoluteFilePath();
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
void Thumbnail::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
#ifdef Q_OS_ANDROID
|
||||
QDesktopServices::openUrl(_path);
|
||||
#else // Q_OS_ANDROID
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(_path));
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
QLabel::mousePressEvent(event);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#define FS(size) \
|
||||
((int)((qreal)size * 1.41))
|
||||
|
||||
|
||||
Units WaypointItem::_units = Metric;
|
||||
CoordinatesFormat WaypointItem::_format = DecimalDegrees;
|
||||
QTimeZone WaypointItem::_timeZone = QTimeZone::utc();
|
||||
@ -80,11 +79,11 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
_size = 8;
|
||||
_color = Qt::black;
|
||||
|
||||
_icon = (_waypoint.icon().isNull())
|
||||
_icon = (_waypoint.style().icon().isNull())
|
||||
? Waypoint::symbolIcon(_waypoint.symbol())
|
||||
: &_waypoint.icon();
|
||||
: &_waypoint.style().icon();
|
||||
|
||||
_font.setPixelSize(FS(_size));
|
||||
_font.setPixelSize(FS(size()));
|
||||
_font.setFamily(FONT_FAMILY);
|
||||
|
||||
updateCache();
|
||||
@ -97,20 +96,29 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
void WaypointItem::updateCache()
|
||||
{
|
||||
QPainterPath p;
|
||||
qreal pointSize = _font.bold() ? HS(_size) : _size;
|
||||
qreal pointSize = _font.bold() ? HS(size()) : size();
|
||||
const QPixmap &icon = _waypoint.style().icon();
|
||||
|
||||
if (_showLabel) {
|
||||
if (_showLabel && !_waypoint.name().isEmpty()) {
|
||||
QFontMetrics fm(_font);
|
||||
_labelBB = fm.tightBoundingRect(_waypoint.name());
|
||||
|
||||
if (_showIcon && _icon) {
|
||||
if (_font.bold())
|
||||
p.addRect(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
p.addRect(-_icon->width() * 0.625, icon.isNull()
|
||||
? -_icon->height() * 1.25 : -_icon->height() * 0.625,
|
||||
_icon->width() * 1.25, _icon->height() * 1.25);
|
||||
else
|
||||
p.addRect(-_icon->width()/2.0, -_icon->height(), _icon->width(),
|
||||
p.addRect(-_icon->width()/2.0, icon.isNull()
|
||||
? -_icon->height() : -_icon->height()/2, _icon->width(),
|
||||
_icon->height());
|
||||
p.addRect(0, 0, _labelBB.width(), _labelBB.height() + fm.descent());
|
||||
|
||||
if (icon.isNull())
|
||||
p.addRect(0, 0, _labelBB.width(), _labelBB.height()
|
||||
+ fm.descent());
|
||||
else
|
||||
p.addRect(_icon->width()/2, _icon->height()/2, _labelBB.width(),
|
||||
_labelBB.height() + fm.descent());
|
||||
} else {
|
||||
p.addRect(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
p.addRect(pointSize/2, pointSize/2, _labelBB.width(),
|
||||
@ -119,10 +127,12 @@ void WaypointItem::updateCache()
|
||||
} else {
|
||||
if (_showIcon && _icon) {
|
||||
if (_font.bold())
|
||||
p.addRect(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
p.addRect(-_icon->width() * 0.625, icon.isNull()
|
||||
? -_icon->height() * 1.25 : -_icon->height() * 0.625,
|
||||
_icon->width() * 1.25, _icon->height() * 1.25);
|
||||
else
|
||||
p.addRect(-_icon->width()/2, -_icon->height(), _icon->width(),
|
||||
p.addRect(-_icon->width()/2, icon.isNull()
|
||||
? -_icon->height() : -_icon->height()/2, _icon->width(),
|
||||
_icon->height());
|
||||
} else
|
||||
p.addRect(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
@ -136,28 +146,35 @@ void WaypointItem::paint(QPainter *painter,
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
qreal pointSize = _font.bold() ? HS(_size) : _size;
|
||||
qreal pointSize = _font.bold() ? HS(size()) : size();
|
||||
const QPixmap &icon = _waypoint.style().icon();
|
||||
|
||||
painter->setPen(_color);
|
||||
painter->setPen(color());
|
||||
|
||||
if (_showLabel) {
|
||||
if (_showLabel && !_waypoint.name().isEmpty()) {
|
||||
painter->setFont(_font);
|
||||
if (_showIcon && _icon)
|
||||
painter->drawText(-qMax(_labelBB.x(), 0), _labelBB.height(),
|
||||
_waypoint.name());
|
||||
else
|
||||
if (_showIcon && _icon) {
|
||||
if (icon.isNull())
|
||||
painter->drawText(-qMax(_labelBB.x(), 0), _labelBB.height(),
|
||||
_waypoint.name());
|
||||
else
|
||||
painter->drawText(_icon->width()/2 - qMax(_labelBB.x(), 0),
|
||||
_icon->height()/2 + _labelBB.height(), _waypoint.name());
|
||||
} else
|
||||
painter->drawText(pointSize/2 - qMax(_labelBB.x(), 0), pointSize/2
|
||||
+ _labelBB.height(), _waypoint.name());
|
||||
}
|
||||
|
||||
painter->setBrush(QBrush(_color, Qt::SolidPattern));
|
||||
painter->setBrush(QBrush(color(), Qt::SolidPattern));
|
||||
if (_showIcon && _icon) {
|
||||
if (_font.bold())
|
||||
painter->drawPixmap(-_icon->width() * 0.625, -_icon->height() * 1.25,
|
||||
painter->drawPixmap(-_icon->width() * 0.625, icon.isNull()
|
||||
? -_icon->height() * 1.25 : -_icon->height() * 0.625,
|
||||
_icon->scaled(_icon->width() * 1.25, _icon->height() * 1.25,
|
||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
else
|
||||
painter->drawPixmap(-_icon->width()/2.0, -_icon->height(), *_icon);
|
||||
painter->drawPixmap(-_icon->width()/2.0, icon.isNull()
|
||||
? -_icon->height() : -_icon->height()/2, *_icon);
|
||||
} else
|
||||
painter->drawEllipse(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||
|
||||
@ -166,26 +183,48 @@ void WaypointItem::paint(QPainter *painter,
|
||||
//painter->drawPath(_shape);
|
||||
}
|
||||
|
||||
int WaypointItem::size() const
|
||||
{
|
||||
return (_useStyle && _waypoint.style().size() > 0)
|
||||
? _waypoint.style().size() : _size;
|
||||
}
|
||||
|
||||
void WaypointItem::setSize(int size)
|
||||
{
|
||||
if (_size == size)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
_size = size;
|
||||
_font.setPixelSize(FS(_size));
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void WaypointItem::updateSize()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
_font.setPixelSize(FS(size()));
|
||||
updateCache();
|
||||
}
|
||||
|
||||
const QColor &WaypointItem::color() const
|
||||
{
|
||||
return (_useStyle && _waypoint.style().color().isValid())
|
||||
? _waypoint.style().color() : _color;
|
||||
}
|
||||
|
||||
void WaypointItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_color == color)
|
||||
return;
|
||||
|
||||
_color = color;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
void WaypointItem::updateColor()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void WaypointItem::updateStyle()
|
||||
{
|
||||
updateSize();
|
||||
updateColor();
|
||||
}
|
||||
|
||||
void WaypointItem::showLabel(bool show)
|
||||
{
|
||||
if (_showLabel == show)
|
||||
|
@ -2,14 +2,12 @@
|
||||
#define WAYPOINTITEM_H
|
||||
|
||||
#include <cmath>
|
||||
#include <QGraphicsItem>
|
||||
#include <QFont>
|
||||
#include <QTimeZone>
|
||||
#include "data/waypoint.h"
|
||||
#include "map/map.h"
|
||||
#include "units.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "format.h"
|
||||
#include "graphicsscene.h"
|
||||
|
||||
|
||||
class WaypointItem : public GraphicsItem
|
||||
@ -25,6 +23,7 @@ public:
|
||||
void showLabel(bool show);
|
||||
void showIcon(bool show);
|
||||
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
||||
void updateStyle();
|
||||
|
||||
QPainterPath shape() const {return _shape;}
|
||||
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||
@ -45,16 +44,22 @@ protected:
|
||||
|
||||
private:
|
||||
void updateCache();
|
||||
void updateColor();
|
||||
void updateSize();
|
||||
int size() const;
|
||||
const QColor &color() const;
|
||||
|
||||
Waypoint _waypoint;
|
||||
QPainterPath _shape;
|
||||
|
||||
QColor _color;
|
||||
int _size;
|
||||
bool _showLabel;
|
||||
bool _showIcon;
|
||||
|
||||
QFont _font;
|
||||
QRect _labelBB;
|
||||
const QPixmap *_icon;
|
||||
QPainterPath _shape;
|
||||
|
||||
static Units _units;
|
||||
static CoordinatesFormat _format;
|
||||
|
@ -68,7 +68,7 @@ void NetworkTimeout::timerEvent(QTimerEvent *ev)
|
||||
return;
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(parent());
|
||||
if (reply->isRunning())
|
||||
reply->close();
|
||||
reply->abort();
|
||||
_timer.stop();
|
||||
}
|
||||
|
||||
|
@ -19,65 +19,97 @@
|
||||
#define TYP_FILE "style.typ"
|
||||
#define RENDERTHEME_FILE "style.xml"
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#define DATA_LOCATION QStandardPaths::GenericDataLocation
|
||||
#else // Q_OS_ANDROID
|
||||
#define DATA_LOCATION QStandardPaths::AppDataLocation
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
static QString assetsPath(const QString &path, const QString &dir)
|
||||
{
|
||||
QDir pd(path);
|
||||
|
||||
if (pd.isAbsolute() && pd.exists())
|
||||
return pd.absolutePath();
|
||||
else
|
||||
return QString("assets://") + dir;
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
QString ProgramPaths::mapDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(MAP_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(MAP_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
#ifdef Q_OS_ANDROID
|
||||
return assetsPath(QStandardPaths::locate(DATA_LOCATION, MAP_DIR,
|
||||
QStandardPaths::LocateDirectory), MAP_DIR);
|
||||
#else // Q_OS_ANDROID
|
||||
return QStandardPaths::locate(DATA_LOCATION,
|
||||
MAP_DIR, QStandardPaths::LocateDirectory);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
QString ProgramPaths::poiDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(POI_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(POI_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
POI_DIR, QStandardPaths::LocateDirectory);
|
||||
return QStandardPaths::locate(DATA_LOCATION, POI_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
}
|
||||
|
||||
QString ProgramPaths::csvDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(CSV_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(CSV_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
CSV_DIR, QStandardPaths::LocateDirectory);
|
||||
#ifdef Q_OS_ANDROID
|
||||
return assetsPath(QStandardPaths::locate(DATA_LOCATION, CSV_DIR,
|
||||
QStandardPaths::LocateDirectory), CSV_DIR);
|
||||
#else // Q_OS_ANDROID
|
||||
return QStandardPaths::locate(DATA_LOCATION, CSV_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
QString ProgramPaths::demDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(DEM_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(DEM_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
DEM_DIR, QStandardPaths::LocateDirectory);
|
||||
return QStandardPaths::locate(DATA_LOCATION, DEM_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
}
|
||||
|
||||
QString ProgramPaths::styleDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(STYLE_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(STYLE_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
STYLE_DIR, QStandardPaths::LocateDirectory);
|
||||
return QStandardPaths::locate(DATA_LOCATION, STYLE_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
}
|
||||
|
||||
QString ProgramPaths::symbolsDir(bool writable)
|
||||
{
|
||||
if (writable)
|
||||
return QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::AppDataLocation)).filePath(SYMBOLS_DIR);
|
||||
return QDir(QStandardPaths::writableLocation(DATA_LOCATION))
|
||||
.filePath(SYMBOLS_DIR);
|
||||
else
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
SYMBOLS_DIR, QStandardPaths::LocateDirectory);
|
||||
#ifdef Q_OS_ANDROID
|
||||
return assetsPath(QStandardPaths::locate(DATA_LOCATION, SYMBOLS_DIR,
|
||||
QStandardPaths::LocateDirectory), SYMBOLS_DIR);
|
||||
#else // Q_OS_ANDROID
|
||||
return QStandardPaths::locate(DATA_LOCATION, SYMBOLS_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
QString ProgramPaths::tilesDir()
|
||||
@ -88,36 +120,36 @@ QString ProgramPaths::tilesDir()
|
||||
|
||||
QString ProgramPaths::translationsDir()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
TRANSLATIONS_DIR, QStandardPaths::LocateDirectory);
|
||||
#ifdef Q_OS_ANDROID
|
||||
return assetsPath(QStandardPaths::locate(DATA_LOCATION, TRANSLATIONS_DIR,
|
||||
QStandardPaths::LocateDirectory), TRANSLATIONS_DIR);
|
||||
#else // Q_OS_ANDROID
|
||||
return QStandardPaths::locate(DATA_LOCATION, TRANSLATIONS_DIR,
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
QString ProgramPaths::ellipsoidsFile()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
CSV_DIR "/" ELLIPSOID_FILE, QStandardPaths::LocateFile);
|
||||
return QDir(csvDir()).filePath(ELLIPSOID_FILE);
|
||||
}
|
||||
|
||||
QString ProgramPaths::gcsFile()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
CSV_DIR "/" GCS_FILE, QStandardPaths::LocateFile);
|
||||
return QDir(csvDir()).filePath(GCS_FILE);
|
||||
}
|
||||
|
||||
QString ProgramPaths::pcsFile()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
CSV_DIR "/" PCS_FILE, QStandardPaths::LocateFile);
|
||||
return QDir(csvDir()).filePath(PCS_FILE);
|
||||
}
|
||||
|
||||
QString ProgramPaths::typFile()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
STYLE_DIR "/" TYP_FILE, QStandardPaths::LocateFile);
|
||||
return QDir(styleDir()).filePath(TYP_FILE);
|
||||
}
|
||||
|
||||
QString ProgramPaths::renderthemeFile()
|
||||
{
|
||||
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||
STYLE_DIR "/" RENDERTHEME_FILE, QStandardPaths::LocateFile);
|
||||
return QDir(styleDir()).filePath(RENDERTHEME_FILE);
|
||||
}
|
||||
|
@ -10,11 +10,17 @@ public:
|
||||
Range() {_min = 0; _max = 0;}
|
||||
Range(int min, int max) : _min(min), _max(max) {}
|
||||
|
||||
bool operator==(const Range &other) const
|
||||
{return _min == other._min && _max == other._max;}
|
||||
bool operator!=(const Range &other) const
|
||||
{return _min != other._min || _max != other._max;}
|
||||
|
||||
int min() const {return _min;}
|
||||
int max() const {return _max;}
|
||||
int size() const {return (_max - _min);}
|
||||
|
||||
bool isValid() const {return size() >= 0;}
|
||||
bool isNull() const {return _min == 0 && _max == 0;}
|
||||
|
||||
void setMin(int min) {_min = min;}
|
||||
void setMax(int max) {_max = max;}
|
||||
|
@ -1,9 +1,72 @@
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <QFileInfo>
|
||||
#include <QTemporaryDir>
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QUrl>
|
||||
#include <QCoreApplication>
|
||||
#include <QJniEnvironment>
|
||||
#include <QJniObject>
|
||||
#endif // Q_OS_ANDROID
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
static QString documentName(const QString &path)
|
||||
{
|
||||
QJniEnvironment env;
|
||||
|
||||
QJniObject urlString = QJniObject::fromString(path);
|
||||
QJniObject uri = QJniObject::callStaticObjectMethod("android/net/Uri",
|
||||
"parse", "(Ljava/lang/String;)Landroid/net/Uri;",
|
||||
urlString.object<jstring>());
|
||||
if (!uri.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
QJniObject context = QNativeInterface::QAndroidApplication::context();
|
||||
if (!context.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
QJniObject contentResolver = context.callObjectMethod(
|
||||
"getContentResolver", "()Landroid/content/ContentResolver;");
|
||||
if (!contentResolver.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
QJniObject columnName = QJniObject::getStaticObjectField<jstring>(
|
||||
"android/provider/MediaStore$MediaColumns", "DISPLAY_NAME");
|
||||
if (!columnName.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
jobjectArray stringArray = env->NewObjectArray(
|
||||
1, env->FindClass("java/lang/String"), 0);
|
||||
env->SetObjectArrayElement(stringArray, 0, columnName.object<jstring>());
|
||||
QJniObject cursor = contentResolver.callObjectMethod("query",
|
||||
"(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;"
|
||||
"Landroid/os/CancellationSignal;)Landroid/database/Cursor;",
|
||||
uri.object(), stringArray, 0, 0);
|
||||
if (!cursor.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
if (!cursor.callMethod<jboolean>("moveToFirst")) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
QJniObject str = cursor.callObjectMethod("getString",
|
||||
"(I)Ljava/lang/String;", 0);
|
||||
if (!str.isValid()) {
|
||||
env->ExceptionClear();
|
||||
return QString();
|
||||
}
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
int Util::str2int(const char *str, int len)
|
||||
{
|
||||
int res = 0;
|
||||
@ -52,6 +115,34 @@ double Util::niceNum(double x, bool round)
|
||||
|
||||
QString Util::file2name(const QString &path)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
QFileInfo fi(displayName(path));
|
||||
return fi.baseName().replace('_', ' ');
|
||||
}
|
||||
|
||||
QString Util::displayName(const QString &path)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QUrl url(path);
|
||||
|
||||
// Not an Android URL, return standard filename.
|
||||
if (url.scheme() != "content") {
|
||||
QFileInfo fi(path);
|
||||
return fi.fileName();
|
||||
// Directory browsing URLs. Those can not be translated using the Android
|
||||
// content resolver but we can get the filename from the URL path.
|
||||
} else if (url.path().startsWith("/tree/")) {
|
||||
QFileInfo fi(url.fileName());
|
||||
return fi.fileName();
|
||||
// Translate all "regular" android URLs using the Android content resolver.
|
||||
} else
|
||||
return documentName(path);
|
||||
#else
|
||||
return path;
|
||||
#endif // Q_OS_ANDROID
|
||||
}
|
||||
|
||||
const QTemporaryDir &Util::tempDir()
|
||||
{
|
||||
static QTemporaryDir dir;
|
||||
return dir;
|
||||
}
|
||||
|
@ -3,11 +3,15 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QTemporaryDir;
|
||||
|
||||
namespace Util
|
||||
{
|
||||
int str2int(const char *str, int len);
|
||||
double niceNum(double x, bool round);
|
||||
QString file2name(const QString &path);
|
||||
QString displayName(const QString &path);
|
||||
const QTemporaryDir &tempDir();
|
||||
}
|
||||
|
||||
#endif // UTIL_H
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include "common/polygon.h"
|
||||
#include "style.h"
|
||||
|
||||
class Area
|
||||
{
|
||||
@ -27,6 +28,7 @@ public:
|
||||
const QString &description() const {return _desc;}
|
||||
const QList<Polygon> &polygons() const {return _polygons;}
|
||||
const RectC &boundingRect() const {return _boundingRect;}
|
||||
const PolygonStyle &style() const {return _style;}
|
||||
|
||||
bool isValid() const
|
||||
{
|
||||
@ -47,11 +49,13 @@ public:
|
||||
|
||||
void setName(const QString &name) {_name = name;}
|
||||
void setDescription(const QString &desc) {_desc = desc;}
|
||||
void setStyle(const PolygonStyle &style) {_style = style;}
|
||||
|
||||
private:
|
||||
QList<Polygon> _polygons;
|
||||
QString _name;
|
||||
QString _desc;
|
||||
PolygonStyle _style;
|
||||
RectC _boundingRect;
|
||||
};
|
||||
|
||||
|
@ -53,6 +53,7 @@ static QMultiMap<QString, Parser*> parsers()
|
||||
map.insert("gpx", &gpx);
|
||||
map.insert("tcx", &tcx);
|
||||
map.insert("kml", &kml);
|
||||
map.insert("kmz", &kml);
|
||||
map.insert("fit", &fit);
|
||||
map.insert("csv", &csv);
|
||||
map.insert("igc", &igc);
|
||||
@ -121,6 +122,13 @@ Data::Data(const QString &fileName, bool tryUnknown)
|
||||
file.reset();
|
||||
++it;
|
||||
}
|
||||
|
||||
qWarning("%s:", qPrintable(fileName));
|
||||
for (it = _parsers.find(suffix); it != _parsers.end()
|
||||
&& it.key() == suffix; it++)
|
||||
qWarning(" %s: line %d: %s", qPrintable(it.key()),
|
||||
it.value()->errorLine(), qPrintable(it.value()->errorString()));
|
||||
|
||||
} else if (tryUnknown) {
|
||||
for (it = _parsers.begin(); it != _parsers.end(); it++) {
|
||||
if (it.value()->parse(&file, trackData, routeData, _polygons,
|
||||
@ -132,9 +140,9 @@ Data::Data(const QString &fileName, bool tryUnknown)
|
||||
file.reset();
|
||||
}
|
||||
|
||||
qWarning("Error loading data file: %s:", qPrintable(fileName));
|
||||
qWarning("%s:", qPrintable(fileName));
|
||||
for (it = _parsers.begin(); it != _parsers.end(); it++)
|
||||
qWarning("%s: line %d: %s", qPrintable(it.key()),
|
||||
qWarning(" %s: line %d: %s", qPrintable(it.key()),
|
||||
it.value()->errorLine(), qPrintable(it.value()->errorString()));
|
||||
|
||||
_errorLine = 0;
|
||||
@ -155,7 +163,7 @@ QString Data::formats()
|
||||
+ qApp->translate("Data", "IGC files") + " (*.igc);;"
|
||||
+ qApp->translate("Data", "ITN files") + " (*.itn);;"
|
||||
+ qApp->translate("Data", "JPEG images") + " (*.jpg *.jpeg);;"
|
||||
+ qApp->translate("Data", "KML files") + " (*.kml);;"
|
||||
+ qApp->translate("Data", "KML files") + " (*.kml *.kmz);;"
|
||||
+ qApp->translate("Data", "LOC files") + " (*.loc);;"
|
||||
+ qApp->translate("Data", "NMEA files") + " (*.nmea);;"
|
||||
+ qApp->translate("Data", "ONmove files") + " (*.omd *.ghp);;"
|
||||
|