Changed default and white themes to show a speed camera warning image. Small fix...
authoreshe <jessehakanen@gmail.com>
Thu, 12 Aug 2010 10:01:45 +0000 (11:01 +0100)
committereshe <jessehakanen@gmail.com>
Thu, 12 Aug 2010 10:01:45 +0000 (11:01 +0100)
src/data/themes/white.jspeed
src/poialerts.cpp
src/poialerts.h
src/resources.qrc
src/resources/themes/default/speedcamera.png [new file with mode: 0644]
src/resources/themes/default/theme.xml
src/textelement.cpp

index 171f527..5a2cf6e 100644 (file)
Binary files a/src/data/themes/white.jspeed and b/src/data/themes/white.jspeed differ
index 2d8fe0d..67cf921 100644 (file)
@@ -197,7 +197,10 @@ double PoiAlerts::getCurrentDistance() const
         return 0.0;
     }
 
         return 0.0;
     }
 
-    return currentDistance_;
+    const Location::Fix* fix = &(Odometer::instance().getLatestFix());
+
+    return calculateDistance(currentPoi_->latitude, currentPoi_->longitude,
+                             fix->latitude, fix->longitude);
 }
 
 QString PoiAlerts::getCurrentPoi() const
 }
 
 QString PoiAlerts::getCurrentPoi() const
@@ -232,7 +235,7 @@ void PoiAlerts::onDataUpdated()
 
     double travelled = Odometer::instance().getTotal();
 
 
     double travelled = Odometer::instance().getTotal();
 
-    if(absValue(travelled - travelled_) > 0.02)
+    if(absValue(travelled - travelled_) > 0.015)
     {
         double distance;
         double inRouteMargin = IN_ROUTE_MARGIN + (fix->eph / 1000.0);
     {
         double distance;
         double inRouteMargin = IN_ROUTE_MARGIN + (fix->eph / 1000.0);
@@ -268,7 +271,7 @@ void PoiAlerts::onDataUpdated()
                     }
                     else
                     {
                     }
                     else
                     {
-                        trackLimit = 90.0 - radToDeg(acos((inRouteMargin + (distance * 0.16)) / distance));
+                        trackLimit = 90.0 - radToDeg(acos((inRouteMargin + (distance * 0.17)) / distance));
                     }
 
                     qDebug() << "Tracklimit: " << trackLimit;
                     }
 
                     qDebug() << "Tracklimit: " << trackLimit;
@@ -277,7 +280,6 @@ void PoiAlerts::onDataUpdated()
                     {
                         found = true;
                         currentPoi_ = &pois_[i];
                     {
                         found = true;
                         currentPoi_ = &pois_[i];
-                        currentDistance_ = distance;
                         emit visibilityChanged(true);
                         playSound(i);
                     }
                         emit visibilityChanged(true);
                         playSound(i);
                     }
@@ -292,7 +294,6 @@ void PoiAlerts::onDataUpdated()
                 {
                     found = true;
                     currentPoi_ = &pois_[i];
                 {
                     found = true;
                     currentPoi_ = &pois_[i];
-                    currentDistance_ = distance;
                     emit visibilityChanged(true);
                     playSound(i);
                 }
                     emit visibilityChanged(true);
                     playSound(i);
                 }
index a8ba9fe..828bda1 100644 (file)
@@ -32,7 +32,7 @@ class PoiAlerts : public QObject
 
 public:
     static int const POI_ALERT_INTERVAL = 120;
 
 public:
     static int const POI_ALERT_INTERVAL = 120;
-    static int const IN_ROUTE_MARGIN = 20;
+    static int const IN_ROUTE_MARGIN = 22;
     static PoiAlerts& instance();
     static QString getPoiDir();
     ~PoiAlerts();
     static PoiAlerts& instance();
     static QString getPoiDir();
     ~PoiAlerts();
@@ -69,7 +69,6 @@ private:
     double distance_;
     double travelled_;
     PoiReader::Poi* currentPoi_;
     double distance_;
     double travelled_;
     PoiReader::Poi* currentPoi_;
-    double currentDistance_;
     bool loaded_;
     QString error_;
 
     bool loaded_;
     QString error_;
 
index 24f58d4..314f1eb 100644 (file)
@@ -15,5 +15,6 @@
     <file>resources/themes/default/theme.xml</file>
     <file>resources/themes/default/digital7.ttf</file>
     <file>resources/themes/default/background.png</file>
     <file>resources/themes/default/theme.xml</file>
     <file>resources/themes/default/digital7.ttf</file>
     <file>resources/themes/default/background.png</file>
+    <file>resources/themes/default/speedcamera.png</file>
 </qresource>
 </RCC>
 </qresource>
 </RCC>
diff --git a/src/resources/themes/default/speedcamera.png b/src/resources/themes/default/speedcamera.png
new file mode 100644 (file)
index 0000000..fd6b412
Binary files /dev/null and b/src/resources/themes/default/speedcamera.png differ
index 9bfd8f3..c1ca87f 100644 (file)
                         <color>#a5efff</color>
                 </effect>
         </text>
                         <color>#a5efff</color>
                 </effect>
         </text>
+       <image>
+               <src>speedcamera.png</src>
+               <xpos>14</xpos>
+               <ypos>418</ypos>
+               <effect name="flicker">
+                       <interval>500</interval>
+               </effect>
+               <visiblewhen>poivisible</visiblewhen>
+       </image>
+       <text>
+               <data>{POIDISTANCE} {DISTANCEUNIT}</data>
+               <xpos>77</xpos>
+               <ypos>420</ypos>
+               <font>Nokia Sans Bold</font>
+               <size>20</size>
+               <color>#e4ff00</color>
+               <bold>true</bold>
+               <visiblewhen>poivisible</visiblewhen>
+       </text>
 </mainscreen>
 <mainscreen orientation="portrait">
        <image>
 </mainscreen>
 <mainscreen orientation="portrait">
        <image>
                         <color>#a5efff</color>
                 </effect>
         </text>
                         <color>#a5efff</color>
                 </effect>
         </text>
+       <image>
+               <src>speedcamera.png</src>
+                <xpos>14</xpos>
+                <ypos>738</ypos>
+                <effect name="flicker">
+                        <interval>500</interval>
+                </effect>
+                <visiblewhen>poivisible</visiblewhen>
+        </image>
+        <text>
+                <data>{POIDISTANCE} {DISTANCEUNIT}</data>
+                <xpos>77</xpos>
+                <ypos>740</ypos>
+                <font>Nokia Sans Bold</font>
+                <size>20</size>
+                <color>#e4ff00</color>
+                <bold>true</bold>
+                <visiblewhen>poivisible</visiblewhen>
+        </text>
 </mainscreen>
 </theme>
 </mainscreen>
 </theme>
index d42b423..f1af21e 100644 (file)
@@ -322,7 +322,7 @@ QString TextElement::formatString(double val)
 
     if(format.isEmpty())
     {
 
     if(format.isEmpty())
     {
-        format = "%.1lf";
+        format = "%.0lf";
     }
 
     QString result;
     }
 
     QString result;