A simple updater system for your projects



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


  • Moderators

    Nice project, thanks for sharing!


  • Lifetime Qt Champion

    Hi,

    Interesting !

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



  • 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)!


  • Lifetime Qt Champion

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



  • 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?


Log in to reply
 

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