Code Monkey home page Code Monkey logo

qtautoupdater's Introduction

QtAutoUpdater

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 Status Appveyor Build status Codacy Badge

The library was recently updated to version 3.0. That release differes strongly from 2.1. Use the Porting 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:
    • Qt Installer Framework (For cross platform desktop)
    • PackageKit (Works with most linux package managers)
    • Chocolatey (A package manager for Windows)
    • Homebrew (A package manager for macOs)
    • Google Playstore (for Android apps)
    • A custom backend that checks for updates based on a HTTP-request and can download and execute any update tool

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

Element Widgets Screenshots Quick Screenshots
Progress Dialog macOs Style Default Style
Information Dialog Windows Style Material Style
Update Button Fusion Style Imagine Style
Install Wizard KDE Style Universal 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 run source /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 prepare qdep
    • Install any potential dependencies for the plugins you need
    • 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.
    • qmake
    • make (If you want the tests/examples/etc. run make 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, 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.

Note: When preparing an application for the release, the windeployqt and macdeployqt will not include the plugins! You have to manually copy matching libraries from <QT_PLUGIN_DIR>/updaters. The d 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 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.

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>

int main(int argc, char *argv[])
{
	QCoreApplication a{argc, argv};
	//create the updater with the application as parent -> will live long enough start the tool on exit
	auto updater = new QtAutoUpdater::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 mode
			qDebug() << "Update info:" << updater->updateInfo();
			updater->runUpdater();
		}
		//Quit the application
		qApp->quit();
	});

	//start the update check
	updater->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 is reduced! for a full example with all parts of the controller, check the examples/autoupdatergui/WidgetsUpdater application.

#include <QApplication>
#include <QtAutoUpdaterWidgets/UpdateController>

int main(int argc, char *argv[])
{
	QApplication a{argc, argv};
	//Since there is no mainwindow, the various dialogs should not quit the app
	QApplication::setQuitOnLastWindowClosed(false);
	//first create an updater as usual
	auto updater = new QtAutoUpdater::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 windows
	auto controller = new QtAutoUpdater::UpdateController{updater, &a};
	//start the update check -> AskLevel to give the user maximum control
	controller->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 is reduced! for a full example with all parts of the controller, check the examples/autoupdaterquick/QuickUpdater application.

import de.skycoder42.QtAutoUpdater.Core 3.0
import de.skycoder42.QtAutoUpdater.Quick 3.0

ApplicationWindow {
	visible: true
	width: 360
	height: 600
	title: qsTr("Hello World")

	// Create the updater, just as you would in cpp
	property Updater globalUpdater: QtAutoUpdater.createUpdater(...)

	// the button to start the update check
	UpdateButton {
		anchors.centerIn: parent
		updater: globalUpdater
	}

	// dialog to show the check progress
	ProgressDialog {
		updater: globalUpdater
	}

	// dialog to show the update result
	UpdateResultDialog {
		updater: globalUpdater
		autoRunUpdater: true
	}
}

Documentation

The documentation is available on github pages. It was created using doxygen. 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 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.

Contributed translations:

Icon sources/Links

Test Project

qtautoupdater's People

Contributors

aalex420 avatar checor avatar rsp4jack avatar skycoder42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtautoupdater's Issues

[Qt6] Use CMake

As you may know, the Qt team has changed their policy regarding building tools, and went for CMake instead of their very own qmake for Qt6 (https://www.qt.io/blog/qt-6-build-system).

@Skycoder42, are you yourself familiar with CMake ? Would you consider maintaining CMake building scripts in parallel of qmake ones ?

Cheers !

Can't build for Qt 5.14.2

Hi, I'm using msvc2017 32bit and Qt 5.14.2 to build my application. However I can't include QtAutoUpdater in my project.

image

Using Qt5AutoUpdater w/ CMake & Qt5.6

I have attempted to add Qt5AutoUpdater to a project with CMake.

Initially, we attempted to just use source files and compile them ourselves. This appears to have some issues on MSVC, so I would prefer to just reference the compiled binaries.

I'm a relative novice with CMake, so any advice would be appreciated:

I have downloaded: 2.1.0 (which appears to have CMake files included, however, it is targeting Qt 5.8), and then the earlier 2.0.0 that do not have any CMake files.

Here is my attempt at a creating a CMakified version:
https://github.com/jordanbaucke/qtautoupdater_cmake

I removed:

include_directories("")
link_directories("")

As I wasn't sure if I needed to "install" the precompiled binaries first - or how to do that without seeing a CMakeLists.txt or Find_Package module for QtAutoUpdater.

Thanks.

Building QtAutoupdater from source

Hey, I am trying to build the latest commit of the QtAutoupdater to check if the latest fix works on Mac, build after downloading the source files from the release page and running qmake I get this error:
/usr/local/Qt-5.12.1/mkspecs/features/qt_build_config.prf:47: shadowed(path) requires one argument.

I can seem to be able to run qmake, I also tried rerunning qdep but that didn't fix the issue

Spanish support

Hello!

Your library is cool, and I'm intending to implement it in one of my projects ๐Ÿ‘

I can provide you a spanish translation, are you interested in adding it to your repo? I can send a pull request.

Cheers!

QtAutoUpdater

Hello,

Your module QtAutoUpdater is so amazing but I have some trouble with it.
I'm working on an app with your module, on your Wiki page for the "UpdateController" section it's said : "This example is reduced! for a full example with all parts of the controller, check the Tests/WidgetsTest application." but the "WidgetsTest" folder doesn't exist.
I also try to use this module in another C++ class (QMainWindow or QWidget), but it doesn't work. How to use your module with another QMainWindow or QWidget ?

Cordially,
Alex

qtautoupdater not included when building qt statically on Mac

I am using qtautupdater in one of my apps, I need to build the app (and Qt) statically for release. It works perfectly fine on windows, but when I try to build qt statically on my Mac it never includes the qtautoupdater library. I can build my app fine when I use the non-static version of qt (where I originally added QtAutoUpdater).

Is there some extra steps I need to take to include this library when I build qt statically ?

Replace remnants of TQtC-licensed code

Hello!

I want to statically link my commercial program with QtAutoUpdater. Given that this library is BSD-licensed this is acceptable. However, there are remnants of code borrowed from the earlier version of Qt Installer Framework in "adminauthoriser_" files. Their code is dual-licensed under LGPL or commercial license. As far as I understand this practically means that despite your work being BSD-licensed I am not allowed to link statically to it unless I pay The Qt Company a huge sum of money, which is an overkill for something as trivial as static linking to this particular library.

Could you rewrite the "contaminated" code please? It would seem it has already been done partially, at least in the Linux version of admin authorization, although I am not sure about the "qt_create_commandline" function (was it borrowed from QProcess API?).

Are there any other parts not licensed under BSD?

Build for Qt LTS, and source code can't be built

Please provide builds for Qt LTS versions, or don't make the versions work only on the Qt release it's built on.

I tried to build the current master source on MinGW32 7.3 on Windows 10, but it always fails with over 40+ errors, all related to source code itself (functions that don't exist, files not being included correctly, etc). I want to use the latest release on my program, but I can't build it.

For now, please provide a MinGW32 build for Qt 5.12.4 and Qt 5.12.5.

dialogmaster.h: No such file or directory

Trying to follow the instructions in the README, the library does currently not build:

progressdialog.cpp:5:10: fatal error: dialogmaster.h: No such file or directory
#include <dialogmaster.h>
^~~~~~~~~~~~~~~~
compilation terminated.

To replicate:
git clone https://github.com/Skycoder42/QtAutoUpdater.git
cd QtAutoUpdater
qmake
make qmake_all
make

I am using Qt 5.9.2 and the Qt IFW 3.0. According to the documentation, no additional tools or dependencies should be required for the build.

Please let us know what is missing. Thanks!

Adminauthorization does not work

Qt 5.6:
MAC OSX El Capitan:
AutoUpdaterGui/adminauthorization_mac.cpp:75: Warning: 'AuthorizationExecuteWithPrivileges' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
status = AuthorizationExecuteWithPrivileges(authorizationRef, utf8Program.data(),

2016-05-11 01 19 22

Windows 10:

screenshot_4426

What I do wrong?
If on windows comment this string (screenshot) then compiling is fine.
OS X able to solve the problem by writing return false; in AdminAuthorization::executeAsAdmin as first line.

Unable to connect to repository

Unfortunately I am unable to connect to your repository:
Failed to connect to install.skycoder42.de port 443: Connection refused

Many thanks for your library! :)

About the installation and use of QtAutoUpdater

Hello, I found this library a few days ago. When I read your document, you wrote in "Download/Install" that you can download compiled files, but I didn't find it. Can you tell me where it is?

Unknown module(s) in QT: autoupdatercore (Qt 5.12.0 x86 compiler MSVC 2017)

Hi.
In my application I decided to update the kit Qt and the compiler.
After upgrading Qt and installing Skycoder42 Qt modules with the QT kit 5.12.0 MSVC 2017 x32 received an error Unknown module (s) in QT: autoupdatercore.
I do not see Qt5AutoUpdaterCore.dll in path C: \ Qt \ 5.12.0 \ msvc2017 \ bin

Please give me advice on how to fix the problem.

QtAutoUpdater::Updater::create returns NULL on the release configuration

I've noticed that QtAutoUpdater::Updater::create method works on the debug configuration, but returns NULL on the release configuration. No errors in the log (I've installed a message handler, so any messages by AutoUpdater should be written in the log).

Code:

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    // Code above

    updater = QtAutoUpdater::Updater::create("qtifw", {{"path", qApp->applicationDirPath() + "/maintenancetool"}}, qApp);

    connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [&](QtAutoUpdater::Updater::State state)
    {
        switch (state)
        {
        case QtAutoUpdater::Updater::State::Error:
            qDebug() << "An error occured.";
            config.checkUpdates = false;
            break;
        case QtAutoUpdater::Updater::State::NoUpdates:
            qDebug() << "No updates are found";
            break;
        case QtAutoUpdater::Updater::State::NewUpdates:
            qDebug() << "An update is found" << updater->updateInfo();
            break;
        default: break;
        }
    });
}

Log file: QObject::connect(QtAutoUpdater::Updater, Unknown): invalid null parameter. This error is because updater is NULL. No other errors releated to AutoUpdater exists in the log.

No errors in the log file with the debug configuration. Everything works as expected.

I am using Qt 5.13.1 on Windows, and QtAutoUpdater 3.0 downloaded from the Qt maintenance tool repository.

Can't use your code

Hi Skycoder42,

I have connected your library to my project. but when I call your code (maintenancetool) it does not work.

This is what I get:
Has updates: false
Has errors: true

Can you help me with this? Or can you let me know what the reason is that it won't allow me to call the code within the function?

Inside my apps main tool the maintenancetoo manual code works correctly.

Looking for a Maintainer

I am no longer able to maintain this repository and am looking for a maintainer to take over.

Can't find MaintenanceTool path for Mac

When passing the maintenancetool path to
QtAutoupdater::UpdateController("path/maintenancetool.app", qApp)
The application crashes when the update button is clicked.

It works fine on windows with the following:
QtAutoupdater::UpdateController("path/maintenancetool.exe", qApp)

What should the path be like on mac? I cannot find an example (but I might just be bad at searching)

Please use Qt coding rules for better import of the library

That means an Qt include should go like:

#include <QtCore/QString>

instead of:

#include <QString>

use the macros: Q_SIGNALS:, Q_SLOTS instead of signals and slots

I would personally also don't user qoverload in order to be compatible with older Qt versions, e.g. 5.6

updatescheduler.cpp maintenancetool path error

File updatescheduler.cpp has error in line 7:

define TOOL_PATH QStringLiteral("../../maintenancetool");

right for osx will be:

define TOOL_PATH QStringLiteral("../../../maintenancetool");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.