Route save dialog development. Added: gps,icon...
authorToni Jussila <toni.jussila@fudeco.com>
Wed, 31 Mar 2010 07:44:08 +0000 (10:44 +0300)
committerToni Jussila <toni.jussila@fudeco.com>
Wed, 31 Mar 2010 07:44:08 +0000 (10:44 +0300)
22 files changed:
Client/Graphics/Speedometer.png [new file with mode: 0644]
Client/Graphics/Speedometer2.png [new file with mode: 0644]
Client/Graphics/applications_internet.png [new file with mode: 0755]
Client/Graphics/route_play.png [new file with mode: 0755]
Client/Graphics/route_stop.png [new file with mode: 0755]
Client/Graphics/satellite_vista.png [new file with mode: 0755]
Client/Graphics/settings.png [new file with mode: 0755]
Client/Graphics/trophy_gold.png [new file with mode: 0755]
Client/Graphics/www.png [new file with mode: 0755]
Client/gpsdata.cpp [new file with mode: 0644]
Client/gpsdata.h [new file with mode: 0644]
Client/graphics.qrc
Client/maemo5location.cpp [new file with mode: 0755]
Client/maemo5location.h [new file with mode: 0755]
Client/maemo5locationprivate.cpp [new file with mode: 0755]
Client/maemo5locationprivate.h [new file with mode: 0755]
Client/mainwindow.cpp
Client/mainwindow.ui
Client/routesavedialog.cpp
Client/routesavedialog.h
Client/routesavedialog.ui
Client/speedfreak.pro

diff --git a/Client/Graphics/Speedometer.png b/Client/Graphics/Speedometer.png
new file mode 100644 (file)
index 0000000..aa706cd
Binary files /dev/null and b/Client/Graphics/Speedometer.png differ
diff --git a/Client/Graphics/Speedometer2.png b/Client/Graphics/Speedometer2.png
new file mode 100644 (file)
index 0000000..ff02874
Binary files /dev/null and b/Client/Graphics/Speedometer2.png differ
diff --git a/Client/Graphics/applications_internet.png b/Client/Graphics/applications_internet.png
new file mode 100755 (executable)
index 0000000..d3f8382
Binary files /dev/null and b/Client/Graphics/applications_internet.png differ
diff --git a/Client/Graphics/route_play.png b/Client/Graphics/route_play.png
new file mode 100755 (executable)
index 0000000..2689e38
Binary files /dev/null and b/Client/Graphics/route_play.png differ
diff --git a/Client/Graphics/route_stop.png b/Client/Graphics/route_stop.png
new file mode 100755 (executable)
index 0000000..d017a95
Binary files /dev/null and b/Client/Graphics/route_stop.png differ
diff --git a/Client/Graphics/satellite_vista.png b/Client/Graphics/satellite_vista.png
new file mode 100755 (executable)
index 0000000..6d7601f
Binary files /dev/null and b/Client/Graphics/satellite_vista.png differ
diff --git a/Client/Graphics/settings.png b/Client/Graphics/settings.png
new file mode 100755 (executable)
index 0000000..5ef3171
Binary files /dev/null and b/Client/Graphics/settings.png differ
diff --git a/Client/Graphics/trophy_gold.png b/Client/Graphics/trophy_gold.png
new file mode 100755 (executable)
index 0000000..3ee0701
Binary files /dev/null and b/Client/Graphics/trophy_gold.png differ
diff --git a/Client/Graphics/www.png b/Client/Graphics/www.png
new file mode 100755 (executable)
index 0000000..4db37a8
Binary files /dev/null and b/Client/Graphics/www.png differ
diff --git a/Client/gpsdata.cpp b/Client/gpsdata.cpp
new file mode 100644 (file)
index 0000000..db0a6bc
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * GPS data
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#include "gpsdata.h"
+
+/**
+  *Default constructor of this class.
+  */
+GPSData::GPSData(Maemo5Location *maemo5location)
+{
+    location = maemo5location;
+
+    connect(location,SIGNAL(agnss()),this,SLOT(agnss()));
+    connect(location,SIGNAL(awcp()),this,SLOT(awcp()));
+    connect(location,SIGNAL(locationUpdated()),this,SLOT(locationUpdated()));
+    connect(location,SIGNAL(gps_connected()),this,SLOT(gpsConnected()));
+    connect(location,SIGNAL(gps_disconnected()),this,SLOT(gpsDisconnected()));
+    connect(location,SIGNAL(gps_error(int)),this,SLOT(gpsError()));
+    connect(location,SIGNAL(gpsd_running()),this,SLOT(gpsdRunning()));
+    connect(location,SIGNAL(gpsd_stopped()),this,SLOT(gpsdStopped()));
+
+    gpsDateTime = new QDateTime();
+    resetAll();
+}
+
+/**
+  *Destructor of this class. Deletes all dynamic objects and sets them to NULL.
+  */
+GPSData::~GPSData()
+{
+    delete location;
+    delete gpsDateTime;
+}
+
+void GPSData::resetAll()
+{
+    satellitesInUse = 0;
+    satellitesInView = 0;
+    signalStrength = 0;
+    latitude = 0;
+    longitude = 0;
+    time = 0;
+    ept = 0;
+    eph = 0;
+    altitude = 0;
+    epv = 0;
+    track = 0;
+    epd = 0;
+    speed = 0;
+    eps = 0;
+    climb = 0;
+    epc = 0;
+    latitudePrevious = 0;
+    longitudePrevious = 0;
+    sLatitudeNow = "";
+    sLongitudeNow = "";
+    sLatitudePrevious = "";
+    sLongitudePrevious = "";
+    routeStartTime = "";
+    routeStopTime = "";
+    recordingStatus = false;
+    roundCounter = 0;
+}
+
+/**
+  *This slot function is called when GPS update location.
+  */
+void GPSData::agnss()
+{
+    //satellitesInUse   = location->getSatellitesInUse());  //Returns number of satellites in use.
+    //satellitesInView  = location->getSatellitesInView();  //Returns number of satellites in view.
+    //signalStrength    = location->getSignalStrength();    //Returns average signal strength of satellites which are in use.
+    //gpsOnline         = location->getGpsOnline();         //Returns gsp online
+    //ept               = location->getEpt();               //Returns time accuracy in seconds.
+    //eph               = location->getEph();               //Returns horizontal position accuracy in cm.
+    //track             = location->getTrack();             //Returns direction of motion in degrees(0-359).
+    //epd               = location->getEpd();               //Returns track accuracy in degrees.
+    //climb             = location->getClimb();             //Returns current rate of climb in m/s.
+    //epc               = location->getEpc();               //Returns climb accuracy in m/s.
+    //time              = location->getTime();              //Returns timestamp of the update in seconds.
+    //epv               = location->getEpv();               //Returns altitude accuracy in meters.
+    //eps               = location->getEps();               //Returns speed accuracy in km/h.
+    //distance          = location->distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+
+    //If route recording true
+    if ( recordingStatus == true )
+    {
+        latitudePrevious = latitude;
+        longitudePrevious = longitude;
+        latitude    = location->getLatitude();  //Returns latitude.
+        longitude   = location->getLongitude(); //Returns longitude.
+        altitude    = location->getAltitude();  //Returns fix altitude in meters.
+        speed       = location->getSpeed();     //Returns current speed in km/h.
+
+        QFile routeTempFile("routetemp.xml");//Temp xml.
+
+        //If first round
+        if (roundCounter == 0)
+        {
+            if (!routeTempFile.open(QIODevice::WriteOnly | QIODevice::Text))
+                return;
+            writeRouteXml(&routeTempFile, 0);
+            routeTempFile.close();
+            roundCounter ++;
+        }
+
+        //Points writing round.
+        else
+        { 
+            sLatitudeNow.sprintf("%.4f", latitude);  //Latitude now to string
+            sLongitudeNow.sprintf("%.4f", longitude);//Longitude now to string
+            sLatitudePrevious.sprintf("%.4f", latitudePrevious);  //Previous latitude to string
+            sLongitudePrevious.sprintf("%.4f", longitudePrevious); //Previous longitude to string
+
+            //If latitude or longitude change
+            if ( sLatitudeNow != sLatitudePrevious || sLongitudeNow != sLongitudePrevious )
+            {
+                if (!routeTempFile.open(QIODevice::Append | QIODevice::Text))
+                    return;
+
+                writeRouteXml(&routeTempFile, 0);
+                roundCounter ++;
+                routeTempFile.close();
+            }
+        }
+    }
+}
+
+/**
+  *This slot function is called when gprs update location.
+  */
+void GPSData::awcp()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::locationUpdated()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::gpsConnected()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::gpsDisconnected()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::gpsError()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::gpsdRunning()
+{
+
+}
+
+/**
+  *This slot function is called when .
+  */
+void GPSData::gpsdStopped()
+{
+
+}
+
+/**
+  *This function start route recording.
+  *@param QString time recording start time.
+  */
+void GPSData::startRouteRecording()
+{
+    if (recordingStatus == false)
+    {
+        //Get start time and start recording.
+        gpsDateTime->setTime_t(location->getTime());
+        routeStartTime = gpsDateTime->toString("dd.MM.yyyy hh:mm:ss");
+        recordingStatus = true;
+        roundCounter = 0;
+    }
+}
+
+/**
+  *This function stop route recording.
+  *@param QString time recording stop time.
+  */
+void GPSData::stopRouteRecording()
+{
+    if (recordingStatus == true)
+    {
+        //Get stop time and stop recording.
+        gpsDateTime->setTime_t(location->getTime());
+        routeStopTime = gpsDateTime->toString("dd.MM.yyyy hh:mm:ss");
+        recordingStatus = false;
+
+        //Write final xml.
+        QFile file("route.xml");
+        if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+            return;
+        writeRouteXml(&file, 1);
+        file.close();
+        roundCounter = 0;
+    }
+}
+
+/**
+  *This function write route to .xml file.
+  */
+void GPSData::writeRouteXml(QIODevice *device, int round)
+{
+    xmlwriter.setDevice(device);
+
+    //Write temp xml (routetemp.xml).
+    if ( round == 0 )
+    {
+        xmlwriter.writeStartElement("Point");
+        xmlwriter.writeAttribute("Latitude", QString::number(latitude));
+        xmlwriter.writeAttribute("Longitude", QString::number(longitude));
+        xmlwriter.writeAttribute("Altitude", QString::number(altitude));
+        xmlwriter.writeAttribute("Speed", QString::number(speed));
+        xmlwriter.writeEndElement();//Point
+    }
+
+    //Write final xml (route.xml).
+    else if ( round == 1 )
+    {
+        xmlwriter.writeStartDocument();
+        xmlwriter.writeStartElement("Route");
+        xmlwriter.writeAttribute("Start-time", routeStartTime);
+        xmlwriter.writeAttribute("Stop-time", routeStopTime);
+        xmlwriter.writeAttribute("Points", QString::number(roundCounter));
+
+        //Open temp xml and read points
+        QFile tempFile("routetemp.xml");
+        if (!tempFile.open(QIODevice::ReadOnly | QIODevice::Text))
+            return;
+        QTextStream readRoute(&tempFile);
+        QTextStream writeRoute(device);
+        writeRoute << readRoute.readLine();
+        tempFile.close();//Close temp xml
+
+        xmlwriter.writeEndElement();//Route
+        xmlwriter.writeEndDocument();     
+    }
+}
diff --git a/Client/gpsdata.h b/Client/gpsdata.h
new file mode 100644 (file)
index 0000000..f7b40e8
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * GPS data
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef GPSDATA_H
+#define GPSDATA_H
+
+#include <QObject>
+#include <maemo5location.h>
+#include <QFile>
+#include <QTextStream>
+#include <QXmlStreamWriter>
+#include <qdatetime.h>
+
+class GPSData : public QObject
+{
+    Q_OBJECT
+public:
+    GPSData( Maemo5Location *maemo5location );
+    ~GPSData();
+    void startRouteRecording();
+    void stopRouteRecording();
+    int roundCounter; //testing, move private!!!
+
+private:
+    Maemo5Location *location;
+    void resetAll();
+    QXmlStreamWriter xmlwriter;
+    void writeRouteXml(QIODevice *device, int round);
+
+    int satellitesInUse; //Number of satellites in use.
+    int satellitesInView;//Number of satellites in view.
+    int signalStrength;  //Average signal strength of satellites which are in use.
+    double latitude;     //Latitude.
+    double longitude;    //Longitude.
+    double time;         //Timestamp of the update in seconds.
+    double ept;          //Time accuracy in seconds.
+    double eph;          //Horizontal position accuracy in cm.
+    double altitude;     //Fix altitude in meters.
+    double epv;          //Altitude accuracy in meters.
+    double track;        //Direction of motion in degrees(0-359).
+    double epd;          //Track accuracy in degrees.
+    double speed;        //Current speed in km/h.
+    double eps;          //Speed accuracy in km/h.
+    double climb;        //Current rate of climb in m/s.
+    double epc;          //Climb accuracy in m/s.
+    double latitudePrevious;
+    double longitudePrevious;
+    QString routeStartTime;
+    QString routeStopTime;
+    QString sLatitudeNow;
+    QString sLongitudeNow;
+    QString sLatitudePrevious;
+    QString sLongitudePrevious;
+    QDateTime *gpsDateTime;
+    bool recordingStatus;
+    //int roundCounter;
+
+private slots:
+    void agnss();
+    void awcp();
+    void locationUpdated();
+    void gpsConnected();
+    void gpsDisconnected();
+    void gpsError();
+    void gpsdRunning();
+    void gpsdStopped();
+
+};
+
+#endif // GPSDATA_H
index 36b139d..69f30cb 100644 (file)
@@ -2,6 +2,13 @@
     <qresource prefix="/new/prefix1">
         <file>Graphics/meter.png</file>
         <file>Graphics/route.png</file>
     <qresource prefix="/new/prefix1">
         <file>Graphics/meter.png</file>
         <file>Graphics/route.png</file>
-        <file>Graphics/Speedometer .png</file>
+        <file>Graphics/satellite_vista.png</file>
+        <file>Graphics/route_play.png</file>
+        <file>Graphics/route_stop.png</file>
+        <file>Graphics/settings.png</file>
+        <file>Graphics/trophy_gold.png</file>
+        <file>Graphics/applications_internet.png</file>
+        <file>Graphics/Speedometer.png</file>
+        <file>Graphics/Speedometer2.png</file>
     </qresource>
 </RCC>
     </qresource>
 </RCC>
diff --git a/Client/maemo5location.cpp b/Client/maemo5location.cpp
new file mode 100755 (executable)
index 0000000..a8065fd
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Maemo5Location
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+//#ifdef Q_WS_MAEMO_5
+#include "maemo5locationprivate.h"
+#include "maemo5location.h"
+
+/**
+  *Default constructor of this class.
+  *@param QObject pointer to parent object. By default the value is NULL.
+  */
+Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
+{
+    ptr = new Maemo5LocationPrivate(this);
+
+    connect(ptr, SIGNAL(agnss()), this, SIGNAL(agnss()));
+    connect(ptr, SIGNAL(awcp()), this, SIGNAL(awcp()));
+    connect(ptr, SIGNAL(locationUpdated()), this, SIGNAL(locationUpdated()));
+    connect(ptr, SIGNAL(gps_connected()), this, SIGNAL(gps_connected()));
+    connect(ptr, SIGNAL(gps_disconnected()), this, SIGNAL(gps_disconnected()));
+    connect(ptr, SIGNAL(gps_error(int)), this, SIGNAL(gps_error(int)));
+    connect(ptr, SIGNAL(gpsd_running()), this, SIGNAL(gpsd_running()));
+    connect(ptr, SIGNAL(gpsd_stopped()), this, SIGNAL(gpsd_stopped()));
+}
+
+/**
+  *Destructor of this class. Should be used to release all allocated resources.
+  */
+Maemo5Location::~Maemo5Location()
+{
+    delete ptr;
+}
+
+/**
+  *Start polling gps.
+  */
+void Maemo5Location::startPollingGPS()
+{
+    ptr->get_agnss();
+}
+
+/**
+  *Stop polling gps.
+  */
+void Maemo5Location::stopPollingGPS()
+{
+    ptr->stop();
+}
+
+/**
+  *Returns number of satellites in use.
+  */
+int Maemo5Location::getSatellitesInUse()
+{
+    return ptr->get_satellites_in_use();
+}
+
+/**
+  *Returns number of satellites in view.
+  */
+int Maemo5Location::getSatellitesInView()
+{
+    return ptr->get_satellites_in_view();
+}
+
+/**
+  *Returns average signal strength of satellites which are in use.
+  */
+int Maemo5Location::getSignalStrength()
+{
+    return ptr->get_signal_strength();
+}
+
+/**
+  *Returns gps online.
+  */
+bool Maemo5Location::getGpsOnline()
+{
+    return ptr->get_gps_online();
+}
+
+/**
+  *Returns latitude.
+  */
+double Maemo5Location::getLatitude()
+{
+    return ptr->get_lat();
+}
+
+/**
+  *Returns longitude.
+  */
+double Maemo5Location::getLongitude()
+{
+    return ptr->get_lon();
+}
+
+/**
+  *Returns timestamp of the update in seconds.
+  */
+double Maemo5Location::getTime()
+{
+    return ptr->get_time();
+}
+
+/**
+  *Returns time accuracy in seconds.
+  */
+double Maemo5Location::getEpt()
+{
+    return ptr->get_ept();
+}
+
+/**
+  *Returns horizontal position accuracy in cm.
+  */
+double Maemo5Location::getEph()
+{
+    return ptr->get_eph();
+}
+
+/**
+  *Returns fix altitude in meters.
+  */
+double Maemo5Location::getAltitude()
+{
+    return ptr->get_altitude();
+}
+
+/**
+  *Returns altitude accuracy in meters.
+  */
+double Maemo5Location::getEpv()
+{
+    return ptr->get_epv();
+}
+
+/**
+  *Returns direction of motion in degrees(0-359).
+  */
+double Maemo5Location::getTrack()
+{
+    return ptr->get_track();
+}
+
+/**
+  *Returns track accuracy in degrees.
+  */
+double Maemo5Location::getEpd()
+{
+    return ptr->get_epd();
+}
+
+/**
+  *Returns current speed in km/h.
+  */
+double Maemo5Location::getSpeed()
+{
+    return ptr->get_speed();
+}
+
+/**
+  *Returns speed accuracy in km/h.
+  */
+double Maemo5Location::getEps()
+{
+    return ptr->get_eps();
+}
+
+/**
+  *Returns current rate of climb in m/s.
+  */
+double Maemo5Location::getClimb()
+{
+    return ptr->get_climb();
+}
+
+/**
+  *Returns climb accuracy in m/s.
+  */
+double Maemo5Location::getEpc()
+{
+    return ptr->get_epc();
+}
+
+/**
+  *Returns distance between two points in kilometers.
+  *@param latitude of first point
+  *@param longitude of first point
+  *@param latitude of second point
+  *@param longitude of second point
+  */
+double Maemo5Location::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
+{
+    return ptr->distance_between_two_points(latitude_s, longitude_s, latitude_f, longitude_f);
+}
diff --git a/Client/maemo5location.h b/Client/maemo5location.h
new file mode 100755 (executable)
index 0000000..7f376f0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Maemo5Location
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef MAEMO5LOCATION_H
+#define MAEMO5LOCATION_H
+
+#include <QObject>
+
+class Maemo5LocationPrivate;
+
+class Maemo5Location : public QObject
+{
+    Q_OBJECT
+public:
+    Maemo5Location(QObject* parent = 0);
+    ~Maemo5Location();
+
+    void startPollingGPS();
+    void stopPollingGPS();
+    int getSatellitesInUse();
+    int getSatellitesInView();
+    int getSignalStrength();
+    bool getGpsOnline();
+    double getLatitude();
+    double getLongitude();
+    double getTime();
+    double getEpt();
+    double getEph();
+    double getAltitude();
+    double getEpv();
+    double getTrack();
+    double getEpd();
+    double getSpeed();
+    double getEps();
+    double getClimb();
+    double getEpc();
+    double distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+
+signals:
+    void awcp();
+    void agnss();
+    void locationUpdated();
+    void gps_connected();
+    void gps_disconnected();
+    void gps_error(int);
+    void gpsd_running();
+    void gpsd_stopped();
+
+private:
+    Maemo5LocationPrivate* ptr;
+};
+
+#endif // MAEMO5LOCATION_H
diff --git a/Client/maemo5locationprivate.cpp b/Client/maemo5locationprivate.cpp
new file mode 100755 (executable)
index 0000000..d8b3b5d
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Maemo5LocationPrivate
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#include "maemo5locationprivate.h"
+
+/**
+  *Default constructor of this class.
+  *@param Maemo5Location pointer to public interface.
+  */
+Maemo5LocationPrivate::Maemo5LocationPrivate(Maemo5Location* location):QObject(location)
+{
+    //Initialize variables
+    gps_online = false;
+    usegps = -1;
+    resetAll();
+    //Get gps control object
+    control = location_gpsd_control_get_default();
+    //create gps device
+    device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
+
+    g_signal_connect(device, "changed", G_CALLBACK(gps_data_changed), this);
+    g_signal_connect(device, "connected", G_CALLBACK(gps_connected_func), this);
+    g_signal_connect(device, "disconnected", G_CALLBACK(gps_disconnected_func), this);
+
+    g_signal_connect(control, "error-verbose", G_CALLBACK(gps_error_func), this);
+    g_signal_connect(control, "gpsd_running", G_CALLBACK(gpsd_running_func), this);
+    g_signal_connect(control, "gpsd_stopped", G_CALLBACK(gpsd_running_func), this);
+
+}
+/**
+  *Destructor of this class. Should be used to release all allocated resources.
+  */
+Maemo5LocationPrivate::~Maemo5LocationPrivate()
+{
+    delete device;
+    delete control;
+}
+
+/**
+  *This function is used to start to poll with gprs
+  */
+void Maemo5LocationPrivate::get_acwp()
+{
+    g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
+    usegps = 0;
+    restart();
+}
+
+/**
+  *This function starts to poll via gps interface
+  */
+void Maemo5LocationPrivate::get_agnss()
+{
+    g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_AGNSS, NULL);
+    usegps = 1;
+    restart();
+}
+
+/**
+  *Stop polling gps
+  */
+void Maemo5LocationPrivate::stop()
+{
+    location_gpsd_control_stop(control);
+}
+
+/**
+  *Stop and restart polling
+  */
+void Maemo5LocationPrivate::restart()
+{
+    location_gpsd_control_stop(control);
+    location_gpsd_control_start(control);
+}
+
+/**
+  *This function is called when device managed to connect to the lcoation server.
+  *Function emits gps_connected signal.
+  *@param Pointer to LocationGPSDevice class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    emit gps->gps_connected();
+}
+
+/**
+  *This function is called when device is disconnected from the location server.
+  *Function emits gps_disconnected signal.
+  *Also this function resets all arguments of Maemo5LcoationPrivate class.
+  *@param Pointer to LocationGPSDevice class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    gps->resetAll();
+    emit gps->gps_disconnected();
+}
+
+/**
+  *This function is called after the location_gpsd_control_stop has been called.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps)
+{
+    emit gps->gpsd_stopped();
+}
+
+/**
+  *This function is called when an error has occurred.
+  *@param Pointer to LocationGPSDControl class
+  *@param error code
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps)
+{
+
+    switch (error) {
+      case LOCATION_ERROR_USER_REJECTED_DIALOG:
+        emit gps->gps_error(0);
+        g_debug("User didn't enable requested methods");
+        break;
+      case LOCATION_ERROR_USER_REJECTED_SETTINGS:
+        emit gps->gps_error(1);
+        g_debug("User changed settings, which disabled location");
+        break;
+      case LOCATION_ERROR_BT_GPS_NOT_AVAILABLE:
+        emit gps->gps_error(2);
+        g_debug("Problems with BT GPS");
+        break;
+      case LOCATION_ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE:
+        emit gps->gps_error(3);
+        g_debug("Requested method is not allowed in offline mode");
+        break;
+      case LOCATION_ERROR_SYSTEM:
+        emit gps->gps_error(4);
+        g_debug("System error");
+        break;
+      }
+}
+
+/**
+  *This function is called after the location_gpsd_control_start has been called.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps)
+{
+    emit gps->gpsd_running();
+}
+
+/**
+  *Callback function to catch gps signals.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    //First check that LocationGpsDeviceFix can be found...this data structure contains the location info.
+    if(gps->device->fix)
+    {
+        //Check that there are fields
+        if(gps->device->fix->fields)
+        {
+            //Store values and emit signal
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET)
+            {
+                gps->latitude = gps->device->fix->latitude;
+                gps->longitude = gps->device->fix->longitude;
+                gps->eph = gps->device->fix->eph;
+            }
+
+
+            gps->satellites_in_use = gps->device->satellites_in_use;
+            gps->satellites_in_view = gps->device->satellites_in_view;
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_TIME_SET)
+            {
+                gps->time = gps->device->fix->time;
+                gps->ept = gps->device->fix->ept;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET)
+            {
+                gps->altitude = gps->device->fix->altitude;
+                gps->epv = gps->device->fix->epv;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_TRACK_SET)
+            {
+                gps->track = gps->device->fix->track;
+                gps->epd = gps->device->fix->epd;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET)
+            {
+                gps->speed = gps->device->fix->speed;
+                gps->eps = gps->device->fix->eps;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_CLIMB_SET)
+            {
+                gps->climb = gps->device->fix->climb;
+                gps->epc = gps->device->fix->epc;
+            }
+
+
+            // Calculate average signal strength of satellites in use
+            int temp = 0;
+            if(gps->satellites_in_use != 0)
+            {
+                for(int i=0 ; i < gps->satellites_in_use ; i++)
+                {
+                    LocationGPSDeviceSatellite *view = (LocationGPSDeviceSatellite*) g_ptr_array_index (gps->device->satellites, i);
+                    temp = temp + view->signal_strength;
+                }
+                gps->signal_strength = (temp / gps->satellites_in_use);
+            }
+
+
+            if(gps->usegps == 0)
+            {
+                emit gps->awcp();
+            }
+            else if(gps->usegps == 1)
+            {
+                emit gps->agnss();
+            }
+            else
+            {
+                emit gps->locationUpdated();
+            }
+        }
+    }
+
+}
+
+/**
+  *Resets all arguments of Maemo5LocationPrivate class.
+  */
+void Maemo5LocationPrivate::resetAll()
+{
+    time = 0;
+    latitude = 0;
+    longitude = 0;
+    satellites_in_view = 0;
+    satellites_in_use = 0;
+    ept = 0;
+    eph = 0;
+    altitude = 0;
+    epv = 0;
+    track = 0;
+    epd = 0;
+    speed = 0;
+    eps = 0;
+    climb = 0;
+    epc = 0;
+}
+
+/**
+  *Returns distance between two points in kilometers.
+  *@param latitude of first point
+  *@param longitude of first point
+  *@param latitude of second point
+  *@param longitude of second point
+  */
+double Maemo5LocationPrivate::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
+{
+    double distance = 0;
+    return distance = location_distance_between(latitude_s, longitude_s, latitude_f, longitude_f);
+}
diff --git a/Client/maemo5locationprivate.h b/Client/maemo5locationprivate.h
new file mode 100755 (executable)
index 0000000..c61d041
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Maemo5LocationPrivate
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef MAEMO5LOCATIONPRIVATE_H
+#define MAEMO5LOCATIONPRIVATE_H
+
+//We have to declare these header file inside extern, since these modules are actually c modules not c++
+extern "C"
+{
+#include <location/location-gps-device.h>
+#include <location/location-gpsd-control.h>
+#include <location/location-distance-utils.h>
+}
+
+#include <QObject>
+#include "maemo5location.h"
+
+class Maemo5LocationPrivate : public QObject
+{
+    Q_OBJECT
+
+public:
+    Maemo5LocationPrivate(Maemo5Location* location);
+    ~Maemo5LocationPrivate();
+
+    void get_acwp();
+    void get_agnss();
+
+    friend void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps);
+    friend void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+    friend void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+
+    static void handleStatus( LocationGPSDeviceStatus status );
+
+    int get_satellites_in_view() { return satellites_in_view; }
+    int get_satellites_in_use() { return satellites_in_use; }
+    int get_signal_strength() { return signal_strength; }
+    gboolean get_gps_online() { return gps_online; }
+    double get_lat() { return latitude; }
+    double get_lon() { return longitude; }
+    double get_time() { return time; }
+    double get_ept() { return ept; }
+    double get_eph() { return eph; }
+    double get_altitude() { return altitude; }
+    double get_epv() { return epv; }
+    double get_track() { return track; }
+    double get_epd() { return epd; }
+    double get_speed() { return speed; }
+    double get_eps() { return eps; }
+    double get_climb() { return climb; }
+    double get_epc() { return epc; }
+    double distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+    void stop();
+
+signals:
+    void awcp();
+    void agnss();
+    void locationUpdated();
+    void gps_connected();
+    void gps_disconnected();
+    void gps_error(int);
+    void gpsd_running();
+    void gpsd_stopped();
+
+private:
+    void resetAll();
+    //void stop();
+    void restart();
+
+    int satellites_in_view;
+    int satellites_in_use;
+    int signal_strength;
+    gboolean gps_online;
+    double latitude;
+    double longitude;
+    double time;
+    double ept;
+    double eph;
+    double altitude;
+    double epv;
+    double track;
+    double epd;
+    double speed;
+    double eps;
+    double climb;
+    double epc;
+
+    Maemo5Location* d_ptr;
+    int usegps;
+    LocationGPSDControl *control;
+    LocationGPSDevice *device;
+};
+
+void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps);
+void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+
+#endif // MAEMO5LOCATIONPRIVATE_H
index 91ca8a4..6e5ea66 100644 (file)
@@ -20,12 +20,23 @@ MainWindow::MainWindow(QWidget *parent) :
 
     creditsDialog = new CreditsDialog;
     routeSaveDialog = new RouteSaveDialog;
 
     creditsDialog = new CreditsDialog;
     routeSaveDialog = new RouteSaveDialog;
+
+    //Button settings
+    ui->pushButtonAccelerate->setAutoFillBackground(true);
+    ui->pushButtonAccelerate->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+    ui->pushButtonRoute->setAutoFillBackground(true);
+    ui->pushButtonRoute->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+    ui->pushButtonResults->setAutoFillBackground(true);
+    ui->pushButtonResults->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+    ui->pushButtonSettings->setAutoFillBackground(true);
+    ui->pushButtonSettings->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+    ui->pushButtonWWW->setAutoFillBackground(true);
+    ui->pushButtonWWW->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
 }
 
 MainWindow::~MainWindow()
 {
     delete ui;
 }
 
 MainWindow::~MainWindow()
 {
     delete ui;
-
     delete routeSaveDialog;
 }
 
     delete routeSaveDialog;
 }
 
index 0f5cbe2..5ad3ad8 100644 (file)
     </property>
     <property name="icon">
      <iconset resource="graphics.qrc">
     </property>
     <property name="icon">
      <iconset resource="graphics.qrc">
-      <normaloff>:/new/prefix1/Graphics/Speedometer .png</normaloff>:/new/prefix1/Graphics/Speedometer .png</iconset>
+      <normaloff>:/new/prefix1/Graphics/Speedometer.png</normaloff>
+      <normalon>:/new/prefix1/Graphics/Speedometer2.png</normalon>
+      <disabledon>:/new/prefix1/Graphics/Speedometer2.png</disabledon>
+      <activeon>:/new/prefix1/Graphics/Speedometer2.png</activeon>
+      <selectedon>:/new/prefix1/Graphics/Speedometer2.png</selectedon>:/new/prefix1/Graphics/Speedometer.png</iconset>
     </property>
     <property name="iconSize">
      <size>
     </property>
     <property name="iconSize">
      <size>
      </rect>
     </property>
     <property name="text">
      </rect>
     </property>
     <property name="text">
-     <string>Results</string>
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="graphics.qrc">
+      <normaloff>:/new/prefix1/Graphics/trophy_gold.png</normaloff>:/new/prefix1/Graphics/trophy_gold.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>125</width>
+      <height>125</height>
+     </size>
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonSettings">
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonSettings">
      </rect>
     </property>
     <property name="text">
      </rect>
     </property>
     <property name="text">
-     <string>Settings</string>
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="graphics.qrc">
+      <normaloff>:/new/prefix1/Graphics/settings.png</normaloff>:/new/prefix1/Graphics/settings.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>125</width>
+      <height>125</height>
+     </size>
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonWWW">
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonWWW">
       <height>130</height>
      </rect>
     </property>
       <height>130</height>
      </rect>
     </property>
+    <property name="autoFillBackground">
+     <bool>true</bool>
+    </property>
     <property name="text">
     <property name="text">
-     <string>WWW</string>
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="graphics.qrc">
+      <normaloff>:/new/prefix1/Graphics/applications_internet.png</normaloff>:/new/prefix1/Graphics/applications_internet.png</iconset>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>125</width>
+      <height>125</height>
+     </size>
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonCredits">
     </property>
    </widget>
    <widget class="QPushButton" name="pushButtonCredits">
      <x>0</x>
      <y>0</y>
      <width>800</width>
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>25</height>
+     <height>27</height>
     </rect>
    </property>
   </widget>
     </rect>
    </property>
   </widget>
index 9cbcb45..befe678 100644 (file)
@@ -19,12 +19,42 @@ RouteSaveDialog::RouteSaveDialog(QWidget *parent) :
 {
     ui->setupUi(this);
 
 {
     ui->setupUi(this);
 
+    routeDialog = new RouteDialog;
+
+    //Button settings
+    buttonStatus = true;
+    pixmapRouteStop = new QPixmap("Graphics/route_stop.png");
+    pixmapRoutePlay = new QPixmap("Graphics/route_play.png");
+    iconRouteStop = new QIcon(*pixmapRouteStop);
+    iconRoutePlay = new QIcon(*pixmapRoutePlay);
+    QSize iconSize(125, 125);
+    ui->buttonRouteStartStop->setIconSize(iconSize);
+    ui->buttonRouteStartStop->setIcon(*iconRoutePlay);
+    ui->buttonRouteStartStop->setAutoFillBackground(true);
+    ui->buttonRouteStartStop->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+
+    //Satellite picture and label
     ui->labelRouteSatelliteStatus->setVisible(0);
     ui->labelRouteSatellitePicture->setVisible(0);
     ui->labelRouteSatelliteStatus->setVisible(0);
     ui->labelRouteSatellitePicture->setVisible(0);
-    ui->labelRouteSatellitePicture->setPixmap(QPixmap("satellite_vista.png"));
+    //ui->labelRouteSatellitePicture->setPixmap(QPixmap("Graphics/satellite_vista.png"));
     timerSatellitePicture = new QTimer();
     timerSatellitePicture->setInterval(400);
     connect(timerSatellitePicture, SIGNAL(timeout()),this, SLOT(timerSatellitePictureTimeout()));
     timerSatellitePicture = new QTimer();
     timerSatellitePicture->setInterval(400);
     connect(timerSatellitePicture, SIGNAL(timeout()),this, SLOT(timerSatellitePictureTimeout()));
+
+    //Route picture and label
+    ui->labelRouteStatus->setVisible(0);
+    ui->labelRoutePicture->setVisible(0);
+    timerRoutePicture = new QTimer();
+    timerRoutePicture->setInterval(400);
+    connect(timerRoutePicture, SIGNAL(timeout()),this, SLOT(timerRoutePictureTimeout()));
+
+    //GPS speed label
+    ui->labelGpsSpeed->setVisible(0);
+
+    //GPS
+    location = new Maemo5Location(this);
+    gpsData = new GPSData(location);
+    connect(location,SIGNAL(agnss()),this,SLOT(gpsStatus()));
 }
 
 /**
 }
 
 /**
@@ -33,6 +63,15 @@ RouteSaveDialog::RouteSaveDialog(QWidget *parent) :
 RouteSaveDialog::~RouteSaveDialog()
 {
     delete ui;
 RouteSaveDialog::~RouteSaveDialog()
 {
     delete ui;
+    delete timerSatellitePicture;
+    delete timerRoutePicture;
+    delete location;
+    delete gpsData;
+    delete routeDialog;
+    delete pixmapRouteStop;
+    delete pixmapRoutePlay;
+    delete iconRouteStop;
+    delete iconRoutePlay;
 }
 
 void RouteSaveDialog::changeEvent(QEvent *e)
 }
 
 void RouteSaveDialog::changeEvent(QEvent *e)
@@ -52,20 +91,37 @@ void RouteSaveDialog::changeEvent(QEvent *e)
   */
 void RouteSaveDialog::on_buttonRouteStartStop_clicked()
 {
   */
 void RouteSaveDialog::on_buttonRouteStartStop_clicked()
 {
-    if ( ui->buttonRouteStartStop->text() == "Start" )
+    //If start button clicked
+    if ( buttonStatus == true )
     {
     {
-        ui->buttonRouteStartStop->setText("Stop");
-        ui->labelRouteSatelliteStatus->setText("Searching satellite");
-        ui->labelRouteSatelliteStatus->setVisible(1);
-        ui->labelRouteSatellitePicture->setVisible(1);
-        timerSatellitePicture->start();
+        buttonStatus = false;
+        ui->buttonRouteStartStop->setIcon(*iconRouteStop);
+        location->startPollingGPS();
+        gpsStatus();
     }
     else
     {
     }
     else
     {
-        ui->buttonRouteStartStop->setText("Start");
+        buttonStatus = true;
+        ui->buttonRouteStartStop->setIcon(*iconRoutePlay);
+
+        //Satellite picture and label
+        ui->labelRouteSatelliteStatus->setText("Searching satellite");
         ui->labelRouteSatelliteStatus->setVisible(0);
         ui->labelRouteSatellitePicture->setVisible(0);
         timerSatellitePicture->stop();
         ui->labelRouteSatelliteStatus->setVisible(0);
         ui->labelRouteSatellitePicture->setVisible(0);
         timerSatellitePicture->stop();
+
+        //Route picture and label
+        ui->labelRouteStatus->setVisible(0);
+        ui->labelRoutePicture->setVisible(0);
+        timerRoutePicture->stop();
+        location->stopPollingGPS();
+        routeDialog->show();
+
+        //GPS speed label
+        ui->labelGpsSpeed->setVisible(0);
+
+        //Stop route recording
+        gpsData->stopRouteRecording();
     }
 }
 
     }
 }
 
@@ -87,3 +143,87 @@ void RouteSaveDialog::timerSatellitePictureTimeout()
     }
     timerSatellitePicture->start();
 }
     }
     timerSatellitePicture->start();
 }
+
+/**
+  *This slot function is called when route picture timer timeout(400ms).
+  */
+void RouteSaveDialog::timerRoutePictureTimeout()
+{
+    //If route picture visible.
+    if (ui->labelRoutePicture->isVisible() == 1)
+    {
+        ui->labelRouteStatus->setVisible(0);
+        ui->labelRoutePicture->setVisible(0);
+    }
+    else
+    {
+        ui->labelRouteStatus->setVisible(1);
+        ui->labelRoutePicture->setVisible(1);
+    }
+    timerRoutePicture->start();
+}
+
+void RouteSaveDialog::gpsStatus()
+{
+    //IF GPS start button clicked
+    if (buttonStatus == false)
+    {
+        //If GPS find 4 satellite.
+        if (location->getSatellitesInUse() >= 4)
+        {
+            //Satellite picture and label
+            ui->labelRouteSatelliteStatus->setText("GPS Ready");
+            ui->labelRouteSatelliteStatus->setVisible(1);
+            ui->labelRouteSatellitePicture->setVisible(1);
+            timerSatellitePicture->stop();
+
+            //Route picture and label
+            ui->labelRouteStatus->setText("Recorded " + QString::number(gpsData->roundCounter) + " route point");
+            ui->labelRouteStatus->setVisible(1);
+            ui->labelRoutePicture->setVisible(1);
+            timerRoutePicture->start();
+
+            //Set GPS speed.
+            gpsSpeed.sprintf("%.0f",location->getSpeed());
+            ui->labelGpsSpeed->setText(gpsSpeed + " km/h");
+            ui->labelGpsSpeed->setVisible(1);
+
+            //Start route recording
+            gpsData->startRouteRecording();
+        }
+
+        //If GPS find less than 4 satellite.
+        else
+        {
+            //Satellite picture and label
+            ui->labelRouteSatelliteStatus->setText("Searching satellite");
+            ui->labelRouteSatelliteStatus->setVisible(1);
+            ui->labelRouteSatellitePicture->setVisible(1);
+            timerSatellitePicture->start();
+
+            //Route picture and label
+            ui->labelRouteStatus->setVisible(0);
+            ui->labelRoutePicture->setVisible(0);
+            timerRoutePicture->stop();
+
+            //GPS speed label
+            ui->labelGpsSpeed->setVisible(0);
+        }
+    }
+    else
+    {
+        //Satellite picture and label
+        ui->labelRouteSatelliteStatus->setText("Searching satellite");
+        ui->labelRouteSatelliteStatus->setVisible(0);
+        ui->labelRouteSatellitePicture->setVisible(0);
+        timerSatellitePicture->stop();
+
+        //Route picture and label
+        ui->labelRouteStatus->setVisible(0);
+        ui->labelRoutePicture->setVisible(0);
+        timerRoutePicture->stop();
+
+        //GPS speed label
+        ui->labelGpsSpeed->setVisible(0);
+    }
+}
index b4a38f1..5112c4b 100644 (file)
 
 #include <QDialog>
 #include <QPixmap>
 
 #include <QDialog>
 #include <QPixmap>
+#include <QIcon>
+#include <QSize>
 #include <QTimer>
 #include <QTimer>
+#include <maemo5location.h>
+#include "gpsdata.h"
+#include "routedialog.h"
 
 namespace Ui {
     class RouteSaveDialog;
 
 namespace Ui {
     class RouteSaveDialog;
@@ -29,10 +34,22 @@ protected:
 private:
     Ui::RouteSaveDialog *ui;
     QTimer *timerSatellitePicture;
 private:
     Ui::RouteSaveDialog *ui;
     QTimer *timerSatellitePicture;
+    QTimer *timerRoutePicture;
+    GPSData *gpsData;
+    Maemo5Location *location;
+    RouteDialog *routeDialog;
+    QString gpsSpeed;
+    QPixmap *pixmapRouteStop;
+    QPixmap *pixmapRoutePlay;
+    QIcon *iconRouteStop;
+    QIcon *iconRoutePlay;
+    bool buttonStatus;
 
 private slots:
     void on_buttonRouteStartStop_clicked();
     void timerSatellitePictureTimeout();
 
 private slots:
     void on_buttonRouteStartStop_clicked();
     void timerSatellitePictureTimeout();
+    void timerRoutePictureTimeout();
+    void gpsStatus();
 };
 
 #endif // ROUTESAVEDIALOG_H
 };
 
 #endif // ROUTESAVEDIALOG_H
index d935540..f141299 100644 (file)
@@ -7,11 +7,22 @@
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <x>0</x>
     <y>0</y>
     <width>800</width>
-    <height>480</height>
+    <height>360</height>
    </rect>
   </property>
    </rect>
   </property>
+  <property name="font">
+   <font>
+    <family>Bitstream Charter</family>
+    <weight>75</weight>
+    <bold>true</bold>
+   </font>
+  </property>
   <property name="windowTitle">
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Route</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="graphics.qrc">
+    <normaloff>:/new/prefix1/Graphics/route.png</normaloff>:/new/prefix1/Graphics/route.png</iconset>
   </property>
   <widget class="QPushButton" name="buttonRouteStartStop">
    <property name="geometry">
   </property>
   <widget class="QPushButton" name="buttonRouteStartStop">
    <property name="geometry">
     </rect>
    </property>
    <property name="text">
     </rect>
    </property>
    <property name="text">
-    <string>Start</string>
+    <string/>
+   </property>
+   <property name="icon">
+    <iconset resource="graphics.qrc">
+     <normaloff>:/new/prefix1/Graphics/route_play.png</normaloff>:/new/prefix1/Graphics/route_play.png</iconset>
+   </property>
+   <property name="iconSize">
+    <size>
+     <width>125</width>
+     <height>125</height>
+    </size>
+   </property>
+   <property name="autoRepeat">
+    <bool>false</bool>
    </property>
   </widget>
   <widget class="QLabel" name="labelRouteSatellitePicture">
    <property name="geometry">
     <rect>
    </property>
   </widget>
   <widget class="QLabel" name="labelRouteSatellitePicture">
    <property name="geometry">
     <rect>
-     <x>190</x>
-     <y>150</y>
-     <width>100</width>
-     <height>100</height>
+     <x>200</x>
+     <y>60</y>
+     <width>80</width>
+     <height>80</height>
     </rect>
    </property>
     </rect>
    </property>
+   <property name="autoFillBackground">
+    <bool>true</bool>
+   </property>
    <property name="text">
    <property name="text">
-    <string>Satellite</string>
+    <string/>
+   </property>
+   <property name="pixmap">
+    <pixmap resource="graphics.qrc">:/new/prefix1/Graphics/satellite_vista.png</pixmap>
+   </property>
+   <property name="scaledContents">
+    <bool>true</bool>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
   <widget class="QLabel" name="labelRouteSatelliteStatus">
    <property name="geometry">
     <rect>
   <widget class="QLabel" name="labelRouteSatelliteStatus">
    <property name="geometry">
     <rect>
-     <x>110</x>
-     <y>280</y>
-     <width>251</width>
+     <x>90</x>
+     <y>80</y>
+     <width>301</width>
      <height>51</height>
     </rect>
    </property>
      <height>51</height>
     </rect>
    </property>
+   <property name="font">
+    <font>
+     <pointsize>12</pointsize>
+    </font>
+   </property>
    <property name="text">
     <string>Satellite status</string>
    </property>
    <property name="text">
     <string>Satellite status</string>
    </property>
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
+  <widget class="QLabel" name="labelRoutePicture">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>170</y>
+     <width>80</width>
+     <height>80</height>
+    </rect>
+   </property>
+   <property name="autoFillBackground">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+   <property name="pixmap">
+    <pixmap resource="graphics.qrc">:/new/prefix1/Graphics/route.png</pixmap>
+   </property>
+   <property name="scaledContents">
+    <bool>true</bool>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignCenter</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="labelRouteStatus">
+   <property name="geometry">
+    <rect>
+     <x>90</x>
+     <y>190</y>
+     <width>301</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <pointsize>12</pointsize>
+    </font>
+   </property>
+   <property name="autoFillBackground">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Route status</string>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignCenter</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="labelGpsSpeed">
+   <property name="geometry">
+    <rect>
+     <x>540</x>
+     <y>40</y>
+     <width>241</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <pointsize>36</pointsize>
+    </font>
+   </property>
+   <property name="text">
+    <string>GPS speed</string>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignCenter</set>
+   </property>
+  </widget>
  </widget>
  </widget>
- <resources/>
+ <resources>
+  <include location="graphics.qrc"/>
+ </resources>
  <connections/>
 </ui>
  <connections/>
 </ui>
index 3d53060..3b190f2 100644 (file)
@@ -1,5 +1,8 @@
 # -------------------------------------------------
 # Project created by QtCreator 2010-03-29T09:21:42
 # -------------------------------------------------
 # Project created by QtCreator 2010-03-29T09:21:42
+# @author     Speed Freak team
+# @copyright  (c) 2010 Speed Freak team
+# @license    http://opensource.org/licenses/gpl-license.php GNU Public License
 # -------------------------------------------------
 TARGET = speedfreak
 TEMPLATE = app
 # -------------------------------------------------
 TARGET = speedfreak
 TEMPLATE = app
@@ -7,13 +10,36 @@ SOURCES += main.cpp \
     mainwindow.cpp \
     creditsdialog.cpp \
     routedialog.cpp \
     mainwindow.cpp \
     creditsdialog.cpp \
     routedialog.cpp \
-    routesavedialog.cpp
+    routesavedialog.cpp \
+    gpsdata.cpp \
+    maemo5locationprivate.cpp \
+    maemo5location.cpp
 HEADERS += mainwindow.h \
     creditsdialog.h \
     routedialog.h \
 HEADERS += mainwindow.h \
     creditsdialog.h \
     routedialog.h \
-    routesavedialog.h
+    routesavedialog.h \
+    gpsdata.h \
+    maemo5locationprivate.h \
+    maemo5location.h
 FORMS += mainwindow.ui \
     creditsdialog.ui \
     routedialog.ui \
     routesavedialog.ui
 RESOURCES += graphics.qrc
 FORMS += mainwindow.ui \
     creditsdialog.ui \
     routedialog.ui \
     routesavedialog.ui
 RESOURCES += graphics.qrc
+
+contains(QT_CONFIG, hildon):CONFIG += hildon
+CONFIG += link_pkgconfig
+
+# Enable this to disable debugging
+DEFINES += QT_NO_DEBUG_OUTPUT
+target.path += /usr/lib
+devincludes.files = $$HEADERS
+devincludes.path += /usr/include/$$TEMPLATE$$TARGET
+INSTALLS += target \
+    devincludes
+PKGCONFIG += glib-2.0 \
+    liblocation
+exists(/usr/lib/liblocation.so) {
+    DEFINES += LIBLOCATION
+    message(liblocation found)
+}