ソースを参照

Added mandatory PluginFramework properties.

Sascha Zelzer 14 年 前
コミット
0b6e5fd854

+ 2 - 0
Libs/PluginFramework/ctkPluginConstants.cpp

@@ -24,6 +24,8 @@
 const QString	ctkPluginConstants::SYSTEM_PLUGIN_LOCATION = "System Plugin";
 const QString	ctkPluginConstants::SYSTEM_PLUGIN_SYMBOLICNAME = "system.plugin";
 
+const QString ctkPluginConstants::FRAMEWORK_VERSION = "org.commontk.pluginfw.version";
+const QString ctkPluginConstants::FRAMEWORK_VENDOR = "org.commontk.pluginfw.vendor";
 const QString ctkPluginConstants::FRAMEWORK_STORAGE = "org.commontk.pluginfw.storage";
 const QString ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN = "org.commontk.pluginfw.storage.clean";
 const QString ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT = "onFirstInit";

+ 19 - 0
Libs/PluginFramework/ctkPluginConstants.h

@@ -44,6 +44,25 @@ struct CTK_PLUGINFW_EXPORT ctkPluginConstants {
 
 
   /**
+   * Framework environment property identifying the Framework version.
+   *
+   * <p>
+   * The value of this property may be retrieved by calling the
+   * <code>ctkPluginContext::getProperty</code> method.
+   */
+  static const QString FRAMEWORK_VERSION; // = "org.commontk.pluginfw.version"
+
+  /**
+   * Framework environment property identifying the Framework implementation
+   * vendor.
+   *
+   * <p>
+   * The value of this property may be retrieved by calling the
+   * <code>ctkPluginContext::getProperty</code> method.
+   */
+  static const QString FRAMEWORK_VENDOR; // = "org.commontk.pluginfw.vendor"
+
+  /**
    * Specifies the persistent storage area used by the framework. The value of
    * this property must be a valid file path in the file system to a
    * directory. If the specified directory does not exist then the framework

+ 7 - 0
Libs/PluginFramework/ctkPluginFrameworkContext.cpp

@@ -43,6 +43,7 @@ ctkPluginFrameworkContext::ctkPluginFrameworkContext(
     systemPlugin->ctkPlugin::init(new ctkPluginFrameworkPrivate(systemPlugin, this));
   }
 
+  initProperties();
   log() << "created";
 }
 
@@ -54,6 +55,12 @@ ctkPluginFrameworkContext::~ctkPluginFrameworkContext()
   }
 }
 
+void ctkPluginFrameworkContext::initProperties()
+{
+  props[ctkPluginConstants::FRAMEWORK_VERSION] = "0.9";
+  props[ctkPluginConstants::FRAMEWORK_VENDOR] = "CommonTK";
+}
+
 void ctkPluginFrameworkContext::init()
 {
   log() << "initializing";

+ 2 - 0
Libs/PluginFramework/ctkPluginFrameworkContext_p.h

@@ -154,6 +154,8 @@ private:
   void deleteFWDir();
 
   void checkRequirePlugin(ctkPluginPrivate* plugin);
+
+  void initProperties();
 };