[Solved]QNetworkReply



  • I want add auto update check feature into my program, the logic i used is at start(of program) the checkForUpdate(); function is called and it downloads a XML file, the XML file contains the info bout the latest supported versions and their download link.

    ...
    checkForUpdate();
    readXML();
    ...
    

    now my problem is checkForUpdate(); is called and the file is downloaded and before it could finish the readXML(); function is called, and the readXML(); gives and an error as it cannot read the file simply because its not created, yet. I understand it as something to do with the QNetworkReply bt i don't understand how to fix it.
    ~thanks in advance. :)



  • You can use the QNetworkReply::finished signal to know when the download is over.



  • @JohanSolo yeah i know bout it, its connected to a slot, bt i want to reuse this code for downloading the new update as well, checkForUpdate() calls a function downloadFile(), i would like to use this again for downloading the file from the link which we got from the XML file.



  • I don't see your point... By connecting correctly the finished signal to a slot calling the readXML() function you're sure the file is complete, which is then independent on how many loops you're performing. Am I missing something?



  • @chronix

    Sounds like you are well down the road of writing code to do this...

    But for the sake of options and if you happen to be running on Windows, there is a fairly inexpensive tool that does all of this for you:

    http://wyday.com/wybuild/

    I've used this tool on both small and large projects and it makes updates a snap. It handles virtually any types of files and can be command line driven.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.