changeset 83:3a02777d5a2a

fix deprecated calls
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 15:13:44 +0100 (14 months ago)
parents 8d67f2a86a38
children 400512b2eb67
files Plugin/Plugin.cpp Resources/Orthanc/CMake/DownloadOrthancFramework.cmake Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h
diffstat 4 files changed, 59 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri Jan 05 10:30:53 2024 +0100
+++ b/Plugin/Plugin.cpp	Fri Mar 22 15:13:44 2024 +0100
@@ -38,6 +38,8 @@
 #include <gdcmUIDGenerator.h>
 #include <gdcmVersion.h>
 
+#define PLUGIN_NAME "gdcm"
+
 #define GDCM_VERSION_IS_ABOVE(major, minor, revision)           \
   (GDCM_MAJOR_VERSION > major ||                                \
    (GDCM_MAJOR_VERSION == major &&                              \
@@ -521,7 +523,7 @@
         return -1;
       }
 
-      OrthancPluginSetDescription(context, "Decoder/transcoder of medical images using GDCM.");
+      OrthancPlugins::SetDescription(PLUGIN_NAME, "Decoder/transcoder of medical images using GDCM.");
 
       OrthancPlugins::OrthancConfiguration global;
 
@@ -618,7 +620,7 @@
 
   ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
   {
-    return "gdcm";
+    return PLUGIN_NAME;
   }
 
 
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Fri Jan 05 10:30:53 2024 +0100
+++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Fri Mar 22 15:13:44 2024 +0100
@@ -160,6 +160,8 @@
         set(ORTHANC_FRAMEWORK_MD5 "8a435140efc8ff4a01d8242f092f21de")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.2")
         set(ORTHANC_FRAMEWORK_MD5 "d2476b9e796e339ac320b5333489bdb3")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.3")
+        set(ORTHANC_FRAMEWORK_MD5 "975f5bf2142c22cb1777b4f6a0a614c5")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Fri Jan 05 10:30:53 2024 +0100
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp	Fri Mar 22 15:13:44 2024 +0100
@@ -4026,4 +4026,48 @@
       result[request->headersKeys[i]] = request->headersValues[i];
     }    
   }
+
+#if !ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+  static void SetPluginProperty(const std::string& pluginIdentifier,
+                                _OrthancPluginProperty property,
+                                const std::string& value)
+  {
+    _OrthancPluginSetPluginProperty params;
+    params.plugin = pluginIdentifier.c_str();
+    params.property = property;
+    params.value = value.c_str();
+
+    GetGlobalContext()->InvokeService(GetGlobalContext(), _OrthancPluginService_SetPluginProperty, &params);
+  }
+#endif
+
+  void SetRootUri(const std::string& pluginIdentifier,
+                  const std::string& uri)
+  {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+    OrthancPluginSetRootUri2(GetGlobalContext(), pluginIdentifier.c_str(), uri.c_str());
+#else
+    SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_RootUri, uri);
+#endif
+  }
+
+  void SetDescription(const std::string& pluginIdentifier,
+                      const std::string& description)
+  {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+    OrthancPluginSetDescription2(GetGlobalContext(), pluginIdentifier.c_str(), description.c_str());
+#else
+    SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_Description, description);
+#endif
+  }
+
+  void ExtendOrthancExplorer(const std::string& pluginIdentifier,
+                             const std::string& javascript)
+  {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+    OrthancPluginExtendOrthancExplorer2(GetGlobalContext(), pluginIdentifier.c_str(), javascript.c_str());
+#else
+    SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_OrthancExplorer, javascript);
+#endif
+  }
 }
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Fri Jan 05 10:30:53 2024 +0100
+++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h	Fri Mar 22 15:13:44 2024 +0100
@@ -1435,4 +1435,13 @@
                          IWebDavCollection& collection);
   };
 #endif
+
+  void SetRootUri(const std::string& pluginIdentifier,
+                  const std::string& uri);
+
+  void SetDescription(const std::string& pluginIdentifier,
+                      const std::string& description);
+
+  void ExtendOrthancExplorer(const std::string& pluginIdentifier,
+                             const std::string& javascript);
 }