1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-04 14:49:30 +02:00

Compare commits

..

247 Commits
10.5 ... 11.6

Author SHA1 Message Date
2abc9ae246 Added android:exported required in SDK 31 2022-10-08 19:39:15 +02:00
4543311c95 Set Android target SDK version to 31 2022-10-08 19:14:19 +02:00
7bc5021989 Switched CI builds to Qt 6.4 2022-10-08 15:38:36 +02:00
26d2bc4f5d Preserve the configured path line style when no style is provided in the data 2022-10-07 21:54:39 +02:00
20f4f72999 Merge remote-tracking branch 'weblate/master' 2022-10-04 18:36:43 +02:00
cf62368ffc Version++ 2022-10-04 18:36:20 +02:00
072ba10e65 Merge branch 'origin/master' into Weblate. 2022-10-03 00:38:01 +02:00
76b0e9ac2f Do not depend on a specific Style/StyleMap element order 2022-10-03 00:36:38 +02:00
raf
530a54e924 Translated using Weblate (Catalan)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ca/
2022-09-29 10:17:52 +02:00
3b1a4f2ccb Translated using Weblate (German)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/de/
2022-09-26 23:00:34 +02:00
723f994527 Translated using Weblate (Czech)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/cs/
2022-09-26 22:59:06 +02:00
743747979e Merge branch 'origin/master' into Weblate. 2022-09-26 22:51:55 +02:00
579d8a5c6e Updated USGS maps (zoom 16) 2022-09-26 22:51:46 +02:00
a019ff3930 OziExplorer files styles support 2022-09-26 22:51:17 +02:00
05bcbddf77 Fixed multiple gx::track parsing issues 2022-09-26 22:50:40 +02:00
e18ac6da02 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-09-26 15:23:51 +02:00
e87999573a Translated using Weblate (Hungarian)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-09-26 15:23:51 +02:00
6407dfabea Translated using Weblate (Turkish)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-09-26 15:23:51 +02:00
f8fe454e72 Translated using Weblate (Swedish)
Currently translated at 100.0% (465 of 465 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-09-26 15:23:51 +02:00
ad2f108fa8 Localization update 2022-09-25 11:06:31 +02:00
418b1a8614 Added missing "use styles" setting save/restore 2022-09-25 11:05:13 +02:00
a59e7a058d Made data styles usage configurable 2022-09-25 02:15:24 +02:00
36b5746456 Fixed MultiGeometry handling 2022-09-24 13:20:58 +02:00
c0f2c1b7ad Fixed Qt6 build 2022-09-23 23:57:58 +02:00
1921087346 Multiple data styles fixes 2022-09-23 21:36:02 +02:00
a8299050c5 Added support for "data defined" styles 2022-09-23 02:35:09 +02:00
e8e1e98775 Version++ 2022-09-14 22:31:53 +02:00
6768647070 Fixed broken zoom 0 on HiDPI displays 2022-09-14 00:21:50 +02:00
de63009edd Enabled Catalan localization 2022-09-06 09:31:27 +02:00
raf
125f99e8f4 Translated using Weblate (Catalan)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ca/
2022-09-06 00:36:06 +02:00
raf
092929a967 Translated using Weblate (Catalan)
Currently translated at 63.3% (294 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ca/
2022-09-02 23:20:28 +02:00
fafe6c4b03 Various KML/KMZ parsing fixes and code cleanup 2022-09-02 22:53:38 +02:00
b156e25023 Properly handle PhotoOverlay icon URLs 2022-09-02 09:55:11 +02:00
e15deccfca Added Catalan localization stub 2022-09-02 08:42:28 +02:00
9b24bccfed Added PhotoOverlay support
+ non-shared styles
2022-09-02 08:36:58 +02:00
589c602d21 Document styles are not inherited 2022-09-01 00:49:21 +02:00
b7df3cbe0e Added support for KMZ data files + KML icons
fixes #312
2022-09-01 00:28:00 +02:00
f08f5893a3 Only offset the waypoint icons when they are using the symbol icons 2022-09-01 00:25:48 +02:00
1d5f7db12f Translated using Weblate (Norwegian Bokmål)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-08-30 08:58:07 +02:00
532a1eb69f Translated using Weblate (Norwegian Bokmål)
Currently translated at 98.7% (458 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-08-20 11:22:56 +02:00
1efb4e494d Properly abort the connections on timeout 2022-08-17 01:50:24 +02:00
4653f771a6 Code cleanup 2022-08-15 09:12:37 +02:00
22e5ffaa0c Added support for non-SQL Orux maps
+ error handling fixes/improvements
2022-08-11 23:39:36 +02:00
9a4514a464 Version++ 2022-08-11 23:38:48 +02:00
7d47f243ea Added Orux maps to supported offline maps 2022-08-11 01:02:58 +02:00
18c2613302 Updated Qt6 version to Qt 6.3 2022-08-11 00:11:40 +02:00
e2bdc1aae6 Added support for RD grid and Ellipsoidal mercator projections
+ removed (aparently) unsupported projections
2022-08-11 00:04:45 +02:00
a245043573 Merge remote-tracking branch 'weblate/master' 2022-08-08 23:28:04 +02:00
42dbc91143 Translated using Weblate (German)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/de/
2022-08-08 23:27:19 +02:00
23a7c6d4eb Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-08-08 23:26:40 +02:00
b6b4319f89 Translated using Weblate (Esperanto)
Currently translated at 92.8% (431 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-08-08 23:26:39 +02:00
8673c00a23 Translated using Weblate (Hungarian)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-08-08 23:26:39 +02:00
90280fb018 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-08-08 23:26:39 +02:00
285022c17a Translated using Weblate (Turkish)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-08-08 23:26:39 +02:00
e76bb40d10 Translated using Weblate (Swedish)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-08-08 23:26:38 +02:00
bbf5c09377 Translated using Weblate (Russian)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-08-08 23:26:38 +02:00
e1c7ad18e6 Translated using Weblate (Finnish)
Currently translated at 97.4% (452 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2022-08-08 23:26:38 +02:00
99792f2984 Translated using Weblate (Czech)
Currently translated at 100.0% (464 of 464 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/cs/
2022-08-08 23:26:19 +02:00
6d2e6f64d3 Added support for LAEA projections to Orux maps 2022-08-08 23:24:33 +02:00
183cb4825c Fixed cut&paste errors 2022-08-08 10:11:19 +02:00
7b8fff7440 Properly sort the Orux maps zoom levels 2022-08-08 00:21:24 +02:00
a01ff33768 Add another alias for WGS84 2022-08-08 00:20:30 +02:00
c3117bb3ac Fixed projection parameters parsing in Orux maps 2022-08-07 23:44:48 +02:00
20fe804293 Localization update 2022-08-07 22:34:36 +02:00
525f70f15e Fixed PNG/PDF export dialogues on Android 2022-08-07 22:31:10 +02:00
209df67380 Orux maps desktop integration 2022-08-07 22:30:38 +02:00
6e40d8cbc7 Handle Orux maps as directories
(there can not be two Orux maps in the same directory)
2022-08-05 08:40:38 +02:00
0ef28cda0f Fixed map calibration 2022-08-05 08:34:16 +02:00
1b83f88b27 Switch to macos-latest as macos-10.15 was cancelled 2022-08-04 00:13:10 +02:00
a40ed633ae Version++ 2022-08-04 00:07:41 +02:00
399299d192 Added support for Orux maps 2022-08-04 00:06:36 +02:00
ec68557de5 NDK root, again... 2022-07-31 17:10:32 +02:00
c68fc72387 Another atempt to set the NDK path... 2022-07-31 16:51:39 +02:00
3c9da66a51 Added missing NDK path 2022-07-31 16:43:32 +02:00
22e56e06fd Back to qt install @v2 2022-07-31 14:22:51 +02:00
2e9d173f53 Added missing Java distribution 2022-07-31 14:05:46 +02:00
84b7da13f0 Some more CI tools version updates 2022-07-31 14:00:51 +02:00
ed74d0c069 Updated Qt/Qt install action versions 2022-07-31 13:51:27 +02:00
218eb3be56 Added GEMF and Osmdroid SQLite maps support info 2022-07-31 13:43:46 +02:00
5795395107 Added missing GEMF icon resource entry 2022-07-31 13:22:33 +02:00
e8b1ce2c29 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-07-30 15:19:46 +02:00
ea159a4a79 Added missing GEMF MIME type 2022-07-23 00:41:59 +02:00
f43786e0ae GEMF OS X desktop integration 2022-07-23 00:39:17 +02:00
cae25ba2db Merge branch 'origin/master' into Weblate. 2022-07-22 20:35:17 +02:00
a0c52069c3 Added Windows & Linux GEMF files desktop integration 2022-07-22 20:34:33 +02:00
475ca98527 Create translation files in android CI build 2022-07-22 19:06:45 +02:00
529aefdb46 Merge branch 'origin/master' into Weblate. 2022-07-22 19:06:11 +02:00
312eb127c4 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-07-20 18:19:31 +02:00
e9d93bcc03 Properly sort th map types 2022-07-18 08:52:12 +02:00
c4353a04a4 Translated using Weblate (German)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/de/
2022-07-18 07:39:52 +02:00
bbc00eadb2 Translated using Weblate (Czech)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/cs/
2022-07-18 07:39:52 +02:00
aef757521c Translated using Weblate (Esperanto)
Currently translated at 92.8% (430 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-07-17 18:17:40 +02:00
ce35bfa196 Translated using Weblate (Hungarian)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-07-17 18:17:40 +02:00
803ed91b73 Translated using Weblate (Ukrainian)
Currently translated at 99.7% (462 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-07-17 18:17:40 +02:00
642e75074b Translated using Weblate (Turkish)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-07-17 18:17:40 +02:00
491f9f1cae Translated using Weblate (Swedish)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-07-17 18:17:39 +02:00
c46e656410 Translated using Weblate (Russian)
Currently translated at 100.0% (463 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-07-17 18:17:39 +02:00
636752991d Translated using Weblate (Finnish)
Currently translated at 97.4% (451 of 463 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2022-07-17 18:17:39 +02:00
c4b6226f8d Merge branch 'origin/master' into Weblate. 2022-07-15 22:29:43 +02:00
6cb209983f Localization update 2022-07-15 22:29:16 +02:00
825e5e6068 Merge branch 'origin/master' into Weblate. 2022-07-15 21:53:10 +02:00
2cb186e674 Removed debug code 2022-07-15 21:52:46 +02:00
4f3bdb4370 Merge branch 'origin/master' into Weblate. 2022-07-15 21:41:33 +02:00
91150e97db Added support for GEMF maps 2022-07-15 21:24:49 +02:00
f52547dc2c Translated using Weblate (Hungarian)
Currently translated at 100.0% (462 of 462 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-07-10 19:19:56 +02:00
377ebc0f7a Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (462 of 462 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-07-09 10:19:53 +02:00
3418a5ddd6 Translated using Weblate (Hungarian)
Currently translated at 100.0% (462 of 462 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-07-09 10:19:52 +02:00
0e8760d4c7 Translated using Weblate (Turkish)
Currently translated at 100.0% (462 of 462 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-07-08 08:21:50 +02:00
586e2a03f9 Translated using Weblate (Swedish)
Currently translated at 100.0% (462 of 462 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-07-08 06:52:06 +02:00
9b135f2579 Localization update 2022-07-08 02:14:47 +02:00
9ae771084b Make the graph tabs display configurable on Android 2022-07-08 02:14:47 +02:00
8b4daa43e3 Improved error reporting 2022-07-08 02:14:47 +02:00
efd496d38c Removed accidentaly commited QtCreator project file 2022-07-07 11:14:11 +02:00
5488f5c531 Remove missleading translation comments
(the given arrows are missing in most fonts)
2022-07-07 00:56:06 +02:00
1c6c47d42d Merge remote-tracking branch 'weblate/master' 2022-07-07 00:51:23 +02:00
699baf14bd Various localization and translations fixes 2022-07-07 00:45:53 +02:00
ce6486ecd2 Translated using Weblate (Russian)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-07-07 00:45:36 +02:00
c9330bf273 Enable localization on Android 2022-07-06 19:43:56 +02:00
06f19bc77c Merge branch 'origin/master' into Weblate. 2022-07-06 19:43:34 +02:00
53f1c66ab0 Translated missing CZ and DE strings 2022-07-06 19:32:00 +02:00
2a2dcb926e Merge branch 'origin/master' into Weblate. 2022-07-06 19:31:53 +02:00
97fdcfdd74 Code cleanup 2022-07-06 14:58:41 +02:00
1bc40cd428 Merge branch 'origin/master' into Weblate. 2022-07-06 14:58:10 +02:00
90c1e52fb5 Fixed map bounds issues 2022-07-06 12:50:57 +02:00
851e99cc66 Merge branch 'origin/master' into Weblate. 2022-07-06 12:50:40 +02:00
c79ee01912 Added Osmdroid SQLite maps desktop integration 2022-07-06 09:26:42 +02:00
fc43076789 Merge branch 'origin/master' into Weblate. 2022-07-06 09:26:34 +02:00
c3f94f8c1a Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-07-06 09:26:33 +02:00
01310944eb Translated using Weblate (Esperanto)
Currently translated at 93.0% (429 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-07-06 09:26:33 +02:00
609596341d Translated using Weblate (Hungarian)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-07-06 09:26:33 +02:00
6c27ccf6e5 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-07-06 09:26:32 +02:00
4e086ae5f6 Translated using Weblate (Turkish)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-07-06 09:26:32 +02:00
4d74190d27 Translated using Weblate (Swedish)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-07-06 09:26:32 +02:00
5a868e25dd Translated using Weblate (Russian)
Currently translated at 99.7% (460 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-07-06 09:26:32 +02:00
e53a8b0333 Translated using Weblate (Finnish)
Currently translated at 97.3% (449 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2022-07-06 09:26:31 +02:00
50e65d95c5 Added some more translators comments 2022-07-05 12:13:42 +02:00
46dec308f9 Merge branch 'origin/master' into Weblate. 2022-07-05 12:13:30 +02:00
56a5c386ae Translated using Weblate (Swedish)
Currently translated at 100.0% (461 of 461 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-07-05 12:13:29 +02:00
6771344c60 Merge remote-tracking branch 'weblate/master' 2022-07-05 12:02:14 +02:00
a149a40221 Localization update 2022-07-05 11:33:04 +02:00
028d87b443 Added support for Osmdroid SQLite maps 2022-07-05 11:32:14 +02:00
74b73d8700 Limit line lengths in line-based parsers 2022-07-05 11:08:57 +02:00
99365c3ac8 Added translators comments for "up" and "down" 2022-07-03 20:47:28 +02:00
8dc9bca93e Merge branch 'origin/master' into Weblate. 2022-07-03 20:47:22 +02:00
20fecb3e99 Translated using Weblate (Esperanto)
Currently translated at 93.0% (428 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-07-03 18:20:05 +02:00
bec747e90a Translated using Weblate (Hungarian)
Currently translated at 100.0% (460 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-07-03 18:20:05 +02:00
e56116b64c Translated using Weblate (Ukrainian)
Currently translated at 100.0% (460 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-07-03 18:20:04 +02:00
a94602785c Translated using Weblate (Russian)
Currently translated at 99.7% (459 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-07-03 18:20:04 +02:00
d083e217f9 Translated using Weblate (Finnish)
Currently translated at 97.3% (448 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2022-07-03 18:20:04 +02:00
f370642c81 Fixed android GUI layout issues 2022-06-30 23:57:39 +02:00
f675558014 Merge branch 'origin/master' into Weblate. 2022-06-30 23:57:26 +02:00
a1167f3daa Translated using Weblate (Chinese (Simplified))
Currently translated at 99.7% (459 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-06-30 23:57:26 +02:00
52fc890697 Translated using Weblate (Hungarian)
Currently translated at 100.0% (460 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-06-30 23:57:25 +02:00
1366dd0f53 Translated using Weblate (Turkish)
Currently translated at 100.0% (460 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-06-30 23:57:25 +02:00
ca1e5d8dae Translated using Weblate (Norwegian Bokmål)
Currently translated at 98.4% (453 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-06-30 23:57:24 +02:00
f6f3741796 Translated using Weblate (Swedish)
Currently translated at 100.0% (460 of 460 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-06-30 06:16:47 +02:00
24584c44c3 Localization update 2022-06-30 00:32:20 +02:00
23e8154a1f Fixed map dir loading on Android 2022-06-19 23:05:01 +02:00
7118794b26 Added android builds Qt6 dependency info 2022-06-12 00:05:12 +02:00
5af3808895 Properly compute the header size
+ code cleanup
2022-06-11 10:19:14 +02:00
1f2e460c87 Silenced clang warning 2022-06-11 09:48:55 +02:00
57c524e08a Version++ 2022-06-11 09:35:01 +02:00
e35cf68309 Upload APK artifact from Android build 2022-06-11 00:02:23 +02:00
3be8ec748a Use java 11 in Android build 2022-06-10 23:40:47 +02:00
5ba00e016b Added OpenSSL to the android build 2022-06-10 23:26:28 +02:00
0f3fea5460 Improved map errors reporting 2022-06-10 08:09:07 +02:00
e7d6c3f76a Do not make unnecessary checks when loading IMG maps and TrekBuddy atlases 2022-06-09 00:38:25 +02:00
ca0089e486 Added missing Android Qt modules install 2022-06-04 14:20:26 +02:00
c9930a7aa3 Make Android OpenSSL support optional 2022-06-04 14:12:54 +02:00
c9b06ba3cf Try to install both the desktop and the Android Qt
(broken aqtinstall workaround)
2022-06-04 13:53:35 +02:00
a168d28d81 Remove debug stuff 2022-06-04 13:29:01 +02:00
8f05346ced Debug CI 2022-06-04 13:10:35 +02:00
8e62bd83d6 Yet another atempt to fix Android CI build... 2022-06-04 12:57:41 +02:00
471ea7a6ee Some more CI debug 2022-06-04 12:53:29 +02:00
353a606864 Use android_armv7 2022-06-04 12:38:17 +02:00
3dc998a5c0 Try the default arch 2022-06-04 12:32:14 +02:00
22e25671ce Remove nonexistent qt6 module 2022-06-04 12:01:21 +02:00
6d07af868e Try again with a newer aqt version... 2022-06-04 11:56:48 +02:00
d9f57eddf2 Specify Android build 2022-06-04 11:04:37 +02:00
ad664d5299 Added some CI debug stuff 2022-06-04 10:53:52 +02:00
13dc02d144 Added Android CI build 2022-06-04 10:39:29 +02:00
306116dbde Fixed possible crash on map unload 2022-06-02 23:22:34 +02:00
ca1c576562 Fixed Android build 2022-06-02 22:08:40 +02:00
feb1650ed0 Allow tile cache sizes up to 2GB 2022-06-02 19:14:34 +02:00
e6e41c846c Increase the default tile image cache size
On big IMG maps that are "digitaly" zoomed out, the tile memory may not be
sufficient for the whole display area which leads to "cache ping-pong", image
artefacts and 100% CPU usage. 512MB RAM should be available for everyone on
the desktop these days...
2022-06-02 19:03:12 +02:00
20adecec89 Code cleanup 2022-06-02 19:02:46 +02:00
8cb08d05ca Version++ 2022-06-02 18:35:44 +02:00
7bd03494db Code cleanup 2022-06-02 18:35:27 +02:00
7ba19b8c0a Use asynchronous tiles rendering in IMG maps
On Android devices, the rendering is very slow so use the same approach as
already used in Mapsforge maps.
2022-06-02 18:31:40 +02:00
25869200db Fixed broken map zooming using the mouse wheel
(introduced in 11.0)
2022-06-02 18:30:19 +02:00
af0bb2e268 Updated features, build and download info 2022-05-30 19:13:12 +02:00
844607f6ce Added missing QT SVG devel package dependency 2022-05-28 14:14:59 +02:00
ba0b7c62a4 Android port 2022-05-28 14:05:14 +02:00
e701ad0ed0 Fixed broken PDF/PNG export of MApsforge maps 2022-05-25 23:04:20 +02:00
c3ba8f1f0d Fixed broken map plotting on systems with HiDpi displays 2022-05-25 23:03:30 +02:00
b98143ef8c Translated using Weblate (German)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/de/
2022-05-25 09:08:09 +02:00
eb04666e38 Translated using Weblate (Czech)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/cs/
2022-05-25 09:08:08 +02:00
d593748e1b Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/zh_Hans/
2022-05-20 09:14:06 +02:00
a03aa81c0a Translated using Weblate (Esperanto)
Currently translated at 94.0% (414 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-05-20 09:14:05 +02:00
d56c748983 Translated using Weblate (Hungarian)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2022-05-20 09:14:05 +02:00
d9de386c34 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-05-20 09:14:05 +02:00
dd038deddd Translated using Weblate (Turkish)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/tr/
2022-05-20 09:14:05 +02:00
3b20d00386 Translated using Weblate (Swedish)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/sv/
2022-05-20 09:14:04 +02:00
4583869e2b Translated using Weblate (Russian)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2022-05-20 09:14:04 +02:00
b2c6a5807c Translated using Weblate (Finnish)
Currently translated at 97.9% (431 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2022-05-20 09:14:04 +02:00
e14fc6b204 Merge branch 'origin/master' into Weblate. 2022-05-18 00:00:58 +02:00
71a8affdeb Back to plurals-only #2 2022-05-18 00:00:53 +02:00
8ed9c7053b Merge branch 'origin/master' into Weblate. 2022-05-17 23:56:00 +02:00
53b8c1c846 Do not use the korean localization until it is translated 2022-05-17 23:55:59 +02:00
98a04cbafc Merge branch 'origin/master' into Weblate. 2022-05-17 23:54:46 +02:00
d51b97f586 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (439 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-05-17 23:54:45 +02:00
2304fb5350 Added (again...) korean localization stub
+ localization update
2022-05-17 23:54:16 +02:00
8ee21a8080 Added missing MG maps HiDPI displays support 2022-05-10 01:05:30 +02:00
2df916eb95 Fixed broken appveyor.yml file 2022-04-30 09:32:29 +02:00
0121381d18 Version++ 2022-04-29 23:18:01 +02:00
93aadb7e74 Do not depend on the file extension when loading the maps 2022-04-29 23:16:10 +02:00
40febb8c0e Use the correct super class 2022-04-28 22:36:04 +02:00
1e5b18d86a Added support for pinch zoom 2022-04-28 21:54:00 +02:00
8f9af0d973 Be more tolerant to broken TYP files
Where possible, only skip the point/line/polygon entry, not the whole TYP file.
2022-04-24 17:19:26 +02:00
208e31c6de Explicitly marking the basemaps is not required 2022-04-24 09:17:28 +02:00
959d08ba94 Removed broken coordinates adjustment 2022-04-22 22:26:47 +02:00
5f16f7b367 Fixed/improved IMG basemaps handling 2022-04-20 19:40:44 +02:00
baee8b3484 Version++ 2022-04-19 22:19:44 +02:00
c694c3e300 A (hopefully) complete path shape parsing fix
fixes #430
2022-04-19 22:17:19 +02:00
1458d66798 Fixed path shape parsing 2022-04-16 23:39:03 +02:00
62fa0cce36 Merge branch 'origin/master' into Weblate. 2022-04-14 23:33:26 +02:00
b115c041be Do not recompute the adjacency info offset as we are lready there 2022-04-14 23:32:50 +02:00
f63c1fee1c Translated using Weblate (Esperanto)
Currently translated at 94.0% (413 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2022-04-14 18:10:22 +02:00
88d9f10a78 Translated using Weblate (Ukrainian)
Currently translated at 92.4% (406 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2022-04-14 18:10:21 +02:00
ec06793a19 Code cleanup 2022-04-14 04:31:46 +02:00
53cdc86aa0 Improved error handling + code cleanup 2022-04-13 22:13:57 +02:00
82ea54cacc Added some more missing marine symbols 2022-04-12 23:44:57 +02:00
d8fb7cb41e Merge branch 'origin/master' into Weblate. 2022-04-11 00:58:36 +02:00
5041d935f0 Increase marinas rendering priority 2022-04-11 00:59:26 +02:00
98f9aab9d9 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.7% (438 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-04-10 13:07:16 +02:00
8bc91c760a Only read the node offset when it is actually present 2022-04-08 00:23:45 +02:00
e96400e564 Merge branch 'origin/master' into Weblate. 2022-04-08 00:23:17 +02:00
e088f03cf9 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.7% (438 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-04-06 18:06:33 +02:00
e3582cc5cf Added missing "Established direction of traffic flow" line 2022-04-04 23:17:46 +02:00
fc033826a1 Code cleanup 2022-04-04 22:27:57 +02:00
8cf4c474f2 Added missing buoy icons 2022-04-04 22:26:57 +02:00
351a969606 Properly center the beacon symbol 2022-04-04 22:25:42 +02:00
2234245e81 Extend obstruction info 2022-04-03 21:20:21 +02:00
681de81b1c Version++ 2022-04-03 18:52:33 +02:00
a5ae41f8ad Added pile symbol 2022-04-03 18:51:15 +02:00
576a063dcb Added support for depth points 2022-04-03 18:21:26 +02:00
c5e46957a8 Removed unused image metadata 2022-03-27 19:25:38 +02:00
191 changed files with 19895 additions and 8399 deletions

View File

@ -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
View 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

View File

@ -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

View File

@ -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

View File

@ -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.
![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux2.png)
## 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)

View File

@ -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
}

View File

@ -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 -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

BIN
icons/IMG/marine/pile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
icons/IMG/marine/tower.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
icons/formats/gemf.icns Normal file

Binary file not shown.

BIN
icons/formats/gemf.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

View File

@ -29,3 +29,4 @@ omd:#ed09cb
ghp:#ed09cb
qct:#370642
trk:#cccccc
gemf:#147085

2528
lang/gpxsee_ca.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2375
lang/gpxsee_ko.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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>

View 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
View 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(",")
}
}

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View 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>

View File

@ -21,7 +21,9 @@
<li>Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
TwoNav RMaps, Garmin IMG &amp; 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>

View File

@ -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

View File

@ -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>

View File

@ -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)'

View File

@ -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>

View File

@ -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>

View File

@ -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) {

View File

@ -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();

View File

@ -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)

View File

@ -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;
};

View File

@ -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();
}

View File

@ -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)

View File

@ -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("...");

View File

@ -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
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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();
}

View File

@ -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. */

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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>&nbsp;" + 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);

View File

@ -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;

View File

@ -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();
}

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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

View 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

View 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

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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();
}

View File

@ -30,7 +30,6 @@ private:
QString _desc;
QString _comment;
QVector<Link> _links;
QVector<WaypointItem*> _waypoints;
};

View File

@ -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"

View File

@ -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();

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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)

View File

@ -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;

View File

@ -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();
}

View File

@ -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);
}

View 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;}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
};

View File

@ -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);;"

Some files were not shown because too many files have changed in this diff Show More