Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]QNetworkReply
QtWS25 Last Chance

[Solved]QNetworkReply

Scheduled Pinned Locked Moved General and Desktop
qnetworkreply
5 Posts 3 Posters 1.3k Views
  • 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 Offline
    C Offline
    chronix
    wrote on last edited by chronix
    #1

    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
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      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
      0
      • JohanSoloJ JohanSolo

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

        C Offline
        C Offline
        chronix
        wrote on last edited by
        #3

        @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
        0
        • JohanSoloJ Offline
          JohanSoloJ Offline
          JohanSolo
          wrote on last edited by
          #4

          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
          1
          • C 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 Offline
            S Offline
            SysTech
            wrote on last edited by SysTech
            #5

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

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved