|
libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
|
Combines updating of folders, feeds and articles. More...
#include <Fuoten/Helpers/Synchronizer>
Properties | |
| Fuoten::AbstractConfiguration * | configuration |
| Pointer to a AbstractConfiguration object. | |
| QString | currentAction |
| Returns the current performed action. | |
| Fuoten::Error * | error |
Pointer to an Error object, if an error occurred. Otherwise a nullptr. | |
| bool | inOperation |
| Returns true while the Synchronizer is in operational mode. | |
| Fuoten::AbstractNotificator * | notificator |
| Pointer to an object derived from AbstractNotificator. | |
| qreal | progress |
| Pregress value between 0.0 and 1.0. | |
| Fuoten::AbstractStorage * | storage |
| Pointer to an AbstractStorage derived object. | |
Public Member Functions | |
| Synchronizer (QObject *parent=nullptr) | |
| Constructs a new Synchronizer object with the given parent. | |
| ~Synchronizer () override | |
| Deconstructs the Synchronizer object. | |
| Q_INVOKABLE void | clearError () |
Clears the current error and sets the error property to a nullptr. | |
| AbstractConfiguration * | configuration () const |
| Returns the pointer to the currently set AbstractConfiguration object. | |
| QString | currentAction () const |
| Getter function for the currentAction property. | |
| virtual Q_INVOKABLE void | deferredSync (quint32 miliseconds) |
| Invokes the synchronizing process after miliseconds. | |
| Error * | error () const |
Returns a pointer to an Error object if any error occurred, otherwise a nullptr. | |
| bool | inOperation () const |
| Returns true while the synchronization is active. | |
| AbstractNotificator * | notificator () const |
| Getter function for the notificator property. | |
| qreal | progress () const |
| Getter function for the progress property. | |
| void | setConfiguration (AbstractConfiguration *nAbstractConfiguration) |
| Sets the pointer to a AbstractConfiguration object. | |
| void | setNotificator (AbstractNotificator *notificator) |
| Setter function for the notificator property. | |
| void | setStorage (AbstractStorage *nStorageHandler) |
| Sets the pointer to an AbstractStorage object. | |
| AbstractStorage * | storage () const |
Returns the pointer to the currently set AbstractStorage object, if any, otherwise a nullptr. | |
| virtual Q_INVOKABLE void | sync () |
| Invokes the synchronizing process. | |
Public Slots | |
| void | start () |
| Starts the synchronizing process. | |
Signals | |
| void | configurationChanged (Fuoten::AbstractConfiguration *configuration) |
| This signal is emitted if the pointer to the AbstractConfiguration object changes. | |
| void | currentActionChanged (const QString ¤tAction) |
| This is emitted if the value of the currentAction property changes. | |
| void | errorChanged (Fuoten::Error *error) |
| This signal is emitted if the pointer to an Error object changes. | |
| void | failed (Fuoten::Error *error) |
| This signal is emitted if the synchonization process failed for some reason. | |
| void | inOperationChanged (bool inOperation) |
| This signal is emitted if the oprational state changes. | |
| void | notificatorChanged (Fuoten::AbstractNotificator *notificator) |
| Notifier signal for the notificator property. | |
| void | progressChanged (qreal progress) |
| This is emitted if the value of the progress property changes. | |
| void | storageChanged (Fuoten::AbstractStorage *storage) |
| This signall is emitted if the pointer to the AbstractStorage object changes. | |
| void | succeeded () |
| This signal is emitted if the synchronization process was successful. | |
Protected Slots | |
| void | finished () |
| Finishes the synchronization and cleans up. | |
| void | notifyAboutRead () |
| Notifies the News App about read articles from the local queue. | |
| void | notifyAboutStarred () |
| Notifies the News App about starred articles from the local queue. | |
| void | notifyAboutUnread () |
| Notifies the News App about unread articles from the local queue. | |
| void | notifyAboutUnstarred () |
| Notifies the News app about unstarred articles from the local queue. | |
| void | requestFeeds () |
| Requests feed information from the News App. | |
| void | requestFolders () |
| Requests folder information from the News App. | |
| void | requestStarred () |
| Requests all starred articles from the News App. | |
| void | requestUnread () |
| Requests all unread articles from the News App. | |
| void | requestUpdated () |
| Requests articles from the News App that are new or have been updated since last sync. | |
| void | setError (Fuoten::Error *nError) |
| Sets a new Error object to the error property. | |
Protected Member Functions | |
| void | setCurrentAction (const QString &nCurrentAction) |
| Sets the current action string. Emits the currentActionChanged() signal if nCurrentAction is not equal to the stored value. | |
| void | setProgress (qreal nProgress) |
| Sets the current progress value. Emits the progressChanged() signal if nProgress is not equal to the stored value. | |
Combines updating of folders, feeds and articles.
|
readwrite |
Pointer to a AbstractConfiguration object.
You have to set a valid AbstractConfiguration object in order to start a synchronization. This property can not be changed while Component::inOperation() returns true.
| AbstractConfiguration* | configuration() const |
| void | setConfiguration(AbstractConfiguration *nAbstractConfiguration) |
| void | configurationChanged(AbstractConfiguration *configuration) |
|
read |
Returns the current performed action.
| QString | currentAction() const |
| void | currentActionChanged(const QString ¤tAction) |
|
read |
Pointer to an Error object, if an error occurred. Otherwise a nullptr.
| Error* | error() const |
| void | errorChanged(Error *error) |
|
read |
Returns true while the Synchronizer is in operational mode.
| bool | inOperation() const |
| void | inOperationChanged(bool inOperation) |
|
readwrite |
Pointer to an object derived from AbstractNotificator.
Set a notificator to notify users about errors and events. This is not mandatory. You have to derive your own notificator that uses the notification system of the target platform.
If no notificator has been set via setNotificator(), the one set via Component::setDefaultConfigurator() will be used - if any has been set. If you do not set a notificator either per instance or global, this property will hold a nullptr. If a notificator is set to an instance of this class via setNotificator(), this notificator will take precedence over the global default notificator object (if any set).
|
read |
Pregress value between 0.0 and 1.0.
| qreal | progress() const |
| void | progressChanged(qreal progress) |
|
readwrite |
Pointer to an AbstractStorage derived object.
This property can not be changed while Component::inOperation() returns true.
| AbstractStorage* | storage() const |
| void | setStorage(AbstractStorage *nStorageHandler) |
| void | storageChanged(AbstractStorage *storage) |
|
explicit |
Constructs a new Synchronizer object with the given parent.
|
override |
Deconstructs the Synchronizer object.
| void Synchronizer::clearError | ( | ) |
Clears the current error and sets the error property to a nullptr.
| AbstractConfiguration * Synchronizer::configuration | ( | ) | const |
Returns the pointer to the currently set AbstractConfiguration object.
|
signal |
This signal is emitted if the pointer to the AbstractConfiguration object changes.
| QString Synchronizer::currentAction | ( | ) | const |
Getter function for the currentAction property.
|
signal |
This is emitted if the value of the currentAction property changes.
|
virtual |
Invokes the synchronizing process after miliseconds.
The base implementation simply calls start() after the timeout in miliseconds.
| Error * Synchronizer::error | ( | ) | const |
|
signal |
|
signal |
This signal is emitted if the synchonization process failed for some reason.
|
protectedslot |
Finishes the synchronization and cleans up.
| bool Synchronizer::inOperation | ( | ) | const |
Returns true while the synchronization is active.
|
signal |
This signal is emitted if the oprational state changes.
| AbstractNotificator * Synchronizer::notificator | ( | ) | const |
Getter function for the notificator property.
|
signal |
Notifier signal for the notificator property.
|
protectedslot |
Notifies the News App about read articles from the local queue.
|
protectedslot |
Notifies the News App about starred articles from the local queue.
|
protectedslot |
Notifies the News App about unread articles from the local queue.
|
protectedslot |
Notifies the News app about unstarred articles from the local queue.
| qreal Synchronizer::progress | ( | ) | const |
Getter function for the progress property.
|
signal |
This is emitted if the value of the progress property changes.
|
protectedslot |
Requests feed information from the News App.
|
protectedslot |
Requests folder information from the News App.
|
protectedslot |
Requests all starred articles from the News App.
|
protectedslot |
Requests all unread articles from the News App.
|
protectedslot |
Requests articles from the News App that are new or have been updated since last sync.
| void Synchronizer::setConfiguration | ( | AbstractConfiguration * | nAbstractConfiguration | ) |
Sets the pointer to a AbstractConfiguration object.
|
protected |
Sets the current action string. Emits the currentActionChanged() signal if nCurrentAction is not equal to the stored value.
|
protectedslot |
| void Synchronizer::setNotificator | ( | AbstractNotificator * | notificator | ) |
Setter function for the notificator property.
|
protected |
Sets the current progress value. Emits the progressChanged() signal if nProgress is not equal to the stored value.
| void Synchronizer::setStorage | ( | AbstractStorage * | nStorageHandler | ) |
Sets the pointer to an AbstractStorage object.
|
slot |
Starts the synchronizing process.
Prior to starting the synchronizing process, it checks inOperation(). If that returns true, nothing will happen. If inOperation() returns false, it will set it to true and will start the update process.
When you create a derived class, call start() in your implementation of sync().
| AbstractStorage * Synchronizer::storage | ( | ) | const |
Returns the pointer to the currently set AbstractStorage object, if any, otherwise a nullptr.
|
signal |
This signall is emitted if the pointer to the AbstractStorage object changes.
|
signal |
This signal is emitted if the synchronization process was successful.
|
virtual |
Invokes the synchronizing process.
The base implementation simply calls start().