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. Is there a way in Qt to create smth like an auto updater?
QtWS25 Last Chance

Is there a way in Qt to create smth like an auto updater?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 6 Posters 3.9k 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.
  • M Offline
    M Offline
    mandruk1331
    wrote on 6 Apr 2017, 08:34 last edited by
    #1

    What I want is, when I launch the app it will check for update on git repository and if the new version is present it will make a pull for it. Is there a way I can achieve that?

    Mandruk1331

    J 1 Reply Last reply 6 Apr 2017, 08:40
    0
    • M mandruk1331
      6 Apr 2017, 08:34

      What I want is, when I launch the app it will check for update on git repository and if the new version is present it will make a pull for it. Is there a way I can achieve that?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 6 Apr 2017, 08:40 last edited by
      #2

      @mandruk1331
      Yes, I believe so.

      If you use qt's InstallerFramework and create an online installer.

      Than during or before start of your app use QNetworkRequest to check for the latest Version online:

      QNetworkRequest request(QUrl("http://www...../Updates.xml"));
      

      parse the file for the version number

      if(sLine.contains("<Version>")){
                  int begin = sLine.indexOf("<Version>") + QString("<Version>").length();
                  int n = sLine.indexOf("</Version>") - begin;
                  versionNumber = sLine.mid(begin, n);
              }
      

      if thats not equal to the current version installed -> do an update.
      Either use QProcess to start the MaintaneceTool or do the update yourself manually. Up to you.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      M 1 Reply Last reply 6 Apr 2017, 08:42
      3
      • J J.Hilk
        6 Apr 2017, 08:40

        @mandruk1331
        Yes, I believe so.

        If you use qt's InstallerFramework and create an online installer.

        Than during or before start of your app use QNetworkRequest to check for the latest Version online:

        QNetworkRequest request(QUrl("http://www...../Updates.xml"));
        

        parse the file for the version number

        if(sLine.contains("<Version>")){
                    int begin = sLine.indexOf("<Version>") + QString("<Version>").length();
                    int n = sLine.indexOf("</Version>") - begin;
                    versionNumber = sLine.mid(begin, n);
                }
        

        if thats not equal to the current version installed -> do an update.
        Either use QProcess to start the MaintaneceTool or do the update yourself manually. Up to you.

        M Offline
        M Offline
        mandruk1331
        wrote on 6 Apr 2017, 08:42 last edited by mandruk1331 4 Jun 2017, 08:43
        #3

        @J.Hilk Looks legit, I'll give it a try. But how I can make an update? this is only to check for an update

        Mandruk1331

        J 1 Reply Last reply 6 Apr 2017, 08:51
        0
        • M mandruk1331
          6 Apr 2017, 08:42

          @J.Hilk Looks legit, I'll give it a try. But how I can make an update? this is only to check for an update

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 6 Apr 2017, 08:51 last edited by
          #4

          @mandruk1331
          in the Updates.xml file you also have the <DownloadableArchives> entry with the name of all packed archives.

          Download those and unpack/overwrite the files in your installation folder.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          M 1 Reply Last reply 6 Apr 2017, 09:24
          2
          • J J.Hilk
            6 Apr 2017, 08:51

            @mandruk1331
            in the Updates.xml file you also have the <DownloadableArchives> entry with the name of all packed archives.

            Download those and unpack/overwrite the files in your installation folder.

            M Offline
            M Offline
            mandruk1331
            wrote on 6 Apr 2017, 09:24 last edited by
            #5

            @J.Hilk No no, I mean how I can make a pull request from qt?

            Mandruk1331

            A 1 Reply Last reply 8 Apr 2017, 04:33
            0
            • M mandruk1331
              6 Apr 2017, 09:24

              @J.Hilk No no, I mean how I can make a pull request from qt?

              A Offline
              A Offline
              ambershark
              wrote on 8 Apr 2017, 04:33 last edited by
              #6

              @mandruk1331 What do you mean by "pull request"?

              My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

              M 1 Reply Last reply 11 Apr 2017, 12:51
              0
              • A ambershark
                8 Apr 2017, 04:33

                @mandruk1331 What do you mean by "pull request"?

                M Offline
                M Offline
                mandruk1331
                wrote on 11 Apr 2017, 12:51 last edited by
                #7

                @ambershark For example: I have an application(old version), a new version is present on my git repository, how I can make my application to check if my git repository has a new version, and if it has one it will download it on Desktop.

                Mandruk1331

                A 1 Reply Last reply 11 Apr 2017, 21:41
                0
                • M mandruk1331
                  11 Apr 2017, 12:51

                  @ambershark For example: I have an application(old version), a new version is present on my git repository, how I can make my application to check if my git repository has a new version, and if it has one it will download it on Desktop.

                  A Offline
                  A Offline
                  ambershark
                  wrote on 11 Apr 2017, 21:41 last edited by
                  #8

                  @mandruk1331 Oh I see, so you want an updater for your application.

                  That can be a complex topic. There is no Qt way. You would need to develop your own or use a 3rd party solution.

                  You can use Qt components to make your own (that's what I did).

                  You can check a webpage (or git) for a newer version. For me that was an xml file I would download, check version differences, etc. If it was new then I would download a package file with the new stuff in it, decompress it, then update my update program (separate exe from my app), launch my update program to update my application. That's pretty much it.

                  There's also 3rd party application and libs that can help/do this for you. I'll let you google that though since I wrote my own.

                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 11 Apr 2017, 21:52 last edited by
                    #9

                    Hi,

                    So something like Sparkle ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply 12 Apr 2017, 11:42
                    1
                    • IMAN4KI Offline
                      IMAN4KI Offline
                      IMAN4K
                      wrote on 12 Apr 2017, 03:42 last edited by
                      #10

                      First of all as others mentioned you should check for the new version by investigating a reply such this : 0.5.19 https://yourarchivesite.com/update/current/data
                      This reply is a request to some kind of permanent update url that contained update info(version + download link) and could be edited also (for example https://site.com/availableUpdate).
                      1.Simply check the version of first part with the version you are running from (in windows it could be query from registry)
                      2.Download the new version data to a temporary directory
                      3.Unzip the data (so the newer .exe is in your temp dir + some other required data)
                      4.Start a new process (updater.exe that is located beside your application .exe) which will close your app -> replace new .exe with older one -> Update registry info -> delete temp dir -> launch your app back

                      1 Reply Last reply
                      2
                      • S SGaist
                        11 Apr 2017, 21:52

                        Hi,

                        So something like Sparkle ?

                        M Offline
                        M Offline
                        mandruk1331
                        wrote on 12 Apr 2017, 11:42 last edited by
                        #11

                        @SGaist yes smth like that

                        Mandruk1331

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 12 Apr 2017, 19:25 last edited by
                          #12

                          The Qt Installer Framework might also be an option.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • simowS Offline
                            simowS Offline
                            simow
                            wrote on 12 Apr 2017, 20:26 last edited by simow
                            #13

                            If you want to restart your application after update there is an article in the wiki about that:
                            https://wiki.qt.io/How_to_make_an_Application_restartable

                            Edit: Well, after a closer look I think it is not enough to just re-instantiate the QApplication if the executable is replaced.
                            One approach would be to write the application as a generic plugin loader and load all your application components as libraries. Then you can reload specific components after update of the physical DLL file.

                            Let's Try To Negotiate!

                            1 Reply Last reply
                            0

                            2/13

                            6 Apr 2017, 08:40

                            topic:navigator.unread, 11
                            • Login

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