# HG changeset patch # User Sebastien Jodogne # Date 1710587167 -3600 # Node ID bf8ddc85023ee6c68dca0fbfdc6dc9740f63b0a1 # Parent 48a7f05c3bd50b95c9a18f5f74edae4e71060121# Parent 11bc8a30403836386810d6c0f86c69e93d8bd770 fix deprecated calls diff -r 48a7f05c3bd5 -r bf8ddc85023e Applications/Samples/RtViewerPlugin/Plugin.cpp --- a/Applications/Samples/RtViewerPlugin/Plugin.cpp Sat Mar 09 10:01:30 2024 +0100 +++ b/Applications/Samples/RtViewerPlugin/Plugin.cpp Sat Mar 16 12:06:07 2024 +0100 @@ -133,7 +133,7 @@ std::string explorer; Orthanc::EmbeddedResources::GetFileResource( explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); - OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); + OrthancPlugins::ExtendOrthancExplorer(PLUGIN_NAME, explorer.c_str()); // RtViewer files below. // --------------------- diff -r 48a7f05c3bd5 -r bf8ddc85023e Applications/StoneWebViewer/Plugin/Plugin.cpp --- a/Applications/StoneWebViewer/Plugin/Plugin.cpp Sat Mar 09 10:01:30 2024 +0100 +++ b/Applications/StoneWebViewer/Plugin/Plugin.cpp Sat Mar 16 12:06:07 2024 +0100 @@ -279,10 +279,12 @@ try { + OrthancPlugins::SetDescription(PLUGIN_NAME, "Stone Web viewer"); + std::string explorer; Orthanc::EmbeddedResources::GetFileResource( explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); - OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); + OrthancPlugins::ExtendOrthancExplorer(PLUGIN_NAME, explorer.c_str()); OrthancPlugins::RegisterRestCallback (STONE_WEB_VIEWER_ROOT + "/configuration.json", true); diff -r 48a7f05c3bd5 -r bf8ddc85023e RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Sat Mar 09 10:01:30 2024 +0100 +++ b/RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Sat Mar 16 12:06:07 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, ¶ms); + } +#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 + } } diff -r 48a7f05c3bd5 -r bf8ddc85023e RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- a/RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sat Mar 09 10:01:30 2024 +0100 +++ b/RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sat Mar 16 12:06:07 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); }