Merge branch 'master' into sailfish-port
authorLuciano Montanaro <mikelima@cirulla.net>
Wed, 6 Nov 2013 22:00:19 +0000 (23:00 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Wed, 6 Nov 2013 22:00:51 +0000 (23:00 +0100)
35 files changed:
application/application.pro [changed mode: 0644->0755]
application/dataprovider.cpp
application/icons/sailfish/90x90/quandoparte.png [new file with mode: 0644]
application/icons/sailfish/scalable/quandoparte-sailfish.svg [new file with mode: 0644]
application/main.cpp
application/quandoparte.qrc
application/resources/harmattan/qml/AboutPage.qml
application/resources/harmattan/qml/StationListPage.js
application/resources/harmattan/qml/StationListPage.qml
application/resources/harmattan/qml/StationPage.qml
application/resources/harmattan/qml/uiconstants.js
application/resources/sailfish/qml/cover/CoverPage.qml [new file with mode: 0644]
application/resources/sailfish/qml/main.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/AboutPage.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/StationListPage.js [new file with mode: 0644]
application/resources/sailfish/qml/pages/StationListPage.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/StationPage.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/components/DelayIndicator.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/components/StationScheduleDelegate.qml [new file with mode: 0644]
application/settings.cpp
application/stationlistmodel.cpp
application/stationlistmodel.h
application/stationlistproxymodel.cpp
application/stationlistproxymodel.h
application/stationscheduleitem.cpp
application/stationscheduleitem.h
application/stationschedulemodel.cpp
application/stationschedulemodel.h
application/view.cpp
application/view.h
application/view_qt4.h [new file with mode: 0644]
application/view_qt5.h [new file with mode: 0644]
qtc_packaging/debian_harmattan/changelog
quandoparte.pro
rpm/quandoparte.yaml [new file with mode: 0755]

old mode 100644 (file)
new mode 100755 (executable)
index 45bbf23..a89d325
@@ -4,17 +4,40 @@
 #
 #-------------------------------------------------
 
-VERSION = 0.5.1
+VERSION = 0.6.0
 USE_RESOURCES = 0
 
-QT += webkit network
-CONFIG += qt webkit mobility
-MOBILITY = location
+QT += network
+CONFIG += qt
+CONFIG += link_pkgconfig
 
-contains(MEEGO_EDITION,harmattan) {
-    CONFIG += harmattan
+lessThan(QT_MAJOR_VERSION, 5) {
+    QT += webkit
+    CONFIG += webkit mobility
+    MOBILITY = location
+} else {
+    QT += qml quick concurrent location webkitwidgets webkit
 }
 
+contains(MEEGO_EDITION, harmattan) {
+   CONFIG += harmattan
+}
+
+sailfish {
+    PLATFORM = sailfish
+    DEFINES += TARGET_PLATFORM_SAILFISH
+    # enable booster
+packagesExist(qdeclarative-boostable) {
+    message("Building with qdeclarative-boostable support")
+    DEFINES += HAS_BOOSTER
+    PKGCONFIG += qdeclarative-boostable
+} else {
+    warning("qdeclarative-boostable not available; startup times will be slower")
+}
+    QMAKE_LFLAGS += -pie -rdynamic
+    PLATFORM_SOURCES = view.cpp
+    PLATFORM_HEADERS = view.h view_qt5.h
+}
 harmattan {
     QT += declarative
     PLATFORM = harmattan
@@ -24,7 +47,7 @@ harmattan {
     QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-psabi
     QMAKE_LFLAGS += -pie -rdynamic
     PLATFORM_SOURCES = view.cpp
-    PLATFORM_HEADERS = view.h
+    PLATFORM_HEADERS = view.h view_qt4.h
 }
 maemo5 {
     QT += maemo5
@@ -43,14 +66,7 @@ maemo5 {
         settingsdialog.h \
         stationview.h
 }
-symbian {
-    QT += declarative
-    DEFINES += TARGET_PLATFORM_SYMBIAN
-    PLATFORM = symbian
-    PLATFORM_SOURCES = view.cpp
-    PLATFORM_HEADERS = view.h
-}
-!harmattan:!maemo5:!symbian {
+!sailfish:!harmattan:!maemo5 {
     PLATFORM = desktop
     DEFINES += TARGET_PLATFORM_DESKTOP
     PLATFORM_SOURCES = view.cpp
@@ -58,6 +74,7 @@ symbian {
 
 message(Compiling For:    $$PLATFORM)
 message(Platform Sources: $$PLATFORM_SOURCES)
+message(Qt Version:       $$QT_MAJOR_VERSION"."$$QT_MINOR_VERSION)
 message(Qt Modules Used:  $$QT)
 message(Building version: $$VERSION)
 
@@ -66,8 +83,9 @@ TEMPLATE = app
 VERSION_STRING = '\\"$${VERSION}\\"'
 DEFINES += QP_VERSION=\"$${VERSION_STRING}\"
 
-contains(USE_RESOURCES,1) {
+contains(USE_RESOURCES, 1) {
     DEFINES += USE_RESOURCES=1
+    CONFIG += resources
 }
 
 !debug {
@@ -99,13 +117,6 @@ FORMS += \
     settingsdialog.ui \
     stationlistview.ui
 
-symbian {
-    TARGET.UID3 = 0xe30fb688
-    # TARGET.CAPABILITY += 
-    TARGET.EPOCSTACKSIZE = 0x14000
-    TARGET.EPOCHEAPSIZE = 0x020000 0x800000
-}
-
 QMLSOURCES = \
     resources/harmattan/qml/main.qml \
     resources/harmattan/qml/StationListPage.qml \
@@ -119,15 +130,24 @@ QMLSOURCES = \
     resources/harmattan/qml/InfoBar.qml \
     resources/harmattan/qml/DroppedShadow.qml \
     resources/harmattan/qml/DelayIndicator.qml \
-    resources/harmattan/qml/StationScheduleDelegate.qml
+    resources/harmattan/qml/StationScheduleDelegate.qml \
+    resources/sailfish/qml/main.qml \
+    resources/sailfish/qml/pages/AboutPage.qml \
+    resources/sailfish/qml/pages/StationListPage.qml \
+    resources/sailfish/qml/pages/StationPage.qml \
+    resources/sailfish/qml/pages/components/DelayIndicator.qml \
+    resources/sailfish/qml/pages/components/StationScheduleDelegate.qml
 
 OTHER_FILES += \
+    resources/sailfish/applications/quandoparte.desktop \
     resources/harmattan/applications/quandoparte.desktop \
     resources/fremantle/applications/quandoparte.desktop \
     icons/48x48/quandoparte.png \
     icons/64x64/quandoparte.png \
     icons/80x80/quandoparte.png \
     icons/scalable/quandoparte.svg \
+    icons/sailfish/90x90/quandoparte.svg \
+    icons/sailfish/scalable/quandoparte.svg \
     icons/quandoparte.png \
     resources/quandoparte.css \
     resources/arrivals.css \
@@ -136,53 +156,59 @@ OTHER_FILES += \
     resources/stations/stations.qpl \
     resources/stations/generatelist.xq \
     resources/stations/generateunclassifiedlist.xq \
-    $$QMLSOURCES
-
-unix {
-    isEmpty(PREFIX) {
-        maemo5 {
-            PREFIX=/opt/usr
-        }
-        harmattan {
-            PREFIX=/opt/$${TARGET}
-        }
-        desktop {
-            PREFIX=/usr/local
-        }
-    }
+    $$QMLSOURCES \
+    resources/sailfish/qml/StationListPage.qml
+
+isEmpty(PREFIX) {
     maemo5 {
-        DESKTOPDIR=/usr/share/applications/hildon
+        PREFIX=/opt/usr
     }
     harmattan {
-        DESKTOPDIR=/usr/share/applications
+        PREFIX=/opt/$${TARGET}
     }
-    desktop {
-        DESKTOPDIR=$$PREFIX/share/applications
+    sailfish {
+        PREFIX=/usr
     }
-
-    BINDIR=$$PREFIX/bin
-    contains(USE_RESOURCES,1) {
-        DATADIR=":"
-    } else {
-        DATADIR=$$PREFIX/share/apps/$${TARGET}
+    !maemo5:!harmattan:!sailfish {
+        PREFIX=/usr/local
     }
-    DEFINES += DATADIR=\\\"$${DATADIR}\\\" PKGDATADIR=\\\"$${PKGDATADIR}\\\"
 }
+maemo5 {
+    DESKTOPDIR=/usr/share/applications/hildon
+}
+harmattan {
+    DESKTOPDIR=/usr/share/applications
+}
+sailfish {
+    DESKTOPDIR=$$PREFIX/share/applications
+}
+desktop {
+    DESKTOPDIR=$$PREFIX/share/applications
+}
+BINDIR=$$PREFIX/bin
+contains(USE_RESOURCES, 1) {
+    DATADIR=":"
+} else {
+    DATADIR=$$PREFIX/share/apps/$${TARGET}
+}
+DEFINES += DATADIR=\\\"$${DATADIR}\\\" PKGDATADIR=\\\"$${PKGDATADIR}\\\"
 
 message(Installing to prefix $$PREFIX)
+message(Executable to $$BINDIR)
+message(Desktop file to $$DESKTOPDIR)
+message(Data to $$DATADIR)
+message(Extra defines $$DEFINES)
 
-unix:!symbian {
-    target.path = $$BINDIR
-    INSTALLS += target
-}
+target.path = $$BINDIR
+INSTALLS += target
 
-unix:!symbian {
+unix:sailfish {
     desktopfile.files = resources/$$PLATFORM/applications/$${TARGET}.desktop
     desktopfile.path = $$DESKTOPDIR
     INSTALLS += desktopfile
 }
 
-unix:!symbian {
+unix:sailfish {
     i18n.files = $$replace(TRANSLATIONS, .ts, .qm)
     stations.files = resources/stations/stations.qpl
 
@@ -199,27 +225,39 @@ unix:!symbian {
 
     INSTALLS += icon48
     INSTALLS += iconscalable
-    !contains(USE_RESOURCES,1) {
-        INSTALLS += i18n
-        INSTALLS += stations
-    }
+    INSTALLS += i18n
+    INSTALLS += stations
 }
 
 maemo5 {
     css.files = resources/$${TARGET}.css resources/arrivals.css resources/departures.css
     css.path = $$DATADIR/css
-    !contains(USE_RESOURCES,1) {
+    !contains(USE_RESOURCES, 1) {
         INSTALLS += css
     }
 }
 
+sailfish {
+    icon90.files = icons/sailfish/90x90/$${TARGET}.png
+    icon90.path = /usr/share/icons/hicolor/meegotouch/apps
+    INSTALLS += icon90
+}
 harmattan {
     icon80.files = icons/80x80/$${TARGET}.png
     icon80.path = /usr/share/icons/hicolor/meegotouch/apps
     INSTALLS += icon80
 }
 
-!contains(USE_RESOURCES,1) {
+!contains(USE_RESOURCES, 1) {
+    sailfish {
+        qml.files = resources/sailfish/qml/*.qml \
+                    resources/sailfish/qml/*.js \
+                    resources/sailfish/qml/pages \
+                    resources/sailfish/qml/pages/components \
+                    resources/sailfish/qml/cover
+        qml.path = $$DATADIR/qml
+        INSTALLS += qml
+    }
     harmattan {
         qml.files = resources/harmattan/qml/*.qml resources/harmattan/qml/*.js
         qml.path = $$DATADIR/qml
@@ -227,7 +265,7 @@ harmattan {
     }
 }
 
-contains(USE_RESOURCES,1) {
+contains(USE_RESOURCES, 1) {
     RESOURCES += \
         quandoparte.qrc
 }
index 8d19c13..44e4844 100644 (file)
@@ -28,9 +28,11 @@ Boston, MA 02110-1301, USA.
 #include <QNetworkReply>
 #include <QNetworkRequest>
 #include <QSharedPointer>
+#if 0
 #include <QWebElement>
 #include <QWebFrame>
 #include <QWebPage>
+#endif
 
 // Constants
 static const int RECENT_STATIONS_MAX_COUNT = 10;
diff --git a/application/icons/sailfish/90x90/quandoparte.png b/application/icons/sailfish/90x90/quandoparte.png
new file mode 100644 (file)
index 0000000..8665d94
Binary files /dev/null and b/application/icons/sailfish/90x90/quandoparte.png differ
diff --git a/application/icons/sailfish/scalable/quandoparte-sailfish.svg b/application/icons/sailfish/scalable/quandoparte-sailfish.svg
new file mode 100644 (file)
index 0000000..8885d71
--- /dev/null
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="80"
+   height="80"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="quandoparte-sailfish.svg"
+   inkscape:export-filename="/home/mikelima/pictures/graphic-work/quandoparte-icon-sailfish-90.png"
+   inkscape:export-xdpi="101.08998"
+   inkscape:export-ydpi="101.08998">
+  <defs
+     id="defs4">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3848">
+      <stop
+         style="stop-color:#008000;stop-opacity:1;"
+         offset="0"
+         id="stop3850" />
+      <stop
+         style="stop-color:#0088ff;stop-opacity:1"
+         offset="1"
+         id="stop3852" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3812">
+      <stop
+         id="stop3838"
+         offset="0"
+         style="stop-color:#323232;stop-opacity:0.78431374;" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.78431374;"
+         offset="1"
+         id="stop3816" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3812"
+       id="linearGradient3818"
+       x1="40"
+       y1="1047.3622"
+       x2="40"
+       y2="977.36218"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3848"
+       id="linearGradient3854"
+       x1="38.051281"
+       y1="67"
+       x2="38.051281"
+       y2="0"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       gradientUnits="userSpaceOnUse"
+       y2="1027.8437"
+       x2="26.50565"
+       y1="1027.8437"
+       x1="21.438231"
+       id="linearGradient3625"
+       xlink:href="#linearGradient3619"
+       inkscape:collect="always" />
+    <inkscape:perspective
+       id="perspective10"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       id="linearGradient3611">
+      <stop
+         id="stop3613"
+         offset="0"
+         style="stop-color:#fcaf3e;stop-opacity:1;" />
+      <stop
+         id="stop3615"
+         offset="1"
+         style="stop-color:#fcaf3e;stop-opacity:0;" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3619"
+       inkscape:collect="always">
+      <stop
+         id="stop3621"
+         offset="0"
+         style="stop-color:#d9bb7a;stop-opacity:1;" />
+      <stop
+         id="stop3623"
+         offset="1"
+         style="stop-color:#806646;stop-opacity:1" />
+    </linearGradient>
+    <filter
+       inkscape:collect="always"
+       id="filter4535">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.85696886"
+         id="feGaussianBlur4537" />
+    </filter>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3848"
+       id="linearGradient4551"
+       gradientUnits="userSpaceOnUse"
+       x1="38.051281"
+       y1="67"
+       x2="38.051281"
+       y2="0"
+       gradientTransform="matrix(1.0540541,0,0,1,-0.10810811,972.36218)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3848"
+       id="linearGradient3825"
+       x1="0"
+       y1="80"
+       x2="78"
+       y2="2"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3848"
+       id="linearGradient3869"
+       x1="16"
+       y1="78"
+       x2="16"
+       y2="2"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3848"
+       id="linearGradient3872"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.0540541,0,0,1,-0.10810811,972.36218)"
+       x1="38.051281"
+       y1="67"
+       x2="38.051281"
+       y2="0" />
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath3915">
+      <path
+         style="fill:#0000ff;fill-opacity:1;stroke:none"
+         d="m 39.65625,972.36218 c -21.160968,0.16495 -38.70822061,16.90023 -39.625,38.28122 -0.06915528,1.6129 -0.02497355,3.2105 0.09375,4.7813 L 0,1052.3622 l 40.125,0.125 0,-0.125 c 21.258055,-0.052 39.875,-17 39.84375,-38.2813 L 80,1014.3622 79.96875,1014.0497 C 80,991.36218 63.784148,973.33955 41.71875,972.39343 c -0.689712,-0.0296 -1.379888,-0.0366 -2.0625,-0.0312 z"
+         id="path3917"
+         inkscape:connector-curvature="0"
+         sodipodi:nodetypes="sscccccccss"
+         mask="none" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="6.3197669"
+     inkscape:cx="40"
+     inkscape:cy="46.576494"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:window-width="1600"
+     inkscape:window-height="880"
+     inkscape:window-x="-4"
+     inkscape:window-y="-3"
+     inkscape:window-maximized="1"
+     inkscape:snap-grids="false"
+     inkscape:snap-object-midpoints="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2985"
+       empspacing="8"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="2,57"
+       id="guide2987" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="13,78"
+       id="guide2989" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="78,62"
+       id="guide2991" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="67,2"
+       id="guide2993" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="67,37"
+       id="guide2995" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="13,30"
+       id="guide2997" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="14,13"
+       id="guide2999" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="8,67"
+       id="guide3001" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-972.36218)">
+    <path
+       style="fill:url(#linearGradient3869);fill-opacity:1;stroke:none"
+       d="M 39.65625,0 C 18.495282,0.16495097 0.94802939,16.90023 0.03125,38.28125 -0.03790528,39.894081 0.00627645,41.491687 0.125,43.0625 L 0,80 40.125,80.125 40.125,80 C 61.383055,79.948399 80,63 79.96875,41.71875 L 80,42 79.96875,41.6875 C 80,19 63.784148,0.97737017 41.71875,0.03125 41.029038,0.00167654 40.338862,-0.005321 39.65625,0 z"
+       transform="translate(0,972.36218)"
+       id="rect3806"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="sscccccccss" />
+    <path
+       clip-path="url(#clipPath3915)"
+       mask="none"
+       inkscape:connector-curvature="0"
+       id="path3900"
+       d="m -20.4375,1012.7684 c -0.998829,-0.01 -1.649505,0.1573 -1.65625,0.5313 2.514975,1.261 2.097418,1.0613 4.40625,2.2187 l -22.125,0.031 14.84375,7.25 21.75,-0.031 c 1.041637,0.5217 1.741398,0.8544 2.71875,1.3438 l -20.9375,-0.031 -0.53125,3.7188 14.5,3.5312 21.46875,0.031 c 16.972663,8.4852 24,12 24,12 2.703946,0.6827 5.370678,0.6827 5.34375,0 l -23.9375,-11.9688 20.78125,0.031 -14.15625,-7.25 -21.125,-0.031 -2.78125,-1.4062 20.21875,-0.031 0.375,-3.5312 -15.375,-3.7188 -19.71875,0.031 -4.375,-2.1875 c -1.351973,-0.3414 -2.688671,-0.5231 -3.6875,-0.5313 z"
+       style="opacity:0.33;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.95595741000000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter4535)" />
+    <g
+       transform="matrix(1.3385088,0,0,1.3351374,8.4422408,-359.95032)"
+       id="layer1-1"
+       inkscape:label="Layer 1"
+       style="stroke:none">
+      <text
+         transform="translate(0,1004.3622)"
+         id="text3600"
+         y="11.38197"
+         x="8.7125654"
+         style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
+         xml:space="preserve"><tspan
+           y="11.38197"
+           x="8.7125654"
+           id="tspan3602"
+           sodipodi:role="line" /></text>
+      <g
+         id="g3643"
+         style="stroke:none">
+        <path
+           sodipodi:nodetypes="ccccc"
+           style="fill:url(#linearGradient3625);fill-opacity:1;stroke:none;stroke-width:1.01129984999999989px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+           d="m 22,1005.3622 c -0.126269,44.9403 0,45 0,45 1,1.0227 3,1.0227 4,0 l 0,-45 c -1,-1.0227 -2.872251,-1.1205 -4,0 z"
+           id="path3592"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path3598"
+           transform="matrix(0.74710006,0,0,0.74898658,-6.3071986,997.88419)"
+           style="opacity:0.66000000999999997;fill:#000000;stroke:none;stroke-width:1.33682203000000022px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+           d="m 37.84375,32.9375 c -0.0088,5.14928 -0.02926,10.756012 -0.03125,14.5 l 5.4375,0.03125 0,-14.5 -5.40625,-0.03125 z M 43.25,15.5625 37.875,15.59375 c -0.01487,5.768213 -0.02272,9.917307 -0.03125,14.5 l 5.40625,0 0,-14.53125 z" />
+        <g
+           transform="translate(-0.79055405,-0.71421602)"
+           id="g3627"
+           style="stroke:none">
+          <path
+             style="fill:#fce94f;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+             d="m 6.2100142,1009.4307 35.3553398,-0.1263 5.934646,5.5559 -5.555839,5.3033 -35.4816087,0.1262 -0.2525381,-10.8591 z"
+             id="path3629"
+             sodipodi:nodetypes="cccccc"
+             inkscape:connector-curvature="0" />
+          <text
+             xml:space="preserve"
+             style="font-size:6px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans Bold"
+             x="17.790554"
+             y="1017.0764"
+             id="text3631"><tspan
+               sodipodi:role="line"
+               id="tspan3633"
+               x="17.790554"
+               y="1017.0764">Arrivi</tspan></text>
+        </g>
+        <g
+           transform="translate(-0.0558386,-1.186)"
+           id="g3635"
+           style="stroke:none">
+          <path
+             sodipodi:nodetypes="cccccc"
+             id="path3637"
+             d="M 41.789986,1022.8153 6.4346456,1022.689 0.5,1028.2449 l 5.5558386,5.3033 35.4816094,0.1262 0.252538,-10.8591 z"
+             style="fill:#8ae234;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+             inkscape:connector-curvature="0" />
+          <text
+             xml:space="preserve"
+             style="font-size:6px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:Bitstream Charter Bold"
+             x="6.0014381"
+             y="1030.3262"
+             id="text3639"><tspan
+               sodipodi:role="line"
+               id="tspan3641"
+               x="6.0014381"
+               y="1030.3262">Partenze</tspan></text>
+        </g>
+      </g>
+      <g
+         transform="translate(-2.8742788e-5,0)"
+         id="g3654"
+         style="stroke:none" />
+    </g>
+    <text
+       transform="matrix(1.415998,0,1.4124228,0.7062157,0,0)"
+       id="text4050"
+       y="1444.1603"
+       x="-1459.1366"
+       style="font-size:8.50748348px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"
+       xml:space="preserve"><tspan
+         y="1444.1603"
+         x="-1459.1366"
+         id="tspan4052"
+         sodipodi:role="line" /></text>
+    <g
+       style="fill:#000000"
+       transform="matrix(1.3385088,0,1.3351293,0.6675687,-1394.1812,341.80968)"
+       id="g4090" />
+  </g>
+</svg>
index 29a4fdf..484529b 100644 (file)
@@ -19,12 +19,18 @@ Boston, MA 02110-1301, USA.
 
 */
 
+#ifdef TARGET_PLATFORM_FREMANTLE
 #include "app.h"
-#ifndef TARGET_PLATFORM_FREMANTLE
+#else
 #include "view.h"
 #endif
 
+#include <QtGlobal>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+#include <QtWidgets/QApplication>
+#else
 #include <QtGui/QApplication>
+#endif
 #include <QDir>
 #include <QDebug>
 #include <QLocale>
@@ -40,7 +46,9 @@ Boston, MA 02110-1301, USA.
 
 Q_DECL_EXPORT int main(int argc, char *argv[])
 {
-#ifdef TARGET_PLATFORM_HARMATTAN
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+    QScopedPointer< QApplication > a(new QApplication(argc, argv));
+#elif TARGET_PLATFORM_HARMATTAN
     QScopedPointer< QApplication > a(MDeclarativeCache::qApplication(argc, argv));
 #else
     QScopedPointer< QApplication > a(new QApplication(argc, argv));
index 3af30a8..dc9879d 100644 (file)
@@ -11,6 +11,7 @@
         <file alias="DroppedShadow.qml">resources/harmattan/qml/DroppedShadow.qml</file>
         <file alias="DelayIndicator.qml">resources/harmattan/qml/DelayIndicator.qml</file>
         <file alias="AboutPage.qml">resources/harmattan/qml/AboutPage.qml</file>
+        <file alias="main.qml">resources/sailfish/qml/main.qml</file>
     </qresource>
     <qresource prefix="/stations">
         <file alias="stations.qpl">resources/stations/stations.qpl</file>
index 273ce34..e7842c6 100644 (file)
@@ -27,6 +27,8 @@ Page {
             right: parent.right;
             margins: UiConstants.DefaultMargin
         }
+        wrapMode: Text.WordWrap
+        textFormat: Text.RichText
         text: qsTr("<h2><a href='http://quandoparte.garage.maemo.org'>" +
                    "Quando Parte" + "</a></h2>" +"<p style='font-size:small;'>version ") +
               settings.versionString +
index ac4a1c6..858b36e 100644 (file)
@@ -21,7 +21,7 @@ function loadStation(name, code)
 
         /*
             XXX Ugliness ahead! Changing the name triggers the station
-            to schedule to be fetched. So any extra data (the code specifically)
+            schedule to be fetched. So any extra data (the code specifically)
             must be set before changing the name.
          */
         if (code !== undefined) view.code = code
index 04751c3..7a90001 100644 (file)
@@ -83,6 +83,11 @@ Page {
         property: "sortingMode"
         value: header.selectedIndex
     }
+    Binding {
+        target: stationListView
+        property: "section.property"
+        value: header.selectedIndex === 0 ? "name" : ""
+    }
     Item {
         id: mainView
         anchors {
@@ -105,6 +110,43 @@ Page {
                 bottom: parent.bottom
             }
             model:  stationListProxyModel
+            section {
+                //property: "name"
+                criteria: ViewSection.FirstCharacter
+                delegate: Item {
+                    width: parent.width
+                    height: UiConstants.SectionItemHeightSmall
+                    anchors {
+                        margins: UiConstants.DefaultMargin
+                    }
+                    Image {
+                        anchors {
+                            left: parent.left
+                            right: sectionLabel.left
+                            verticalCenter: parent.verticalCenter
+                            margins: UiConstants.DefaultMargin
+                        }
+                        source: "image://theme/meegotouch-separator-" + (theme.inverted ? "inverted-" : "") + "background-horizontal"
+                    }
+                    Label {
+                        id: sectionLabel
+                        anchors {
+                            right: sectionRightMargin.left
+                            verticalCenter: parent.verticalCenter
+                        }
+                        text: section
+                    }
+                    Item {
+                        id: sectionRightMargin
+                        anchors {
+                            right: parent.right
+                        }
+                        width: UiConstants.DefaultMargin
+                        height: UiConstants.DefaultMargin
+                    }
+                }
+            }
+
             delegate: Item {
                 id: listItem
                 height: UiConstants.ListItemHeightSmall
@@ -137,7 +179,7 @@ Page {
                         left: parent.left
                         right: parent.right
                     }
-                    source: "image://theme/meegotouch-separator-" + (theme.inverted ? "inverted-" : "") + "background-horizontal"
+                    //source: "image://theme/meegotouch-separator-" + (theme.inverted ? "inverted-" : "") + "background-horizontal"
                 }
                 MouseArea {
                     id: mouseArea
index cce8f3e..40105f6 100644 (file)
@@ -60,7 +60,7 @@ Page {
             clip: true
             visible: false
             width: parent.width
-            cacheBuffer: 10
+            cacheBuffer: 40
             anchors {
                 top: shadow.top
                 bottom: parent.bottom
index c6c4e11..c7d42c4 100644 (file)
@@ -15,6 +15,8 @@ const HeaderDefaultBottomSpacingLandscape = 16
 
 const SearchBarDefaultHeight = 80
 
+const SectionItemHeightSmall = 32
+
 const ListItemHeightSmall = 64
 const ListItemHeightDefault = 80
 const ListItemHeightLarge = 96
diff --git a/application/resources/sailfish/qml/cover/CoverPage.qml b/application/resources/sailfish/qml/cover/CoverPage.qml
new file mode 100644 (file)
index 0000000..17ee438
--- /dev/null
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+CoverBackground {
+    Label {
+        id: label
+        anchors.centerIn: parent
+        text: qsTr("Quando Parte")
+    }
+    
+/*
+    CoverActionList {
+        id: coverAction
+        
+        CoverAction {
+            iconSource: "image://theme/icon-cover-next"
+        }
+        
+        CoverAction {
+            iconSource: "image://theme/icon-cover-pause"
+        }
+    }
+*/
+}
+
+
diff --git a/application/resources/sailfish/qml/main.qml b/application/resources/sailfish/qml/main.qml
new file mode 100644 (file)
index 0000000..3463613
--- /dev/null
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import "pages"
+
+ApplicationWindow {
+    id: window
+    initialPage: StationListPage { }
+    cover: Qt.resolvedUrl("cover/CoverPage.qml")
+    Timer { /* XXX This is an AlignedTimer in Harmattan, which should be better for battery */
+        id: updateTimer
+        interval: 120
+    }
+}
diff --git a/application/resources/sailfish/qml/pages/AboutPage.qml b/application/resources/sailfish/qml/pages/AboutPage.qml
new file mode 100644 (file)
index 0000000..a41cd3b
--- /dev/null
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Page {
+    SilicaFlickable {
+       anchors.fill: parent
+       PageHeader {
+           id: header
+           anchors.top: parent.top
+        title: qsTr("About Quando Parte")
+       }
+       Label {
+           anchors {
+               top: header.bottom;
+               left: parent.left;
+               right: parent.right;
+               margins: Theme.paddingLarge
+           }
+            fontSizeMode: Text.Fit
+            textFormat: Text.RichText
+            wrapMode: Text.WordWrap
+            linkColor: Theme.highlightColor
+        text: qsTr("<h2><a href='http://quandoparte.garage.maemo.org'>" +
+                      "Quando Parte" + "</a></h2>" +"<p style='font-size:small;'>version ") +
+                 settings.versionString +
+                  "<div style='font-size:small;'>" +
+                 qsTr("</p>" +
+                       "<p>Copyright (c) 2010, 2011, 2012, 2013</p>" +
+                      "<p>Luciano Montanaro " +
+                      "(<a href='mailto:mikelima@cirulla.net'>mikelima@cirulla.net</a>)</p>" +
+                      "<p>Licensed under the GNU Public License v2 or above</p>" +
+                      "<p/><p>Station geolocation data from " +
+                      "<a href='http://www.openstreetmap.org'>OpenStreetMap</a></p>" +
+                      "<p>Realtime train data from " +
+                       "<a href='http://mobile.viaggiatreno.it'>Viaggiatreno</a></p>") +
+                       "</div>"
+            onLinkActivated: Qt.openUrlExternally(link)
+       }
+    }
+
+ }
diff --git a/application/resources/sailfish/qml/pages/StationListPage.js b/application/resources/sailfish/qml/pages/StationListPage.js
new file mode 100644 (file)
index 0000000..7a06bc2
--- /dev/null
@@ -0,0 +1,52 @@
+var view = undefined
+var about = undefined
+
+function showAboutPage()
+{
+    var component = Qt.createComponent("AboutPage.qml")
+    if (component.status === Component.Ready) {
+        about = component.createObject(stationListPage)
+        pageStack.push(about)
+    } else
+        console.log('Cannot load component: ' + component.errorString());
+}
+
+function loadStation(name, code)
+{
+    var component = Qt.createComponent("StationPage.qml");
+    if (component.status === Component.Ready) {
+        view = component.createObject(stationListPage)
+        stationListPage.stationView = view
+        pageStack.push(view)
+
+        /*
+            XXX Ugliness ahead! Changing the name triggers the station
+            schedule to be fetched. So any extra data (the code specifically)
+            must be set before changing the name.
+         */
+        if (code !== undefined) view.code = code
+        view.name = name
+    }
+    else
+        console.log('Cannot load component: ' + component.errorString());
+}
+
+function highlightSearch(s, color)
+{
+    // TODO compile RegExp on change, or find a way to cleanly use
+    // stationListProxyModel.filterRegExp
+    if (searchPattern.length) {
+        var r = new RegExp(searchPattern, 'i')
+        var match = r.exec(s)
+       console.log('s is ' + s);
+       if (match) {
+               return s.replace(r, '<font color="' + color + '">' +
+                               match + '</font>')
+       } else {
+               return s
+       }
+    } else {
+        return s
+    }
+}
+
diff --git a/application/resources/sailfish/qml/pages/StationListPage.qml b/application/resources/sailfish/qml/pages/StationListPage.qml
new file mode 100644 (file)
index 0000000..382c7ca
--- /dev/null
@@ -0,0 +1,75 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
+import "StationListPage.js" as Private
+
+Page {
+    id: stationListPage
+    property variant stationView
+    property string searchPattern
+    Binding {
+        target: stationListProxyModel
+        property: "searchPattern"
+        value: stationListPage.searchPattern
+    }
+    SilicaListView {
+        id: stationListView
+        clip: true
+        width: parent.width
+        cacheBuffer: 10
+        anchors.top: parent.top
+        anchors.bottom: parent.bottom
+        model:  stationListProxyModel
+        PullDownMenu {
+            MenuItem {
+                text: qsTr("About Quando Parte")
+                onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
+            }
+            MenuItem {
+                text: qsTr("Stations by Name")
+                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+            }
+            MenuItem {
+                text: qsTr("Stations by Distance")
+                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+            }
+            MenuItem {
+                text: qsTr("Stations Recently Seen")
+                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
+            }
+        }
+        header: SearchField {
+            id: searchField
+            placeholderText: qsTr("Search station...")
+            onTextChanged: stationListPage.searchPattern = searchField.text
+            width: stationListPage.width
+        }
+        delegate: BackgroundItem {
+            id: listItem
+            height: Theme.itemSizeSmall
+            width: parent.width
+            Label {
+                id: mainText
+                anchors {
+                    verticalCenter: parent.Center
+                    margins: Theme.paddingMedium
+                }
+                x: Theme.paddingLarge
+                textFormat: Text.StyledText
+                text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
+            }
+            onClicked: Private.loadStation(model.name, model.code)
+        }
+        section {
+            criteria: ViewSection.FirstCharacter
+            delegate: BackgroundItem {
+                height: Theme.itemSizeSmall
+                width: parent.width
+                Label {
+                    id: sectionLabel
+                    text: section
+                }
+            }
+        }
+    }
+}
diff --git a/application/resources/sailfish/qml/pages/StationPage.qml b/application/resources/sailfish/qml/pages/StationPage.qml
new file mode 100644 (file)
index 0000000..b1ea927
--- /dev/null
@@ -0,0 +1,145 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
+import "components"
+
+Page {
+    property alias name: schedule.name
+    property alias code: schedule.code
+
+    SilicaFlickable {
+        id: view
+        anchors.fill: parent
+        PullDownMenu {
+            MenuItem {
+                text: qsTr("Update Schedule")
+                onClicked: updateStation()
+            }
+            MenuItem {
+                text: qsTr("Departures")
+                onClicked: schedule.type = StationScheduleModel.DepartureSchedule
+            }
+            MenuItem {
+                text: qsTr("Arrivals")
+                onClicked: schedule.type = StationScheduleModel.ArrivalSchedule
+            }
+        }
+        SilicaListView {
+            id: stationScheduleView
+            anchors.fill: parent
+            clip: true
+            visible: false
+            width: parent.width
+            cacheBuffer: 40
+            header: PageHeader {
+                    id: header
+                    title: (schedule.type === StationScheduleModel.DepartureSchedule ? qsTr("Departures from ") : qsTr("Arrivals to ")) + name
+                }
+            model: schedule
+            delegate: StationScheduleDelegate {
+                width: stationScheduleView.width
+                type: schedule.type
+                arrivalTime: model.arrivalTime
+                departureTime: model.departureTime
+                train: model.train
+                arrivalStation: model.arrivalStation
+                departureStation: model.departureStation
+                delay: model.delay
+                actualPlatform: model.actualPlatform
+                expectedPlatfrom: model.expectedPlatform
+            }
+        }
+        BusyIndicator {
+            id: busyIndicator
+            anchors.centerIn: parent
+            running: visible
+            size: BusyIndicatorSize.Large
+        }
+        Item {
+            id: errorDisplay
+            anchors.centerIn: parent
+            Column {
+                anchors.centerIn: parent
+                spacing: Theme.paddingLarge
+                Label {
+                    text: qsTr("Error!")
+                    width: parent.width
+                    font.pixelSize: Theme.fontSizeHuge
+                    horizontalAlignment: Text.AlignHCenter
+                }
+                Label {
+                    text: schedule.error
+                    width: parent.width
+                    font.pixelSize: Theme.fontSizeHuge
+                    horizontalAlignment: Text.AlignHCenter
+                }
+            }
+        }
+        states: [
+            State {
+                name: "loading"
+                when: !completed
+                PropertyChanges {
+                    target: stationScheduleView
+                    visible: false
+                }
+                PropertyChanges {
+                    target: errorDisplay
+                    visible: false
+                }
+                PropertyChanges {
+                    target: busyIndicator
+                    visible: true
+                }
+            },
+            State {
+                name: "ready"
+                PropertyChanges {
+                    target: stationScheduleView
+                    visible: true
+                }
+                PropertyChanges {
+                    target: errorDisplay
+                    visible: false
+                }
+                PropertyChanges {
+                    target: busyIndicator
+                    visible: false
+                }
+            },
+            State {
+                name: "error"
+                when: schedule.error
+                PropertyChanges {
+                    target: stationScheduleView
+                    visible: false
+                }
+                PropertyChanges {
+                    target: errorDisplay
+                    visible: true
+                }
+                PropertyChanges {
+                    target: busyIndicator
+                    visible: false
+                }
+            }
+        ]
+
+        function updateStation() {
+            view.state = "loading"
+            console.log("Updating station with " + schedule.name + ", " + schedule.code)
+            schedule.fetch(schedule.name, schedule.code)
+        }
+        StationScheduleModel {
+            id: schedule
+            onNameChanged: view.updateStation()
+            onLayoutChanged: if (error) view.state = "error"
+                             else view.state = "ready"
+        }
+
+        Component.onCompleted: {
+            updateTimer.triggered.connect(view.updateStation)
+            view.state = "loading"
+        }
+    }
+}
diff --git a/application/resources/sailfish/qml/pages/components/DelayIndicator.qml b/application/resources/sailfish/qml/pages/components/DelayIndicator.qml
new file mode 100644 (file)
index 0000000..cfccfae
--- /dev/null
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Item {
+    id: indicator
+    property int level: 0
+    width: 10
+    height: parent.height
+    anchors {
+        top: parent.top
+        bottom: parent.bottom
+        rightMargin: Theme.paddingMedium
+    }
+    Rectangle {
+        id: rect
+        width: 10
+        height: indicator.height - 10
+        anchors.centerIn: parent
+        color: {
+            switch (indicator.level) {
+            case 0: return "#0b0"
+            case 1: return "#dd0"
+            case 2: return "#da0"
+            case 3: return "#d60"
+            case 4: return "#d00"
+            default: return "#b0b"
+            }
+        }
+    }
+}
diff --git a/application/resources/sailfish/qml/pages/components/StationScheduleDelegate.qml b/application/resources/sailfish/qml/pages/components/StationScheduleDelegate.qml
new file mode 100644 (file)
index 0000000..7d943b7
--- /dev/null
@@ -0,0 +1,119 @@
+import QtQuick 2.0
+import QtWebKit 3.0
+import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
+
+BackgroundItem {
+    id: root
+    property variant type
+    property alias arrivalTime: arrivalTimeLabel.text
+    property alias departureTime: departureTimeLabel.text
+    property alias train: trainLabel.text
+    property string arrivalStation
+    property string departureStation
+    property alias delay: delayLabel.text
+    property string actualPlatform
+    property string expectedPlatfrom
+
+    implicitHeight: Theme.itemSizeExtraLarge
+    height: Theme.itemSizeExtraLarge
+    Item {
+        id: bodyRow
+        anchors {
+            fill: parent
+            margins: Theme.paddingSmall
+        }
+        DelayIndicator {
+            id: indicator
+            level: delayClass
+        }
+        Item {
+            anchors {
+                left: indicator.right
+                right: bodyRow.right
+                leftMargin: Theme.paddingMedium
+            }
+            Row {
+                id: firstRow
+                anchors.top: parent.top
+                spacing: Theme.paddingMedium
+                Label {
+                    id: arrivalTimeLabel
+                    font.pixelSize: Theme.fontSizeMedium
+                    visible: type === StationScheduleModel.ArrivalSchedule
+                }
+                Label {
+                    id: departureTimeLabel
+                    font.pixelSize: Theme.fontSizeMedium
+                    visible: type === StationScheduleModel.DepartureSchedule
+                }
+                Label {
+                    id: trainLabel
+                    font.pixelSize: Theme.fontSizeMedium
+                    color: Theme.highlightColor
+                }
+            }
+            Item {
+                id: secondRow
+                height: Theme.fontSizeMedium
+                anchors.top: firstRow.bottom
+                Label {
+                    text: qsTr("from %1").arg(root.arrivalStation)
+                    font.pixelSize: Theme.fontSizeMedium
+                    visible: type === StationScheduleModel.ArrivalSchedule
+                }
+                Label {
+                    text: qsTr("to %1").arg(root.departureStation)
+                    font.pixelSize: Theme.fontSizeMedium
+                    visible: type === StationScheduleModel.DepartureSchedule
+                }
+            }
+            Item {
+                height: Theme.fontSizeSmall
+                anchors {
+                    top: secondRow.bottom
+                    left: parent.left
+                    right: parent.right
+                }
+                Label {
+                    id: delayLabel
+                    anchors.top: parent.top
+                    font.pixelSize: Theme.fontSizeSmall
+                }
+                Label {
+                    anchors {
+                        top: parent.top
+                        right: parent.right
+                        rightMargin: Theme.paddingMedium
+                    }
+                    text: displayPlatform(root.expectedPlatfrom, root.actualPlatform)
+                    font.pixelSize: Theme.fontSizeSmall
+                    textFormat: Text.RichText
+                }
+            }
+        }
+    }
+    Separator {
+        anchors {
+            left: parent.left
+            right: parent.right
+        }
+    }
+    onClicked: {
+        // Load an external page about the train, for now
+        Qt.openUrlExternally(settings.queryBaseUrl + "/" + detailsUrl)
+        console.log(settings.queryBaseUrl + "/" + detailsUrl)
+    }
+    function displayPlatform(expected, actual)
+    {
+        if (actual === "--") {
+            return qsTr("Platform %1").arg(expected)
+        } else if (actual === expected || expected === "--") {
+            return qsTr("Platform <span style='font-weight:bold;color:%2'>%1</span>").arg(actual).arg("#0f0")
+        } else {
+            return qsTr("Platform " +
+                        "<span style='text-decoration:line-through'>%1</span> " +
+                        "<span style='font-weight:bold;color:%3'>%2</span>").arg(expected).arg(actual).arg("#f00")
+        }
+    }
+}
index 654dcaa..2c59793 100644 (file)
@@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA.
 
 #include "settings.h"
 
-#include <QApplication>
+#include <QCoreApplication>
 #include <QDebug>
 #include <QSettings>
 #include <QStringList>
index 36cec14..5770141 100644 (file)
@@ -27,18 +27,18 @@ Boston, MA 02110-1301, USA.
 #include <QStandardItem>
 #include <QGeoCoordinate>
 
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
 QTM_USE_NAMESPACE
 Q_DECLARE_METATYPE(QGeoCoordinate)
+#endif
 
 StationListModel::StationListModel(QObject *parent) :
     QStandardItemModel(parent)
 {
     setRowCount(0);
-    QHash<int, QByteArray> roles;
-    roles[Qt::DisplayRole] = "name";
-    roles[StationListModel::PositionRole] = "position";
-    roles[StationListModel::StationCodeRole] = "code";
-    setRoleNames(roles);
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+    setRoleNames(roleNames());
+#endif
 }
 
 bool StationListModel::load(const QString &filename)
@@ -81,6 +81,15 @@ bool StationListModel::load(const QString &filename)
     return true;
 }
 
+QHash<int, QByteArray> StationListModel::roleNames() const
+{
+    QHash<int, QByteArray> roles;
+    roles[Qt::DisplayRole] = "name";
+    roles[StationListModel::PositionRole] = "position";
+    roles[StationListModel::StationCodeRole] = "code";
+    return roles;
+}
+
 void StationListModel::readStationsElement()
 {
     m_reader.readNext();
index b497fb5..7913e06 100644 (file)
@@ -43,6 +43,8 @@ public:
 
     bool load(const QString &filename);
 
+    QHash<int, QByteArray> roleNames() const;
+
 signals:
 
 public slots:
index 3a693cd..919f17a 100644 (file)
@@ -24,12 +24,15 @@ Boston, MA 02110-1301, USA.
 #include "settings.h"
 #include "stationlistmodel.h"
 
+#include <QtGlobal>
 #include <QDebug>
 #include <QGeoCoordinate>
 
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
 QTM_USE_NAMESPACE
 
 Q_DECLARE_METATYPE(QGeoCoordinate)
+#endif
 
 StationListProxyModel::StationListProxyModel(QObject *parent) :
     QSortFilterProxyModel(parent),
@@ -71,7 +74,8 @@ bool StationListProxyModel::lessThan(const QModelIndex &left,
     }
 }
 
-void StationListProxyModel::setUserPosition(const QtMobility::QGeoCoordinate &pos)
+
+void StationListProxyModel::setUserPosition(const QGeoCoordinate &pos)
 {
     qDebug() << "Position is now" << pos;
     m_here = pos;
@@ -163,15 +167,19 @@ void StationListProxyModel::forceSortingMode(SortingMode mode)
         break;
     }
     if (mode == StationListProxyModel::DistanceSorting) {
-        positionInfoSource->startUpdates();
+        if (positionInfoSource) {
+            positionInfoSource->startUpdates();
+        }
     } else {
-        positionInfoSource->stopUpdates();
+        if (positionInfoSource) {
+            positionInfoSource->stopUpdates();
+        }
     }
     invalidate();
     sort(0);
 }
 
-void StationListProxyModel::updatePosition(const QtMobility::QGeoPositionInfo &update)
+void StationListProxyModel::updatePosition(const QGeoPositionInfo &update)
 {
     qDebug() << "Position update received" << update;
     if (update.isValid()) {
index 45644a4..5ab5260 100644 (file)
@@ -22,13 +22,16 @@ Boston, MA 02110-1301, USA.
 
 */
 
+#include <QtGlobal>
 #include <QSortFilterProxyModel>
 #include <QGeoCoordinate>
 #include <QGeoPositionInfoSource>
 #include <QMetaType>
 #include <QStringList>
 
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
 QTM_USE_NAMESPACE
+#endif
 
 class StationListProxyModel : public QSortFilterProxyModel
 {
index 244cbb7..af4d997 100644 (file)
@@ -131,7 +131,7 @@ int StationScheduleItem::delayClass()
     return d->delayClass;
 }
 
-void StationScheduleItem::setDelayClass(const int value)
+void StationScheduleItem::setDelayClass(int value)
 {
     d->delayClass = value;
 }
index 8205318..156438f 100644 (file)
@@ -56,7 +56,7 @@ public:
     void setDelay(const QString &value);
 
     int delayClass();
-    void setDelayClass(const int value);
+    void setDelayClass(int value);
 
     QString &expectedPlatform();
     void setExpectedPlatform(const QString &value);
index d852c22..c3fb03d 100644 (file)
@@ -24,10 +24,15 @@ Boston, MA 02110-1301, USA.
 #include "dataprovider.h"
 #include "settings.h"
 
+#include <QtGlobal>
 #include <QDebug>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+#include <QtWebKitWidgets>
+#else
 #include <QWebElement>
 #include <QWebFrame>
 #include <QWebPage>
+#endif
 
 StationScheduleModel::StationScheduleModel(const QString &name, QObject *parent) :
     QAbstractListModel(parent),
@@ -36,25 +41,15 @@ StationScheduleModel::StationScheduleModel(const QString &name, QObject *parent)
 
 {
     DataProvider *provider = DataProvider::instance();
-    QHash<int, QByteArray> roles;
-    roles[TrainRole] = "train";
-    roles[DepartureStationRole] = "departureStation";
-    roles[DepartureTimeRole] = "departureTime";
-    roles[ArrivalStationRole] = "arrivalStation";
-    roles[ArrivalTimeRole] = "arrivalTime";
-    roles[DetailsUrlRole] = "detailsUrl";
-    roles[DelayRole] = "delay";
-    roles[DelayClassRole] = "delayClass";
-    roles[ExpectedPlatformRole] = "expectedPlatform";
-    roles[ActualPlatformRole] = "actualPlatform";
-    setRoleNames(roles);
-
     connect(provider, SIGNAL(stationScheduleReady(QByteArray,QUrl)),
             this, SLOT(parse(QByteArray,QUrl)));
     connect(provider, SIGNAL(error()),
             this, SLOT(onNetworkError()));
     Settings *settings = Settings::instance();
     m_scheduleType = settings->showArrivalsPreferred() ? ArrivalSchedule : DepartureSchedule;
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+    setRoleNames(roleNames());
+#endif
 }
 
 const QString &StationScheduleModel::name()
@@ -96,6 +91,23 @@ void StationScheduleModel::setError(const QString &error)
     }
 }
 
+QHash<int, QByteArray> StationScheduleModel::roleNames() const
+{
+    QHash<int, QByteArray> roles;
+    roles[TrainRole] = "train";
+    roles[DepartureStationRole] = "departureStation";
+    roles[DepartureTimeRole] = "departureTime";
+    roles[ArrivalStationRole] = "arrivalStation";
+    roles[ArrivalTimeRole] = "arrivalTime";
+    roles[DetailsUrlRole] = "detailsUrl";
+    roles[DelayRole] = "delay";
+    roles[DelayClassRole] = "delayClass";
+    roles[ExpectedPlatformRole] = "expectedPlatform";
+    roles[ActualPlatformRole] = "actualPlatform";
+
+    return roles;
+}
+
 StationScheduleModel::ScheduleType StationScheduleModel::type()
 {
     return m_scheduleType;
index ca668cd..1f97de7 100644 (file)
@@ -73,6 +73,8 @@ public:
     const QString &error();
     void setError(const QString &code);
 
+    QHash<int, QByteArray> roleNames() const;
+
 signals:
     void nameChanged();
     void codeChanged();
index 3e57d80..1236dcc 100644 (file)
@@ -26,12 +26,17 @@ Boston, MA 02110-1301, USA.
 #include "stationlistproxymodel.h"
 #include "stationschedulemodel.h"
 
+#include <QtGlobal>
+#include <QtConcurrentRun>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
 #include <QModelIndex>
-#include <QtConcurrentRun>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#include <QtQuick/QtQuick>
+#else
 #include <QtDeclarative>
+#endif
 
 // search Paths seem to be broken in Harmattan?
 
@@ -60,8 +65,13 @@ static QString trueFilePath(const QString &path)
 #endif
 }
 
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+View::View(QWindow *parent) :
+    QQuickView(parent),
+#else
 View::View(QWidget *parent) :
     QDeclarativeView(parent),
+#endif
     stationListModel(new StationListModel(this)),
     stationListProxyModel(new StationListProxyModel(this))
 {
@@ -79,7 +89,11 @@ View::View(QWidget *parent) :
     qmlRegisterType<StationScheduleModel>(
                 "net.cirulla.quandoparte", 1, 0, "StationScheduleModel");
 
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+    QQmlContext *context = this->rootContext();
+#else
     QDeclarativeContext *context = this->rootContext();
+#endif
     /* objects to be made accessible to QML */
     context->setContextProperty("settings", Settings::instance());
     context->setContextProperty("stationList", stationListModel);
index a91ce6e..daac6dc 100644 (file)
@@ -22,27 +22,12 @@ Boston, MA 02110-1301, USA.
 
 */
 
-#include <QFuture>
-#include <QDeclarativeView>
+#include <QtGlobal>
 
-class StationListModel;
-class StationListProxyModel;
-
-class View : public QDeclarativeView
-{
-    Q_OBJECT
-public:
-    explicit View(QWidget *parent = 0);
-    ~View();
-
-signals:
-
-public slots:
-
-private:
-    QFuture<void> future;
-    StationListModel *stationListModel;
-    StationListProxyModel *stationListProxyModel;
-};
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+#include "view_qt4.h"
+#else
+#include "view_qt5.h"
+#endif
 
 #endif // QP_VIEW_H
diff --git a/application/view_qt4.h b/application/view_qt4.h
new file mode 100644 (file)
index 0000000..ae6783b
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef QP_VIEW_QT4_H
+#define QP_VIEW_QT5_H
+
+/*
+
+Copyright (C) 2011 Luciano Montanaro <mikelima@cirulla.net>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+
+*/
+
+#include <QtGlobal>
+#include <QFuture>
+#include <QDeclarativeView>
+
+class StationListModel;
+class StationListProxyModel;
+
+class View :
+        public QDeclarativeView
+{
+    Q_OBJECT
+public:
+    explicit View(QWidget *parent = 0);
+
+    ~View();
+
+signals:
+
+public slots:
+
+private:
+    QFuture<void> future;
+    StationListModel *stationListModel;
+    StationListProxyModel *stationListProxyModel;
+};
+
+#endif // QP_VIEW_QT4_H
diff --git a/application/view_qt5.h b/application/view_qt5.h
new file mode 100644 (file)
index 0000000..b65bdec
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef QP_VIEW_QT5_H
+#define QP_VIEW_QT5_H
+
+/*
+
+Copyright (C) 2011 Luciano Montanaro <mikelima@cirulla.net>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+
+*/
+
+#include <QtGlobal>
+#include <QFuture>
+#include <QtQuick/QQuickView>
+
+class StationListModel;
+class StationListProxyModel;
+
+class View :
+        public QQuickView
+{
+    Q_OBJECT
+public:
+    explicit View(QWindow *parent = 0);
+
+    ~View();
+
+signals:
+
+public slots:
+
+private:
+    QFuture<void> future;
+    StationListModel *stationListModel;
+    StationListProxyModel *stationListProxyModel;
+};
+
+#endif // QP_VIEW_QT5_H
index f3baedc..7e3f002 100644 (file)
@@ -1,3 +1,11 @@
+quandoparte (0.6.0) unstable; urgency=low
+  * Sailfish OS port
+  * Added section headers to the station list view
+  * Various tweaks to the Harmattan UI
+  * Updated station list data
+
+ -- Luciano Montanaro <mikelima@zaphod>  Wed, 05 Nov 2013 20:21:40 +0100
+
 quandoparte (0.5.1) unstable; urgency=low
   * Fix single instance startup
 
index 99e7869..cae6f9a 100644 (file)
@@ -3,6 +3,8 @@ TEMPLATE = subdirs
 SUBDIRS = application
 
 OTHER_FILES += \
+    rpm/quandoparte.yaml \
+    rpm/quandoparte.spec \
     qtc_packaging/debian_fremantle/rules \
     qtc_packaging/debian_fremantle/README \
     qtc_packaging/debian_fremantle/copyright \
diff --git a/rpm/quandoparte.yaml b/rpm/quandoparte.yaml
new file mode 100755 (executable)
index 0000000..1946842
--- /dev/null
@@ -0,0 +1,38 @@
+Name: quandoparte
+Summary: Quando Parte
+Version: 0.6.0
+Release: 0
+Group: Qt/Qt
+License: GPL v2 or above
+Sources:
+- '%{name}-%{version}.tar.bz2'
+Description: |-
+  Virtual Arrivals and Departures board for Italian trains quandoparte
+  uses the Trenitalia data to show arrival and departure times of trains of a given station, with delay or suppression information.
+Configure: none
+Builder: qtc5
+PkgConfigBR:
+- Qt5Location
+- Qt5Concurrent
+- Qt5Core
+- Qt5Qml
+- Qt5Quick
+- Qt5WebKit
+- Qt5WebKitWidgets
+- qdeclarative5-boostable
+Requires:
+- libqtlocation1
+- qt5-qtconcurrent
+- qt5-qtlocation
+- sailfishsilica-qt5
+- mapplauncherd-booster-silica-qt5
+Files:
+- '%{_datadir}/icons/hicolor/scalable/apps'
+- '%{_datadir}/icons/hicolor/48x48/apps'
+- '%{_datadir}/icons/hicolor/meegotouch/apps'
+- '%{_datadir}/applications'
+- '%{_datadir}/apps/quandoparte/i18n'
+- '%{_datadir}/apps/quandoparte/stations'
+- '%{_datadir}/apps/quandoparte/qml'
+- '%{_bindir}'
+PkgBR: []