|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
26 #ifndef VIEWER_EXTENSION_H
27 #define VIEWER_EXTENSION_H
32 #include <QRegularExpression>
33 #include <QTranslator>
43 #define registerDefaultViewer(className) setManagedMetaObject(&className::staticMetaObject); \
44 registerViewer(new className(QString(#className).replace(QRegularExpression("([^A-Z\\s])([A-Z])"),"\\1 \\2").replace(QRegularExpression("([A-Z]+)([A-Z][a-z])"),"\\1 \\2")));
47 #define registerNewViewer(className, instanceName) setManagedMetaObject(&className::staticMetaObject); \
48 registerViewer(new className(QString(instanceName)))
85 class CAMITK_API ViewerExtension :
public QObject {
93 ~ViewerExtension()
override;
96 virtual QString getName() = 0;
99 virtual QString getDescription() = 0;
102 virtual void init() = 0;
108 void setLocation(
const QString loc);
111 QString getLocation()
const;
114 void initResources();
117 QString getViewerClassName();
121 Viewer* getNewInstance(QString name);
127 bool registerViewer(
Viewer*);
133 void setManagedMetaObject(
const QMetaObject*);
137 QString dynamicLibraryFileName;
140 QTranslator* translator;
143 const QMetaObject* managedMetaObject;
150 #endif //VIEWER_EXTENSION_H
void setManagedMetaObject(const QMetaObject *)
The first time this method is called, it sets the static meta object.
Definition: ViewerExtension.cpp:122
static QString getSelectedLanguage()
Returns for the current CamiTK application, the selected language (stored in its ....
Definition: Application.cpp:1437
QString getViewerClassName()
get the class name of the viewer managed by this extension
Definition: ViewerExtension.cpp:112
#define CAMITK_INFO(MSG)
Log for info verbosity (the second most verbose one) The msg will appear only if the user asked for I...
Definition: Log.h:261
const QMetaObject * managedMetaObject
static meta object of the viewer class managed by this extension
Definition: ViewerExtension.h:166
const ViewerList & getViewers()
get the list of viewer instances registered by this extension
Definition: ViewerExtension.cpp:190
~ViewerExtension() override
destructor
Definition: ViewerExtension.cpp:67
QString getLocation() const
get the file path (location of the .dll/.so/.dylib) of this plugin
Definition: ViewerExtension.cpp:107
void setLocation(const QString loc)
set the file path (once loaded as a dynamic library) = where this extension was loaded
Definition: ViewerExtension.cpp:102
ViewerExtension()
constructor
Definition: ViewerExtension.cpp:61
QString getName() const
get the name of the viewer
Definition: Viewer.h:200
virtual QString getName()=0
returns the viewer extension name (to be overriden in the derived class)
#define CAMITK_ERROR(MSG)
Log for error verbosity (the minimum verbosity) Will always appear.
Definition: Log.h:276
void initResources()
Load, for the selected langage (asked to the Application), the associated .qm file.
Definition: ViewerExtension.cpp:80
ViewerList viewers
the list of viewers
Definition: ViewerExtension.h:153
Viewer * getNewInstance(QString name)
factory: create a new viewer instance and register it
Definition: ViewerExtension.cpp:161
QTranslator * translator
Provide internationalization support for text output.
Definition: ViewerExtension.h:163
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
QString dynamicLibraryFileName
the shared lib (.so, .dll or .dylib) used to instantiate the ComponentExtension subclass instance
Definition: ViewerExtension.h:160
QList< Viewer * > ViewerList
A list of Viewer.
Definition: CamiTKAPI.h:139
bool registerViewer(Viewer *)
register an viewer instance The first call will also register the managed viewer class name in viewer...
Definition: ViewerExtension.cpp:130
This class describes what is a generic Action extension. To add a ActionExtension to CamiTK core,...
Definition: ViewerExtension.h:108
#define CAMITK_API
Definition: CamiTKAPI.h:49
Definition: Action.cpp:35