Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Announcements
  4. A simple updater system for your projects
Forum Updated to NodeBB v4.3 + New Features

A simple updater system for your projects

Scheduled Pinned Locked Moved Announcements
6 Posts 4 Posters 3.5k Views 1 Watching
  • 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.
  • alex_spataruA Offline
    alex_spataruA Offline
    alex_spataru
    wrote on last edited by
    #1

    Hello,

    Recently, I found the need to implement a way to check for updates in some of my Qt applications, however I did not find any library to do the job, so I decided to write it myself. After implementing the updater system, I thought that it would be very helpful to develop a "library" that would be easy to implement and would work for almost any Qt project (you just need to include a *.pri file in your project). Of course, the system is supported on any OS that is supported by Qt and SSL.

    The idea behind this updater system is simple, you will need to have the following files in a remote server which can be accessed by HTTP:

    • A plain text file containing only the latest version number of your app.

    • A file that contains the changelog in any format you desire.

    Then, you just tell QSimpleUpdater where the files are and it will do the rest of the work for you. A minimalist example would be:

    @QSimpleUpdater *updater;

    // Point out the version of the local (installed) application (obligatory)
    updater->setApplicationVersion(qApp->applicationVersion());

    // Point out where the changelog file is (optional)
    updater->setChangelogUrl("http://myapp.com/updater/changelog.txt");

    // Point out where the file containing the latest app version is (obligatory)
    updater->setReferenceUrl("http://myapp.com/updater/latest.txt");

    // Point out the URL to open when we call the downloadLatestVersion() function (optional)
    updater->setDownloadUrl("http://myapp.com/download");

    // Do something when the updater finishes checking for updates (such as showing a messagebox)
    connect(updater, SIGNAL(checkingFinished()), this, SLOT(onCheckingFinished()));

    // Finally, check for updates
    updater->checkForUpdates();@

    I have written an example that will help anyone interested in the project to implement it in their own projects.

    You can find the source of QSimpleUpdater "here":https://github.com/alex-97/qsimpleupdater.

    Any feedback is greatly appreciated :)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Nice project, thanks for sharing!

      (Z(:^

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Interesting !

        One thing that is missing is the possibility to download files directly.

        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
        • alex_spataruA Offline
          alex_spataruA Offline
          alex_spataru
          wrote on last edited by
          #4

          Hi,

          I implemented an updater dialog in the last commit, the dialog allows the user to see the progress of the download and open the downloaded file by clicking the "Install" button.

          To use the dialog, just specify which file to download with the setDownloadUrl() function, call checkForUpdates() and then downloadLatestVersion().

          Screenshots:

          !https://raw.githubusercontent.com/alex-97/QSimpleUpdater/Files-for-example-project/images/Window_1.png(Window 1)!

          !https://raw.githubusercontent.com/alex-97/QSimpleUpdater/Files-for-example-project/images/Window_2.png(Window 2)!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Are you planning on offering a Pause/Reset (e.g.) mode when downloading ?

            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
            • S Offline
              S Offline
              sanx
              wrote on last edited by
              #6

              I tried to check example application given by you but, it gives error when we click on check for update button. the error "An unknown error occured while checking for updates" pops-up on click of check for update button. can you suggest me what to do?

              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