ctkPluginFrameworkEvent.h

Go to the documentation of this file.
00001 /*=============================================================================
00002 
00003   Library: CTK
00004 
00005   Copyright (c) 2010 German Cancer Research Center,
00006     Division of Medical and Biological Informatics
00007 
00008   Licensed under the Apache License, Version 2.0 (the "License");
00009   you may not use this file except in compliance with the License.
00010   You may obtain a copy of the License at
00011 
00012     http://www.apache.org/licenses/LICENSE-2.0
00013 
00014   Unless required by applicable law or agreed to in writing, software
00015   distributed under the License is distributed on an "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017   See the License for the specific language governing permissions and
00018   limitations under the License.
00019 
00020 =============================================================================*/
00021 
00022 #ifndef CTKPLUGINFRAMEWORKEVENT_H
00023 #define CTKPLUGINFRAMEWORKEVENT_H
00024 
00025 #include <QObject>
00026 #include <QSharedDataPointer>
00027 
00028 #include "CTKPluginFrameworkExport.h"
00029 
00030 
00031   class ctkPlugin;
00032   class ctkPluginFrameworkEventData;
00033 
00046   class CTK_PLUGINFW_EXPORT ctkPluginFrameworkEvent : public QObject
00047   {
00048     Q_OBJECT
00049     Q_PROPERTY(Type type READ getType CONSTANT)
00050     Q_PROPERTY(ctkPlugin* plugin READ getPlugin CONSTANT)
00051     Q_PROPERTY(QString errorString READ getErrorString CONSTANT)
00052     Q_ENUMS(Type)
00053 
00054     QSharedDataPointer<ctkPluginFrameworkEventData> d;
00055 
00056   public:
00057 
00058     enum Type {
00068       STARTED,
00069 
00076       ERROR,
00077 
00084       WARNING,
00085 
00092       INFO,
00093 
00102       STOPPED,
00103 
00112       STOPPED_UPDATE,
00113 
00121       WAIT_TIMEDOUT
00122 
00123     };
00124 
00128     ctkPluginFrameworkEvent();
00129 
00137     ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin, const std::exception& fwException);
00138 
00145     ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin);
00146 
00147     ctkPluginFrameworkEvent(const ctkPluginFrameworkEvent& other);
00148 
00154     QString getErrorString() const;
00155 
00162     ctkPlugin* getPlugin() const;
00163 
00181     Type getType() const;
00182   };
00183 
00184 
00185   class ctkPluginFrameworkEventData : public QSharedData
00186   {
00187   public:
00188 
00189     ctkPluginFrameworkEventData(ctkPluginFrameworkEvent::Type type, ctkPlugin* plugin, const QString& exc)
00190       : plugin(plugin), errorString(exc), type(type)
00191     {
00192 
00193     }
00194 
00195     ctkPluginFrameworkEventData(const ctkPluginFrameworkEventData& other)
00196       : QSharedData(other), plugin(other.plugin), errorString(other.errorString),
00197         type(other.type)
00198     {
00199 
00200     }
00201 
00205     ctkPlugin* const  plugin;
00206 
00210     const QString errorString;
00211 
00215     const ctkPluginFrameworkEvent::Type type;
00216   };
00217 
00218 
00219 #endif // CTKPLUGINFRAMEWORKEVENT_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines