changeset 22:0bbb4e12b1f0

fix deprecated call
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 15:59:05 +0100
parents 4ff1471ebe8b
children 591f73e7b8e9 c6e74cb17ad7
files Plugin/Plugin.cpp Resources/Orthanc/CMake/JsonCppConfiguration.cmake
diffstat 2 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri Jan 05 17:36:06 2024 +0100
+++ b/Plugin/Plugin.cpp	Fri Mar 22 15:59:05 2024 +0100
@@ -47,6 +47,9 @@
 
 #include "Mutex.h"
 
+#define ORTHANC_PLUGIN_NAME  "java"
+
+
 OrthancPluginContext* context_ = NULL;
 
 static std::unique_ptr<JavaVirtualMachine> java_;
@@ -417,6 +420,21 @@
 }
 
 
+static void SetPluginDescription(const std::string& description)
+{
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+  OrthancPluginSetDescription2(context_, ORTHANC_PLUGIN_NAME, description.c_str());
+#else
+  _OrthancPluginSetPluginProperty params;
+  params.plugin = ORTHANC_PLUGIN_NAME;
+  params.property = _OrthancPluginProperty_Description;
+  params.value = description.c_str();
+
+  context_->InvokeService(context_, _OrthancPluginService_SetPluginProperty, &params);
+#endif
+}
+
+
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
@@ -436,7 +454,7 @@
       return -1;
     }
 
-    OrthancPluginSetDescription(context, "Java plugin for Orthanc");
+    SetPluginDescription("Java plugin for Orthanc");
 
     try
     {
@@ -546,7 +564,7 @@
 
   ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
   {
-    return "java";
+    return ORTHANC_PLUGIN_NAME;
   }
 
 
--- a/Resources/Orthanc/CMake/JsonCppConfiguration.cmake	Fri Jan 05 17:36:06 2024 +0100
+++ b/Resources/Orthanc/CMake/JsonCppConfiguration.cmake	Fri Mar 22 15:59:05 2024 +0100
@@ -28,9 +28,9 @@
     set(JSONCPP_MD5 "3a8072ca6a1fa9cbaf7715ae625f134f")
     add_definitions(-DORTHANC_LEGACY_JSONCPP=1)
   else()
-    set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.9.4)
-    set(JSONCPP_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/jsoncpp-1.9.4.tar.gz")
-    set(JSONCPP_MD5 "4757b26ec89798c5247fa638edfdc446")
+    set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.9.5)
+    set(JSONCPP_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/jsoncpp-1.9.5.tar.gz")
+    set(JSONCPP_MD5 "d6c8c609f2162eff373db62b90a051c7")
     add_definitions(-DORTHANC_LEGACY_JSONCPP=0)
     set(JSONCPP_CXX11 ON)
   endif()