1 /* 2 SPDX-FileCopyrightText: 2008 Aaron Seigo <aseigo@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #include "debug_p.h" 8 #include <QDebug> 9 #include <plasma/version.h> 10 11 #if PLASMA_BUILD_DEPRECATED_SINCE(5, 85) 12 13 namespace Plasma 14 { version()15unsigned int version() 16 { 17 return PLASMA_VERSION; 18 } 19 versionMajor()20unsigned int versionMajor() 21 { 22 return PLASMA_VERSION_MAJOR; 23 } 24 versionMinor()25unsigned int versionMinor() 26 { 27 return PLASMA_VERSION_MINOR; 28 } 29 versionRelease()30unsigned int versionRelease() 31 { 32 return PLASMA_VERSION_PATCH; 33 } 34 versionString()35const char *versionString() 36 { 37 return PLASMA_VERSION_STRING; 38 } 39 isPluginVersionCompatible(unsigned int version)40bool isPluginVersionCompatible(unsigned int version) 41 { 42 if (version == quint32(-1)) { 43 // unversioned, just let it through 44 qCWarning(LOG_PLASMA) << "unversioned plugin detected, may result in instability"; 45 return true; 46 } 47 48 // we require PLASMA_VERSION_MAJOR and PLASMA_VERSION_MINOR 49 const quint32 minVersion = PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, 0, 0); 50 const quint32 maxVersion = PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR, PLASMA_VERSION_MINOR, 60); 51 52 if (version < minVersion || version > maxVersion) { 53 #ifndef NDEBUG 54 // qCDebug(LOG_PLASMA) << "plugin is compiled against incompatible Plasma version " << version 55 // << "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion 56 // << ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")"; 57 #endif 58 return false; 59 } 60 61 return true; 62 } 63 64 } // Plasma namespace 65 #endif 66