Results 1 to 3 of 3

Thread: Qhttp several downloads

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Qhttp several downloads

    hi, i have a program that connects with an ip-cam, on this kind of cam, i can order it to go to some predefinied positions, tanke pictures, or videos, but i have one problem combining all these.

    thanks to qhttp and signals, i can send the order to move to one position, and when i recive the requestfinished, i send the order to take a picture, and when that one finishes make another move... and so on, i have a list of activities to do.
    Qt Code:
    1. void TEjecutor::httpRequestFinished(int id, bool error)
    2. {
    3.  
    4. Sleep(1500);
    5. if (id==httpMove)
    6. {
    7. // QMessageBox msgBox;
    8. // msgBox.setText(QObject::tr("Move"));
    9. // msgBox.exec();
    10. Sleep(1500);
    11. this->takePicture();
    12. }
    13. else if (this->lista.seekFile(id))
    14. {
    15.  
    16. this->list.closeFile(id);
    17. // QMessageBox msgBox;
    18. // msgBox.setText(QObject::tr("Download %1").arg(id));
    19. // msgBox.exec();
    20. Sleep(1500);
    21. this->goToPosition();
    22. }
    To copy to clipboard, switch view to plain text mode 

    As you can see, when i recive the httpMove, means that the movement its made, so i take the picture, which creates a file and a connection, and goToPosition takes the next target from a list, and makes it

    Qt Code:
    1. void TEjecutor::takePicture()
    2. {
    3. http->setHost(ip);
    4. http->setUser(user,pass);
    5. int id=http->get(order,file);
    6. this->list.add(file,id);
    7.  
    8. void TEjecutor:: goToPosition(QString ip, QString user, QString pass, QString destino)
    9. .
    10. .
    11. .
    12. http->setHost(ip);
    13. http->setUser(user,pass);
    14. httpMovimientos = http->get(QString("http://%1/axis-cgi/com/ptz.cgi?gotoserverpresetname=%2").arg(ip).arg(destino));
    To copy to clipboard, switch view to plain text mode 

    As you can see at httpRequestFinished i have some QBoxMessage, the fact is that if i run the application with those QBoxes, it'll work perfectly, but if i comment them, the files that i create will remain empty... but i have to make it work without them.
    How is this possible? i tryed writing some sleep() functions on the same place as Qboxes were... but it didnt work!!!!


    I'm on Windows and Qt 4.5.3

  2. #2
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qhttp several downloads

    I finally found the solution (not the problem).

    I created 2 Qhttp connections, one for the moves and other one for downloading the images.... and it works!!

  3. #3
    Join Date
    Oct 2009
    Posts
    37
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Qhttp several downloads

    Just a small note:
    For 4.6 you should move to QNetworkAccessManager. More performance and hopefully less bugs.
    Disclaimer: Although I work on Qt for Nokia, anything I post here is personal

Similar Threads

  1. problem in using QHttp
    By Ferdous in forum Newbie
    Replies: 4
    Last Post: 10th September 2008, 12:07
  2. Replies: 0
    Last Post: 9th September 2008, 12:57
  3. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  4. Retrieving modified date of file using QHttp
    By hardgeus in forum Qt Programming
    Replies: 9
    Last Post: 3rd December 2006, 23:20
  5. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.