*/
CategoryList::CategoryList()
{
-
+ qDebug() << "__CategoryList";
}
/**
*/
CategoryList::~CategoryList()
{
+ qDebug() << "__~CategoryList";
}
/**
*/
QStringList CategoryList::getCategoryList()
{
- qDebug() << "_getCategoryList" << realSizeOfCats;
+ qDebug() << "__getCategoryList" << realSizeOfCats;
if(sizeOfCategoryList() != 0) {
clearCategoryList();
*/
#include "gpsdata.h"
+#include <QDebug>
/**
*Default constructor of this class.
*/
GPSData::GPSData(Maemo5Location *maemo5location)
{
+ qDebug() << "__GPSData";
location = maemo5location;
connect(location,SIGNAL(agnss()),this,SLOT(agnss()));
*/
GPSData::~GPSData()
{
- delete location;
- delete gpsDateTime;
+ qDebug() << "__~GPSData";
+ location = NULL;
+
+ if(gpsDateTime)
+ delete gpsDateTime;
}
+/**
+ * This function reset all variables
+ */
void GPSData::resetAll()
{
satellitesInUse = 0;
+/*
+ * Http client Connects application to server.
+ *
+ * @author Tiina Kivilinna-Korhola <tiina.kivilinna-korhola@fudeco.com>
+ * @author Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
+ * @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 <QString>
#include <QMessageBox>
#include "httpclient.h"
#include "mainwindow.h"
-
/**
*@brief Constructor, connects object to GUI
*@param Pointer to carmainwindow, which is temporarily used during development
*/
HttpClient::HttpClient(MainWindow *myCarw)
{
+ qDebug() << "__HttpClient";
myMainw = myCarw;
netManager = new QNetworkAccessManager();
myXmlwriter = new XmlWriter();
*/
HttpClient::~HttpClient()
{
-
+ qDebug() << "__~HttpClient" ;
}
/**
currentDownload = netManager->post(request, ("xml=" + regbuffer->data()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRegistration()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- myMainw->settingsDialog->setLabelInfoToUser("Reguesting registration from server");
+
+ //Indicating user
+ if(myMainw->settingsDialog)
+ myMainw->settingsDialog->setLabelInfoToUser("Reguesting registration from server");
regbuffer->close();
}
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
//Indicating user
- myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("Sending result to server");
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("Sending result to server");
xmlbuffer->close();
}
currentDownload = netManager->post(request, ("xml=" + file.readAll()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRoute()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("Sending route to server");
+
+ //Indicating user
+ if(myMainw->routeSaveDialog->routeDialog)
+ myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("Sending route to server");
file.close();
}
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfToplist()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- myMainw->topResultDialog->setLabelInfoToUser("Reguesting top10 list from server");
-}
+ //Indicating user
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("Reguesting top10 list from server");
+}
/**
*@brief Request categories list from the server.
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfCategories()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- myMainw->topResultDialog->setLabelInfoToUser("Reguesting categories from server");
-}
+ //Indicating user
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("Reguesting categories from server");
+}
/**
*@brief Check that username and password exist on the server.
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfLogin()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- myMainw->settingsDialog->setLabelInfoToUser("Checking login validity from server");
-}
+ //Indicating user
+ if(myMainw->settingsDialog)
+ myMainw->settingsDialog->setLabelInfoToUser("Checking login validity from server");
+}
/**
*@brief React to servers responce after result has been sent.
qDebug() << "_ackOfResult";
//Indicating user
- myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("");
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
qDebug() << "errorcode:" << errorcode << reply->errorString();
//Indicating user
- QMessageBox::about(myMainw->accstart->accRealTimeDialog->resultDialog, "Server reply to result sending ",reply->errorString());
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ QMessageBox::about(myMainw->accstart->accRealTimeDialog->resultDialog, "Server reply to result sending ",reply->errorString());
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("Error");
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ myMainw->accstart->accRealTimeDialog->resultDialog->setSendServerButtonEnabled();
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
//Indicating user
- QMessageBox::about(myMainw->accstart->accRealTimeDialog->resultDialog, "Server reply to result sending", "Result received " + reply->readAll());
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ QMessageBox::about(myMainw->accstart->accRealTimeDialog->resultDialog, "Server reply to result sending", "Result received " + reply->readAll());
+ if(myMainw->accstart->accRealTimeDialog->resultDialog)
+ myMainw->accstart->accRealTimeDialog->resultDialog->setLabelInfoToUser("Result received");
}
}
{
qDebug() << "_ackOfRoute";
- myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("");
+ if(myMainw->routeSaveDialog->routeDialog)
+ myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->routeSaveDialog->routeDialog, "Server reply to route sending ",reply->errorString());
+ if(myMainw->routeSaveDialog->routeDialog)
+ QMessageBox::about(myMainw->routeSaveDialog->routeDialog, "Server reply to route sending ",reply->errorString());
+ if(myMainw->routeSaveDialog->routeDialog)
+ myMainw->routeSaveDialog->routeDialog->setSendServerButtonEnabled();
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw, "Server reply to route sending", "Route received " + reply->readAll());
+ if(myMainw->routeSaveDialog->routeDialog)
+ QMessageBox::about(myMainw->routeSaveDialog->routeDialog, "Server reply to route sending", "Route received " + reply->readAll());
}
}
{
qDebug() << "_ackOfRegistration";
- myMainw->settingsDialog->setLabelInfoToUser("");
+ if(myMainw->settingsDialog)
+ myMainw->settingsDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->settingsDialog, "Server reply to registration",reply->readAll());
+ if(myMainw->settingsDialog)
+ QMessageBox::about(myMainw->settingsDialog, "Server reply to registration",reply->readAll());
}
else {
qDebug() << "errorcode=0" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->settingsDialog, "Server reply to registration", "User registration " + reply->readAll());
+ if(myMainw->settingsDialog)
+ QMessageBox::about(myMainw->settingsDialog, "Server reply to registration", "User registration " + reply->readAll());
}
}
-
/**
*@brief React to servers responce after request for categories has been sent.
*/
{
qDebug() << "_ackOfCategories";
- myMainw->topResultDialog->setLabelInfoToUser("");
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
myXmlreader->xmlReadCategories(reply);
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
//QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories",reply->errorString());
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("You're not logged! Please register or log in.");
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
//QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories ", "OK");
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("");
}
}
-
/**
*@brief React to servers responce after request of TopList in certain category has been sent.
*/
{
qDebug() << "_ackOffLogin";
- myMainw->settingsDialog->setLabelInfoToUser("");
+ if(myMainw->settingsDialog)
+ myMainw->settingsDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QNetworkReply::NetworkError errorcode;
errorcode = reply->error();
- if(errorcode != 0) {
+ if(errorcode != 0)
+ {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->settingsDialog, "Server does not recognize your username. Please registrate.",reply->errorString());
- myMainw->settingsDialog->usernameOk(false);
+ if(myMainw->settingsDialog)
+ {
+ QMessageBox::about(myMainw->settingsDialog, "Server does not recognize your username. Please registrate.",reply->errorString());
+ myMainw->settingsDialog->usernameOk(false);
+ }
}
- else {
+ else
+ {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->settingsDialog, "Server reply to login", "User login " + reply->readAll());
+ if(myMainw->settingsDialog)
+ QMessageBox::about(myMainw->settingsDialog, "Server reply to login", "User login " + reply->readAll());
// here signal emit to mainwindow for username setting to main panel
emit loginOK();
- myMainw->settingsDialog->usernameOk(true);
- myMainw->settingsDialog->close();
- }
-
+ if( myMainw->settingsDialog)
+ {
+ myMainw->settingsDialog->usernameOk(true);
+ myMainw->settingsDialog->close();
+ }
+ }
}
-
/**
*@brief Reports errors, when server has sent error signal.
*/
void HttpClient::errorFromServer(QNetworkReply::NetworkError errorcode)
{
qDebug() << "_errorFromServer";
-
- //myMainw->setLabelInfoToUser("");
-
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
if(errorcode != 0) {
}
}
-
/**
*@brief React to servers responce after request of TopList in certain category has been sent.
*/
void HttpClient::ackOfToplist()
{
qDebug() << "_ackOfToplist";
-
- //myMainw->setLabelInfoToUser("");
-
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
myXmlreader->xmlReadTop10Results(reply);
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
//QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list",reply->errorString());
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("Error");
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
//QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list", "OK " + reply->readAll());
+ if(myMainw->topResultDialog)
+ myMainw->topResultDialog->setLabelInfoToUser("");
}
}
-
/*
* Http client Connects application to server.
*
- * @author Tiina Kivilinna-Korhola
- * @copyright (c) 2010 Speed Freak team
- * license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @author Tiina Kivilinna-Korhola
+ * @author Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
+ * @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 HTTPCLIENT_H
//#ifdef Q_WS_MAEMO_5
#include "maemo5locationprivate.h"
#include "maemo5location.h"
+#include <QDebug>
/**
*Default constructor of this class.
*/
Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
{
+ qDebug() << "__Maemo5Location";
ptr = new Maemo5LocationPrivate(this);
connect(ptr, SIGNAL(agnss()), this, SIGNAL(agnss()));
*/
Maemo5Location::~Maemo5Location()
{
- delete ptr;
+ qDebug() << "__~Maemo5Location";
+ if(ptr)
+ delete ptr;
}
/**
*/
void Maemo5Location::startPollingGPS()
{
+ qDebug() << "__Maemo5Location: startPollingGPS";
ptr->get_agnss();
}
*/
void Maemo5Location::stopPollingGPS()
{
+ qDebug() << "__Maemo5Location: stopPollingGPS";
ptr->stop();
}
*/
#include "maemo5locationprivate.h"
+#include <QDebug>
/**
*Default constructor of this class.
*/
Maemo5LocationPrivate::Maemo5LocationPrivate(Maemo5Location* location):QObject(location)
{
+ qDebug() << "__Maemo5LocationPrivate";
//Initialize variables
gps_online = false;
usegps = -1;
resetAll();
//Get gps control object
+ control = NULL;
control = location_gpsd_control_get_default();
//create gps device
+ device = NULL;
device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
g_signal_connect(device, "changed", G_CALLBACK(gps_data_changed), this);
*/
Maemo5LocationPrivate::~Maemo5LocationPrivate()
{
- delete device;
- delete control;
+ qDebug() << "__~Maemo5LocationPrivate";
+ //delete device;
+ //delete control;
}
/**
QCoreApplication::setOrganizationDomain("fudeco.com");
QCoreApplication::setApplicationName("Speed Freak");
- //routeDialog = new RouteDialog;
- //connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
-
helpDialog = NULL;
accstart = NULL;
routeSaveDialog = NULL;
connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
- //creditsDialog = new CreditsDialog;
-
welcomeDialog = new WelcomeDialog;
- welcomeDialog->show();
+ //welcomeDialog->show();
this->setUsernameToMainPanel();
{
if(!helpDialog)
helpDialog = new HelpDialog;
+
helpDialog->show();
- //creditsDialog->show();
}
/**
{
if(!routeSaveDialog)
routeSaveDialog = new RouteSaveDialog;
+
connect(routeSaveDialog, SIGNAL(sendroute()), this, SLOT(clientSendRoute()));
- connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
+ connect(routeSaveDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
routeSaveDialog->show();
}
{
if(!accstart)
accstart = new accelerationstart(this);
+
connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double)));
connect(accstart, SIGNAL(rejected()), this, SLOT(killDialog()));
accstart->show();
{
if (!topResultDialog)
topResultDialog = new TopResultDialog;
+
clientRequestCategoryList();
connect(topResultDialog, SIGNAL(refreshCategoryList()), this, SLOT(clientRequestCategoryList()));
connect(topResultDialog, SIGNAL(refreshTopList(int)), this, SLOT(clientRequestTopList(int)));
*/
void MainWindow::clientRequestCategoryList()
{
- httpClient->requestCategories();
+ if(httpClient)
+ httpClient->requestCategories();
}
/**
*/
void MainWindow::clientRequestTopList(int index)
{
- QString limit = QString::number(topResultDialog->getLimitNr());
- httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
+ QString limit;
+
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList)
+ {
+ limit = QString::number(topResultDialog->getLimitNr());
+ httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
+ }
}
/**
*/
void MainWindow::setCategoryCompoBox()
{
- topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList)
+ topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
}
/**
*/
void MainWindow::showTop10()
{
- int ind = topResultDialog->getRecentCategoryIndex();
- setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
+ int ind;
+
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList && topResultDialog)
+ {
+ ind = topResultDialog->getRecentCategoryIndex();
+ setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
+ }
}
/**
void MainWindow::setListViewTopList(QString category, int size)
{
QString topList;
- topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
- topResultDialog->showTopList(topList);
+
+ if(httpClient->myXmlreader->myCategoryList && topResultDialog)
+ {
+ topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
+ topResultDialog->showTopList(topList);
+ }
}
/**
*/
void MainWindow::clientRegUserToServer()
{
- httpClient->requestRegistration();
+ if(httpClient)
+ httpClient->requestRegistration();
}
/**
*/
void MainWindow::clientUserLogin()
{
- connect(httpClient, SIGNAL(loginOK()), this, SLOT(setUsernameToMainPanel()));
- httpClient->checkLogin();
+
+ if(httpClient)
+ {
+ connect(httpClient, SIGNAL(loginOK()), this, SLOT(setUsernameToMainPanel()));
+ httpClient->checkLogin();
+ }
}
/**
*/
void MainWindow::clientSendRoute()
{
- httpClient->sendRouteXml();
+ if(httpClient)
+ httpClient->sendRouteXml();
}
/**
qDebug() << "__clientSendResult";
if(accstart) {
qDebug() << "_clientSendResult, calling server";
- httpClient->sendResultXml(category, result);
+ if(httpClient)
+ httpClient->sendResultXml(category, result);
}
}
/**
{
if(topResultDialog)
{
+ qDebug() << "__MW kill: topResultDialog";
delete topResultDialog;
topResultDialog = NULL;
}
- else if(routeSaveDialog)
+ if(routeSaveDialog)
{
- delete routeSaveDialog;
- routeSaveDialog = NULL;
+ qDebug() << "__MW kill: routeSaveDialog";
+ //delete routeSaveDialog;
+ //routeSaveDialog = NULL;
}
- else if(accstart)
+ if(accstart)
{
+ qDebug() << "__MW kill: accstart";
delete accstart;
accstart = NULL;
}
+ if(welcomeDialog)
+ {
+ qDebug() << "__MW kill: welcomeDialog";
+ delete welcomeDialog;
+ welcomeDialog = NULL;
+ }
+ if(helpDialog)
+ {
+ qDebug() << "__MW kill: helpDialog";
+ delete helpDialog;
+ helpDialog = NULL;
+ }
}
void MainWindow::setUsernameToMainPanel()
*/
void ResultDialog::on_pushButtonSend_clicked()
{
- //emit sendresult();
+ ui->pushButtonSend->setEnabled(false);
emit sendresult(timeArray[this->getTargetChoice()]);
}
{
this->ui->labelInfoToUser->setText(infoText);
}
+
+/**
+ * This function enable send server button.
+ */
+void ResultDialog::setSendServerButtonEnabled()
+{
+ ui->pushButtonSend->setEnabled(true);
+}
void setValue(int pSpeed, double pTime);
void setLabelInfoToUser(QString infoText);
double getResult();
+ void setSendServerButtonEnabled();
signals:
void sendresult(double);
<property name="geometry">
<rect>
<x>10</x>
- <y>310</y>
- <width>471</width>
- <height>51</height>
+ <y>350</y>
+ <width>781</width>
+ <height>21</height>
</rect>
</property>
<property name="text">
*
* @author Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
* @author Toni Jussila <toni.jussila@fudeco.com>
- * @copyright (c) 2010 Speed Freak team
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
#include "routedialog.h"
#include <QFile>
#include <QFileDialog>
#include <QPolygon>
+#include <QDebug>
-/*
+/**
* Vector class.
* In starting Qt 4.6 there is QVector3D.
* Later (updating Qt version) this class can be removed.
void transformseg( Viewing *v, Vector *v1, Vector *v2, int *xscreen1, int *yscreen1, int *xscreen2, int *yscreen2 );
#define R 6378.140 // The radius of the earth by kilometers
-/*
+
+/**
* count distance of two points (defined by longitude & latitude)
* on the surface of the earth.
*/
return R*c; // Return distance in kilometers
}
+/**
+ * Constructor of this class.
+ */
RouteDialog::RouteDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::RouteDialog)
{
+ qDebug() << "__RouteDialog";
ui->setupUi(this);
this->setWindowTitle("Route");
left = 5; top = 5; right = 495; bottom = 295; // Limits in screen coordinates
ui->newPushButton->setAutoFillBackground(true);
ui->newPushButton->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
+ //Clear labels
+ ui->labelInfoToUser->setText("");
+ ui->maxSpeedLabel->setText("");
+ ui->speedValueLabel->setText("");
+
// Send rout to server button disable/enable.
ui->sendPushButton->setEnabled(false);
if (loginSaved())
{
ui->sendPushButton->setEnabled(true);
}
+ else
+ {
+ ui->labelInfoToUser->setText("You're not logged! Please register or log in.");
+ }
}
+/**
+ * Destructor of this class.
+ */
RouteDialog::~RouteDialog()
{
- delete ui;
+ qDebug() << "__~RouteDialog";
+ if(ui)
+ delete ui;
}
+/**
+ *
+ */
void RouteDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
break;
}
}
+
+/**
+ *
+ */
int RouteDialog::getLeft()
{
return left;
}
+
+/**
+ *
+ */
int RouteDialog::getRight()
{
return right;
}
+
+/**
+ *
+ */
int RouteDialog::getTop()
{
return top;
}
+
+/**
+ *
+ */
int RouteDialog::getBottom()
{
return bottom;
}
+/**
+ *
+ */
void drawFlag( RouteDialog *rD, QPainter *p, int x, int y)
{
/*QPolygon pg;
}
}
+/**
+ *
+ */
bool RouteDialog::readRouteFromFile( QString &routeFile)
{
+ QString rFile = routeFile; //Not used
Vector temp;
QString rivi;
QFile file;
return true;
}
-/*
+/**
* Find out data range for x-, y- and z-coordinates
*/
void dataMinMax( void)
//QMessageBox::about(0,"Tark", jono);
}
-/*
+/**
* Setting the point where the viewed object is. In the middle of datapoints.
*/
void setAtPoint( Viewing *v)
* */
}
-/*
+/**
* Setting the point where the object is viewed by eye.
*/
void setFromPoint( Viewing *v)
#define RIGHTEDGE 0x02
#define BOTTOMEDGE 0x04
#define TOPEDGE 0x08
-/*
+
+/**
* Returns a code specifying which edge in the viewing pyramid was crossed.
* There may be more than one.
*/
return c;
}
-/*
+/**
* Converts clipped world coordinates to screen coordinates.
*/
void WORLDtoSCREEN( qreal xWorld, qreal yWorld, int *xScreen, int *yScreen)
*yScreen = (int) (c*yWorld+d);
}
-/*
+/**
* Clips the line segment in three-dimensional coordinates to the
* viewing pyramid.
*/
//Now ready to draw line( xscreen1, yscreen1, xscreen2, yscreen2);
}
-/*
+/**
* Transform the segment connecting the two vectors into the viewing plane.
* clip3d() clips the line if needed.
*/
clip3d(x1,y1,z1,x2,y2,z2, xscreen1, yscreen1, xscreen2, yscreen2 );
}
+/**
+ * This slot function is called when ever new push button clicked.
+ */
void RouteDialog::on_newPushButton_clicked()
{
close(); // go back to previous dialog
}
+/**
+ * This slot function is called when ever send push button clicked.
+ */
void RouteDialog::on_sendPushButton_clicked()
{
+ ui->sendPushButton->setEnabled(false);
emit sendroute();
}
+/**
+ * This function is set info text to user.
+ */
void RouteDialog::setLabelInfoToUser(QString infoText)
{
this->ui->labelInfoToUser->setText(infoText);
}
+
+/**
+ * This function enable send server button.
+ */
+void RouteDialog::setSendServerButtonEnabled()
+{
+ ui->sendPushButton->setEnabled(true);
+}
*
* @author Olavi Pulkkinen <olavi.pulkkinen@fudeco.com>
* @author Toni Jussila <toni.jussila@fudeco.com>
- * @copyright (c) 2010 Speed Freak team
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @copyright (c) 2010 Speed Freak team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
#ifndef ROUTEDIALOG_H
class RouteDialog : public QDialog {
Q_OBJECT
+
public:
RouteDialog(QWidget *parent = 0);
~RouteDialog();
int getRight();
int getBottom();
void setLabelInfoToUser(QString infoText);
+ void setSendServerButtonEnabled();
signals:
void sendroute();
<property name="geometry">
<rect>
<x>10</x>
- <y>310</y>
- <width>521</width>
+ <y>330</y>
+ <width>781</width>
<height>51</height>
</rect>
</property>
<property name="text">
- <string/>
+ <string>User info</string>
</property>
</widget>
</widget>
#include "routesavedialog.h"
#include "ui_routesavedialog.h"
+#include <QDebug>
/**
*Constructor of this class.
RouteSaveDialog::RouteSaveDialog(QWidget *parent) :
QDialog(parent), ui(new Ui::RouteSaveDialog){
+ qDebug() << "__RouteSaveDialog";
ui->setupUi(this);
this->setWindowTitle("Tracking");
routeDialog = NULL;
+ location = NULL;
+ gpsData = NULL;
//Button settings
buttonStatus = true;
timerSatellitePicture->setInterval(400);
connect(timerSatellitePicture, SIGNAL(timeout()),this, SLOT(timerSatellitePictureTimeout()));
- //Route picture and label
+ //Invisible or clear labels
ui->labelRouteStatus->setVisible(0);
ui->labelRoutePicture->setVisible(0);
+ ui->labelGpsSpeed->setVisible(0); //GPS speed label
+ ui->labelUserInfo->setText(""); //User info label
timerRoutePicture = new QTimer();
timerRoutePicture->setInterval(400);
connect(timerRoutePicture, SIGNAL(timeout()),this, SLOT(timerRoutePictureTimeout()));
- //GPS speed label
- ui->labelGpsSpeed->setVisible(0);
-
- //User info label
- ui->labelUserInfo->setText("");
-
//GPS
location = new Maemo5Location(this);
gpsData = new GPSData(location);
*/
RouteSaveDialog::~RouteSaveDialog()
{
- delete ui;
+ qDebug() << "__~RouteSaveDialog";
+ if(ui)
+ delete ui;
+ if(gpsData)
+ delete gpsData;
+ if(location)
+ delete location;
+ if(routeDialog)
+ delete routeDialog;
+
delete timerSatellitePicture;
delete timerRoutePicture;
- delete location;
- delete gpsData;
- delete routeDialog;
delete pixmapRouteStop;
delete pixmapRouteStart;
delete iconRouteStop;
*/
void RouteSaveDialog::on_buttonRouteStartStop_clicked()
{
- //If start button clicked
- if ( buttonStatus == true )
+ if ( buttonStatus == true )//If start button clicked
{
+ qDebug() << "__start button clicked";
buttonStatus = false;
ui->buttonRouteStartStop->setIcon(*iconRouteStop);
location->startPollingGPS();
gpsStatus();
}
- else
+ else //If stop button clicked
{
+ qDebug() << "__stop button clicked";
buttonStatus = true;
ui->buttonRouteStartStop->setIcon(*iconRouteStart);
CONFIG += link_pkgconfig
# Enable this to disable debugging
-DEFINES += QT_NO_DEBUG_OUTPUT
+#DEFINES += QT_NO_DEBUG_OUTPUT
target.path += /usr/lib
devincludes.files = $$HEADERS
devincludes.path += /usr/include/$$TEMPLATE$$TARGET
*/
XmlReader::XmlReader()
{
+ qDebug() << "__XmlReader";
myCategoryList = new CategoryList();
}
*/
XmlReader::~XmlReader()
{
+ qDebug() << "__~XmlReader";
category = "";
unit = "";
position = "";
user = "";
value = "";
- delete myCategoryList;
+
+ if(myCategoryList)
+ delete myCategoryList;
}
/**
xmlreader.clear();
QByteArray array = device->readAll();
- qDebug() << "array: " << array;
+ //qDebug() << "array: " << array;
xmlreader.addData(array);
//xmlreader.addData(device->readAll());
xmlreader.clear();
QByteArray array = device->readAll();
- qDebug() << "array: " << array;
+ //qDebug() << "array: " << array;
xmlreader.addData(array);
//xmlreader.addData(device->readAll());
* Xml writer
*
* @author Tiina Kivilinna-Korhola
+ * @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 "xmlwriter.h"
-
-
/**
*@brief Constructor, connects object to GUI
*@param Pointer to carmainwindow, which is temporarily used during development
xmlwriter.writeEndDocument();
}
-
/**
*@brief Writes Speed Freek results items as tags and contents into a buffer.
*@todo Consider looping when writing many values.
xmlwriter.writeEndDocument();
}
-
/**
*@brief Write track to server.
*@param netbuf where to write.
xmlwriter.writeEndDocument();
}
-
/**
*@brief Opens and closes a file, when xml information is written into a file,
*and passes file to writeXmlFile()
return true;
}
-
/**
*@brief Writes Speed Freek results items as tags and contents to earlier defined target.
*@todo Consider looping when writing many values.