Git Product home page Git Product logo

updater's Introduction

An updater for Qt apps

This is an extensible updater for Qt apps. It can wrap Sparkle on macOS and use its own implementation on Windows and Linux. I use it in my apps at https://flavio.tordini.org .

Design

The main interface is Updater. A shared Updater subclass instance should be set on startup using Updater::setInstance(). Available implementations are:

User Interface

Built-in Widgets

Updater provides ready-to-use widgets:

  • Updater::getAction() returns a QAction suitable to be inserted in a QMenu.
  • Updater::getLabel() returns a QLabel that automatically changes its message. Typically used in the about box.
  • Updater::getButton() returns a QPushButton that autohides or automatically changes its function depending on the Updater status.

When the user triggers the action or pushes the button a dialog will show which is dependent on the Updater implementation.

Entension Points

updater::DefaultUpdater has a number of extension points so it can be adapted to different release manifest formats and update mechanisms.

Parser

Implement updater::Parser to parse your own manifest format. There are two ready-to-use parsers:

Set the desired Parser implementation using updater::DefaultUpdater::setParser. The default is [updater::AppcastParser].

Installer

updater::Installer is the abstraction responsible for preparing and running the update process. Currently the only available Installer implementation is updater::RunInstaller. It just runs an executable update payload, optionally with arguments.

Installer can be implemented in other ways, for example an Installer that unzips a payload and moves files. Or one that invokes an update helper. Another idea is signature validation.

Set the desired Installer implementation using updater::DefaultUpdater::setInstaller. The default is [updater::RunInstaller].

Build Instructions

qmake

mkdir build
cd build
qmake ..
make

Integration

You can use this library as a git submodule. For example, add it to your project inside a lib subdirectory:

git submodule add -b master https://github.com/flaviotordini/updater lib/updater

Then you can update your git submodules like this:

git submodule update --init --recursive --remote

To integrate the library in your qmake based project just add this to your .pro file:

include(lib/updater/updater.pri)

qmake builds all object files in the same directory. In order to avoid filename clashes use:

CONFIG += object_parallel_to_source

Examples

Example setup of the shared Updater instance:

#include "updater.h"
#ifdef UPDATER_SPARKLE
#include "sparkleupdater.h"
#else
#include "defaultupdater.h"
#endif

void setupUpdater() {
    #ifdef UPDATER_SPARKLE
        Updater::setInstance(new updater::SparkleUpdater());
    #else
        auto updater = new updater::DefaultUpdater();
        updater->setManifestUrl(myAppcastUrl);
        Updater::setInstance(updater);
    #endif
}

Updater provides a QAction instance ready to be used in a menu.

myMenu->addAction(Updater::instance().getAction());

In the About box you can use the standard widgets provided by Updater. A QLabel and a QPushButton.

myLayout->addWidget(Updater::instance().getLabel());
myLayout->addWidget(Updater::instance().getButton());

Security

Always serve your manifest files and binary updates via HTTPS.

License

You can use this library under the GPLv3 license terms. If you do, you're welcome contributing your changes and fixes. Donations are welcome at https://flavio.tordini.org/donate

For commercial projects I ask for a one-time license fee, contact me at [email protected]

updater's People

Contributors

flaviotordini avatar

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.