How can I enable auto-updates in a Qt cross-platform application?

前端 未结 12 511
孤街浪徒
孤街浪徒 2020-12-22 18:37

I love applications that are able to update themselves without any effort from the user (think: Sparkle framework for Mac). Is there any code/library I can leverage to do th

相关标签:
12条回答
  • 2020-12-22 19:19

    Shameless plug: Fervor, a simple multiplatform (Qt-based) application autoupdater inspired by Sparkle.

    0 讨论(0)
  • 2020-12-22 19:23

    The blog post Mixing Cocoa and Qt may solve the problem for the Mac platform.

    0 讨论(0)
  • 2020-12-22 19:26

    Shameless plug: this a relatively old question, but I thought that it may be useful to mention a library that I created recently, which I named "QSimpleUpdater". Aside from notifying you if there's a newer version, it allows you to download the change log in any format (such as HTML or RTF) and download the updates directly from your application using a dialog.

    As you may expect from a Qt project, it works on any platform supported by Qt (tested on Windows, Mac & Linux).

    Links:

    • Website
    • GitHub repository

    Screenshot:

    enter image description here

    0 讨论(0)
  • 2020-12-22 19:29

    Though it works a bit differently than Sparkle, BitRock InstallBuilder contains an autoupdater written in Qt that can be used independently (disclaimer, I am the original BitRock developer). It is a commercial app, but we have free licenses for open source projects.

    0 讨论(0)
  • 2020-12-22 19:31

    It is not a complete solution, but a cross-platform (Windows, Mac, Linux) tool for creating packages for auto-updates and installing them is available at https://github.com/mendeley/Update-Installer. This tool does not deal with publishing updates or downloading them.

    This was written for use with a Qt-based application but to make the update installer small, standalone and easy to build, the installer uses only standard system libraries (C++ runtime, pthreads/libz/libbz2 on Linux/Mac, Win32 API on Windows, Cocoa on Mac, GTK with fallback on Linux). This simplifies delivering updates which include new versions of Qt and other non-system libraries that your application may depend on.

    Before considering this though, I would suggest:

    • If you are only building for two platforms, consider using standard and well-tested auto-update frameworks for those platforms - eg. Sparkle on Mac, Google's Omaha on Windows or auto-update systems built into popular install frameworks (eg. InstallShield). I haven't tried BitRock.
    • On Mac, the Mac App Store may be a good option. See https://bugreports.qt.io/browse/QTBUG-16549 though.
    • On Linux, consider creating a .deb package and a simple repository to host it. Once users have a repository set up, the system-wide software update tools will take care of checking for and installing new releases. The steps for setting up a new repository however are too complex for many new Ubuntu/Debian users. What we did, and also what Dropbox and Google have done, is to create a .deb package which sets up the repository as part of the package installation.

    A few other notes on creating an updater:

    • On Windows Vista/7, if the application is installed system-wide (eg. in C:\Program Files\$APPNAME) your users will see a scary UAC prompt when the updater tries to obtain permissions to write to the install directory. This can be avoided either by installing to a user-writable directory (I gather that this is what Google Chrome does) or by obtaining an Authenticode certificate and using it to sign the updater binary.
    • On Windows Vista/7, an application .exe or DLL cannot be deleted if in use, but the updater can move the existing .exe/DLL out of the way into a temporary directory and schedule it for deletion on the next reboot.
    • On Ubuntu, 3rd-party repositories are disabled after distribution updates. Google works around this by creating a cron-job to re-add the repository if necessary.
    0 讨论(0)
  • 2020-12-22 19:32

    This is an old question but there is not Squirrel in answers which is BEST SOLUTION , here is what I'm doing in qt 5.12.4 with qt quick "my qml app" you can do this in any other language

    I'm doing this in windows there is mac version of squirrel too, I don't know about Linux

    1. download nuget package explorer release https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/releases
    2. open nuget package explorer and add this directory 'lib/net45' it doesn't matter you have a .net app or not, I did this for my qt application otherwise it won't work.
    3. add all files into this folder specify your version in the metadata
    4. save nupkg file
    5. download squirrel release https://github.com/Squirrel/Squirrel.Windows/releases
    6. add squirrel to windows environment path
    7. open cmd and cd to directory of nupkg file
    8. squirrel --releasify file_name.nupkg -> now inide releases folder, there should be setup.exe file which will install app and other files.
    9. to create new version do 2,3,4,7,8 again if its an update it will create delta file which is only needed file to update, put this files into your service directory for example in updates folder of your website which you need to disable directory browsing in IIS , and to auto-update application you need to call Update.exe which is in parent folder of application root directory appdir/../update.exe --update http://yourserver.com/upates/ after application restart app should start with new version
    10. you can find documentation for squirrel in https://github.com/Squirrel/Squirrel.Windows/blob/develop/docs/getting-started/0-overview.md and nuget package explorer here https://github.com/NuGetPackageExplorer/NuGetPackageExplorer and you can use only nuget.exe too if you don't want to use nuget package explorer which can be used for dynamic generation of versions, which can be download from https://www.nuget.org/downloads

    That easy. Now you have auto-update app which will download updates from the server and auto-update app. For more info you can read documentations.
    note: for iis uses https://github.com/Squirrel/OldSquirrelForWindows/issues/205

    0 讨论(0)
提交回复
热议问题