QtAutoUpdater  3.0.0
A Qt library to automatically check for updates and install them
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
QtAutoUpdater::UpdateController Class Reference

A class to show a controlled update GUI to the user. More...

#include <updatecontroller.h>

+ Inheritance diagram for QtAutoUpdater::UpdateController:

Public Types

enum  DisplayLevel {
  DisplayLevel::Automatic = 0, DisplayLevel::Exit = 1, DisplayLevel::Info = 2, DisplayLevel::ExtendedInfo = 3,
  DisplayLevel::Progress = 4, DisplayLevel::Ask = 5
}
 Defines the different display-levels of the dialog. More...
 

Public Slots

void setDisplayLevel (DisplayLevel displayLevel)
 WRITE accessor for UpdateController::displayLevel.
 
void setDesktopFileName (QString desktopFileName)
 WRITE accessor for UpdateController::desktopFileName.
 
void setUpdater (QtAutoUpdater::Updater *updater)
 WRITE accessor for UpdateController::updater.
 
void setInstallScope (QtAutoUpdater::Updater::InstallScope installScope)
 WRITE accessor for UpdateController::installScope.
 
void setDetailedUpdateInfo (bool detailedUpdateInfo)
 WRITE accessor for UpdateController::detailedUpdateInfo.
 
bool start ()
 Starts the controller. More...
 
bool start (DisplayLevel displayLevel)
 Sets the display level and then starts the controller. More...
 

Signals

void displayLevelChanged (DisplayLevel displayLevel, QPrivateSignal)
 NOTIFY accessor for UpdateController::displayLevel.
 
void desktopFileNameChanged (const QString &desktopFileName, QPrivateSignal)
 NOTIFY accessor for UpdateController::desktopFileName.
 
void updaterChanged (QtAutoUpdater::Updater *updater, QPrivateSignal)
 NOTIFY accessor for UpdateController::updater.
 
void installScopeChanged (QtAutoUpdater::Updater::InstallScope installScope, QPrivateSignal)
 NOTIFY accessor for UpdateController::installScope.
 
void detailedUpdateInfoChanged (bool detailedUpdateInfo, QPrivateSignal)
 NOTIFY accessor for UpdateController::detailedUpdateInfo.
 

Public Member Functions

 UpdateController (QObject *parent=nullptr)
 Default constructor without a window. Will be application modal. More...
 
 UpdateController (QWidget *parentWindow)
 Default constructor for a window. Will modal to the parent window. More...
 
 UpdateController (Updater *updater, QObject *parent=nullptr)
 Constructs a new controller with an updater but without a window. Will be application modal. More...
 
 UpdateController (Updater *updater, QWidget *parentWindow)
 Constructs a new controller with an updater and for a window. Will modal to the parent window. More...
 
QWidgetparentWindow () const
 Returns the parent window, if one is used. More...
 
DisplayLevel displayLevel () const
 READ accessor for UpdateController::displayLevel.
 
QString desktopFileName () const
 READ accessor for UpdateController::desktopFileName.
 
Updaterupdater () const
 READ accessor for UpdateController::updater.
 
Updater::InstallScope installScope () const
 READ accessor for UpdateController::installScope.
 
bool isDetailedUpdateInfo () const
 READ accessor for UpdateController::detailedUpdateInfo.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Static Public Member Functions

static QActioncreateUpdateAction (Updater *updater, QObject *parent)
 Create a QAction to start an update check from. More...
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 

Properties

QtAutoUpdater::Updater updater
 The updater beeing used by the controller. More...
 
DisplayLevel displayLevel
 The display level, managing which parts of the GUI are shown. More...
 
QString desktopFileName
 The path to the desktop file of the application. More...
 
QtAutoUpdater::Updater::InstallScope installScope
 The scope to be used when launching an installation. More...
 
bool detailedUpdateInfo
 Specifies, whether information about updates should be detailed or not. More...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Detailed Description

A class to show a controlled update GUI to the user.

The update-controller is a helpful tool if you want to show a simple GUI to the users. It offers an automated update process, controlled by the user. All thats left for you to do is starting this controller. When creating the controller, it attaches to the updater passed to it. Whenever the updater changes it's state, a GUI is automatically shown based on the displayLevel. This means you can either start the GUI by directly using the controller, or by doing it via the underlying updater.

To start updates, you can do the following:

Images

For a full collection of all immages, please go to the Image Page

See also
QtAutoUpdater::Updater, QtAutoUpdater::UpdateButton

Definition at line 19 of file updatecontroller.h.

Member Enumeration Documentation

◆ DisplayLevel

Defines the different display-levels of the dialog.

Enumerator
Automatic 

The lowest level. Nothing will be displayed at all. The programm will be auto-closed.

Exit 

The whole updating works completly automatically without displaying anything. Only a notification that updates are ready to install will be shown if updates are available.

Info 

Will show information about updates if available, nothing otherwise.

ExtendedInfo 

Will show information about the update result, for both cases, updates and no updates.

Progress 

Shows a modal progress dialog while checking for updates.

Ask 

The highest level. Will ask the user if he wants to check for updates before actually checking.

Definition at line 36 of file updatecontroller.h.

Constructor & Destructor Documentation

◆ UpdateController() [1/4]

QtAutoUpdater::UpdateController::UpdateController ( QObject parent = nullptr)
explicit

Default constructor without a window. Will be application modal.

Parameters
parentThe parent object. Will serve as parent for the controller

The created controller will not be bound to a specific window. Instead, all it's dialogs will be top-level windows without a parent and application modal. You can change this by using a QWidget as parent via setParent().

See also
UpdateController::parentWindow, QObject::parent, QObject::setParent

◆ UpdateController() [2/4]

QtAutoUpdater::UpdateController::UpdateController ( QWidget parentWindow)
explicit

Default constructor for a window. Will modal to the parent window.

Parameters
parentWindowThe parent window. Will serve as parent for the windows and the controller

The created controller will be bound to the widget. This means all dialogs will be child windows of the widgets window. On Mac, dialogs will be shown as "Sheets" of the parent window. You can change this by using a non QWidget as parent via setParent().

See also
UpdateController::parentWindow, QObject::parent, QObject::setParent

◆ UpdateController() [3/4]

QtAutoUpdater::UpdateController::UpdateController ( Updater updater,
QObject parent = nullptr 
)
explicit

Constructs a new controller with an updater but without a window. Will be application modal.

Parameters
updaterThe updater to be used by the controller
parentThe parent object. Will serve as parent for the controller

The created controller will not be bound to a specific window. Instead, all it's dialogs will be top-level windows without a parent and application modal. You can change this by using a QWidget as parent via setParent().

See also
UpdateController::parentWindow, QObject::parent, QObject::setParent

◆ UpdateController() [4/4]

QtAutoUpdater::UpdateController::UpdateController ( Updater updater,
QWidget parentWindow 
)
explicit

Constructs a new controller with an updater and for a window. Will modal to the parent window.

Parameters
updaterThe updater to be used by the controller
parentWindowThe parent window. Will serve as parent for the windows and the controller

The created controller will be bound to the widget. This means all dialogs will be child windows of the widgets window. On Mac, dialogs will be shown as "Sheets" of the parent window. You can change this by using a non QWidget as parent via setParent().

See also
UpdateController::parentWindow, QObject::parent, QObject::setParent

Member Function Documentation

◆ createUpdateAction()

QtAutoUpdater::UpdateController::createUpdateAction ( Updater updater,
QObject parent 
)
static

Create a QAction to start an update check from.

Parameters
updaterThe updater to create the action for
parentThe parent object the action should belong to
Returns
a newly created action associated with the given updater

The action will automatically start the updater using Updater::checkForUpdates. In addition to that, the action will be automatically disabled if the updater is already running or deleted.

The action has a text, an icon and a tooltip. On Mac, the action will be placed in the Applications menu if added to the Menubar. To show it in other places (for example as dock-menu), unset the QAction::menuRole.

See also
QtAutoUpdater::UpdateButton, Updater::checkForUpdates, Image Page, QAction::menuRole

◆ parentWindow()

QtAutoUpdater::UpdateController::parentWindow ( ) const

Returns the parent window, if one is used.

Returns
The parent, cast to a widget, or nullptr

If the controllers parent is a QWidget, this method returns it. If there is no parent, or the parent is only a QObject, nullptr is returned

See also
QObject::parent, QObject::isWidgetType

◆ start [1/2]

QtAutoUpdater::UpdateController::start ( )
slot

Starts the controller.

Returns
true, if the controller started, false if unable to

start will fail if the updater is already running, or if the user rejects the ask dialog, in case the AskLevel was set. Otherwise, it will always succeed and run Updater::checkForUpdates. All further dialogs will then be shown automatically, according to the displayLevel.

See also
UpdateController::displayLevel, Updater::running, Updater::checkForUpdates

◆ start [2/2]

QtAutoUpdater::UpdateController::start ( DisplayLevel  displayLevel)
slot

Sets the display level and then starts the controller.

Parameters
displayLevelThe DisplayLevel to be set as displayLevel property before starting
Returns
true, if the controller started, false if unable to

start will fail if the updater is already running, or if the user rejects the ask dialog, in case the AskLevel was set. Otherwise, it will always succeed and run Updater::checkForUpdates. All further dialogs will then be shown automatically, according to the displayLevel.

See also
UpdateController::displayLevel, Updater::running, Updater::checkForUpdates

Property Documentation

◆ desktopFileName

QtAutoUpdater::UpdateController::desktopFileName
readwrite

The path to the desktop file of the application.

Default: <empty>

On linux, to show a progress and update counter on the taskbar, a desktop file is needed. Use this property to set the name (not path) of the desktop file, e.g. "myapp.desktop". If your application does not run on linux, or you don't care for this feature, you can ignore this property.

Accessors
READdesktopFileName()
WRITEsetDesktopFileName()
NOTIFYdesktopFileNameChanged()

Definition at line 28 of file updatecontroller.h.

◆ detailedUpdateInfo

QtAutoUpdater::UpdateController::detailedUpdateInfo
readwrite

Specifies, whether information about updates should be detailed or not.

Default: false

The controller supports two different update info dialogs. The detailed one will show a "big" dialog with the information, in a wide format. The simple one is just a messagebox that provides the same functionality, but is much smaller and hides the details of the specific UpdateInfos. This property is used to switch between the two dialogs. If the DisplayLevel is set to not show an info dialog at all, neither of the two will be shown.

For a comparison how each of these dialogs looks on each platform, check the Image Page.

Accessors
READisDetailedUpdateInfo()
WRITEsetDetailedUpdateInfo()
NOTIFYdetailedUpdateInfoChanged()
See also
UpdateController::DisplayLevel, UpdateInfo, Image Page

Definition at line 32 of file updatecontroller.h.

◆ displayLevel

QtAutoUpdater::UpdateController::displayLevel
readwrite

The display level, managing which parts of the GUI are shown.

Default: UpdateController::DisplayLevel::Info

The display level controlls the kind of dialogs shown to the user. Levels are ranked from the lowest (AutomaticLevel = 0) to the highest (AskLevel = 5). Each Level includes all levels with a smaller value, i.e. using the AskLevel will add the ask dialog to everything shown with ProgressLevel, but not less.

All GUI-elements except of the ask dialog are shown automatically when changes in the used updater happen. However, for this dialog to be shown, you must use start().

Note
Changing the displayLevel while an update is running will not close any active dialogs, but otherwise be in effect immediatly.
Accessors
READdisplayLevel()
WRITEsetDisplayLevel()
NOTIFYdisplayLevelChanged()
See also
UpdateController::start, UpdateController::DisplayLevel

Definition at line 26 of file updatecontroller.h.

◆ installScope

QtAutoUpdater::UpdateController::installScope
readwrite

The scope to be used when launching an installation.

Default: Updater::InstallScope::PreferInternal

Specifies if the controller should prefer to launch a parallel update installation as internal or external updater. This property only sets a preference - if a backend only supports one of these two, that one will be used, ignoring this property. Only for backends that support both, this property has any effect.

Accessors
READinstallScope()
WRITEsetInstallScope()
NOTIFYinstallScopeChanged()
See also
Updater::runUpdater, Updater::InstallScope

Definition at line 30 of file updatecontroller.h.

◆ updater

QtAutoUpdater::UpdateController::updater
readwrite

The updater beeing used by the controller.

Default: nullptr

The controller can only be used if the updater was set, either directly or via the constructor. The controller attaches to the updater and reacts on changes in it's state to show a GUI. This includes the Updater::showInstaller signal to show an installation wizard, if neccessary. Which parts of the GUI are shown can be controlled via the displayLevel property.

Accessors
READupdater()
WRITEsetUpdater()
NOTIFYupdaterChanged()
See also
UpdateController::displayLevel, UpdateController::start

Definition at line 24 of file updatecontroller.h.


The documentation for this class was generated from the following files: