summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2017-06-05 12:40:14 +0200
committerStefan Wildemann <gta04@metalstrolche.de>2017-06-21 21:37:35 +0200
commitbec0938fe36aeba2ca708b58d34a0260801c05ac (patch)
treed6677080bd4763dbae7e8ff700d8f69a0b58cd4e
parent18ce924a1daaad37ae460cb70079ca7fa47f6a4f (diff)
downloadnavit-bec0938fe36aeba2ca708b58d34a0260801c05ac.tar.gz
Create config using xslt
This converts the sailfish build to use xslt instead of predefined config. Unfortunately getting the zoom levels right is pain in the ass and therefor not (yet) done.
-rwxr-xr-xcontrib/sailfish/navit-sailfish.spec10
-rw-r--r--navit/xslt/sailfish_disable.xslt56
-rw-r--r--navit/xslt/sailfish_mapset.xslt30
-rw-r--r--navit/xslt/sailfish_osd.xslt38
-rw-r--r--navit/xslt/sailfish_qt5.xslt42
-rw-r--r--navit/xslt/sailfish_svg.xslt34
6 files changed, 207 insertions, 3 deletions
diff --git a/contrib/sailfish/navit-sailfish.spec b/contrib/sailfish/navit-sailfish.spec
index 4ed226967..dc48fc569 100755
--- a/contrib/sailfish/navit-sailfish.spec
+++ b/contrib/sailfish/navit-sailfish.spec
@@ -82,6 +82,7 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \
-Dvehicle/gpsd_dbus:BOOL=FALSE \
-DUSE_PLUGINS=n \
-DUSE_QWIDGET:BOOL=FALSE \
+ -DXSLTS:STRING="sailfish_disable;sailfish_qt5;sailfish_osd;sailfish_mapset;sailfish_svg" \
%{navit_real_source}
%{__make}
@@ -90,7 +91,7 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \
%install
%make_install
#copy in sailfish config
-cp %{navit_real_source}/contrib/sailfish/navit.xml %{buildroot}/usr/share/harbour-navit/navit.xml
+#cp %{navit_real_source}/contrib/sailfish/navit.xml %{buildroot}/usr/share/harbour-navit/navit.xml
%files
%defattr(644, root, root, 755)
@@ -111,8 +112,11 @@ cp %{navit_real_source}/contrib/sailfish/navit.xml %{buildroot}/usr/share/harbou
%changelog
-*Wed May 11 2017 metalstrolch 0.5.1-3
-- Switch to QT font rendering. Remove freetype dep.
+*Wed Jun 05 2017 metalstrolch 0.5.1-3
+- Enable rotating.
+- Create default config from xlst
+- Switch to QT font rendering.
+- Remove freetype dep.
*Wed May 03 2017 metalstrolch 0.5.1-2
- Use qt5_espeak
diff --git a/navit/xslt/sailfish_disable.xslt b/navit/xslt/sailfish_disable.xslt
new file mode 100644
index 000000000..4f730b00e
--- /dev/null
+++ b/navit/xslt/sailfish_disable.xslt
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>
+
+ <!-- Default rule: copy all -->
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Disable all vehicles -->
+ <xsl:template match="vehicle">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="enabled">no</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- Disable all graphics -->
+ <xsl:template match="graphics">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="enabled">no</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- Disable all mapsets -->
+ <xsl:template match="mapset">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="enabled">no</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- Disable all osd -->
+ <xsl:template match="osd">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="enabled">no</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- Disable all speech -->
+ <xsl:template match="speech">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="enabled">no</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/navit/xslt/sailfish_mapset.xslt b/navit/xslt/sailfish_mapset.xslt
new file mode 100644
index 000000000..8c210db63
--- /dev/null
+++ b/navit/xslt/sailfish_mapset.xslt
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>
+
+ <!-- Default rule: copy all -->
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/config/navit/mapset[1]">
+ <mapset enabled="yes">
+ <xsl:text>&#x0A; </xsl:text>
+ <map type="binfile" enabled="no" data="/usr/share/harbour-navit/maps/osm_bbox_11.3,47.9,11.7,48.2.bin"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <map type="binfile" enabled="yes" data="~/Maps/map.navit.bin"/>
+ <xsl:text>&#x0A; </xsl:text>
+ </mapset>
+ <xsl:text>&#x0A; </xsl:text>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/navit/xslt/sailfish_osd.xslt b/navit/xslt/sailfish_osd.xslt
new file mode 100644
index 000000000..a60a8c6d4
--- /dev/null
+++ b/navit/xslt/sailfish_osd.xslt
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>
+
+ <!-- Default rule: copy all -->
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/config/navit/osd[1]">
+ <osd enabled="yes" type="gps_status" x="0" y="0" w="50" h="50"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="no" type="text" label="${{vehicle.position_sats_used}}/${{vehicle.position_qual}}" x="0" y="0" w="50" h="50" background_color="#00000058" font_size="400"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="text" label="${{vehicle.position_speed}}" x="50" y="0" w="150" h="50" background_color="#00000058" font_size="400"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="text" label="${{navigation.item.destination_length[named]}}" x="200" y="0" w="240" h="50" background_color="#00000058" font_size="400"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="navigation_next_turn" x="-100" y="0" w="100" h="100" icon_w="90" icon_h="80" background_color="#00000058"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="button" x="-96" y="-96" w="96" h="96" command="zoom_in()" src="zoom_in"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="text" label="${{navigation.item[1].length[named]}}" x="-100" y="100" w="100" h="50" background_color="#00000058" font_size="400"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <osd enabled="yes" type="button" x="0" y="-96" w="96" h="96" command="zoom_out()" src="zoom_out"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/navit/xslt/sailfish_qt5.xslt b/navit/xslt/sailfish_qt5.xslt
new file mode 100644
index 000000000..5ee20e2e9
--- /dev/null
+++ b/navit/xslt/sailfish_qt5.xslt
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>
+
+ <!-- Default rule: copy all -->
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/config/navit/graphics[1]">
+ <graphics type="qt5" qt5_platform="wayland"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/config/navit/vehicle[1]">
+ <vehicle name="Qt5" profilename="car" enabled="yes" active="1" source="qt5://"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="/config/navit/speech[1]">
+ <speech type="qt5_espeak" cps="15"/>
+ <xsl:text>&#x0A; </xsl:text>
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/navit/xslt/sailfish_svg.xslt b/navit/xslt/sailfish_svg.xslt
new file mode 100644
index 000000000..7203ed34d
--- /dev/null
+++ b/navit/xslt/sailfish_svg.xslt
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/>
+
+ <!-- Default rule: copy all -->
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Force all png icons to svg and add w and h if not exist -->
+ <xsl:template match="icon">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:if test="@src[substring(., string-length()-3)='.png']|@src[substring(., string-length()-3)='.xpm']">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat(substring(@src,1, string-length(@src)-3),'svg')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@h)">
+ <xsl:attribute name="h">15</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@w)">
+ <xsl:attribute name="w">15</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>