{
ui->progressBar->setMaximum( max );
}
+
+void CalibrateDialog::setTitle(QString title)
+{
+ this->setWindowTitle(title);
+}
void setProgressValue(int value);
void resetProgressValue();
void setMaxValue(int max);
+ void setTitle(QString title);
protected:
void changeEvent(QEvent *e);
if(myMainw->settingsDialog->profileDialog)
myMainw->settingsDialog->profileDialog->setLabelInfoToUser("Profile saved to phone");
- QUrl qurl("http://api.speedfreak-app.com/api/profile");
+ // Send xml to server
+ /*QUrl qurl("http://api.speedfreak-app.com/api/profile");
QNetworkRequest request(qurl);
qDebug() << qurl.toString();
QNetworkReply *currentDownload;
request.setRawHeader(QByteArray("Authorization"),credentials.toAscii());
currentDownload = netManager->post(request, ("xml=" + file.readAll()));
- bool error = connect(currentDownload, SIGNAL(finished()), this, SLOT(ackOfProfile()));
+ bool error = connect(currentDownload, SIGNAL(finished()), this, SLOT(ackOfProfile()));*/
file.close();
- // Send picture
- if(myMainw->settingsDialog->profileDialog->getPicture() != "" && error == false)
+ // Send picture to server
+ /*if(myMainw->settingsDialog->profileDialog->getPicture() != "" && error == false)
{
QFile pictureFile( myMainw->settingsDialog->profileDialog->getPicture() );
if (!pictureFile.open(QIODevice::ReadOnly))
currentDownload = netManager->post(request, pictureFile.readAll());
connect(currentDownload, SIGNAL(finished()), this, SLOT(ackOfSendingPicture()));
pictureFile.close();
- }
+ }*/
}
/**
}
if(routeSaveDialog)
{
- qDebug() << "__MW kill: routeSaveDialog";
+ //qDebug() << "__MW kill: routeSaveDialog";
//delete routeSaveDialog;
//routeSaveDialog = NULL;
}
// Button settings
ui->sendPushButton->setAutoFillBackground(true);
ui->sendPushButton->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
- ui->newPushButton->setAutoFillBackground(true);
- ui->newPushButton->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
// Clear labels
ui->labelInfoToUser->setText("");
/**
*
*/
-bool RouteDialog::readRouteFromFile( QString &routeFile , CalibrateDialog *calibrateDialog)
+bool RouteDialog::readRouteFromFile( QString &routeFile )
{
QString rFile = routeFile; //Not used
Vector temp;
QString rivi;
QFile file;
- progresbar = calibrateDialog;
- int progresbarValue = 0;
- progresbar->setProgressValue(++progresbarValue);
-
- //QString fileName = QFileDialog::getOpenFileName(this,
- // tr("Read Route"), "./", tr("Route Files (*.txt)"));
-
- //file.setFileName( fileName);
file.setFileName( "routetemp.xml");
if (!file.open(QIODevice::ReadOnly))
{
QMessageBox::about(0, "Error", "File not found");
- progresbar->setProgressValue(100);
return false;
}
-
+emit progressbar(5);
vertexList.clear();
-
+ emit progressbar(50);
while(!file.atEnd())
{
+ //qDebug() << "__jee ";
+
int count;
bool allRead;
QString astr1, astr2, astr3, astr4;
QString str1, str2, str3, str4;
rivi = file.readLine();
-
allRead = false;
count = 0;
while( !allRead)
str2 = astr2.section('"',1,1);
str3 = astr3.section('"',1,1);
str4 = astr4.section('"',1,1);
- //QString str = QString("%1 %2 %3 %4").arg(str1).arg(str2).arg(str3).arg(str4);
- //QMessageBox::about(0, "LUKEE", str);
- /* */
if (str1.length() > 0)
{
y = str1.toDouble();// longitude x-value
z = str3.toDouble();// altitude z-value
v = str4.toDouble();// speed km/h
- // QString str = QString("%1 %2 %3 %4").arg(x).arg(y).arg(z).arg(v);
- // QMessageBox::about(0, "LUKEE", str);
temp.setX( x); // Longitude
temp.setY( y); // Latitude
temp.setZ( z); // altitude
}
}
}
- // Older version
- /*
- str1 = rivi.section(" ", 0, 0);
- if (str1.compare("Start:") != 0 && str1.compare("Stop:") != 0)
- {
- str1 = rivi.section(" ", 2, 2); // latitude y-value
- str2 = rivi.section(" ", 4, 4); // longitude x-value
- str3 = rivi.section(" ", 6, 6); // altitude z-value
- str4 = rivi.section(" ", 8, 8); // speed km/h
- //QString str = QString("la: %1 lo: %2 al: %3").arg(str1).arg(str2).arg(str3);
- //QMessageBox::about(0, "LUKEE", str);
-
- if (str1.length() > 0)
- {
- double x, y, z, v;
- x = str2.toDouble();
- y = str1.toDouble();
- z = str3.toDouble();
- v = str4.toDouble();
- temp.setX( x); // Longitude
- temp.setY( y); // Latitude
- temp.setZ( z); // altitude
- temp.setV( v);
-
- vertexList.append(temp);
- }
- }
- */
}
file.close();
QString str = QString("Min & Max datan välimatka %1").arg(dist);
QMessageBox::about( 0, "Testi", str);
*/
-
- return true;
+ emit progressbar(100);
+ return true;
}
/**
}
/**
- * 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()
#include <QDialog>
#include <helproutingdialog.h>
class RouteSaveDialog;
-class CalibrateDialog;
namespace Ui {
class RouteDialog;
public:
RouteDialog(RouteSaveDialog *parent = 0);
~RouteDialog();
- bool readRouteFromFile( QString &routeFile, CalibrateDialog *calibrateDialog);
+ bool readRouteFromFile( QString &routeFile);
int getLeft();
int getTop();
int getRight();
signals:
void sendroute();
+ void progressbar(int);
protected:
void changeEvent(QEvent *e);
private:
Ui::RouteDialog *ui;
- CalibrateDialog *progresbar;
int left, top, right, bottom; // Limits in screen coordinates in route dialog
void checkLogin();
private slots:
void on_pushButtonInfo_clicked();
void on_sendPushButton_clicked();
- void on_newPushButton_clicked();
void killHelpDialog();
};
<property name="windowTitle">
<string>Dialog</string>
</property>
- <widget class="QPushButton" name="newPushButton">
- <property name="geometry">
- <rect>
- <x>710</x>
- <y>150</y>
- <width>90</width>
- <height>90</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="graphics.qrc">
- <normaloff>:/new/prefix1/Graphics/route_new.png</normaloff>:/new/prefix1/Graphics/route_new.png</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>85</width>
- <height>85</height>
- </size>
- </property>
- </widget>
<widget class="QPushButton" name="sendPushButton">
<property name="geometry">
<rect>
<x>710</x>
- <y>50</y>
+ <y>120</y>
<width>90</width>
<height>90</height>
</rect>
delete location;
if(routeDialog)
delete routeDialog;
+ if(calibrateDialog)
+ {
+ delete calibrateDialog;
+ calibrateDialog = NULL;
+ }
delete timerSatellitePicture;
delete timerRoutePicture;
timerRoutePicture->stop();
location->stopPollingGPS();
- // Progres bar
+ // Progress bar
if(!calibrateDialog)
+ {
calibrateDialog = new CalibrateDialog();
+ }
- calibrateDialog->show();
+ progressbarPoints = 100;
+ progressbarIteration = 0;
calibrateDialog->resetProgressValue();
- int points = 100;
- int iteration = 0;
- calibrateDialog->setMaxValue( points + 1 );
+ calibrateDialog->setMaxValue( progressbarPoints );
+ calibrateDialog->setTitle("Calculating route...");
+ calibrateDialog->show();
+
- /*do {
- calibrateDialog->setProgressValue(iteration);
- iteration++;
+ if(!routeDialog)
+ {
+ routeDialog = new RouteDialog(this);
+ }
- } while(iteration != points);*/
+ connect(routeDialog, SIGNAL(sendroute()), this, SLOT(sendRoute()));
+ connect(routeDialog, SIGNAL(progressbar(int)), this, SLOT(setProgressbar(int)));
+ connect(routeDialog, SIGNAL(rejected()), this, SLOT(killRouteDialog()));
+ //connect(routeDialog, SIGNAL(killRoute()), this, SLOT(killRouteDialog()));
QString routeFile = QString("routetemp.xml");
- if (routeDialog->readRouteFromFile( routeFile , calibrateDialog) == true)
+ if (routeDialog->readRouteFromFile( routeFile ) == true)
{
- if(!routeDialog)
- routeDialog = new RouteDialog(this);
- connect(routeDialog, SIGNAL(sendroute()), this, SLOT(sendRoute()));
-
- calibrateDialog->close();
+ //calibrateDialog->close();
routeDialog->show();
}
else
{
- calibrateDialog->close();
+ //calibrateDialog->close();
}
-
+calibrateDialog->close();
//Set GPS speed labels in visible
ui->labelGpsSpeed->setVisible(0);
ui->labelGpsAvgSpeed->setVisible(0);
}
/**
+ * This slot function called when ever dialog rejected.
+ */
+void RouteSaveDialog::killRouteDialog()
+{
+ if(routeDialog)
+ {
+ qDebug() << "__Route save kill: routeDialog";
+ delete routeDialog;
+ routeDialog = NULL;
+ }
+ if(calibrateDialog)
+ {
+ qDebug() << "__Route save kill: calibrateDialog";
+ delete calibrateDialog;
+ calibrateDialog = NULL;
+ }
+}
+
+/**
* This function return speed average.
* @return double average speed
*/
{
return distanceString;
}
+
+/**
+ * This function
+ */
+void RouteSaveDialog::setProgressbar(int i)
+{
+ qDebug() << "__setProgressbar " ;//+ i;
+ qDebug() << i;
+ calibrateDialog->setProgressValue(i);//progressbarIteration);
+ progressbarIteration++;
+}
~RouteSaveDialog();
RouteDialog *routeDialog;
HelpRoutingDialog *helpRoutingDialog;
+ CalibrateDialog *calibrateDialog;
double getAverageSpeed();
QString getDistanceTraveled();
QTimer *timerRoutePicture;
GPSData *gpsData;
Maemo5Location *location;
- CalibrateDialog *calibrateDialog;
QString gpsSpeed;
QString distanceString;
QPixmap *pixmapRouteStop;
double allSpeeds;
int speedCount;
double direction;
+ int progressbarIteration;
+ int progressbarPoints;
private slots:
void on_pushButtonInfo_clicked();
void gpsStatus();
void sendRoute();
void killHelpDialog();
+ void killRouteDialog();
+ void setProgressbar(int i);
signals:
void sendroute();