Skip to content

Commit e9fc852

Browse files
committed
update readme
1 parent ed9c9ee commit e9fc852

File tree

1 file changed

+112
-61
lines changed

1 file changed

+112
-61
lines changed

README.md

Lines changed: 112 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
# QtAutoUpdater
22

3-
The Qt auto updater library is a library to automatically check for updates and install them. This repository includes:
3+
The Qt auto updater library is a library to automatically check for updates and install them based on various backends. This repository includes:
4+
45
- A library with the basic updater (without any GUI)
5-
- A second library that requires the first one and adds basic GUI features
6+
- An automated Widgets GUI
7+
- An automated Quick GUI
68

79
[![Travis Build Status](https://travis-ci.org/Skycoder42/QtAutoUpdater.svg?branch=master)](https://travis-ci.org/Skycoder42/QtAutoUpdater)
810
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/5iw2byrvnsdfytxv/branch/master?svg=true)](https://ci.appveyor.com/project/Skycoder42/qtautoupdater/branch/master)
911
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a5b2e3cc66c644869515d2f3a5c3ff49)](https://www.codacy.com/app/Skycoder42/QtAutoUpdater)
1012

13+
> The library was recently updated to version 3.0. That release differes strongly from 2.*. Use the [Porting Guide](port_to_3_0.md) to get your application from 2.* to 3.0!
14+
1115
## Features
1216
### Core Library
13-
- Automatic Check for updates using the maintenancetool
14-
- Can automatically run the maintenancetool after the application finished
15-
- To run as admin/root, either use the GUI library or implement it yourself (via an interface)
16-
- Simple update scheduling mechanism for the running instance
17-
18-
### GUI Library
19-
- Requires Widgets (no direct QML-support, and I'm not intending to create one. The library can be used for QML applications, since it operates mostly with own windows. If you want to use the updater in QML, do the connection yourself!)
20-
- Automated controller to guide the user through the check-for-updates process
17+
- Automatic Check for updates
18+
- Install updates in parallel or after exit
19+
- Simple update scheduling mechanism for the running instance
20+
- Currently 7 different backends are supported:
21+
- [Qt Installer Framework](https://doc.qt.io/qtinstallerframework/index.html) (For cross platform desktop)
22+
- [PackageKit](https://www.freedesktop.org/software/PackageKit/) (Works with most linux package managers)
23+
- [Chocolatey](https://chocolatey.org/) (A package manager for Windows)
24+
- [Homebrew](https://brew.sh/) (A package manager for macOs)
25+
- [Google Playstore](https://play.google.com/store) (for Android apps)
26+
- A custom backend that checks for updates based on a HTTP-request and can download and execute any update tool
27+
28+
### GUI Libraries
29+
- Applies for both, the widgets and the quick GUI
30+
- Automated classes that show dialogs etc. based on a configuration and guide the user through the update process
2131
- customizable: you can decide what to show
2232
- extended information dialog or simple dialog to show basic information about the update
23-
- "Run as Admin/root" fully supported on all 3 platforms
24-
- UpdateAction -> a QAction that starts the updater
25-
- UpdateButton -> a button with a busy-indicator to to the same
26-
- *Prepared* for translation
33+
- A custom menu action and button for easy integration into the GUI
34+
- *Prepared* for translation and fully translated for:
35+
- German
36+
- French
37+
- Spanish
38+
- Arabic (outdated)
2739

2840
#### Screenshots
2941
Here some sample screenshots of the gui (The rocket of the information dialog is the "application icon" and depends on your application)
@@ -36,63 +48,77 @@ Here some sample screenshots of the gui (The rocket of the information dialog is
3648
| Update Action | ![Update Action](./doc/images/win_action.png) | ![Update Action](./doc/images/mac_action.png) | ![Update Action](./doc/images/x11_action.png) |
3749

3850
## Requirements
39-
- Qt Installer Framework: The updater requires the application to be installed using the framework and will use the frameworks update mechanism to check for updates (https://doc.qt.io/qtinstallerframework/, download at via Qt MaintenanceTool)
40-
- Since the Installer Framework supports Windows, Mac and X11 only, it's the same for this library
51+
- The core library only depends on QtCore
52+
- The widgets library only depends on QtWidgets
53+
- The quick library requires Qt Quick Controls 2
54+
- The plugins have different requirements. Typically the package managers and/or libraries associated with that plugin
4155

4256
## Download/Installation
4357
There are multiple ways to install the Qt module, sorted by preference:
4458

45-
1. Simply add my repository to your Qt MaintenanceTool (Image-based How-To here: [Add custom repository](https://github.com/Skycoder42/QtModules/blob/master/README.md#add-my-repositories-to-qt-maintenancetool)):
46-
1. Start the MaintenanceTool from the commandline using `/path/to/MaintenanceTool --addTempRepository <url>` with one of the following urls (GUI-Method is currently broken, see [QTIFW-1156](https://bugreports.qt.io/browse/QTIFW-1156)) - This must be done *every time* you start the tool:
59+
1. Package Managers: The library is available via:
60+
- **Arch-Linux:** AUR-Repository: [`qt5-autoupdater`](https://aur.archlinux.org/packages/qt5-autoupdater/)
61+
- **MacOs:**
62+
- Tap: [`brew tap Skycoder42/qt-modules`](https://github.com/Skycoder42/homebrew-qt-modules)
63+
- Package: `qtautoupdater`
64+
- **IMPORTANT:** Due to limitations of homebrew, you must run `source /usr/local/opt/qtautoupdater/bashrc.sh` before you can use the module.
65+
2. Simply add my repository to your Qt MaintenanceTool (Image-based How-To here: [Add custom repository](https://github.com/Skycoder42/QtModules/blob/master/README.md#add-my-repositories-to-qt-maintenancetool)):
66+
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):
4767
- On Linux: https://install.skycoder42.de/qtmodules/linux_x64
4868
- On Windows: https://install.skycoder42.de/qtmodules/windows_x86
4969
- On Mac: https://install.skycoder42.de/qtmodules/mac_x64
50-
2. A new entry appears under all supported Qt Versions (e.g. `Qt > Qt 5.11 > Skycoder42 Qt modules`)
51-
3. You can install either all of my modules, or select the one you need: `Qt Auto Updater`
70+
2. A new entry appears under all supported Qt Versions (e.g. `Qt > Qt 5.13 > Skycoder42 Qt modules`)
71+
3. You can install either all of my modules, or select the one you need: `Qt Autoupdater`
5272
4. Continue the setup and thats it! you can now use the module for all of your installed Kits for that Qt
53-
2. 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!
54-
3. 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:
73+
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!
74+
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:
5575
- Install and prepare [qdep](https://github.com/Skycoder42/qdep#installation)
76+
- Install any potential dependencies for the plugins you need
77+
- Download the sources. Either use `git 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.
5678
- `qmake`
5779
- `make` (If you want the tests/examples/etc. run `make all`)
58-
- Optional step: `make doxygen` to generate the documentation
80+
- Optional steps:
81+
- `make doxygen` to generate the documentation
82+
- `make -j1 run-tests` to build and run all tests
5983
- `make install`
6084

85+
6186
## Usage
62-
The autoupdater is provided as a Qt module. Thus, all you have to do is add the module, and then, in your project, add `QT += autoupdatercore` or `QT += autoupdatergui` to your .pro file - depending on what you need!
87+
The autoupdater is provided as a Qt module. Thus, all you have to do is add the module, and then, in your project, add `QT += autoupdatercore` or `QT += autoupdaterwidgets` to your .pro file - depending on what you need! For QML, you can import the library as `de.skycoder42.QtAutoUpdater.Core` and `de.skycoder42.QtAutoUpdater.Quick`.
6388

6489
### Getting started
65-
The usage of this library is not that complicated. However, to make this work you will have to use the Qt Installer Framework to create an installer/updater. If you already know how to to that, just check out the examples below. If not, here are some links that
66-
will explain how to create an online-installer using the framework. Once you have figured out how to do that, it's only a small step
67-
to the updater library:
90+
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.
91+
92+
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:
6893
- [QtIFW - Tutorial: Creating an Installer](https://doc.qt.io/qtinstallerframework/ifw-tutorial.html): Check this to learn how to create an installer in general. Don't be afraid, it's a very short tutorial
6994
- [QtIFW - Creating Online Installers](https://doc.qt.io/qtinstallerframework/ifw-online-installers.html): This page will tell you how to create an online installer from your offline installer - in just 2 steps
7095
- [QtIFW - Promoting Updates](https://doc.qt.io/qtinstallerframework/ifw-updates.html): And this site explains how to create updates
7196

7297
### Examples
73-
**Important:**<br>
74-
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 use this library, the maintenancetool will be available for your final application. For testing purpose or the examples, I set the path to the `MaintenanceTool` 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.
98+
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 the `MaintenanceTool` 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.
7599

76100
#### Updater
77101
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.
78102

79103
```cpp
80104
#include <QCoreApplication>
81105
#include <QDebug>
82-
#include <updater.h>
106+
#include <QtAutoUpdaterCore/Updater>
83107

84108
int main(int argc, char *argv[])
85109
{
86-
QCoreApplication a(argc, argv);
110+
QCoreApplication a{argc, argv};
87111
//create the updater with the application as parent -> will live long enough start the tool on exit
88-
QtAutoUpdater::Updater *updater = new QtAutoUpdater::Updater("C:/Qt/MaintenanceTool", &a);//.exe is automatically added
112+
auto updater = new QtAutoUpdater::Updater::create("qtifw", {
113+
{"path", "C:/Qt/MaintenanceTool"} //.exe or .app is automatically added on the platform
114+
}, &a);
89115

90-
QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](bool hasUpdate, bool hasError) {
91-
qDebug() << "Has updates:" << hasUpdate << "\nHas errors:" << hasError;
92-
if(hasUpdate) {
116+
QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](QtAutoUpdater::Updater::State state) {
117+
qDebug() << "Update result:" << state;
118+
if (state == QtAutoUpdater::Updater::State::NewUpdates) {
93119
//As soon as the application quits, the maintenancetool will be started in update mode
94-
updater->runUpdaterOnExit();
95120
qDebug() << "Update info:" << updater->updateInfo();
121+
updater->runUpdater();
96122
}
97123
//Quit the application
98124
qApp->quit();
@@ -104,55 +130,80 @@ int main(int argc, char *argv[])
104130
}
105131
```
106132
107-
#### UpdateController
108-
This example will show you the full dialog flow of the controller. Both libraries are required for this example. 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 is *reduced*! for a full example with all parts of the controller, check the `examples/autoupdatergui/WidgetsUpdater` application.
133+
#### UpdateController (QtWidgets)
134+
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 is *reduced*! for a full example with all parts of the controller, check the `examples/autoupdatergui/WidgetsUpdater` application.
109135
110136
```cpp
111137
#include <QApplication>
112-
#include <updatecontroller.h>
138+
#include <QtAutoUpdaterWidgets/UpdateController>
113139
114140
int main(int argc, char *argv[])
115141
{
116-
QApplication a(argc, argv);
142+
QApplication a{argc, argv};
117143
//Since there is no mainwindow, the various dialogs should not quit the app
118144
QApplication::setQuitOnLastWindowClosed(false);
119-
//create the update controller with the application as parent -> will live long enough start the tool on exit
145+
//first create an updater as usual
146+
auto updater = new QtAutoUpdater::Updater::create(...);
147+
//then create the update controller with the application as parent -> will live long enough start the tool on exit
120148
//since there is no parent window, all dialogs will be top-level windows
121-
QtAutoUpdater::UpdateController *controller = new QtAutoUpdater::UpdateController("C:/Qt/MaintenanceTool", &a);//.exe is automatically added
122-
123-
QObject::connect(updater, &QtAutoUpdater::UpdateController::runningChanged, [updater](bool running) {
124-
qDebug() << "Running changed:" << running;
125-
//quit the application as soon as the updating finished
126-
if(!running)
127-
qApp->quit();
128-
});
129-
149+
auto controller = new QtAutoUpdater::UpdateController{updater, &a};
130150
//start the update check -> AskLevel to give the user maximum control
131-
controller->start(QtAutoUpdater::UpdateController::AskLevel);
151+
controller->start(QtAutoUpdater::UpdateController::DisplayLevel::Ask);
132152
return a.exec();
133153
}
134154
```
135155

156+
#### Quick GUI
157+
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 is *reduced*! for a full example with all parts of the controller, check the `examples/autoupdaterquick/QuickUpdater` application.
158+
159+
```qml
160+
import de.skycoder42.QtAutoUpdater.Core 3.0
161+
import de.skycoder42.QtAutoUpdater.Quick 3.0
162+
163+
ApplicationWindow {
164+
visible: true
165+
width: 360
166+
height: 600
167+
title: qsTr("Hello World")
168+
169+
// Create the updater, just as you would in cpp
170+
property Updater globalUpdater: QtAutoUpdater.createUpdater(...)
171+
172+
// the button to start the update check
173+
UpdateButton {
174+
anchors.centerIn: parent
175+
updater: globalUpdater
176+
}
177+
178+
// dialog to show the check progress
179+
ProgressDialog {
180+
updater: globalUpdater
181+
}
182+
183+
// dialog to show the update result
184+
UpdateResultDialog {
185+
updater: globalUpdater
186+
autoRunUpdater: true
187+
}
188+
}
189+
```
190+
136191
## Documentation
137-
The documentation is available on [github pages](https://skycoder42.github.io/QtAutoUpdater/). It was created using [doxygen](http://www.doxygen.org/). The HTML-documentation and Qt-Help files are shipped
138-
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.
192+
The documentation is available on [github pages](https://skycoder42.github.io/QtAutoUpdater/). It was created using [doxygen](http://www.doxygen.org/). 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.
139193

140194
## Translations
141-
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 german and spanish translations are provided. However, you can easily create the translations yourself. The file `src/autoupdatergui/translations/QtAutoUpdaterController_template.ts` is a ready-made TS file. Just rename it (e.g. to `QtAutoUpdaterController_jp.ts`) and open it with the QtLinguist to create the translations.
195+
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 file `src/translations/qtautoupdater_template.ts` is a ready-made TS file. Just rename it (e.g. to `qtautoupdater_jp.ts`) and open it with the QtLinguist to create the translations.
142196

143197
### Contributed translations:
144-
- French by @aalex420
145-
- Spanish by @checor
146-
- Arabic by @abdullah-radwan
198+
- French by [@aalex420](https://github.com/aalex420)
199+
- Spanish by [@checor](https://github.com/checor)
200+
- Arabic by [@abdullah-radwan](https://github.com/abdullah-radwan)
147201

148202
## Icon sources/Links
149203
- [FatCow Free Icons](https://www.fatcow.com/free-icons)
150204
- [Icons - Material Design](https://material.io/resources/icons/?style=outline)
151205
- [IconArchive](http://www.iconarchive.com/)
152-
153-
### GUI Library
154-
- http://www.fatcow.com/free-icons
155-
- http://www.ajaxload.info/
206+
- http://www.ajaxload.info/
156207

157208
### Test Project
158209
- http://www.oxygen-icons.org/

0 commit comments

Comments
 (0)