This class abstracts the common functionalities provided by the different types of applications in GCF3. More...
#include <GCF3/Application>
Public Member Functions | |
QDateTime | launchTimestamp () const |
ObjectTree * | objectTree () const |
QObject * | findObject (const QString &path) const |
void | loadComponent (Component *component) |
void | unloadComponent (Component *component) |
QObjectList | components () const |
void | activateComponent (Component *component) |
void | deactivateComponent (Component *component) |
bool | isLoaded (const Component *component) const |
bool | isActive (const Component *component) const |
void | unloadAllComponents () |
Component * | instantiateComponent (const QString &library) |
Component * | loadComponent (const QString &library) |
Component * | loadComponent (const QString &library, const QList< QPair< QByteArray, QVariant > > &properties) |
QList< Component * > | loadComponents (const QStringList &libraries) |
QVariantMap | argumentsMap () const |
void | processArguments (const QStringList &additionalArgs=QStringList()) |
GCF::Result | invokeMethod (const QString &path, const QString &method, const QVariantList &args, bool secureCall=true) const |
This method can be used to invoke a named method in an object. More... | |
GCF::JobListModel * | jobs () const |
QString | translate (const QString &string) const |
Static Public Member Functions | |
static GCF::Result | invokeMethod (QObject *object, const QString &method, const QVariantList &args, bool secureCall=true) |
This method can be used to invoke a named method in an object. More... | |
static GCF::Result | invokeMethod (QObject *object, const QMetaMethod &method, const QVariantList &args, bool secureCall=true) |
This method can be used to invoke a named method in an object. More... | |
Protected Member Functions | |
ApplicationServices () | |
virtual | ~ApplicationServices () |
Detailed Description
All application configurations in GCF inherrit this class so that they can offer the following capabilities
Read about the GCF Component Model to learn how this can be used in the application.
The single global instance of this class in the application can be accessed using the gAppService
global pointer.
Constructor & Destructor Documentation
|
protected |
Constructor
|
protectedvirtual |
Destructor
Member Function Documentation
QDateTime GCF::ApplicationServices::launchTimestamp | ( | ) | const |
Returns the date-time at which application was launched.
GCF::ObjectTree * GCF::ApplicationServices::objectTree | ( | ) | const |
Returns the object-tree of the application.
QObject * GCF::ApplicationServices::findObject | ( | const QString & | path | ) | const |
Looks for the exposed object specfied by path
in the application's object-tree, and returns it if found. Usage
- Parameters
-
hierarchical path to the object inside object tree, separated by '.'
void GCF::ApplicationServices::loadComponent | ( | GCF::Component * | component | ) |
Loads the component into the application. This function will add the specified component into the object tree and will initialize it. For more details on initialization refer GCF::Component.
- Parameters
-
component pointer to the component which needs to be loaded.
void GCF::ApplicationServices::unloadComponent | ( | GCF::Component * | component | ) |
Unloads the component from the application. Unloading the component will remove the component node from the applciation's object-tree. For more details on unloading refer GCF::Component.
- Parameters
-
component pointer to the component which needs to be unloaded.
QObjectList GCF::ApplicationServices::components | ( | ) | const |
- Returns
- list of components loaded by the application.
void GCF::ApplicationServices::activateComponent | ( | GCF::Component * | component | ) |
Activates the component specified by component
. For more details refer to GCF::Component.
- Note
- to activate a component it should have been loaded by the application first.
- Parameters
-
component pointer to the component that needs to be activated.
void GCF::ApplicationServices::deactivateComponent | ( | GCF::Component * | component | ) |
Deactivates the component specified by component
. For more details refer to GCF::Component.
- Note
- to deactivate a component it should have been loaded by the application first.
- Parameters
-
component pointer to the component that needs to be deactivated.
bool GCF::ApplicationServices::isLoaded | ( | const Component * | component | ) | const |
- Returns
- true if component is loaded; false otherwise.
bool GCF::ApplicationServices::isActive | ( | const Component * | component | ) | const |
- Returns
- true if component is active; false otherwise.
void GCF::ApplicationServices::unloadAllComponents | ( | ) |
Unloads all the components loaded by the application. Also removes them from the object tree.
GCF::Component * GCF::ApplicationServices::instantiateComponent | ( | const QString & | libraryName | ) |
Creates an instance of the component from the specified file. The instantiation will fail if the file does not exist or if version of the component is not same as the application version.
- Note
- This function does not load the component. For loading the component call GCF::ApplicationServices::loadComponent(Component * component) on the component pointer returned by this function.
- Do not specify the file extension while invoking this function
Usage
- Parameters
-
libraryName full or relative path to the library file.
GCF::Component * GCF::ApplicationServices::loadComponent | ( | const QString & | libraryName | ) |
Instantiates the component from the file libraryName
and loads it.
- Note
- Do not specify the file extension while invoking this function
Usage
- Parameters
-
libraryName full or relative path to the library file.
GCF::Component * GCF::ApplicationServices::loadComponent | ( | const QString & | libraryName, |
const QList< QPair< QByteArray, QVariant > > & | properties | ||
) |
Overloads GCF::ApplicationServices::loadComponent(Component *component). Loads the specified component and initializes it with the properties specified in properties
.
Usage
- Parameters
-
libraryName path to the library file. properties properties that needs to be set on component before loading
QList< Component * > GCF::ApplicationServices::loadComponents | ( | const QStringList & | libraries | ) |
This function loops over each and every library name provided in libraries
and invokes the loadComponent() method to load components. It returns a list of components that got loaded.
QVariantMap GCF::ApplicationServices::argumentsMap | ( | ) | const |
- Returns
QVariantMap
which contains all the command line arguments.
void GCF::ApplicationServices::processArguments | ( | const QStringList & | additionalArgs = QStringList() | ) |
Parses the list of arguments supplied to the application. This method expects the strings in the arguments to be in a "-key:value" format. This would then be loaded as <key, value> pair in to an internal map which can then be retrieved using GCF::ApplicationServices::argumentsMap().
By default this method processes –loadComponents
argument as a command, and can be used to load a comma separated list of components.
Usage
- Parameters
-
additionalArgs can be used to supply additional arguments, and is optional.
GCF::Result GCF::ApplicationServices::invokeMethod | ( | const QString & | path, |
const QString & | method, | ||
const QVariantList & | args, | ||
bool | secureCall = true |
||
) | const |
- Parameters
-
path complete path of the object in the objectTree() method name of the method to invoke in the object. (Only the name. Not the complete signature) args list of arguments to to pass to the method secureCall if true, then the function will check for allowmetaaccess attribute. If false, then it will ignore the attribute.
- Returns
- Upon success this function will return a true. Calling data() on the returned result will provide the value returned by the invoked method.
- Note
- Only public methods and signals can be invoked by this function.
- See Also
- allowmetaaccess attribute
|
static |
- Parameters
-
object pointer to a QObject
in which a method needs to be invokedmethod name of the method to invoke in the object. (Only the name. Not the complete signature) args list of arguments to to pass to the method secureCall if true, then the function will check for allowmetaaccess attribute. If false, then it will ignore the attribute.
- Returns
- Upon success this function will return a true. Calling data() on the returned result will provide the value returned by the invoked method.
- Note
- Only public methods and signals can be invoked by this function.
- See Also
- allowmetaaccess attribute
|
static |
- Parameters
-
object pointer to a QObject
in which a method needs to be invokedmethod meta information of the method that needs to be invoked args list of arguments to to pass to the method secureCall if true, then the function will check for allowmetaaccess attribute. If false, then it will ignore the attribute.
- Returns
- Upon success this function will return a true. Calling data() on the returned result will provide the value returned by the invoked method.
- Note
- Only public methods and signals can be invoked by this function.
- See Also
- allowmetaaccess attribute
GCF::JobListModel * GCF::ApplicationServices::jobs | ( | ) | const |
- Returns
- the list of jobs for the application. See GCF::AbstractJob for more information.
GCF::ApplicationServices::translate | ( | const QString & | string | ) | const |
Returns the translation for string
in "GCF" context, if it is available.