Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Qt library to automatically check for updates and install them

License

NotificationsYou must be signed in to change notification settings

Skycoder42/QtAutoUpdater

Repository files navigation

Looking for a Maintainer! See #39

The Qt auto updater library is a library to automatically check for updates and install them based on various backends. This repository includes:

  • A library with the basic updater (without any GUI)
  • An automated Widgets GUI
  • An automated Quick GUI

Travis Build StatusAppveyor Build statusCodacy Badge

The library was recently updated to version 3.0. That release differes strongly from 2.1. Use thePorting Guide to get your application from 2.1 to 3.0!

Features

Core Library

  • Automatic Check for updates
  • Install updates in parallel or after exit
  • Simple update scheduling mechanism for the running instance
  • Currently 7 different backends are supported:

GUI Libraries

  • Applies for both, the widgets and the quick GUI
  • Automated classes that show dialogs etc. based on a configuration and guide the user through the update process
    • customizable: you can decide what to show
    • extended information dialog or simple dialog to show basic information about the update
  • A custom menu action and button for easy integration into the GUI
  • Prepared for translation and fully translated for:
    • German
    • French
    • Spanish (outdated)
    • Arabic

Screenshots

Here some random sample screenshots of the gui (The rocket of the information dialog is the "application icon" and depends on your application). These are various parts of the GUI in various different styles. The first row shows elements from the widgets module, the second from quick

ElementWidgets ScreenshotsQuick Screenshots
Progress DialogmacOs StyleDefault Style
Information DialogWindows StyleMaterial Style
Update ButtonFusion StyleImagine Style
Install WizardKDE StyleUniversal Style

Requirements

  • The core library only depends on QtCore
  • The widgets library only depends on QtWidgets
  • The quick library requires Qt Quick Controls 2
  • The plugins have different requirements. Typically the package managers and/or libraries associated with that plugin

Download/Installation

There are multiple ways to install the Qt module, sorted by preference:

  1. Package Managers: The library is available via:
    • Arch-Linux: AUR-Repository:qt5-autoupdater
    • MacOs:
      • Tap:brew tap Skycoder42/qt-modules
      • Package:qtautoupdater
      • IMPORTANT: Due to limitations of homebrew, you must runsource /usr/local/opt/qtautoupdater/bashrc.sh before you can use the module.
  2. Simply add my repository to your Qt MaintenanceTool (Image-based How-To here:Add custom repository):
    1. Start the MaintenanceTool from the commandline using/path/to/MaintenanceTool --addRepository <url> with one of the following urls (Alternatively you can add it via the GUI, as stated in the previously linked GUI):
    2. A new entry appears under all supported Qt Versions (e.g.Qt > Qt 5.13 > Skycoder42 Qt modules)
    3. You can install either all of my modules, or select the one you need:Qt Autoupdater
    4. Continue the setup and thats it! you can now use the module for all of your installed Kits for that Qt
  3. Download the compiled modules from the release page.Note: You will have to add the correct ones yourself and may need to adjust some paths to fit your installation!
  4. Build it yourself!Note: This requires perl to be installed. If you don't have/need cmake, you can ignore the related warnings. To automatically build and install to your Qt installation, run:
    • Install and prepareqdep
    • Install any potential dependencies for the plugins you need
    • Download the sources. Either usegit clone or download from the releases. If you choose the second option, you have to manually create a folder named.git in the projects root directory, otherwise the build will fail.
    • qmake
    • make (If you want the tests/examples/etc. runmake all)
    • Optional steps:
      • make doxygen to generate the documentation
      • make -j1 run-tests to build and run all tests
    • make install

Usage

The autoupdater is provided as a Qt module. Thus, all you have to do is add the module, and then, in your project, addQT += autoupdatercore orQT += autoupdaterwidgets to your .pro file - depending on what you need! For QML, you can import the library asde.skycoder42.QtAutoUpdater.Core andde.skycoder42.QtAutoUpdater.Quick.

Note: When preparing an application for the release, thewindeployqt andmacdeployqt willnot include the plugins! You have to manually copy matching libraries from<QT_PLUGIN_DIR>/updaters. Thed suffix is used on windows and the_debug suffix on macos for the debug version of the plugins.

Getting started

The following examples assumes you are using the Qt Installer Framework as backend. The usage is similar for all backends, as you only have to adjust the configuration. This document expects you to already know the installation system you are using. If you are new to all of this, I can personally recommend you to use the Qt Installer Framework. It is relatively easy to use and works for Linux, Windows and macOs.

Here are some links that will explain how to create an online-installer using the QtIFW framework. Once you have figured out how to do that, it's only a small step to the updater library:

Examples

Since this library requires the maintenancetool that is deployed with every Qt Installer Framework installation, the examples cannot be tested without a maintenancetool! If you intend to recreate this example, set the path to theMaintenanceTool that is deployed with the installation of Qt (or any other maintenancetool). So make shure to adjust the path if you try to run the examples.

Updater

The following example shows the basic usage of the updater. Only the core library is required for this example. It creates a new updater instance that is connected to the maintenancetool located at "C:/Qt/MaintenanceTool". As soon as the application starts, it will check for updates and print the update result. If updates are available, their details will be printed and the maintenancetool is scheduled to start on exit. In both cases, the application will quit afterwards.

#include<QCoreApplication>#include<QDebug>#include<QtAutoUpdaterCore/Updater>intmain(int argc,char *argv[]){QCoreApplication a{argc, argv};//create the updater with the application as parent -> will live long enough start the tool on exitauto updater =newQtAutoUpdater::Updater::create("qtifw", {{"path","C:/Qt/MaintenanceTool"}//.exe or .app is automatically added on the platform}, &a);QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](QtAutoUpdater::Updater::State state) {qDebug() <<"Update result:" << state;if (state == QtAutoUpdater::Updater::State::NewUpdates) {//As soon as the application quits, the maintenancetool will be started in update modeqDebug() <<"Update info:" << updater->updateInfo();updater->runUpdater();}//Quit the applicationqApp->quit();});//start the update checkupdater->checkForUpdates();return a.exec();}

UpdateController (QtWidgets)

This example will show you the full dialog flow of the update controller, which is used by the widgets library to control the update GUI flow. Since there is no mainwindow in this example, you will only see the controller dialogs. Please note that you can control how much of that dialogset will be shown to the user. This example isreduced! for a full example with all parts of the controller, check theexamples/autoupdatergui/WidgetsUpdater application.

#include<QApplication>#include<QtAutoUpdaterWidgets/UpdateController>intmain(int argc,char *argv[]){QApplication a{argc, argv};//Since there is no mainwindow, the various dialogs should not quit the appQApplication::setQuitOnLastWindowClosed(false);//first create an updater as usualauto updater =newQtAutoUpdater::Updater::create(...);//then create the update controller with the application as parent -> will live long enough start the tool on exit//since there is no parent window, all dialogs will be top-level windowsauto controller =new QtAutoUpdater::UpdateController{updater, &a};//start the update check -> AskLevel to give the user maximum controlcontroller->start(QtAutoUpdater::UpdateController::DisplayLevel::Ask);return a.exec();}

Quick GUI

Unlike the widgets variant, in quick you simply place all the components you want to be shown and attach the to an updater. The flow is created automatically, since all the components know when to show up. It was designed differently, as QML follows a declarative approach. The following shows a basic QML based GUI using simple dialogs. This example isreduced! for a full example with all parts of the controller, check theexamples/autoupdaterquick/QuickUpdater application.

importde.skycoder42.QtAutoUpdater.Core3.0importde.skycoder42.QtAutoUpdater.Quick3.0ApplicationWindow {visible:truewidth:360height:600title:qsTr("Hello World")// Create the updater, just as you would in cppproperty Updater globalUpdater:QtAutoUpdater.createUpdater(...)// the button to start the update checkUpdateButton {anchors.centerIn: parentupdater: globalUpdater}// dialog to show the check progressProgressDialog {updater: globalUpdater}// dialog to show the update resultUpdateResultDialog {updater: globalUpdaterautoRunUpdater:true}}

Documentation

The documentation is available ongithub pages. It was created usingdoxygen. The HTML-documentation and Qt-Help files are shipped together with the module for both the custom repository and the package on the release page. Please note that doxygen docs do not perfectly integrate with QtCreator/QtAssistant.

Translations

The core library does not need any translation, because it won't show anything to the user. The Gui library however does. The project is prepared for translation. Only a few translations are provided. However, you can easily create the translations yourself. The filesrc/translations/qtautoupdater_template.ts is a ready-made TS file. Just rename it (e.g. toqtautoupdater_jp.ts) and open it with the QtLinguist to create the translations.

Contributed translations:

Icon sources/Links

Test Project


[8]ページ先頭

©2009-2025 Movatter.jp