Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved]QNetworkReply

    General and Desktop
    qnetworkreply
    3
    5
    1163
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      chronix last edited by chronix

      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. :)

      S 1 Reply Last reply Reply Quote 0
      • JohanSolo
        JohanSolo last edited by JohanSolo

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

        `They did not know it was impossible, so they did it.'
        -- Mark Twain

        C 1 Reply Last reply Reply Quote 0
        • C
          chronix @JohanSolo last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • JohanSolo
            JohanSolo last edited by

            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?

            `They did not know it was impossible, so they did it.'
            -- Mark Twain

            1 Reply Last reply Reply Quote 1
            • S
              SysTech @chronix last edited by SysTech

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post