libschauer  0.0.1
Qt based library to access the Docker HTTP API.
Public Types | Properties | Public Member Functions | Public Slots | Signals | Protected Member Functions | List of all members
Schauer::AbstractBaseModel Class Reference

Base class for all data models. More...

#include <abstractbasemodel.h>

Inheritance diagram for Schauer::AbstractBaseModel:
Inheritance graph
[legend]

Public Types

enum  LoadMode : int { LoadAsync, LoadSync }
 Load mode for model. More...
 

Properties

Schauer::AbstractConfiguration configuration
 Pointer to an object providing configuration data. More...
 
int error
 Error code. More...
 
QString errorString
 Human-readable error message. More...
 
bool isLoading
 Indicates loading state. More...
 

Public Member Functions

 AbstractBaseModel (QObject *parent=nullptr)
 Constructs a new AbstractBaseModel class with the given parent. More...
 
 ~AbstractBaseModel () override
 Destroys the AbstractBaseModel object. More...
 
AbstractConfigurationconfiguration () const
 Getter function for the configuraion property. More...
 
int error () const
 Returns the error code, if there has been an error. More...
 
QString errorString () const
 Returns the human-readable error message. More...
 
bool isLoading () const
 Returns true while the model is loading, otherwise returns false. More...
 
void setConfiguration (AbstractConfiguration *configuration)
 Setter function for the configuraion property. More...
 

Public Slots

bool load (Schauer::AbstractBaseModel::LoadMode mode=LoadAsync)
 Loads the model data. More...
 

Signals

void configurationChanged (Schauer::AbstractConfiguration *configuration)
 Notifier signal for the configuration property. More...
 
void errorChanged (int error)
 Notifier signal for the error property. More...
 
void isLoadingChanged (bool isLoading)
 Notifier signal for the isLoading property. More...
 
void loaded ()
 Emitted to indicate model data loading has been finished. More...
 

Protected Member Functions

virtual void clear ()
 Clears the model data. More...
 

Detailed Description

Base class for all data models.

Member Enumeration Documentation

◆ LoadMode

Load mode for model.

Enumerator
LoadAsync 

Loads the model data asynchronously.

LoadSync 

Loads the model data synchronously.

Property Documentation

◆ configuration

AbstractConfiguration * AbstractBaseModel::configuration
readwrite

Pointer to an object providing configuration data.

This property holds a pointer to an object of a class derived from AbstractConfiguration that provides configuration information for the API request. It especialls provides the remote host and port. See AbstractConfiguration for more information.

You can also set a global default configuration via Schauer::setDefaultConfiguration() that will be used if no local configuration is available.

Access functions
  • AbstractConfiguration *configuration() const
  • void setConfiguration(AbstractCofiguration *configuration)
Notifier signal

◆ error

int AbstractBaseModel::error
read

Error code.

This property holds the error code after the model data hase been loaded. If no error has occured, the error code will be 0. errorString property will hold a human-readble error message.

Access functions
Notifier signal

◆ errorString

QString AbstractBaseModel::errorString
read

Human-readable error message.

This property holds a translated, human-readable description of the error.

Access functions
Notifier signal

◆ isLoading

bool AbstractBaseModel::isLoading
read

Indicates loading state.

This property holds true while the model is loading, otherwise false.

Access functions
Notifier signal

Constructor & Destructor Documentation

◆ AbstractBaseModel()

AbstractBaseModel::AbstractBaseModel ( QObject parent = nullptr)
explicit

Constructs a new AbstractBaseModel class with the given parent.

◆ ~AbstractBaseModel()

AbstractBaseModel::~AbstractBaseModel ( )
overridedefault

Destroys the AbstractBaseModel object.

Member Function Documentation

◆ clear()

void AbstractBaseModel::clear ( )
protectedvirtual

Clears the model data.

The default implementation dos nothing.

Reimplemented in Schauer::AbstractVersionModel, Schauer::AbstractContainerModel, and Schauer::AbstractImageModel.

◆ configuration()

AbstractConfiguration* Schauer::AbstractBaseModel::configuration ( ) const

Getter function for the configuraion property.

See also
setConfiguration(), configurationChanged()

◆ configurationChanged

void Schauer::AbstractBaseModel::configurationChanged ( Schauer::AbstractConfiguration configuration)
signal

Notifier signal for the configuration property.

See also
configuration(), setConfiguration()

◆ error()

int Schauer::AbstractBaseModel::error ( ) const

Returns the error code, if there has been an error.

If there has been no error, 0 will be returned.

See also
errorString()

◆ errorChanged

void Schauer::AbstractBaseModel::errorChanged ( int  error)
signal

Notifier signal for the error property.

See also
error()

◆ errorString()

QString Schauer::AbstractBaseModel::errorString ( ) const

Returns the human-readable error message.

This provides a translated, human-readable description of the error(). Only call if error() is not 0.

See also
error()

◆ isLoading()

bool Schauer::AbstractBaseModel::isLoading ( ) const

Returns true while the model is loading, otherwise returns false.

◆ isLoadingChanged

void Schauer::AbstractBaseModel::isLoadingChanged ( bool  isLoading)
signal

Notifier signal for the isLoading property.

See also
isLoading()

◆ load

bool AbstractBaseModel::load ( Schauer::AbstractBaseModel::LoadMode  mode = LoadAsync)
slot

Loads the model data.

Call this function to load the model data either in asynchronous or synchronous mode. When executing load, isLoading property will be true while the model loads its data. After data loading has been finished, isLoading will be false and the loaded() signal will be emitted.

Use the error property to check if an error has occured.

◆ loaded

void Schauer::AbstractBaseModel::loaded ( )
signal

Emitted to indicate model data loading has been finished.

Use error() to check if no error has been occured.

◆ setConfiguration()

void AbstractBaseModel::setConfiguration ( AbstractConfiguration configuration)

Setter function for the configuraion property.

See also
configuration(), configurationChanged()

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