Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Types | Signals | Public Member Functions | Properties | List of all members
IComponent Class Referenceabstract

The abstract IComponent class defines contract for the components deployed in the application. More...

#include <IComponent.h>

Inherits QObject.

Inherited by BaseComponent.

Public Types

enum  Availability { Enabled, Disabled, Unavailable }
 

Signals

void availabilityChanged (IComponent::Availability)
 

Public Member Functions

virtual Availability availability () const =0
 
virtual const ComponentDefinitiondefinition () const =0
 
template<typename TExtension >
TExtension * extension ()
 
template<typename TExtension >
const TExtension * extension () const
 
virtual void * getExtension (const QString &byTypeId) const =0
 
virtual bool isCompatible (const IComponent *withOther) const =0
 
virtual const QStringname () const =0
 
virtual void setAvailability (Availability newMode)=0
 
virtual void shutdown (IServiceLocator *serviceLocator)=0
 
virtual bool started () const =0
 
virtual bool startup (IServiceLocator *serviceLocator)=0
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Properties

Availability availability
 
const ComponentDefinition definition
 
QString name
 
bool started
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, 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)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Detailed Description

The abstract IComponent class defines contract for the components deployed in the application.

It is a base unit of the carousel, that can contain UI and/or logic features, provides or exposes some services for the other components. The instances of the IComponent class could be registered statically in code or discovered by other way - e.g., loaded from the specified pathes by DirectoryComponentProvider. Regardless of how you register new components, they will be passed to the IComponentManager after bootloading sequence and will be started.

The IComponent also stores its extensions, that could be handled by other components pr by carousel core (like IInteractiveExtension).

See ComponentDefinition interface, if your component will have a dependencies from the other application components.

Consider deriving from the BaseComponent class instead of implement this interface directly.

Member Enumeration Documentation

Component availability states.

Enumerator
Enabled 

Enabled for use.

Disabled 

Disabled by the user. If component is disabled, child components that have dependency from this component, cannot be started.

Unavailable 

Unavailable - not licensed. If component is unavailable, child components that have dependency from this component, cannot be started.

Member Function Documentation

virtual Availability IComponent::availability ( ) const
pure virtual

Gets the value specified whether this component is enabled, disabled, or unavailable. When the availability is enabled, the component is checked in the Components dialog.

See Also
setAvailability

Implemented in BaseComponent.

virtual const ComponentDefinition* IComponent::definition ( ) const
pure virtual

Gets the component definition that can specify component dependencies and also describes the component.

Note, that component takes ownership for its defition.

Implemented in BaseComponent.

template<typename TExtension >
TExtension * IComponent::extension ( )

Finds a registered in derived class extension by its type, if any. If extension with such type was not registered, returns nullptr.

template<typename TExtension >
const TExtension * IComponent::extension ( ) const

Finds a registered in derived class extension by its type, if any. If extension with such type was not registered, returns nullptr.

virtual void* IComponent::getExtension ( const QString byTypeId) const
pure virtual

When overridden in derived classes finds pointer associated with specified type id in inner objects dictionary.

Returns
The raw pointer corresponded with specified type id if such found. Null pointer otherwise.

Implemented in BaseComponent, and ProxyComponent.

virtual const QString& IComponent::name ( ) const
pure virtual

The name of the component. This name should be unique and used for the resolving component dependencies.

It is a shortcut for the definition()->name().

See Also
toStringList

Implemented in BaseComponent.

virtual bool IComponent::isCompatible ( const IComponent withOther) const
pure virtual

Returns true if component version is compatible with all parent component versions, e.g. if they are equal. Otherwise, returns false.

See Also
ComponentDefinition::isCompatible()

Implemented in BaseComponent.

virtual void IComponent::setAvailability ( Availability  newMode)
pure virtual

Sets the value specified whether this component is enabled or disabled. The checked state of the component is saved in the user settings.

See Also
availability

Implemented in BaseComponent.

virtual void IComponent::shutdown ( IServiceLocator serviceLocator)
pure virtual

Shuts down the component. Implement this method to perform some action when the component gets unloaded.

Note
You should not use this method directly, use IComponentManager::shutdownComponent() instead.

Implemented in BaseComponent.

virtual bool IComponent::started ( ) const
pure virtual

Gets the value determined whether component is already started or not.

Implemented in BaseComponent.

virtual bool IComponent::startup ( IServiceLocator serviceLocator)
pure virtual

When all components are registered, each component started up with given initialization data.

Parameters
serviceLocatoris a reference to the services pool. It is needed to register/locate to common services and other components' services.
Returns
true, if component started up successful. Otherwise - return false. E.g. if component started twice - it is return false on the second time, because it is already started.
Note
You should not use this method directly, use IComponentManager::startupComponent() instead.

Implemented in BaseComponent.

void IComponent::availabilityChanged ( IComponent::Availability  )
signal

This signal is emited when extension's availability changed.

See Also
setAvailability

Property Documentation

Availability IComponent::availability
readwrite

Gets or sets the value specified whether this component is enabled, disabled, or unavailable. When the availability is enabled, the component is checked in the Components dialog.