Urls changed in httpclient because of changes in API.
authorJanne Änäkkälä <janne_anakkala@hotmail.com>
Tue, 25 May 2010 07:51:04 +0000 (10:51 +0300)
committerJanne Änäkkälä <janne_anakkala@hotmail.com>
Tue, 25 May 2010 07:51:04 +0000 (10:51 +0300)
Client/httpclient.cpp
Client/xmlwriter.cpp
Client/xmlwriter.h

index 933de3d..e59a0ae 100644 (file)
@@ -50,7 +50,7 @@ void HttpClient::requestRegistration()
     qDebug() <<  myMainw->settingsDialog->getRegUserName() << "+" <<  myMainw->settingsDialog->getRegPassword() << "+" <<  myMainw->settingsDialog->getRegEmail();
 
     QBuffer *regbuffer = new QBuffer();
-    QUrl qurl("http://api.speedfreak-app.com/api/register");
+    QUrl qurl("http://www.speedfreak-app.com/users/register");
     QNetworkRequest request(qurl);
     qDebug() << qurl.toString();
     QNetworkReply *currentDownload;
@@ -59,7 +59,8 @@ void HttpClient::requestRegistration()
     myXmlwriter->writeRegistering(regbuffer,
                        myMainw->settingsDialog->getRegUserName(),
                        myMainw->settingsDialog->getRegPassword(),
-                       myMainw->settingsDialog->getRegEmail());
+                       myMainw->settingsDialog->getRegEmail(),
+                       "My car is cool");
     qDebug() << "carmainwindow: regbuffer->data(): " << regbuffer->data();
 
     currentDownload = netManager->post(request, ("xml=" + regbuffer->data()));
@@ -80,10 +81,12 @@ void HttpClient::requestRegistration()
 void HttpClient::sendResultXml(QString category, double result)
 {
     qDebug() << "_sendResultXml";
+    qDebug() << category;
 
     QBuffer *xmlbuffer = new QBuffer();
 
-    QUrl qurl("http://api.speedfreak-app.com/api/update/" + category);
+    QUrl qurl("http://www.speedfreak-app.com/results/update/" + category);
+
     qDebug() << qurl.toString();
     QNetworkRequest request(qurl);
     QNetworkReply *currentDownload;
@@ -138,7 +141,7 @@ void HttpClient::sendRouteXml(QString s, int i)
             return;
         }
 
-        QUrl qurl("http://api.speedfreak-app.com/api/update/route");
+        QUrl qurl("http://speedfreak-app.com/update/route");
         qDebug() << qurl.toString();
         QNetworkRequest request(qurl);
         QNetworkReply *currentDownload;
@@ -170,7 +173,7 @@ void HttpClient::requestTopList(QString category, QString limit)
     qDebug() << "_requestTopList";
     qDebug() << category;
 
-    QString urlBase = "http://api.speedfreak-app.com/api/results/";
+    QString urlBase = "http://www.speedfreak-app.com/results/list/";
     QUrl qurl(urlBase + category + "/" + limit);
     qDebug() << qurl.toString();
     QNetworkRequest request(qurl);
@@ -196,8 +199,8 @@ void HttpClient::requestTopList(QString category, QString limit)
 void HttpClient::requestCategories()
 {
     qDebug() << "_requestCategories" ;
+    QUrl qurl("www.speedfreak-app.com/results/categories");
 
-    QUrl qurl("http://api.speedfreak-app.com/api/categories/");
     qDebug() << qurl.toString();
     QNetworkRequest request(qurl);
     QNetworkReply *currentDownload;
@@ -223,8 +226,9 @@ void HttpClient::checkLogin()
 {
     qDebug() << "_checkLogin";
 
-    QUrl qurl("http://api.speedfreak-app.com/api/login/");
+    QUrl qurl("http://www.speedfreak-app.com/users/login");
     qDebug() << qurl.toString();
+
     QNetworkRequest request(qurl);
     QNetworkReply *currentDownload;
 
@@ -481,7 +485,7 @@ void HttpClient::sendProfileXml()
         myMainw->settingsDialog->profileDialog->setLabelInfoToUser("Profile saved to phone");
 
     // Send xml to server
-    /*QUrl qurl("http://api.speedfreak-app.com/api/profile");
+    /*QUrl qurl("http://speedfreak-app.com/api/profile");
     QNetworkRequest request(qurl);
     qDebug() << qurl.toString();
     QNetworkReply *currentDownload;
index 49e9c66..cb97457 100644 (file)
@@ -33,7 +33,7 @@ XmlWriter::~XmlWriter()
   *@param psswd for password.
   *@param email.
   */
-void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email)
+void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email, QString description)
 {
     qDebug() << "_writeRegistering";
 
@@ -54,6 +54,10 @@ void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QS
     xmlwriter.writeCharacters(email);
     xmlwriter.writeEndElement();
 
+    xmlwriter.writeStartElement("description");
+    xmlwriter.writeCharacters(description);
+    xmlwriter.writeEndElement();
+
     xmlwriter.writeEndElement();
     xmlwriter.writeEndDocument();
 }
index d98eef4..0d20d4b 100644 (file)
@@ -36,7 +36,7 @@ private:
     QXmlStreamWriter xmlwriter;
 
 public slots:
-    void writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email);
+    void writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email, QString description);
     void writeResult(QBuffer *netbuf, double result);
     void writeGpsTrack(QBuffer *netbuf, int counter, int start, int stop, int lat, int lon, int alt, int speed, int time);
     bool writeXmlFile(QIODevice *device);