florb rebuild with omake.

This commit is contained in:
uglyside
2024-12-22 10:40:56 +03:00
parent 49d2d05f71
commit 4b57072a05
8 changed files with 1743 additions and 768 deletions
+14 -19
View File
@@ -5,30 +5,25 @@
# See the file https://www.gnu.org/licenses/gpl-3.0.txt
from pisi.actionsapi import shelltools
from pisi.actionsapi import cmaketools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
j = "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr -L \
"
def setup():
pisitools.flags.add("-pthread -fpermissive -lXpm")
pisitools.unlinkDir("src/i18n/de_DE")
shelltools.makedirs("build")
shelltools.cd("build")
cmaketools.configure(j, sourceDir = '..')
def build():
shelltools.cd("build")
cmaketools.make()
# passed with --ignore-sandbox
shelltools.cd("src")
pisitools.dosed("fluid/dlg_search.fl", "Double\ resizable", "Double resizable modal")
pisitools.dosed("OMakefile", "unroll-loops", "unroll-loops -fpermissive")
for t in ["", "i18nupdate", "i18ncompile"]:
shelltools.system("omake %s" % t)
def install():
pisitools.dobin("build/src/florb")
pisitools.dopixmaps("src/res/florb.png")
shelltools.chmod("src/res/florb.svg", mode = 0644)
pisitools.insinto("/usr/share/icons/hicolor/scalable/apps", "src/res/florb.svg")
shelltools.cd("src")
shelltools.system("omake PREFIX=%s/usr install" % get.installDIR())
# pisitools.dodoc("LICENSE.txt", "README.txt")
for mo in ["de_DE/LC_MESSAGES", "sv_SE/LC_MESSAGES"]:
shelltools.chmod("%s/usr/share/locale/%s/florb.mo" % (get.installDIR(), mo), mode = 0644)
for i in ["florb.xpm", "res/florb.png", "res/florb.svg"]:
pisitools.insinto("/usr/share/pixmaps", i)
pisitools.dodoc("../LICENSE.txt")
@@ -0,0 +1,56 @@
From e8295730fd2b6fce9b7366277f5f7560e5d44768 Mon Sep 17 00:00:00 2001
From: Bud Davis <jimmie.davis@uta.edu>
Date: Thu, 19 Dec 2024 11:34:37 -0600
Subject: [PATCH] Merged in pending pull requests, and cleared up a curl
deprecation warning.
---
src/dlg_settings_ex.cpp | 4 +++-
src/downloader.cpp | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/dlg_settings_ex.cpp b/src/dlg_settings_ex.cpp
index 5dca6ce..1d5279b 100644
--- a/src/dlg_settings_ex.cpp
+++ b/src/dlg_settings_ex.cpp
@@ -194,7 +194,9 @@ void dlg_settings::tab_ui_setup_ex()
m_box_trackcolor->color(fl_rgb_color(m_cfgui.trackcolor().r(), m_cfgui.trackcolor().g(), m_cfgui.trackcolor().b()));
m_box_selectioncolor->color(fl_rgb_color(m_cfgui.selectioncolor().r(), m_cfgui.selectioncolor().g(), m_cfgui.selectioncolor().b()));
m_box_gpscursorcolor->color(fl_rgb_color(m_cfgui.gpscursorcolor().r(), m_cfgui.gpscursorcolor().g(), m_cfgui.gpscursorcolor().b()));
- m_input_trackwidth->value(static_cast<std::ostringstream*>( &(std::ostringstream() << m_cfgui.tracklinewidth()) )->str().c_str());
+ std::ostringstream oss;
+ oss << m_cfgui.tracklinewidth();
+ m_input_trackwidth->value(oss.str().c_str());
}
void dlg_settings::tab_cache_setup_ex()
diff --git a/src/downloader.cpp b/src/downloader.cpp
index 840c848..3039766 100644
--- a/src/downloader.cpp
+++ b/src/downloader.cpp
@@ -1,6 +1,6 @@
#include <curl/curl.h>
#include <curl/easy.h>
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <FL/Fl.H>
@@ -8,6 +8,8 @@
#include "version.hpp"
#include "downloader.hpp"
+using namespace boost::placeholders;
+
florb::downloader::downloader(int nthreads) :
m_timeout(10),
m_nice(0),
@@ -221,7 +223,7 @@ void florb::downloader::worker()
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, cb_header);
curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
- curl_easy_setopt(curl_handle, CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
+ curl_easy_setopt(curl_handle, CURLOPT_SHARE, 0);
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, timeout());
curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, timeout());
@@ -0,0 +1,659 @@
From a119886c0c644fa1005dd094a75d5e179e4e4672 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Claes=20N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
Date: Tue, 1 Sep 2020 09:27:03 +0200
Subject: [PATCH] Swedish translation
Initial go at translating florb to Swedish.
---
src/i18n/sv_SE.po | 642 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 642 insertions(+), 0 deletions(-)
create mode 100644 src/i18n/sv_SE.po
diff --git a/src/i18n/sv_SE/florb.po b/src/i18n/sv_SE/florb.po
new file mode 100644
index 0000000..472699c
--- /dev/null
+++ b/src/i18n/sv_SE/florb.po
@@ -0,0 +1,642 @@
+# Swedish translations for florb package
+# Swedish messages for florb.
+# Copyright (C) 2019 THE florb's COPYRIGHT HOLDER
+# This file is distributed under the same license as the florb package.
+# Automatically generated, 2020.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-09-25 16:30+0200\n"
+"PO-Revision-Date: 2020-09-01 09:50+0200\n"
+"Last-Translator: Claes Nästén <pekdon@gmail.com>\n"
+"Language-Team: none\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+
+#: dlg_tileserver_ex.cpp:97
+msgid "A tile server with the same name already exists."
+msgstr "En kartserver med det namnet existerar redan."
+
+#: dlg_ui_ex.cpp:181
+msgid "About"
+msgstr "Om florb"
+
+#: dlg_ui_ex.cpp:494
+msgid "About / License"
+msgstr "Om florb / Licens"
+
+#: dlg_settings_ex.cpp:156
+msgid "Add tile server"
+msgstr "Lägg till kartserver"
+
+#: fluid/dlg_settings.cpp:521
+msgid "Add tileserver"
+msgstr "Lägg till kartserver"
+
+#: fluid/dlg_ui.cpp:942
+msgid "Base"
+msgstr "Baskarta"
+
+#: fluid/dlg_bulkdl.cpp:12
+msgid "Bulk download"
+msgstr "Kartendownload"
+
+#: fluid/dlg_settings.cpp:554
+msgid "Cache"
+msgstr "Cache"
+
+#: cache.cpp:156
+msgid "Cache error: EXISTS"
+msgstr "Cache Fel: EXISTS"
+
+#: cache.cpp:217
+msgid "Cache error: GET"
+msgstr "Cache Fel: GET"
+
+#: cache.cpp:107
+msgid "Cache error: PUT"
+msgstr "Cache Fel: PUT"
+
+#: dlg_bulkdl_ex.cpp:171 fluid/dlg_settings.cpp:639
+#: fluid/dlg_tileserver.cpp:123 fluid/dlg_editselection.cpp:80
+#: fluid/dlg_garmindl.cpp:61
+msgid "Cancel"
+msgstr "Avbryt"
+
+#: dlg_ui_ex.cpp:168
+msgid "Clear"
+msgstr "Rensa"
+
+#: fluid/dlg_ui.cpp:869
+msgid "Clear current track"
+msgstr "Rensa spår"
+
+#: fluid/dlg_bulkdl.cpp:48
+msgid "Delay [ms]"
+msgstr "Fördröjning [ms]"
+
+#: dlg_ui_ex.cpp:170 fluid/dlg_ui.cpp:889
+msgid "Delete waypoints"
+msgstr "Radera ruttpunkter"
+
+#: fluid/dlg_garminul.cpp:28 fluid/dlg_garmindl.cpp:23
+msgid "Device"
+msgstr "Enhet"
+
+#: fluid/dlg_garmindl.cpp:12
+msgid "Device download"
+msgstr "Hämta från enhet"
+
+#: fluid/dlg_garminul.cpp:17
+msgid "Device upload"
+msgstr "Lagra på enhet"
+
+#: fluid/dlg_settings.cpp:593
+msgid "Distances"
+msgstr "Avstånd"
+
+#: dlg_bulkdl_ex.cpp:219 fluid/dlg_bulkdl.cpp:61 fluid/dlg_garmindl.cpp:36
+msgid "Download"
+msgstr "Hämta"
+
+#: dlg_garmindl_ex.cpp:121
+msgid "Download Failed!"
+msgstr "Hämtning misslyckades!"
+
+#: dlg_garmindl_ex.cpp:117
+msgid "Download OK"
+msgstr "Hämtning OK"
+
+#: dlg_ui_ex.cpp:172
+msgid "Download from device"
+msgstr "Hämta från enhet"
+
+#: dlg_ui_ex.cpp:163 fluid/dlg_settings.cpp:326 fluid/dlg_settings.cpp:350
+#: fluid/dlg_settings.cpp:374 fluid/dlg_settings.cpp:398
+#: fluid/dlg_settings.cpp:422
+msgid "Edit"
+msgstr "Redigera"
+
+#: dlg_settings_ex.cpp:182
+msgid "Edit tile server"
+msgstr "Redigera kartserver"
+
+#: fluid/dlg_settings.cpp:539 fluid/dlg_tileserver.cpp:17
+msgid "Edit tileserver"
+msgstr "Redigera kartserver"
+
+#: dlg_ui_ex.cpp:169 fluid/dlg_editselection.cpp:8 fluid/dlg_ui.cpp:879
+msgid "Edit waypoints"
+msgstr "Redigera ruttpunkter"
+
+#: fluid/dlg_editselection.cpp:42 dlg_editselection_ex.cpp:32
+msgid "Elevation"
+msgstr "Höjd"
+
+#: fluid/dlg_editselection.cpp:38
+msgid "Elevation [m]"
+msgstr "Höjd [m]"
+
+#: fluid/dlg_eleprofile.cpp:16
+msgid "Elevation profile"
+msgstr "Höjdprofil"
+
+#: dlg_eleprofile_ex.cpp:75
+msgid "Elevation: "
+msgstr "Höjd: "
+
+#: fluid/dlg_settings.cpp:459
+msgid "Enable GPSd"
+msgstr "Aktivera GPSd"
+
+#: tracklayer.cpp:478
+msgid "Error updating selected waypoints"
+msgstr "Fel vid uppdatering av markerade ruttpunkter"
+
+#: cache.cpp:46
+msgid "Failed to open / create cache database"
+msgstr "Fel vid öppnning / skapande av cache-databasen"
+
+#: tracklayer.cpp:289 tracklayer.cpp:312
+msgid "Failed to open GPX file"
+msgstr "Fel vid öppning av GPX-fil"
+
+#: tracklayer.cpp:415
+msgid "Failed to save GPX data"
+msgstr "Fel vid lagring av GPX-fil"
+
+#: downloader.cpp:34
+msgid "Failed to start downloader"
+msgstr "Misslyckades att starta hämtning"
+
+#: dlg_bulkdl_ex.cpp:121
+msgid "Failure parsing zoomlevel description."
+msgstr "Fel vid inläsning av zoomnivå"
+
+#: dlg_ui_ex.cpp:158
+msgid "File"
+msgstr "Fil"
+
+#: dlg_ui_ex.cpp:129 dlg_ui_ex.cpp:192
+msgid "GPS"
+msgstr "GPS"
+
+#: fluid/dlg_settings.cpp:410
+msgid "GPS cursor color"
+msgstr "GPS färg"
+
+#: dlg_ui_ex.cpp:175 fluid/dlg_settings.cpp:452
+msgid "GPSd"
+msgstr "GPSd"
+
+#: gpsdclient.cpp:16
+msgid "GPSd error"
+msgstr "GPSd fel"
+
+#: wgt_map.cpp:37
+msgid "GPX error"
+msgstr "GPX fel"
+
+#: dlg_ui_ex.cpp:176 fluid/dlg_ui.cpp:905
+msgid "Go to cursor"
+msgstr "Gå till position"
+
+#: dlg_ui_ex.cpp:180
+msgid "Help"
+msgstr "Hjälp"
+
+#: fluid/dlg_tileserver.cpp:53
+msgid "Image format"
+msgstr "Bildformat"
+
+#: dlg_settings_ex.cpp:214
+msgid "Imperial"
+msgstr "Brittiska"
+
+#: fluid/dlg_settings.cpp:308
+msgid "Interface"
+msgstr "Gränssnitt"
+
+#: dlg_bulkdl_ex.cpp:267
+msgid "Invalid delay"
+msgstr "Ogiltig fördörjning"
+
+#: utils.cpp:28
+msgid "Invalid latitude"
+msgstr "Ogiltig latitud"
+
+#: utils.cpp:26
+msgid "Invalid longitude"
+msgstr "Ogiltig longitud"
+
+#: utils.cpp:69 utils.cpp:94
+msgid "Invalid pixel position"
+msgstr "Ogiltig pixelposition"
+
+#: unit.cpp:54 unit.cpp:74
+msgid "Invalid unit conversion"
+msgstr "Ogiltig enhetskonvertering"
+
+#: dlg_bulkdl_ex.cpp:146
+msgid "Invalid zoomlevel specified for this map."
+msgstr "Ogiltig zoomnivå för denna karta"
+
+#: dlg_ui_ex.cpp:86
+msgid "Lat: "
+msgstr "Lat: "
+
+#: fluid/dlg_editselection.cpp:32
+msgid "Latitude"
+msgstr "Latitud"
+
+#: fluid/dlg_editselection.cpp:28
+msgid "Latitude [°]"
+msgstr "Latitud [°]"
+
+#: fluid/dlg_ui.cpp:843
+msgid "Load GPX file"
+msgstr "Öppna GPX-fil"
+
+#: fluid/dlg_settings.cpp:561
+msgid "Location"
+msgstr "Plats"
+
+#: dlg_ui_ex.cpp:178 fluid/dlg_ui.cpp:915
+msgid "Lock to cursor"
+msgstr "Position folgen"
+
+#: dlg_ui_ex.cpp:82
+msgid "Lon: "
+msgstr "Long: "
+
+#: fluid/dlg_editselection.cpp:22
+msgid "Longitude"
+msgstr "Longitud"
+
+#: fluid/dlg_editselection.cpp:18
+msgid "Longitude [°]"
+msgstr "Longitud [°]"
+
+#: fluid/dlg_bulkdl.cpp:23
+msgid "Map"
+msgstr "Karta"
+
+#: fluid/dlg_settings.cpp:314
+msgid "Marker color"
+msgstr "Markörfärg"
+
+#: fluid/dlg_settings.cpp:338
+msgid "Marker color (selected)"
+msgstr "Markörfärg (vald)"
+
+#: wgt_map.cpp:48 wgt_map.cpp:145 wgt_map.cpp:153 wgt_map.cpp:161
+msgid "Marker error"
+msgstr "Markörfel"
+
+#: fluid/dlg_tileserver.cpp:83
+msgid "Max. z"
+msgstr "Max. z"
+
+#: fluid/dlg_ui.cpp:823
+msgid "Menu"
+msgstr "Meny"
+
+#: dlg_settings_ex.cpp:220
+msgid "Metric"
+msgstr "Metrisk"
+
+#: fluid/dlg_tileserver.cpp:66
+msgid "Min. z"
+msgstr "Min. z"
+
+#: dlg_settings_ex.cpp:153
+msgid "My tileserver"
+msgstr "Min kartserver"
+
+#: fluid/dlg_tileserver.cpp:29
+msgid "Name"
+msgstr "Namn"
+
+#: dlg_settings_ex.cpp:217
+msgid "Nautical"
+msgstr "Nautisk"
+
+#: dlg_garminul_ex.cpp:35 dlg_garmindl_ex.cpp:43
+msgid "No devices found"
+msgstr "Inga enheter funna"
+
+#: dlg_ui_ex.cpp:212
+msgid "None"
+msgstr "Ingen"
+
+#: fluid/dlg_eleprofile.cpp:71 fluid/dlg_bulkdl.cpp:86
+#: fluid/dlg_settings.cpp:643 fluid/dlg_tileserver.cpp:127
+#: fluid/dlg_garminul.cpp:74 fluid/dlg_editselection.cpp:76
+#: fluid/dlg_garmindl.cpp:65 fluid/dlg_search.cpp:67 fluid/dlg_txtdisp.cpp:47
+msgid "OK"
+msgstr "OK"
+
+#: dlg_ui_ex.cpp:159
+msgid "Open GPX"
+msgstr "Öppna GPX-fil"
+
+#: fluid/dlg_ui.cpp:951
+msgid "Overlay"
+msgstr "Överlägg"
+
+#: dlg_tileserver_ex.cpp:68
+msgid "Please provide a name for this server!"
+msgstr "Ange ett namn för denna server"
+
+#: dlg_tileserver_ex.cpp:76
+msgid "Please specify the download url for this server!"
+msgstr "Ange en address för denna server"
+
+#: fluid/dlg_settings.cpp:485
+msgid "Port"
+msgstr "Port"
+
+#: dlg_ui_ex.cpp:161
+msgid "Quit"
+msgstr "Avsluta"
+
+#: dlg_ui_ex.cpp:177 fluid/dlg_ui.cpp:926
+msgid "Record track"
+msgstr "Spela in bana"
+
+#: fluid/dlg_settings.cpp:530
+msgid "Remove tileserver"
+msgstr "Radera kartserver"
+
+#: dlg_ui_ex.cpp:160
+msgid "Save GPX as"
+msgstr "Spara som GPX-fil"
+
+#: fluid/dlg_ui.cpp:853
+msgid "Save current track"
+msgstr "Spara bana"
+
+#: wgt_map.cpp:59
+msgid "Scale error"
+msgstr "Skalfel"
+
+#: dlg_ui_ex.cpp:165 fluid/dlg_search.cpp:7 fluid/dlg_search.cpp:26
+msgid "Search"
+msgstr "Sök"
+
+#: dlg_settings_ex.cpp:97 fluid/dlg_settings.cpp:571
+msgid "Select cache directory"
+msgstr "Välj cachekatalog"
+
+#: dlg_settings_ex.cpp:277
+msgid "Select color"
+msgstr "Välg färg"
+
+#: dlg_ui_ex.cpp:342
+msgid "Select download area"
+msgstr "Välj område att hämta"
+
+#: dlg_ui_ex.cpp:341
+msgid "Select the desired area on the map now"
+msgstr "Välj önskat område på kartan"
+
+#: fluid/dlg_settings.cpp:386
+msgid "Selection color"
+msgstr "Välj färg"
+
+#: wgt_map.cpp:67
+msgid "Selection error"
+msgstr "Fel"
+
+#: fluid/dlg_settings.cpp:471
+msgid "Server"
+msgstr "Server"
+
+#: dlg_ui_ex.cpp:164 fluid/dlg_settings.cpp:298
+msgid "Settings"
+msgstr "Inställningar"
+
+#: dlg_ui_ex.cpp:171
+msgid "Show waypoint markers"
+msgstr "Visa ruttpunktsmarkörer"
+
+#: fluid/dlg_tileserver.cpp:99
+msgid "Sim. downloads"
+msgstr "Sim. hämtning"
+
+#: fluid/dlg_ui.cpp:972
+msgid "Slippy Map"
+msgstr "Karta"
+
+#: fluid/dlg_settings.cpp:503
+msgid "Tileservers"
+msgstr "Kartservrar"
+
+#: dlg_ui_ex.cpp:167
+msgid "Track"
+msgstr "Bana"
+
+#: fluid/dlg_settings.cpp:362
+msgid "Track color"
+msgstr "Banfärg"
+
+#: fluid/dlg_settings.cpp:434
+msgid "Track line width"
+msgstr "Banlinjefärg"
+
+#: fluid/dlg_garminul.cpp:41
+msgid "Track title"
+msgstr "Bannamn"
+
+#: dlg_ui_ex.cpp:106 dlg_eleprofile_ex.cpp:71
+msgid "Trip: "
+msgstr "Tur"
+
+#: fluid/dlg_tileserver.cpp:41
+msgid "URL"
+msgstr "URL"
+
+#: fluid/dlg_settings.cpp:586
+msgid "Units"
+msgstr "Enheter"
+
+#: fluid/dlg_garminul.cpp:55
+msgid "Upload"
+msgstr "Ladda upp"
+
+#: dlg_garminul_ex.cpp:88
+msgid "Upload Failed!"
+msgstr "Uppladdning misslyckades!"
+
+#: dlg_garminul_ex.cpp:86
+msgid "Upload OK"
+msgstr "Uppladdning OK"
+
+#: dlg_ui_ex.cpp:173
+msgid "Upload to device"
+msgstr "Ladda upp till enhet"
+
+#: dlg_ui_ex.cpp:182 dlg_ui_ex.cpp:510
+msgid "Usage"
+msgstr "Användning"
+
+#: dlg_ui_ex.cpp:491
+msgid "Version: "
+msgstr "Version: "
+
+#: fluid/dlg_eleprofile.cpp:7
+msgid "View elevation profile"
+msgstr "Visa höjdprofil"
+
+#: dlg_bulkdl_ex.cpp:306
+msgid "Zoom "
+msgstr "Zoom "
+
+#: fluid/dlg_bulkdl.cpp:36
+msgid "Zoom levels"
+msgstr "Zoom nivåer"
+
+#: dlg_ui_ex.cpp:74
+msgid "Zoom: "
+msgstr "Zoom: "
+
+#: fluid/dlg_ui.cpp:819
+msgid "florb"
+msgstr "florb"
+
+#: unit.cpp:14
+msgid "ft"
+msgstr "fot"
+
+#: unit.cpp:13
+msgid "in"
+msgstr "tum"
+
+#: unit.cpp:8
+msgid "km"
+msgstr "km"
+
+#: unit.cpp:7
+msgid "m"
+msgstr "m"
+
+#: unit.cpp:9 unit.cpp:10
+msgid "mi"
+msgstr "mi"
+
+#: unit.cpp:11
+msgid "sm"
+msgstr "sm"
+
+#: unit.cpp:12
+msgid "yd"
+msgstr "yd"
+
+#~ msgid ""
+#~ " * Left-click the map to define a new trackpoint\n"
+#~ " * Hold the left mouse button on a trackpoint to drag it\n"
+#~ " * Left-click any trackpoint to select it\n"
+#~ " * Left-click and drag to select multiple trackpoints\n"
+#~ " * Hit DEL to delete selected trackpoints"
+#~ msgstr ""
+#~ " * Klicke mit links um einen Wegpunkt zu definieren\n"
+#~ " * Halte die linke Maustaste gedrückt, um einen Wegpunkt zu "
+#~ "verschieben\n"
+#~ " * Zum Auswählen klicke mit links auf einen Wegpunkt\n"
+#~ " * Klicke mit links und ziehe um mehrere Wegpunkte auszuwählen\n"
+#~ " * Drücke ENTF um ausgewählte Wegpunkte zu löschen"
+
+#~ msgid ""
+#~ " * Use the arrow keys (UP / DOWN / RIGHT / LEFT) to move the map or\n"
+#~ " * hold the right mouse button and drag\n"
+#~ " * Use the + and - keys to zoom or\n"
+#~ " * scroll to zoom"
+#~ msgstr ""
+#~ " * Benutze die Pfeiltasten (OBEN / UNTEN / LINKS / RECHTS) um die "
+#~ "Karte zu bewegen oder\n"
+#~ " * bewege die Karte mit der Maus (rechte Maustaste halten)\n"
+#~ " * Benutze die + und - Tasten zum Zoomen oder\n"
+#~ " * benutze das Scrollrad an Maus / Trackpad"
+
+#~ msgid "Cache error: SESSIONID"
+#~ msgstr "Cache-Fehler: SESSIONID"
+
+#~ msgid "Copyright (c) 2014, Björn Rehm (bjoern@shugaa.de)"
+#~ msgstr "Copyright (c) 2014, Björn Rehm (bjoern@shugaa.de)"
+
+#~ msgid "Editing trackpoints:"
+#~ msgstr "Wegpunkte bearbeiten:"
+
+#~ msgid "Map motion:"
+#~ msgstr "Karte bewegen:"
+
+#~ msgid "New GPX track"
+#~ msgstr "Neuer GPS Track"
+
+#~ msgid ""
+#~ "Permission is hereby granted, free of charge, to any person obtaining a "
+#~ "copy\n"
+#~ "of this software and associated documentation files (the \"Software\"), "
+#~ "to deal\n"
+#~ "in the Software without restriction, including without limitation the "
+#~ "rights\n"
+#~ "to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+#~ "sell\n"
+#~ "copies of the Software, and to permit persons to whom the Software is\n"
+#~ "furnished to do so, subject to the following conditions:"
+#~ msgstr ""
+#~ "Permission is hereby granted, free of charge, to any person obtaining a "
+#~ "copy\n"
+#~ "of this software and associated documentation files (the \"Software\"), "
+#~ "to deal\n"
+#~ "in the Software without restriction, including without limitation the "
+#~ "rights\n"
+#~ "to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+#~ "sell\n"
+#~ "copies of the Software, and to permit persons to whom the Software is\n"
+#~ "furnished to do so, subject to the following conditions:"
+
+#~ msgid "Pick"
+#~ msgstr "Wählen"
+
+#~ msgid ""
+#~ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS "
+#~ "OR\n"
+#~ "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"
+#~ "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL "
+#~ "THE\n"
+#~ "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n"
+#~ "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+#~ "FROM,\n"
+#~ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS "
+#~ "IN\n"
+#~ "THE SOFTWARE."
+#~ msgstr ""
+#~ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS "
+#~ "OR\n"
+#~ "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"
+#~ "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL "
+#~ "THE\n"
+#~ "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n"
+#~ "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+#~ "FROM,\n"
+#~ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS "
+#~ "IN\n"
+#~ "THE SOFTWARE."
+
+#~ msgid ""
+#~ "The above copyright notice and this permission notice shall be included "
+#~ "in\n"
+#~ "all copies or substantial portions of the Software."
+#~ msgstr ""
+#~ "The above copyright notice and this permission notice shall be included "
+#~ "in\n"
+#~ "all copies or substantial portions of the Software."
+
+#~ msgid "pixels"
+#~ msgstr "Pixel"
@@ -1,130 +0,0 @@
--- a/src/dlg_ui_ex.cpp 2019-07-16 16:54:55.000000000 +0000
+++ b/src/dlg_ui_ex.cpp 2020-12-19 18:28:04.920908321 +0000
@@ -13,16 +13,16 @@
#include "fluid/dlg_ui.hpp"
#include "version.hpp"
-extern "C"
-{
- extern char _binary_LICENSE_res_start;
- extern char _binary_LICENSE_res_end;
- extern char _binary_LICENSE_res_size;
-
- extern char _binary_KEYS_res_start;
- extern char _binary_KEYS_res_end;
- extern char _binary_KEYS_res_size;
-}
+//extern "C"
+//{
+// extern char _binary_LICENSE_res_start;
+// extern char _binary_LICENSE_res_end;
+// extern char _binary_LICENSE_res_size;
+
+// extern char _binary_KEYS_res_start;
+// extern char _binary_KEYS_res_end;
+// extern char _binary_KEYS_res_size;
+//}
static dlg_ui *ui;
@@ -188,8 +188,8 @@
m_menuitem_gpsd_lockcursor->label(_("Lock to cursor"));
// Help
m_menuitem_help->label(_("Help"));
- m_menuitem_help_about->label(_("About"));
- m_menuitem_help_usage->label(_("Usage"));
+// m_menuitem_help_about->label(_("About"));
+// m_menuitem_help_usage->label(_("Usage"));
// Populate the Basemap selector
update_choice_map_ex();
@@ -492,38 +492,38 @@
m_dlg_search->show();
}
-void dlg_ui::about_ex()
-{
+//void dlg_ui::about_ex()
+//{
// Show about dialog
- if (!m_dlg_txtdisp)
- m_dlg_txtdisp = new dlg_txtdisp;
-
- std::string v(std::string(_("Version: ")) + std::string(FLORB_PROGSTR));
- std::string l(&_binary_LICENSE_res_start, (size_t)&_binary_LICENSE_res_size);
-
- m_dlg_txtdisp->title(_("About / License"));
- m_dlg_txtdisp->clear();
- m_dlg_txtdisp->append(v);
- m_dlg_txtdisp->append("\n\n");
- m_dlg_txtdisp->append(florb::utils::str_split(l, "\n\n"), "\n\n", true);
-
- m_dlg_txtdisp->show();
-}
-void dlg_ui::usage_ex()
-{
+// if (!m_dlg_txtdisp)
+// m_dlg_txtdisp = new dlg_txtdisp;
+//
+// std::string v(std::string(_("Version: ")) + std::string(FLORB_PROGSTR));
+// std::string l(&_binary_LICENSE_res_start, (size_t)&_binary_LICENSE_res_size);
+//
+// m_dlg_txtdisp->title(_("About / License"));
+// m_dlg_txtdisp->clear();
+// m_dlg_txtdisp->append(v);
+// m_dlg_txtdisp->append("\n\n");
+// m_dlg_txtdisp->append(florb::utils::str_split(l, "\n\n"), "\n\n", true);
+//
+// m_dlg_txtdisp->show();
+//}
+//void dlg_ui::usage_ex()
+//{
// Show about dialog
- if (!m_dlg_txtdisp)
- m_dlg_txtdisp = new dlg_txtdisp;
-
- std::string u(&_binary_KEYS_res_start, (size_t)&_binary_KEYS_res_size);
-
- m_dlg_txtdisp->title(_("Usage"));
- m_dlg_txtdisp->clear();
- m_dlg_txtdisp->append(florb::utils::str_split(u, "\n\n"), "\n\n", true);
-
- m_dlg_txtdisp->show();
-}
-
+// if (!m_dlg_txtdisp)
+// m_dlg_txtdisp = new dlg_txtdisp;
+//
+// std::string u(&_binary_KEYS_res_start, (size_t)&_binary_KEYS_res_size);
+//
+// m_dlg_txtdisp->title(_("Usage"));
+// m_dlg_txtdisp->clear();
+// m_dlg_txtdisp->append(florb::utils::str_split(u, "\n\n"), "\n\n", true);
+//
+// m_dlg_txtdisp->show();
+//}
+//
void dlg_ui::cb_btn_loadtrack_ex(Fl_Widget *widget)
{
@@ -709,13 +709,13 @@
}
// Help submenu
- else if (mit == m_menuitem_help_about) {
- about_ex();
- }
- else if (mit == m_menuitem_help_usage) {
- usage_ex();
- }
-
+// else if (mit == m_menuitem_help_about) {
+// about_ex();
+// }
+// else if (mit == m_menuitem_help_usage) {
+// usage_ex();
+// }
+//
m_wgtmap->take_focus();
}
@@ -1,613 +0,0 @@
From cb0eb27e06d93f315f8cea8b7657b6cae58226a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Claes=20N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
Date: Wed, 2 Sep 2020 08:29:56 +0200
Subject: [PATCH] Support building with CMake
Preparing for OS X support with a build system that is available in
homebrew and helps with abstracting platform differences.
Correct link libararies are missing and missing resource compilation.
libgps not supported at all on Windows (if such a port is to be
made in the future) and unavailable in homebrew. Allow compilation
without it as florb is very usable without it.
---
CMake/config.h.in | 6 ++
CMakeLists.txt | 36 +++++++++
src/CMakeLists.txt | 100 +++++++++++++++++++++++++
src/OMakefile | 19 ++---
src/dlg_bulkdl_ex.cpp | 2 +-
src/dlg_editselection_ex.cpp | 2 +-
src/dlg_eleprofile_ex.cpp | 2 +-
src/dlg_garmindl_ex.cpp | 2 +-
src/dlg_garminul_ex.cpp | 2 +-
src/dlg_search_ex.cpp | 2 +-
src/dlg_settings_ex.cpp | 14 +++-
src/dlg_tileserver_ex.cpp | 2 +-
src/dlg_txtdisp_ex.cpp | 2 +-
src/dlg_ui_ex.cpp | 6 +-
src/fluid/dlg_ui.fl | 20 ++---
src/gpsdclient.cpp | 7 +-
src/gpsdclient.hpp | 6 ++
src/i18n/CMakeLists.txt | 1 +
src/i18n/{de_DE/florb.po => de_DE.po} | 0
src/i18n/de_DE/florb.mo | Bin 10279 -> 0 bytes
src/mkversionhpp.sh | 25 +++++--
src/res/audio-input-microphone-ina.png | Bin 0 -> 1315 bytes
src/utils.cpp | 2 +
23 files changed, 217 insertions(+), 41 deletions(-)
create mode 100644 CMake/config.h.in
create mode 100644 CMakeLists.txt
create mode 100644 src/CMakeLists.txt
create mode 100644 src/i18n/CMakeLists.txt
rename src/i18n/{de_DE/florb.po => de_DE.po} (100%)
delete mode 100644 src/i18n/de_DE/florb.mo
create mode 100644 src/res/audio-input-microphone-ina.png
diff --git a/CMake/config.h.in b/CMake/config.h.in
new file mode 100644
index 0000000..eb28c3f
--- /dev/null
+++ b/CMake/config.h.in
@@ -0,0 +1,6 @@
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+#cmakedefine HAVE_LIBGPS
+
+#endif // _CONFIG_H_
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..39afa50
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(florb)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+set(OpenGL_GL_PREFERENCE GLVND)
+
+include(FindPkgConfig)
+
+find_package(Boost REQUIRED COMPONENTS system filesystem thread)
+find_package(CURL REQUIRED)
+find_package(FLTK REQUIRED)
+find_package(Gettext REQUIRED)
+find_package(Intl REQUIRED)
+find_package(TinyXML2)
+if (TinyXML2_FOUND)
+ set(TinyXML2_LIBRARIES tinyxml2::tinyxml2)
+else (Tinyxml2_FOUND)
+ pkg_check_modules(TinyXML2 REQUIRED tinyxml2)
+endif (NOT TinyXML2_FOUND)
+find_package(yaml-cpp REQUIRED)
+
+# optional packages
+find_package(libgps)
+if (libgps_FOUND)
+ set(HAVE_LIBGPS 1)
+else (libgps_FOUND)
+ pkg_check_modules(libgps libgps)
+ if (libgps_FOUND)
+ set(HAVE_LIBGPS 1)
+ endif (libgps_FOUND)
+endif (libgps_FOUND)
+
+add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..21ea513
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,100 @@
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_PREFIX}/share/local\\\"")
+
+configure_file(${CMAKE_SOURCE_DIR}/CMake/config.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+add_custom_target(version ALL)
+
+add_custom_command(TARGET version
+ PRE_BUILD
+ COMMAND ${CMAKE_SOURCE_DIR}/src/mkversionhpp.sh
+ COMMENT "Generating version.hpp")
+
+set(Ui_FLUID
+ fluid/dlg_bulkdl.fl
+ fluid/dlg_editselection.fl
+ fluid/dlg_eleprofile.fl
+ fluid/dlg_garmindl.fl
+ fluid/dlg_garminul.fl
+ fluid/dlg_search.fl
+ fluid/dlg_settings.fl
+ fluid/dlg_tileserver.fl
+ fluid/dlg_txtdisp.fl
+ fluid/dlg_ui.fl)
+
+set(Ui_SOURCES
+ dlg_bulkdl_ex.cpp
+ dlg_editselection_ex.cpp
+ dlg_eleprofile_ex.cpp
+ dlg_garmindl_ex.cpp
+ dlg_garminul_ex.cpp
+ dlg_search_ex.cpp
+ dlg_settings_ex.cpp
+ dlg_tileserver_ex.cpp
+ dlg_txtdisp_ex.cpp
+ dlg_ui_ex.cpp)
+
+set(Ui_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}/src
+ ${Boost_INCLUDE_DIRS}
+ ${CURL_INCLUDE_DIRS}
+ ${FLTK_INCLUDE_DIRS}
+ ${Intl_INCLUDE_DIRS}
+ ${TinyXML2_INCLUDE_DIRS})
+
+fltk_wrap_ui(Ui ${Ui_FLUID})
+add_library(Ui ${Ui_SOURCES} ${Ui_FLTK_UI_SRCS})
+add_dependencies(Ui version)
+target_include_directories(Ui PUBLIC ${Ui_INCLUDE_DIRS})
+
+set(florb_SOURCES
+ areaselectlayer.cpp
+ cache.cpp
+ downloader.cpp
+ event.cpp
+ gfx.cpp
+ gpsdclient.cpp
+ gpsdlayer.cpp
+ layer.cpp
+ markerlayer.cpp
+ osmlayer.cpp
+ scalelayer.cpp
+ settings.cpp
+ shell.cpp
+ tracklayer.cpp
+ unit.cpp
+ utils.cpp
+ viewport.cpp
+ wgt_eleprofile.cpp
+ wgt_map.cpp)
+
+set(florb_INCLUDE_DIRS
+ ${Boost_INCLUDE_DIRS}
+ ${CURL_INCLUDE_DIRS}
+ ${FLTK_INCLUDE_DIRS}
+ ${Intl_INCLUDE_DIRS}
+ ${TinyXML2_INCLUDE_DIRS})
+
+add_executable(florb ${florb_SOURCES})
+add_dependencies(florb Ui version)
+
+target_include_directories(florb PUBLIC ${florb_INCLUDE_DIRS})
+
+link_directories(florb PRIVATE
+ ${Boost_LIBRARY_DIRS}
+ ${CURL_LIBRARY_DIRS})
+
+target_link_libraries(florb PRIVATE Ui)
+target_link_libraries(florb PRIVATE ${FLTK_LIBRARIES})
+target_link_libraries(florb PRIVATE ${Boost_LIBRARIES})
+target_link_libraries(florb PRIVATE ${TinyXML2_LIBRARIES})
+target_link_libraries(florb PRIVATE yaml-cpp)
+target_link_libraries(florb PRIVATE ${CURL_LIBRARIES})
+target_link_libraries(florb PRIVATE ${Intl_LIBRARIES})
+target_link_libraries(florb PRIVATE ${libgps_LIBRARIES})
+
+add_subdirectory(i18n)
+
+install(TARGETS florb DESTINATION bin)
diff --git a/src/OMakefile b/src/OMakefile
index 8eb6ede..7fa8a13 100644
--- a/src/OMakefile
+++ b/src/OMakefile
@@ -59,10 +59,7 @@ OBJS_CPP = $(rootname $(find . -name *.cpp))
OBJS_RES = $(rootname $(find . -name *.res))
OBJS = $(set $(OBJS_FLUID) $(OBJS_CPP) $(OBJS_RES))
-# Find all translations
-TRANSLATIONS =
- foreach(d => ..., $(find ./i18n/ -regex [a-z]{2\,2}_[A-Z]{2\,2}))
- value $(d)
+TRANSLATIONS[] += de_DE
# (Re-)generate version string (version.hpp) from repository information if present
version.hpp: :exists: ../.git/HEAD :exists: ../.git/index gittags.txt :value: $(shell ./gittags.sh) version.txt ./mkversionhpp.sh
@@ -70,7 +67,7 @@ version.hpp: :exists: ../.git/HEAD :exists: ../.git/index gittags.txt :value: $(
# Rule for generating CPP code from fluid sources
%.cpp: %.fl
- fluid -c -o $@ -h $(replacesuffixes .cpp, .hpp, $@) $<
+ fluid -c -o $@ -h $(replacesuffixes .cpp, .h, $@) $<
# Rule for generating binary resources
%.o: %.res
@@ -97,7 +94,7 @@ install:
#install ../LICENSE.txt $(RESOURCEDIR)
foreach(t => ..., $(basename $(TRANSLATIONS)))
mkdir -p $(LOCALEDIR)/$(t)/LC_MESSAGES/
- install ./i18n/$(t)/florb.mo $(LOCALEDIR)/$(t)/LC_MESSAGES/
+ install ./i18n/$(t).mo $(LOCALEDIR)/$(t)/LC_MESSAGES/
# clean target
clean:
@@ -110,12 +107,12 @@ i18nupdate:
txt2po -P -i $(t) -o $(t).pot
msgcat -o i18n/all.pot $(addsuffix .res.pot, $(OBJS_RES)) i18n/$(PROGRAM).pot
foreach(t => ..., $(basename $(TRANSLATIONS)))
- if $(file-exists ./i18n/$(t)/$(PROGRAM).po)
- msgmerge -U ./i18n/$(t)/$(PROGRAM).po i18n/all.pot
+ if $(file-exists ./i18n/$(t).po)
+ msgmerge -U ./i18n/$(t).po i18n/all.pot
else
- msginit --no-translator -l $(t).utf8 -o ./i18n/$(t)/$(PROGRAM).po -i i18n/all.pot
-
+ msginit --no-translator -l $(t).utf8 -o ./i18n/$(t).po -i i18n/all.pot
+
# compile translations
i18ncompile:
foreach(t => ..., $(basename $(TRANSLATIONS)))
- msgfmt -c -o ./i18n/$(t)/florb.mo ./i18n/$(t)/$(PROGRAM).po
+ msgfmt -c -o ./i18n/$(t).mo ./i18n/$(t).po
diff --git a/src/dlg_bulkdl_ex.cpp b/src/dlg_bulkdl_ex.cpp
index e60fbf1..b02e1cc 100644
--- a/src/dlg_bulkdl_ex.cpp
+++ b/src/dlg_bulkdl_ex.cpp
@@ -4,7 +4,7 @@
#include <algorithm>
#include "settings.hpp"
#include "utils.hpp"
-#include "fluid/dlg_bulkdl.hpp"
+#include "dlg_bulkdl.h"
void dlg_bulkdl::create_ex()
{
diff --git a/src/dlg_editselection_ex.cpp b/src/dlg_editselection_ex.cpp
index 8ee9902..75b2d47 100644
--- a/src/dlg_editselection_ex.cpp
+++ b/src/dlg_editselection_ex.cpp
@@ -1,7 +1,7 @@
#include <FL/fl_ask.H>
#include "settings.hpp"
#include "unit.hpp"
-#include "fluid/dlg_editselection.hpp"
+#include "dlg_editselection.h"
void dlg_editselection::create_ex()
{
diff --git a/src/dlg_eleprofile_ex.cpp b/src/dlg_eleprofile_ex.cpp
index 12971e8..7c485e0 100644
--- a/src/dlg_eleprofile_ex.cpp
+++ b/src/dlg_eleprofile_ex.cpp
@@ -1,6 +1,6 @@
#include "utils.hpp"
#include "unit.hpp"
-#include "fluid/dlg_eleprofile.hpp"
+#include "dlg_eleprofile.h"
void dlg_eleprofile::create_ex()
{
diff --git a/src/dlg_garmindl_ex.cpp b/src/dlg_garmindl_ex.cpp
index a898bdd..8357b5d 100644
--- a/src/dlg_garmindl_ex.cpp
+++ b/src/dlg_garmindl_ex.cpp
@@ -3,7 +3,7 @@
#include <iostream>
#include "utils.hpp"
#include "shell.hpp"
-#include "fluid/dlg_garmindl.hpp"
+#include "dlg_garmindl.h"
void dlg_garmindl::create_ex()
{
diff --git a/src/dlg_garminul_ex.cpp b/src/dlg_garminul_ex.cpp
index 1d05341..4bed5ac 100644
--- a/src/dlg_garminul_ex.cpp
+++ b/src/dlg_garminul_ex.cpp
@@ -3,7 +3,7 @@
#include <iostream>
#include "utils.hpp"
#include "shell.hpp"
-#include "fluid/dlg_garminul.hpp"
+#include "dlg_garminul.h"
void dlg_garminul::create_ex()
{
diff --git a/src/dlg_search_ex.cpp b/src/dlg_search_ex.cpp
index 6e00773..907c86a 100644
--- a/src/dlg_search_ex.cpp
+++ b/src/dlg_search_ex.cpp
@@ -4,7 +4,7 @@
#include <clocale>
#include <limits>
#include "utils.hpp"
-#include "fluid/dlg_search.hpp"
+#include "dlg_search.h"
void dlg_search::create_ex()
{
diff --git a/src/dlg_settings_ex.cpp b/src/dlg_settings_ex.cpp
index 5dca6ce..2b740be 100644
--- a/src/dlg_settings_ex.cpp
+++ b/src/dlg_settings_ex.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include <sstream>
#include <iostream>
#include <FL/Fl_Color_Chooser.H>
@@ -5,8 +7,8 @@
#include "settings.hpp"
#include "utils.hpp"
#include "unit.hpp"
-#include "fluid/dlg_settings.hpp"
-#include "fluid/dlg_tileserver.hpp"
+#include "dlg_settings.h"
+#include "dlg_tileserver.h"
void dlg_settings::create_ex()
{
@@ -231,7 +233,13 @@ void dlg_settings::tab_gpsd_setup_ex()
m_input_server->value(m_cfggpsd.host().c_str());
m_input_port->value(m_cfggpsd.port().c_str());
- bool en = m_cfggpsd.enabled();
+ bool en;
+#ifdef HAVE_LIBGPS
+ en = m_cfggpsd.enabled();
+#else // ! HAVE_LIBGPS
+ en = false;
+ m_chkbtn_enable->deactivate();
+#endif // HAVE_LIBGPS
if (en)
{
diff --git a/src/dlg_tileserver_ex.cpp b/src/dlg_tileserver_ex.cpp
index 003c3e5..b398193 100644
--- a/src/dlg_tileserver_ex.cpp
+++ b/src/dlg_tileserver_ex.cpp
@@ -1,6 +1,6 @@
#include "settings.hpp"
#include "utils.hpp"
-#include "fluid/dlg_tileserver.hpp"
+#include "dlg_tileserver.h"
#include <FL/fl_ask.H>
void dlg_tileserver::create_ex()
diff --git a/src/dlg_txtdisp_ex.cpp b/src/dlg_txtdisp_ex.cpp
index c500cbd..d3f28d9 100644
--- a/src/dlg_txtdisp_ex.cpp
+++ b/src/dlg_txtdisp_ex.cpp
@@ -3,7 +3,7 @@
#include <iostream>
#include <fstream>
#include "utils.hpp"
-#include "fluid/dlg_txtdisp.hpp"
+#include "dlg_txtdisp.h"
void dlg_txtdisp::create_ex()
{
diff --git a/src/dlg_ui_ex.cpp b/src/dlg_ui_ex.cpp
index ff2967b..6461b83 100644
--- a/src/dlg_ui_ex.cpp
+++ b/src/dlg_ui_ex.cpp
@@ -10,7 +10,7 @@
#include "gpsdclient.hpp"
#include "utils.hpp"
#include "unit.hpp"
-#include "fluid/dlg_ui.hpp"
+#include "dlg_ui.h"
#include "version.hpp"
extern "C"
@@ -186,6 +186,10 @@ void dlg_ui::create_ex(void)
m_menuitem_gpsd_gotocursor->label(_("Go to cursor"));
m_menuitem_gpsd_recordtrack->label(_("Record track"));
m_menuitem_gpsd_lockcursor->label(_("Lock to cursor"));
+#ifndef HAVE_LIBGPS
+ m_menuitem_gpsd->deactivate();
+ m_btn_recordtrack->deactivate();
+#endif // HAVE_LIBGPS
// Help
m_menuitem_help->label(_("Help"));
m_menuitem_help_about->label(_("About"));
diff --git a/src/fluid/dlg_ui.fl b/src/fluid/dlg_ui.fl
index 80e4b20..2aedbfd 100644
--- a/src/fluid/dlg_ui.fl
+++ b/src/fluid/dlg_ui.fl
@@ -11,7 +11,7 @@ decl {\#include <signal.h>} {private global
decl {\#include <curl/curl.h>} {private global
}
-decl {\#include "dlg_ui.hpp"} {private global
+decl {\#include "dlg_ui.h"} {private global
}
decl {\#include "wgt_map.hpp"} {public global
@@ -20,28 +20,28 @@ decl {\#include "wgt_map.hpp"} {public global
decl {\#include "event.hpp"} {public global
}
-decl {\#include "dlg_search.hpp"} {public global
+decl {\#include "dlg_search.h"} {public global
}
-decl {\#include "dlg_garminul.hpp"} {public global
+decl {\#include "dlg_garminul.h"} {public global
}
-decl {\#include "dlg_garmindl.hpp"} {public global
+decl {\#include "dlg_garmindl.h"} {public global
}
-decl {\#include "dlg_editselection.hpp"} {public global
+decl {\#include "dlg_editselection.h"} {public global
}
-decl {\#include "dlg_settings.hpp"} {public global
+decl {\#include "dlg_settings.h"} {public global
}
-decl {\#include "dlg_txtdisp.hpp"} {public global
+decl {\#include "dlg_txtdisp.h"} {public global
}
-decl {\#include "dlg_bulkdl.hpp"} {public global
+decl {\#include "dlg_bulkdl.h"} {public global
}
-decl {\#include "dlg_eleprofile.hpp"} {public global
+decl {\#include "dlg_eleprofile.h"} {public global
}
decl {int main_ex(int argc, char* argv[]);} {private global
@@ -396,7 +396,7 @@ ui->cb_choice_overlay_ex(widget);} {}
Fl_Button m_btn_recordtrack {
user_data this
callback cb_btn_recordtrack
- private tooltip {Record track} image {../res/audio-input-microphone.png} xywh {229 29 25 25} type Toggle box NO_BOX down_box THIN_DOWN_BOX
+ private tooltip {Record track} image {../res/audio-input-microphone.png} deimage {../res/audio-input-microphone-ina.png} xywh {229 29 25 25} type Toggle box NO_BOX down_box THIN_DOWN_BOX
}
Fl_Box {} {
private xywh {254 29 5 25} box FLAT_BOX
diff --git a/src/gpsdclient.cpp b/src/gpsdclient.cpp
index 3dd542e..f975457 100644
--- a/src/gpsdclient.cpp
+++ b/src/gpsdclient.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "gpsdclient.hpp"
#include "utils.hpp"
@@ -141,6 +143,7 @@ void florb::gpsdclient::fire_event_gpsd(void)
void florb::gpsdclient::worker(void)
{
+#ifdef HAVE_LIBGPS
int rc;
for (;;)
{
@@ -200,6 +203,7 @@ void florb::gpsdclient::worker(void)
gps_stream(&m_gpsdata, WATCH_DISABLE, NULL);
gps_close(&m_gpsdata);
}
+#endif // HAVE_LIBGPS
// Update connection status
connected(false);
@@ -209,6 +213,7 @@ void florb::gpsdclient::worker(void)
bool florb::gpsdclient::handle_set()
{
bool ret = false;
+#ifdef HAVE_LIBGPS
for (;;) {
@@ -255,7 +260,7 @@ bool florb::gpsdclient::handle_set()
break;
}
-
+#endif // HAVE_LIBGPS
return ret;
}
diff --git a/src/gpsdclient.hpp b/src/gpsdclient.hpp
index 1256ca4..1d2cf6a 100644
--- a/src/gpsdclient.hpp
+++ b/src/gpsdclient.hpp
@@ -1,10 +1,14 @@
#ifndef GPSDCLIENT_HPP
#define GPSDCLIENT_HPP
+#include "config.h"
+
#include <string>
#include <boost/thread.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#ifdef HAVE_LIBGPS
#include <gps.h>
+#endif // HAVE_LIBGPS
#include "event.hpp"
#include "point.hpp"
@@ -43,7 +47,9 @@ namespace florb
void fire_event_gpsd(void);
+#ifdef HAVE_LIBGPS
struct gps_data_t m_gpsdata;
+#endif // HAVE_LIBGPS
boost::interprocess::interprocess_mutex m_mutex;
std::string m_host;
diff --git a/src/i18n/CMakeLists.txt b/src/i18n/CMakeLists.txt
new file mode 100644
index 0000000..673bffe
--- /dev/null
+++ b/src/i18n/CMakeLists.txt
@@ -0,0 +1 @@
+gettext_create_translations(florb.pot ALL de_DE.po)
diff --git a/src/i18n/de_DE/florb.po b/src/i18n/de_DE.po
similarity index 100%
rename from src/i18n/de_DE/florb.po
rename to src/i18n/de_DE.po
diff --git a/src/mkversionhpp.sh b/src/mkversionhpp.sh
index 3562cd1..6a8f81c 100755
--- a/src/mkversionhpp.sh
+++ b/src/mkversionhpp.sh
@@ -1,7 +1,11 @@
#!/bin/sh
# Default version if we can't take it from git
-FLORB_V="v1.0"
+if [ -e version.txt ]; then
+ FLORB_V=`cat version.txt`
+else
+ FLORB_V="v1.0"
+fi
# Check whether we have git installed, and do nothing if not
which git > /dev/null 2>&1
@@ -21,11 +25,18 @@ if [ $? -eq 0 ]; then
fi
-echo "#ifndef VERSION_HPP" > version.hpp
-echo "#define VERSION_HPP" >> version.hpp
+echo "#ifndef VERSION_HPP" > version.hpp.tmp
+echo "#define VERSION_HPP" >> version.hpp.tmp
+
+echo "#define FLORB_VERSION \"$FLORB_V\"" >> version.hpp.tmp
+echo "#define FLORB_PROGSTR \"florb $FLORB_V\"" >> version.hpp.tmp
+echo "#define FLORB_USERAGENT \"florb/$FLORB_V\"" >> version.hpp.tmp
-echo "#define FLORB_VERSION \"$FLORB_V\"" >> version.hpp
-echo "#define FLORB_PROGSTR \"florb $FLORB_V\"" >> version.hpp
-echo "#define FLORB_USERAGENT \"florb/$FLORB_V\"" >> version.hpp
+echo "#endif //VERSION_HPP" >> version.hpp.tmp
-echo "#endif //VERSION_HPP" >> version.hpp
+diff version.hpp.tmp version.hpp >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ rm version.hpp.tmp
+else
+ mv version.hpp.tmp version.hpp
+fi
diff --git a/src/utils.cpp b/src/utils.cpp
index aa5f9cc..3e631c4 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include <cmath>
#include <limits>
#include <stdexcept>
@@ -0,0 +1,16 @@
diff --git a/src/dlg_search_ex.cpp b/src/dlg_search_ex.cpp
index 6e00773..da5a692 100644
--- a/src/dlg_search_ex.cpp
+++ b/src/dlg_search_ex.cpp
@@ -66,9 +66,9 @@ void dlg_search::cb_btn_search_ex(Fl_Widget *widget)
// Construct query string
std::ostringstream oss;
- oss << "http://nominatim.openstreetmap.org/search/";
+ oss << "https://nominatim.openstreetmap.org/search?q=";
oss << query;
- oss << "?format=xml";
+ oss << "&format=xml";
// Download the search results
bool ret = m_downloader->queue(oss.str(), NULL);
+982
View File
@@ -0,0 +1,982 @@
diff --git a/.gitignore b/.gitignore
index 45e3cc4..8b91261 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ build/*.hpp
install
*.po~
src/version.hpp
+compile_commands.json
diff --git a/src/dlg_bulkdl_ex.cpp b/src/dlg_bulkdl_ex.cpp
index 9fa6ca4..e60fbf1 100644
--- a/src/dlg_bulkdl_ex.cpp
+++ b/src/dlg_bulkdl_ex.cpp
@@ -32,8 +32,8 @@ bool dlg_bulkdl::show_ex()
{
// Populate the map selector
m_choice_map->clear();
- florb::node section = florb::settings::get_instance()["tileservers"];
- for(florb::node::iterator it=section.begin(); it!=section.end(); ++it) {
+ YAML::Node section = florb::settings::get_instance()["tileservers"];
+ for(YAML::Node::iterator it=section.begin(); it!=section.end(); ++it) {
m_choice_map->add((*it).as<florb::cfg_tileserver>().name().c_str());
}
m_choice_map->value(0);
diff --git a/src/dlg_search_ex.cpp b/src/dlg_search_ex.cpp
index 1d5d9e7..6e00773 100644
--- a/src/dlg_search_ex.cpp
+++ b/src/dlg_search_ex.cpp
@@ -153,7 +153,7 @@ void dlg_search::process_download_ex()
break;
tinyxml2::XMLDocument doc;
- if (doc.Parse(std::string(dtmp.buf().begin(), dtmp.buf().end()).c_str()) != tinyxml2::XML_NO_ERROR)
+ if (doc.Parse(std::string(dtmp.buf().begin(), dtmp.buf().end()).c_str()) != tinyxml2::XML_SUCCESS)
break;
tinyxml2::XMLElement* root = doc.RootElement();
diff --git a/src/dlg_settings_ex.cpp b/src/dlg_settings_ex.cpp
index a1bf6e0..5dca6ce 100644
--- a/src/dlg_settings_ex.cpp
+++ b/src/dlg_settings_ex.cpp
@@ -1,7 +1,7 @@
#include <sstream>
#include <iostream>
#include <FL/Fl_Color_Chooser.H>
-#include <Fl/Fl_File_Chooser.H>
+#include <FL/Fl_File_Chooser.H>
#include "settings.hpp"
#include "utils.hpp"
#include "unit.hpp"
diff --git a/src/dlg_tileserver_ex.cpp b/src/dlg_tileserver_ex.cpp
index d49f4da..003c3e5 100644
--- a/src/dlg_tileserver_ex.cpp
+++ b/src/dlg_tileserver_ex.cpp
@@ -81,8 +81,8 @@ bool dlg_tileserver::handle_ok_ex(bool add)
// Make sure there is no other tile server with the same name
if (add)
{
- florb::node section = florb::settings::get_instance()["tileservers"];
- for(florb::node::iterator it=section.begin(); it!=section.end(); ++it)
+ YAML::Node section = florb::settings::get_instance()["tileservers"];
+ for(YAML::Node::iterator it=section.begin(); it!=section.end(); ++it)
{
if ((*it).as<florb::cfg_tileserver>().name() == std::string(m_input_name->value()))
{
diff --git a/src/dlg_ui_ex.cpp b/src/dlg_ui_ex.cpp
index 3f99b60..ff2967b 100644
--- a/src/dlg_ui_ex.cpp
+++ b/src/dlg_ui_ex.cpp
@@ -1,5 +1,5 @@
#include <sstream>
-#include <Fl/Fl_File_Chooser.H>
+#include <FL/Fl_File_Chooser.H>
#include <FL/fl_ask.H>
#include <curl/curl.h>
#include <locale.h>
@@ -222,8 +222,8 @@ void dlg_ui::update_choice_map_ex(void)
m_choice_overlay->add(_("None"));
// Get the configured tileservers from the florb::settings and populate the widgets
- florb::node section = florb::settings::get_instance()["tileservers"];
- for(florb::node::iterator it=section.begin(); it!=section.end(); ++it) {
+ YAML::Node section = florb::settings::get_instance()["tileservers"];
+ for(YAML::Node::iterator it=section.begin(); it!=section.end(); ++it) {
m_choice_basemap->add((*it).as<florb::cfg_tileserver>().name().c_str());
m_choice_overlay->add((*it).as<florb::cfg_tileserver>().name().c_str());
}
diff --git a/src/gfx.cpp b/src/gfx.cpp
index df55180..d8e714e 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -147,7 +147,7 @@ namespace florb
m_init = true;
};
- image::image(int type, const unsigned char *buffer, int bufsize) :
+ image::image(int type, void const * const buffer, int bufsize) :
m_type(type),
m_init(false),
m_buf(NULL)
@@ -156,19 +156,18 @@ namespace florb
{
case PNG:
{
- m_buf = new Fl_PNG_Image(NULL, buffer, bufsize);
+ m_buf = new Fl_PNG_Image(NULL, static_cast<const unsigned char*>(buffer), bufsize);
m_init = true;
break;
}
case JPG:
{
- m_buf = new Fl_JPEG_Image(NULL, buffer);
+ m_buf = new Fl_JPEG_Image(NULL, static_cast<const unsigned char*>(buffer));
m_init = true;
break;
}
default:
- m_buf = NULL;
- m_init = false;
+ break;
}
};
diff --git a/src/gfx.hpp b/src/gfx.hpp
index 9b6085b..aae20c6 100644
--- a/src/gfx.hpp
+++ b/src/gfx.hpp
@@ -74,7 +74,7 @@ namespace florb
class image
{
public:
- image(int type, const unsigned char *buffer, int bufsize);
+ image(int type, void const * const buffer, int bufsize);
~image();
image_storage buf(void) { return m_buf; };
diff --git a/src/gpsdclient.cpp b/src/gpsdclient.cpp
index 1b00439..3dd542e 100644
--- a/src/gpsdclient.cpp
+++ b/src/gpsdclient.cpp
@@ -181,7 +181,11 @@ void florb::gpsdclient::worker(void)
}
// Read data
+#if GPSD_API_MAJOR_VERSION >= 7
+ if (gps_read(&m_gpsdata, NULL, 0) == -1) {
+#else
if (gps_read(&m_gpsdata) == -1) {
+#endif
// Error
break;
}
diff --git a/src/settings.cpp b/src/settings.cpp
index 8a01d07..1a8e679 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -2,322 +2,19 @@
#include <fstream>
#include "settings.hpp"
-namespace YAML {
- template<>
- struct convert<florb::cfg_tileserver> {
- static Node encode(const florb::cfg_tileserver& rhs) {
- Node node;
- node["name"] = rhs.name();
- node["url"] = rhs.url();
- node["zmin"] = rhs.zmin();
- node["zmax"] = rhs.zmax();
- node["parallel"] = rhs.parallel();
-
- node["type"] = "PNG";
- if (rhs.type() == florb::image::PNG)
- node["type"] = "PNG";
- else if (rhs.type() == florb::image::JPG)
- node["type"] = "JPG";
-
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_tileserver& rhs)
- {
- if((!node.IsMap()) || (node.size() == 0))
- return true;
-
- if (node["name"])
- rhs.name(node["name"].as<std::string>());
-
- if (node["url"])
- rhs.url(node["url"].as<std::string>());
-
- if (node["zmin"])
- rhs.zmin(node["zmin"].as<int>());
-
- if (node["zmax"])
- rhs.zmax(node["zmax"].as<int>());
-
- if (node["parallel"])
- rhs.parallel(node["parallel"].as<int>());
-
- if (node["type"])
- {
- rhs.type(florb::image::PNG);
- std::string imgtype = node["type"].as<std::string>();
- if (imgtype.compare("PNG") == 0)
- rhs.type(florb::image::PNG);
- else if (imgtype.compare("JPG") == 0)
- rhs.type(florb::image::JPG);
- }
-
- return true;
- }
- };
-
- template<>
- struct convert<florb::cfg_cache> {
- static Node encode(const florb::cfg_cache& rhs) {
- Node node;
- node["location"] = rhs.location();
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_cache& rhs)
- {
- if((!node.IsMap()) || (node.size() == 0))
- return true;
-
- if (node["location"])
- rhs.location(node["location"].as<std::string>());
-
- return true;
- }
- };
-
- template<>
- struct convert<florb::cfg_units> {
- static Node encode(const florb::cfg_units& rhs) {
- Node node;
-
- switch (rhs.system_length())
- {
- case (florb::cfg_units::system::IMPERIAL):
- node["system_length"] = "imperial";
- break;
- case (florb::cfg_units::system::NAUTICAL):
- node["system_length"] = "nautical";
- break;
- default:
- node["system_length"] = "metric";
- break;
- }
-
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_units& rhs)
- {
- if((!node.IsMap()) || (node.size() == 0))
- return true;
-
- if (node["system_length"])
- {
- std::string sm(node["system_length"].as<std::string>());
- if (sm == "imperial")
- rhs.system_length(florb::cfg_units::system::IMPERIAL);
- else if (sm == "nautical")
- rhs.system_length(florb::cfg_units::system::NAUTICAL);
- else
- rhs.system_length(florb::cfg_units::system::METRIC);
- }
-
- return true;
- }
- };
-
- template<>
- struct convert<florb::cfg_gpsd> {
- static Node encode(const florb::cfg_gpsd& rhs) {
- Node node;
- node["enabled"] = rhs.enabled();
- node["host"] = rhs.host();
- node["port"] = rhs.port();
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_gpsd& rhs)
- {
- if((!node.IsMap()) || (node.size() == 0))
- return true;
-
- if (node["enabled"])
- rhs.enabled(node["enabled"].as<bool>());
-
- if (node["host"])
- rhs.host(node["host"].as<std::string>());
-
- if (node["port"])
- rhs.port(node["port"].as<std::string>());
-
- return true;
- }
- };
-
- template<>
- struct convert<florb::cfg_ui> {
- static Node encode(const florb::cfg_ui& rhs) {
- Node node;
- node["markercolor"] = rhs.markercolor().rgb();
- node["markercolorselected"] = rhs.markercolorselected().rgb();
- node["trackcolor"] = rhs.trackcolor().rgb();
- node["selectioncolor"] = rhs.selectioncolor().rgb();
- node["gpscursorcolor"] = rhs.gpscursorcolor().rgb();
- node["tracklinewidth"] = rhs.tracklinewidth();
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_ui& rhs)
- {
- // Use defaults
- if((!node.IsMap()) || (node.size() == 0))
- {
- return true;
- }
-
- if (node["markercolor"])
- rhs.markercolor(florb::color(node["markercolor"].as<unsigned int>()));
-
- if (node["markercolorselected"])
- rhs.markercolorselected(florb::color(node["markercolorselected"].as<unsigned int>()));
-
- if (node["trackcolor"])
- rhs.trackcolor(florb::color(node["trackcolor"].as<unsigned int>()));
-
- if (node["selectioncolor"])
- rhs.selectioncolor(florb::color(node["selectioncolor"].as<unsigned int>()));
-
- if (node["gpscursorcolor"])
- rhs.gpscursorcolor(florb::color(node["gpscursorcolor"].as<unsigned int>()));
-
- if (node["tracklinewidth"])
- rhs.tracklinewidth(node["tracklinewidth"].as<unsigned int>());
-
- return true;
- }
- };
-
- template<>
- struct convert<florb::cfg_viewport> {
- static Node encode(const florb::cfg_viewport& rhs) {
- Node node;
- node["lon"] = rhs.lon();
- node["lat"] = rhs.lat();
- node["z"] = rhs.z();
- return node;
- }
-
- static bool decode(const Node& node, florb::cfg_viewport& rhs)
- {
- if((!node.IsMap()) || (node.size() == 0))
- {
- return true;
- }
-
-
- if (node["lat"])
- rhs.lat(node["lat"].as<double>());
-
- if (node["lon"])
- rhs.lon(node["lon"].as<double>());
-
- if (node["z"])
- rhs.z(node["z"].as<unsigned int>());
-
- return true;
- }
- };
-}
-
-class florb::yaml_node
-{
- public:
- yaml_node(YAML::Node n) : m_node(n) {};
- yaml_node(const std::string& path)
- {
- // Touch cfgfile in case it doesn't exist
- florb::utils::touch(path);
- m_node = YAML::LoadFile(path);
- }
- ~yaml_node() {};
-
- YAML::Node& get() { return m_node; };
- private:
- YAML::Node m_node;
-};
-
-class florb::yaml_iterator
-{
- public:
- yaml_iterator(YAML::iterator i) : m_iter(i) {};
- ~yaml_iterator() {};
-
- YAML::iterator& get() { return m_iter; };
- private:
- YAML::iterator m_iter;
-};
-
-florb::node::iterator::iterator(const node& n, int be)
-{
- if (be <= 0)
- m_ref = new yaml_iterator(n.m_ref->get().begin());
- else
- m_ref = new yaml_iterator(n.m_ref->get().end());
-}
-
-florb::node::iterator::~iterator()
-{
- delete m_ref;
-}
-
-bool florb::node::iterator::operator==(iterator const& rhs) const
-{
- return (m_ref->get() == rhs.m_ref->get());
-}
-
-bool florb::node::iterator::operator!=(iterator const& rhs) const
-{
- return !(m_ref->get() == rhs.m_ref->get());
-}
-
-florb::node::iterator& florb::node::iterator::operator++()
-{
- (m_ref->get())++;
- return *this;
-}
-
-florb::node::iterator florb::node::iterator::operator++(int)
-{
- florb::node::iterator tmp (*this);
- ++(*this);
- return tmp;
-}
-
-// Bidirectional iterators are not supported by YAML-Cpp
-#if 0
-iterator& florb::node::iterator::operator--()
-{
- (m_ref.get())--;
- return *this;
-}
-
-iterator florb::node::iterator::operator--(int)
-{
- iterator tmp (*this);
- --(*this);
- return tmp;
-}
-#endif
-
-florb::node florb::node::iterator::operator* () const
-{
- florb::yaml_node *tmp = new florb::yaml_node(*(m_ref->get()));
- return florb::node(tmp);
-}
-
florb::settings::settings()
{
m_cfgfile = florb::utils::appdir() + florb::utils::pathsep() + "config";
florb::utils::mkdir(florb::utils::appdir());
- m_rootnode = florb::node(m_cfgfile);
+ m_rootnode = YAML::LoadFile(m_cfgfile);
defaults(m_cfgfile);
}
florb::settings::~settings()
{
- m_rootnode.serialize(m_cfgfile);
+ std::ofstream fout(m_cfgfile.c_str(), std::fstream::in|std::fstream::out|std::fstream::trunc);
+ fout << m_rootnode;
}
florb::settings& florb::settings::get_instance()
@@ -330,7 +27,7 @@ void florb::settings::defaults(const std::string& path)
{
// Tileserver default configuration
florb::cfg_tileserver cfgtileserver;
- if((!m_rootnode["tileservers"]) || (!m_rootnode["tileservers"].is_sequence()))
+ if((!m_rootnode["tileservers"]) || (!m_rootnode["tileservers"].IsSequence()))
{
std::vector<florb::cfg_tileserver> v;
v.push_back(cfgtileserver);
@@ -359,115 +56,3 @@ void florb::settings::defaults(const std::string& path)
m_rootnode["units"] = cfgunits;
}
-florb::node::node(const std::string& path)
-{
- m_ref = new florb::yaml_node(path);
-}
-
-florb::node::node(const node& n)
-{
- m_ref = new florb::yaml_node(n.m_ref->get());
-}
-
-florb::node::node()
-{
- m_ref = new florb::yaml_node(YAML::Node());
-}
-
-florb::node::~node()
-{
- if (m_ref)
- delete m_ref;
-}
-
-bool florb::node::is_sequence()
-{
- return m_ref->get().IsSequence();
-}
-
-florb::node florb::node::operator[] (const int idx)
-{
- return florb::node(new florb::yaml_node(m_ref->get()[idx]));
-}
-
-florb::node florb::node::operator[] (const std::string &name)
-{
- return florb::node(new florb::yaml_node(m_ref->get()[name]));
-}
-
-florb::node& florb::node::operator= (const node& n)
-{
- if (m_ref)
- delete m_ref;
-
- m_ref = new florb::yaml_node(n.m_ref->get());
-
- return *this;
-}
-
-template<typename T> florb::node& florb::node::operator= (const T& rhs)
-{
- m_ref->get() = rhs;
- return *this;
-}
-
-florb::node::operator bool() const
-{
- return m_ref->get();
-}
-
-template<typename T> T florb::node::as() const
-{
- return m_ref->get().as<T>();
-}
-
-template<typename T> void florb::node::push_back(const T& rhs)
-{
- m_ref->get().push_back<T>(rhs);
-}
-
-void florb::node::push_back(const node& rhs)
-{
- m_ref->get().push_back(rhs.m_ref->get());
-}
-
-void florb::node::serialize(const std::string& path)
-{
- std::ofstream fout(path.c_str(), std::fstream::in|std::fstream::out|std::fstream::trunc);
- fout << m_ref->get();
-}
-
-size_t florb::node::size()
-{
- return m_ref->get().size();
-}
-
-// This is necessary so YAML::Node template internals remain hidden from the
-// header file
-template int florb::node::as<int>() const;
-template std::string florb::node::as<std::string>() const;
-template florb::cfg_tileserver florb::node::as<florb::cfg_tileserver>() const;
-template std::vector< florb::cfg_tileserver > florb::node::as< std::vector<florb::cfg_tileserver> >() const;
-template bool florb::node::as<bool>() const;
-template florb::cfg_cache florb::node::as<florb::cfg_cache>() const;
-template florb::cfg_gpsd florb::node::as<florb::cfg_gpsd>() const;
-template florb::cfg_ui florb::node::as<florb::cfg_ui>() const;
-template florb::cfg_viewport florb::node::as<florb::cfg_viewport>() const;
-template florb::cfg_units florb::node::as<florb::cfg_units>() const;
-
-template void florb::node::push_back<int>(const int& rhs);
-template void florb::node::push_back<std::string>(const std::string& rhs);
-template void florb::node::push_back<florb::cfg_tileserver>(const florb::cfg_tileserver& rhs);
-
-template florb::node& florb::node::operator=<int> (const int& rhs);
-template florb::node& florb::node::operator=< std::vector<int> > (const std::vector<int>& rhs);
-template florb::node& florb::node::operator=<std::string> (const std::string& rhs);
-template florb::node& florb::node::operator=< std::vector<florb::cfg_tileserver> > (const std::vector<florb::cfg_tileserver>& rhs);
-template florb::node& florb::node::operator=<florb::cfg_tileserver> (const florb::cfg_tileserver& rhs);
-template florb::node& florb::node::operator=<bool> (const bool& rhs);
-template florb::node& florb::node::operator=<florb::cfg_gpsd> (const florb::cfg_gpsd& rhs);
-template florb::node& florb::node::operator=<florb::cfg_ui> (const florb::cfg_ui& rhs);
-template florb::node& florb::node::operator=<florb::cfg_cache> (const florb::cfg_cache& rhs);
-template florb::node& florb::node::operator=<florb::cfg_viewport> (const florb::cfg_viewport& rhs);
-template florb::node& florb::node::operator=<florb::cfg_units> (const florb::cfg_units& rhs);
-
diff --git a/src/settings.hpp b/src/settings.hpp
index 952ce26..71a865a 100644
--- a/src/settings.hpp
+++ b/src/settings.hpp
@@ -2,17 +2,10 @@
#define SETTINGS_HPP
#include <string>
-#include <iterator>
+#include <yaml-cpp/yaml.h>
#include "gfx.hpp"
#include "utils.hpp"
-// The YAML namespace defines an enumerator "None". This clashes with a
-// definition of "None" in X.h which is included by FLTK. So if there is any
-// module including FLTK and YAML headers, things get nasty. Thus this clumsy
-// attempt at hiding the YAML-cpp internals. It could have been so easy...
-// On a positive note it is now relatively easy to swap out YAML-cpp for some
-// other backend.
-
namespace florb
{
// Tileserver configuration class
@@ -160,7 +153,6 @@ namespace florb
class cfg_units
{
public:
-
enum system
{
METRIC,
@@ -174,7 +166,6 @@ namespace florb
cfg_units() :
m_sl(system::METRIC) {};
-
system system_length() const { return m_sl; }
void system_length(system sl) { m_sl = sl; }
@@ -182,77 +173,243 @@ namespace florb
system m_sl;
};
- // Forward declaration of YAML-cpp node container and iterator container
- class yaml_node;
- class yaml_iterator;
-
- // A configuration node
- class node
- {
- public:
- class iterator : public std::iterator<std::forward_iterator_tag, int>
- {
- public:
- iterator(const node &n, int be);
- ~iterator();
- bool operator==(iterator const& rhs) const;
- bool operator!=(iterator const& rhs) const;
- iterator& operator++();
- iterator operator++(int);
-#if 0
- iterator& operator--();
- iterator operator--(int);
-#endif
- node operator* () const;
- private:
- yaml_iterator *m_ref;
- };
- iterator begin() { return iterator(*this, -1); }
- iterator end() { return iterator(*this, 1); }
-
- node();
- node(yaml_node *in) : m_ref(in) {};
- node(const std::string& path);
- node(const node& n);
- ~node();
-
- bool is_sequence();
-
- node operator[] (const int idx);
- node operator[] (const std::string &name);
- node& operator= (const node& n);
- template<typename T> node& operator= (const T& rhs);
-
- explicit operator bool() const;
-
- size_t size();
- template<typename T> T as() const;
- template<typename T> void push_back(const T& rhs);
- void push_back(const node& rhs);
- void serialize(const std::string& path);
- private:
- yaml_node *m_ref;
- };
-
// Settings singleton
class settings
{
public:
~settings();
static settings& get_instance();
- node& root() { return m_rootnode; };
-
- node operator[] (const int idx) { return m_rootnode[idx]; };
- node operator[] (const std::string &name) { return m_rootnode[name]; };
+ YAML::Node& root() { return m_rootnode; };
+ YAML::Node operator[] (const int idx) { return m_rootnode[idx]; };
+ YAML::Node operator[] (const std::string &name) { return m_rootnode[name]; };
private:
settings();
settings(const settings& s);
void defaults(const std::string& path);
- node m_rootnode;
+ YAML::Node m_rootnode;
std::string m_cfgfile;
};
};
+namespace YAML {
+ template<>
+ struct convert<florb::cfg_tileserver> {
+ static Node encode(const florb::cfg_tileserver& rhs) {
+ Node node;
+ node["name"] = rhs.name();
+ node["url"] = rhs.url();
+ node["zmin"] = rhs.zmin();
+ node["zmax"] = rhs.zmax();
+ node["parallel"] = rhs.parallel();
+
+ node["type"] = "PNG";
+ if (rhs.type() == florb::image::PNG)
+ node["type"] = "PNG";
+ else if (rhs.type() == florb::image::JPG)
+ node["type"] = "JPG";
+
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_tileserver& rhs)
+ {
+ if((!node.IsMap()) || (node.size() == 0))
+ return true;
+
+ if (node["name"])
+ rhs.name(node["name"].as<std::string>());
+
+ if (node["url"])
+ rhs.url(node["url"].as<std::string>());
+
+ if (node["zmin"])
+ rhs.zmin(node["zmin"].as<int>());
+
+ if (node["zmax"])
+ rhs.zmax(node["zmax"].as<int>());
+
+ if (node["parallel"])
+ rhs.parallel(node["parallel"].as<int>());
+
+ if (node["type"])
+ {
+ rhs.type(florb::image::PNG);
+ std::string imgtype = node["type"].as<std::string>();
+ if (imgtype.compare("PNG") == 0)
+ rhs.type(florb::image::PNG);
+ else if (imgtype.compare("JPG") == 0)
+ rhs.type(florb::image::JPG);
+ }
+
+ return true;
+ }
+ };
+
+ template<>
+ struct convert<florb::cfg_cache> {
+ static Node encode(const florb::cfg_cache& rhs) {
+ Node node;
+ node["location"] = rhs.location();
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_cache& rhs)
+ {
+ if((!node.IsMap()) || (node.size() == 0))
+ return true;
+
+ if (node["location"])
+ rhs.location(node["location"].as<std::string>());
+
+ return true;
+ }
+ };
+
+ template<>
+ struct convert<florb::cfg_units> {
+ static Node encode(const florb::cfg_units& rhs) {
+ Node node;
+
+ switch (rhs.system_length())
+ {
+ case (florb::cfg_units::system::IMPERIAL):
+ node["system_length"] = "imperial";
+ break;
+ case (florb::cfg_units::system::NAUTICAL):
+ node["system_length"] = "nautical";
+ break;
+ default:
+ node["system_length"] = "metric";
+ break;
+ }
+
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_units& rhs)
+ {
+ if((!node.IsMap()) || (node.size() == 0))
+ return true;
+
+ if (node["system_length"])
+ {
+ std::string sm(node["system_length"].as<std::string>());
+ if (sm == "imperial")
+ rhs.system_length(florb::cfg_units::system::IMPERIAL);
+ else if (sm == "nautical")
+ rhs.system_length(florb::cfg_units::system::NAUTICAL);
+ else
+ rhs.system_length(florb::cfg_units::system::METRIC);
+ }
+
+ return true;
+ }
+ };
+
+ template<>
+ struct convert<florb::cfg_gpsd> {
+ static Node encode(const florb::cfg_gpsd& rhs) {
+ Node node;
+ node["enabled"] = rhs.enabled();
+ node["host"] = rhs.host();
+ node["port"] = rhs.port();
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_gpsd& rhs)
+ {
+ if((!node.IsMap()) || (node.size() == 0))
+ return true;
+
+ if (node["enabled"])
+ rhs.enabled(node["enabled"].as<bool>());
+
+ if (node["host"])
+ rhs.host(node["host"].as<std::string>());
+
+ if (node["port"])
+ rhs.port(node["port"].as<std::string>());
+
+ return true;
+ }
+ };
+
+ template<>
+ struct convert<florb::cfg_ui> {
+ static Node encode(const florb::cfg_ui& rhs) {
+ Node node;
+ node["markercolor"] = rhs.markercolor().rgb();
+ node["markercolorselected"] = rhs.markercolorselected().rgb();
+ node["trackcolor"] = rhs.trackcolor().rgb();
+ node["selectioncolor"] = rhs.selectioncolor().rgb();
+ node["gpscursorcolor"] = rhs.gpscursorcolor().rgb();
+ node["tracklinewidth"] = rhs.tracklinewidth();
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_ui& rhs)
+ {
+ // Use defaults
+ if((!node.IsMap()) || (node.size() == 0))
+ {
+ return true;
+ }
+
+ if (node["markercolor"])
+ rhs.markercolor(florb::color(node["markercolor"].as<unsigned int>()));
+
+ if (node["markercolorselected"])
+ rhs.markercolorselected(florb::color(node["markercolorselected"].as<unsigned int>()));
+
+ if (node["trackcolor"])
+ rhs.trackcolor(florb::color(node["trackcolor"].as<unsigned int>()));
+
+ if (node["selectioncolor"])
+ rhs.selectioncolor(florb::color(node["selectioncolor"].as<unsigned int>()));
+
+ if (node["gpscursorcolor"])
+ rhs.gpscursorcolor(florb::color(node["gpscursorcolor"].as<unsigned int>()));
+
+ if (node["tracklinewidth"])
+ rhs.tracklinewidth(node["tracklinewidth"].as<unsigned int>());
+
+ return true;
+ }
+ };
+
+ template<>
+ struct convert<florb::cfg_viewport> {
+ static Node encode(const florb::cfg_viewport& rhs) {
+ Node node;
+ node["lon"] = rhs.lon();
+ node["lat"] = rhs.lat();
+ node["z"] = rhs.z();
+ return node;
+ }
+
+ static bool decode(const Node& node, florb::cfg_viewport& rhs)
+ {
+ if((!node.IsMap()) || (node.size() == 0))
+ {
+ return true;
+ }
+
+
+ if (node["lat"])
+ rhs.lat(node["lat"].as<double>());
+
+ if (node["lon"])
+ rhs.lon(node["lon"].as<double>());
+
+ if (node["z"])
+ rhs.z(node["z"].as<unsigned int>());
+
+ return true;
+ }
+ };
+}
+
+
#endif // SETTINGS_HPP
diff --git a/src/tracklayer.cpp b/src/tracklayer.cpp
index 994ccf6..06fd920 100644
--- a/src/tracklayer.cpp
+++ b/src/tracklayer.cpp
@@ -285,7 +285,7 @@ void florb::tracklayer::load_track(const std::string &path)
{
// Load the XML
tinyxml2::XMLDocument doc;
- if (doc.LoadFile(path.c_str()) != tinyxml2::XML_NO_ERROR)
+ if (doc.LoadFile(path.c_str()) != tinyxml2::XML_SUCCESS)
throw std::runtime_error(_("Failed to open GPX file"));
// Clear existing track and selection
@@ -411,7 +411,7 @@ void florb::tracklayer::save_track(const std::string &path)
setlocale(LC_ALL, oldlc);
// Throw in case of error
- if (xmlerr != tinyxml2::XML_NO_ERROR)
+ if (xmlerr != tinyxml2::XML_SUCCESS)
throw std::runtime_error(_("Failed to save GPX data"));
}
diff --git a/src/utils.cpp b/src/utils.cpp
index 1efb7ad..aa5f9cc 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -117,7 +117,7 @@ double florb::utils::dist(const florb::point2d<double> &p1, const florb::point2d
double ret = (6378.388 * acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)));
- return (isnan(ret) > 0) ? 0.0 : ret;
+ return (std::isnan(ret) > 0) ? 0.0 : ret;
}
double florb::utils::dist_merc(const florb::point2d<double> &p1, const florb::point2d<double> &p2)
+16 -6
View File
@@ -6,7 +6,7 @@
<Homepage>http://florb.shugaa.de/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
<Email>admin@pisilinux.org</Email>
</Packager>
<License>MIT</License>
<IsA>app:gui</IsA>
@@ -15,10 +15,10 @@
<Description>
florb is a really simple map viewer and GPX editor written in C++ using the FLTK UI toolkit. florb makes it easy to create and edit tracks for planning short and extended trips into the wild green. Or anywhere else for that matter.
</Description>
<Archive sha1sum="074ee0eca20fd8977e659a8bf353e28028ef3107" type="zip">https://github.com/shugaa/florb/archive/85d2be7d851f83db8a289fd2018832aec295d526.zip</Archive>
<Archive target="florb-85d2be7d851f83db8a289fd2018832aec295d526/src/res" sha1sum="0857fd36313ceeed06b19c3c37a121d34bd621ee" type="binary">https://github.com/pekdon/florb/raw/cmake_support/src/res/audio-input-microphone-ina.png</Archive>
<Archive sha1sum="22e837752f164641ab5deb614e30e653a5c78d80" type="targz">https://github.com/shugaa/florb/archive/v1.1/florb-1.1.tar.gz</Archive>
<Archive target="florb-1.1/src/res" sha1sum="0857fd36313ceeed06b19c3c37a121d34bd621ee" type="binary">https://github.com/pekdon/florb/raw/cmake_support/src/res/audio-input-microphone-ina.png</Archive>
<BuildDependencies>
<Dependency>cmake</Dependency>
<Dependency>omake</Dependency>
<Dependency>yaml-cpp</Dependency>
<Dependency>curl-devel</Dependency>
<Dependency>mesa-devel</Dependency>
@@ -31,11 +31,14 @@
<Dependency>tinyxml2-devel</Dependency>
<Dependency>libxkbfile-devel</Dependency>
<Dependency>libxkbcommon-devel</Dependency>
<Dependency>python3-translate_toolkit</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">support_building_with_cmake.patch</Patch>
<Patch level="1">upstream.patch</Patch>
<Patch level="1">allow_startup_with_missing_config_file.patch</Patch>
<Patch level="1">no_build_about_resources.patch</Patch>
<Patch level="1">Swedish_translation.patch</Patch>
<Patch level="1">update_search_request.patch</Patch>
<Patch level="1">BudDavis__1.patch</Patch>
</Patches>
</Source>
@@ -63,6 +66,13 @@
</Package>
<History>
<Update release="6">
<Date>2024-12-22</Date>
<Version>1.1</Version>
<Comment>Rebuild</Comment>
<Name>fury</Name>
<Email>uglyside@yandex.ru</Email>
</Update>
<Update release="5">
<Date>2023-11-01</Date>
<Version>1.1</Version>