# HG changeset patch # User Sebastien Jodogne # Date 1711117579 -3600 # Node ID 82ab647f7e73784ae6add30c8293aaf402cfa5f0 # Parent c6edc5caca7a23b548765d2cc39dbc2c079ac794 fix deprecated calls diff -r c6edc5caca7a -r 82ab647f7e73 Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Sat Mar 02 11:26:20 2024 +0100 +++ b/Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Fri Mar 22 15:26:19 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 c6edc5caca7a -r 82ab647f7e73 Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h --- a/Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Sat Mar 02 11:26:20 2024 +0100 +++ b/Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h Fri Mar 22 15:26:19 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); } diff -r c6edc5caca7a -r 82ab647f7e73 Common/StoragePlugin.cpp --- a/Common/StoragePlugin.cpp Sat Mar 02 11:26:20 2024 +0100 +++ b/Common/StoragePlugin.cpp Fri Mar 22 15:26:19 2024 +0100 @@ -534,7 +534,7 @@ OrthancPlugins::OrthancConfiguration orthancConfig; OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing"); - OrthancPluginSetDescription(context, StoragePluginFactory::GetStorageDescription()); + OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription()); /* Check the version of the Orthanc core */ if (OrthancPluginCheckVersion(context) == 0)