libfuoten 0.8.2
Qt based library to access the Nextcloud News App API.
Loading...
Searching...
No Matches
Fuoten::Synchronizer Class Reference

Combines updating of folders, feeds and articles. More...

#include <Fuoten/Helpers/Synchronizer>

Inheritance diagram for Fuoten::Synchronizer:
QObject

Properties

Fuoten::AbstractConfigurationconfiguration
 Pointer to a AbstractConfiguration object.
QString currentAction
 Returns the current performed action.
Fuoten::Errorerror
 Pointer to an Error object, if an error occurred. Otherwise a nullptr.
bool inOperation
 Returns true while the Synchronizer is in operational mode.
Fuoten::AbstractNotificatornotificator
 Pointer to an object derived from AbstractNotificator.
qreal progress
 Pregress value between 0.0 and 1.0.
Fuoten::AbstractStoragestorage
 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.
AbstractConfigurationconfiguration () 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.
Errorerror () 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.
AbstractNotificatornotificator () 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.
AbstractStoragestorage () 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 &currentAction)
 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.

Detailed Description

Combines updating of folders, feeds and articles.

Mandatory properties
Synchronizer::configuration

Property Documentation

◆ configuration

Fuoten::AbstractConfiguration * Fuoten::Synchronizer::configuration
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.

Access functions:
AbstractConfiguration*configuration() const
voidsetConfiguration(AbstractConfiguration *nAbstractConfiguration)
Notifier signal:
voidconfigurationChanged(AbstractConfiguration *configuration)

◆ currentAction

QString Fuoten::Synchronizer::currentAction
read

Returns the current performed action.

Access functions:
QStringcurrentAction() const
Notifier signal:
voidcurrentActionChanged(const QString &currentAction)
See also
setCurrentAction()

◆ error

Fuoten::Error * Fuoten::Synchronizer::error
read

Pointer to an Error object, if an error occurred. Otherwise a nullptr.

Access functions:
Error*error() const
Notifier signal:
voiderrorChanged(Error *error)

◆ inOperation

bool Fuoten::Synchronizer::inOperation
read

Returns true while the Synchronizer is in operational mode.

Access functions:
boolinOperation() const
Notifier signal:
voidinOperationChanged(bool inOperation)

◆ notificator

Fuoten::AbstractNotificator * Fuoten::Synchronizer::notificator
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).

Access functions:
Notifier signal:

◆ progress

qreal Fuoten::Synchronizer::progress
read

Pregress value between 0.0 and 1.0.

Access functions:
qrealprogress() const
Notifier signal:
voidprogressChanged(qreal progress)
See also
setProgress()

◆ storage

Fuoten::AbstractStorage * Fuoten::Synchronizer::storage
readwrite

Pointer to an AbstractStorage derived object.

This property can not be changed while Component::inOperation() returns true.

Access functions:
AbstractStorage*storage() const
voidsetStorage(AbstractStorage *nStorageHandler)
Notifier signal:
voidstorageChanged(AbstractStorage *storage)

Constructor & Destructor Documentation

◆ Synchronizer()

Synchronizer::Synchronizer ( QObject * parent = nullptr)
explicit

Constructs a new Synchronizer object with the given parent.

◆ ~Synchronizer()

Synchronizer::~Synchronizer ( )
override

Deconstructs the Synchronizer object.

Member Function Documentation

◆ clearError()

void Synchronizer::clearError ( )

Clears the current error and sets the error property to a nullptr.

◆ configuration()

AbstractConfiguration * Synchronizer::configuration ( ) const

Returns the pointer to the currently set AbstractConfiguration object.

See also
configuration

◆ configurationChanged

void Fuoten::Synchronizer::configurationChanged ( Fuoten::AbstractConfiguration * configuration)
signal

This signal is emitted if the pointer to the AbstractConfiguration object changes.

See also
configuration

◆ currentAction()

QString Synchronizer::currentAction ( ) const

◆ currentActionChanged

void Fuoten::Synchronizer::currentActionChanged ( const QString & currentAction)
signal

This is emitted if the value of the currentAction property changes.

See also
Synchronizer::currentAction(), Synchronizer::setCurrentAction()

◆ deferredSync()

void Synchronizer::deferredSync ( quint32 miliseconds)
virtual

Invokes the synchronizing process after miliseconds.

The base implementation simply calls start() after the timeout in miliseconds.

◆ error()

Error * Synchronizer::error ( ) const

Returns a pointer to an Error object if any error occurred, otherwise a nullptr.

See also
error

◆ errorChanged

void Fuoten::Synchronizer::errorChanged ( Fuoten::Error * error)
signal

This signal is emitted if the pointer to an Error object changes.

Maybe a nullptr if the Error object was reset.

See also
error

◆ failed

void Fuoten::Synchronizer::failed ( Fuoten::Error * error)
signal

This signal is emitted if the synchonization process failed for some reason.

See also
succeeded(), error

◆ finished

void Synchronizer::finished ( )
protectedslot

Finishes the synchronization and cleans up.

◆ inOperation()

bool Synchronizer::inOperation ( ) const

Returns true while the synchronization is active.

See also
inOperation

◆ inOperationChanged

void Fuoten::Synchronizer::inOperationChanged ( bool inOperation)
signal

This signal is emitted if the oprational state changes.

See also
inOperation

◆ notificator()

AbstractNotificator * Synchronizer::notificator ( ) const

Getter function for the notificator property.

See also
setNotificator(), notificatorChanged()

◆ notificatorChanged

void Fuoten::Synchronizer::notificatorChanged ( Fuoten::AbstractNotificator * notificator)
signal

Notifier signal for the notificator property.

See also
setNotificator(), notificator()

◆ notifyAboutRead

void Synchronizer::notifyAboutRead ( )
protectedslot

Notifies the News App about read articles from the local queue.

◆ notifyAboutStarred

void Synchronizer::notifyAboutStarred ( )
protectedslot

Notifies the News App about starred articles from the local queue.

◆ notifyAboutUnread

void Synchronizer::notifyAboutUnread ( )
protectedslot

Notifies the News App about unread articles from the local queue.

◆ notifyAboutUnstarred

void Synchronizer::notifyAboutUnstarred ( )
protectedslot

Notifies the News app about unstarred articles from the local queue.

◆ progress()

qreal Synchronizer::progress ( ) const

Getter function for the progress property.

See also
Synchronizer::setProgress(), Synchronizer::progressChanged()

◆ progressChanged

void Fuoten::Synchronizer::progressChanged ( qreal progress)
signal

This is emitted if the value of the progress property changes.

See also
Synchronizer::progress(), Synchronizer::setProgress()

◆ requestFeeds

void Synchronizer::requestFeeds ( )
protectedslot

Requests feed information from the News App.

◆ requestFolders

void Synchronizer::requestFolders ( )
protectedslot

Requests folder information from the News App.

◆ requestStarred

void Synchronizer::requestStarred ( )
protectedslot

Requests all starred articles from the News App.

◆ requestUnread

void Synchronizer::requestUnread ( )
protectedslot

Requests all unread articles from the News App.

◆ requestUpdated

void Synchronizer::requestUpdated ( )
protectedslot

Requests articles from the News App that are new or have been updated since last sync.

◆ setConfiguration()

void Synchronizer::setConfiguration ( AbstractConfiguration * nAbstractConfiguration)

Sets the pointer to a AbstractConfiguration object.

See also
configuration

◆ setCurrentAction()

void Synchronizer::setCurrentAction ( const QString & nCurrentAction)
protected

Sets the current action string. Emits the currentActionChanged() signal if nCurrentAction is not equal to the stored value.

See also
Synchronizer::currentAction(), Synchronizer::currentActionChanged(), Synchronizer::currentAction

◆ setError

void Synchronizer::setError ( Fuoten::Error * nError)
protectedslot

Sets a new Error object to the error property.

See also
error

◆ setNotificator()

void Synchronizer::setNotificator ( AbstractNotificator * notificator)

Setter function for the notificator property.

See also
notificator(), notificatorChanged()

◆ setProgress()

void Synchronizer::setProgress ( qreal nProgress)
protected

Sets the current progress value. Emits the progressChanged() signal if nProgress is not equal to the stored value.

See also
Synchronizer::progress(), Synchronizer::progressChanged(), Synchronizer::progress

◆ setStorage()

void Synchronizer::setStorage ( AbstractStorage * nStorageHandler)

Sets the pointer to an AbstractStorage object.

See also
storage

◆ start

void Synchronizer::start ( )
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().

◆ storage()

AbstractStorage * Synchronizer::storage ( ) const

Returns the pointer to the currently set AbstractStorage object, if any, otherwise a nullptr.

◆ storageChanged

void Fuoten::Synchronizer::storageChanged ( Fuoten::AbstractStorage * storage)
signal

This signall is emitted if the pointer to the AbstractStorage object changes.

See also
storage

◆ succeeded

void Fuoten::Synchronizer::succeeded ( )
signal

This signal is emitted if the synchronization process was successful.

See also
failed()

◆ sync()

void Synchronizer::sync ( )
virtual

Invokes the synchronizing process.

The base implementation simply calls start().


The documentation for this class was generated from the following files:
  • Fuoten/Helpers/synchronizer.h
  • build/Fuoten/FuotenQt5_autogen/include/moc_synchronizer.cpp
  • Fuoten/Helpers/synchronizer.cpp