Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 4939133

Browse files
committed
fix debug/release detection via "hidden" parameter
1 parent cf91fa3 commit 4939133

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

isdebughelper.cpp

Lines changed: 0 additions & 8 deletions
This file was deleted.

qpluginfactory.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include <QDir>
77
#include <QCoreApplication>
88

9-
extern bool __qpluginfactory_is_debug();
10-
119
class StaticPluginInfo : public QPluginFactoryBase::PluginInfo
1210
{
1311
public:
@@ -36,12 +34,13 @@ class DynamicPluginInfo : public QPluginFactoryBase::PluginInfo
3634

3735

3836

39-
QPluginFactoryBase::QPluginFactoryBase(QString pluginType, QObject *parent) :
40-
QPluginFactoryBase(std::move(pluginType), QByteArray(), parent)
37+
QPluginFactoryBase::QPluginFactoryBase(QString pluginType, QObject *parent, bool isDebugBuild) :
38+
QPluginFactoryBase(std::move(pluginType), QByteArray(), parent, isDebugBuild)
4139
{}
4240

43-
QPluginFactoryBase::QPluginFactoryBase(QString pluginType, QByteArray pluginIid, QObject *parent) :
41+
QPluginFactoryBase::QPluginFactoryBase(QString pluginType, QByteArray pluginIid, QObject *parent, bool isDebugBuild) :
4442
QObject(parent),
43+
_isDebugBuild{isDebugBuild},
4544
_pluginType(std::move(pluginType)),
4645
_pluginIid(std::move(pluginIid)),
4746
_extraDirs(),
@@ -207,7 +206,7 @@ void QPluginFactoryBase::unload(const QString &key)
207206

208207
QJsonArray QPluginFactoryBase::checkMeta(const QJsonObject &metaData, const QString &filename) const
209208
{
210-
if(metaData[QStringLiteral("debug")].toBool() != __qpluginfactory_is_debug())
209+
if(metaData[QStringLiteral("debug")].toBool() != _isDebugBuild)
211210
return {};
212211

213212
auto iid = metaData.value(QStringLiteral("IID")).toString().toUtf8();

qpluginfactory.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#include <QException>
88
#include <QMutex>
99

10+
#ifdef QT_NO_DEBUG
11+
#define Q_PLUGIN_FACTORY_IS_DEBUG false
12+
#else
13+
#define Q_PLUGIN_FACTORY_IS_DEBUG true
14+
#endif
15+
1016
class QPluginLoadException : public QException
1117
{
1218
public:
@@ -38,8 +44,8 @@ class QPluginFactoryBase : public QObject
3844
virtual QObject *instance() = 0;
3945
};
4046

41-
QPluginFactoryBase(QString pluginType, QObject *parent = nullptr);
42-
QPluginFactoryBase(QString pluginType, QByteArray pluginIid, QObject *parent = nullptr);
47+
QPluginFactoryBase(QString pluginType, QObject *parent = nullptr, bool isDebugBuild = Q_PLUGIN_FACTORY_IS_DEBUG);
48+
QPluginFactoryBase(QString pluginType, QByteArray pluginIid, QObject *parent = nullptr, bool isDebugBuild = Q_PLUGIN_FACTORY_IS_DEBUG);
4349

4450
void addSearchDir(const QDir &dir, bool isTopLevel = false);
4551

@@ -60,6 +66,7 @@ public slots:
6066
void unload(const QString &key);
6167

6268
private:
69+
const bool _isDebugBuild;
6370
const QString _pluginType;
6471
QByteArray _pluginIid;
6572
QList<QDir> _extraDirs;

qpluginfactory.prc

Lines changed: 0 additions & 1 deletion
This file was deleted.

qpluginfactory.pri

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ HEADERS += \
66
SOURCES += \
77
$$PWD/qpluginfactory.cpp
88

9-
!qpmx_static:include($$PWD/qpluginfactory.prc)
10-
119
TRANSLATIONS +=

qpm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"version": {
1717
"fingerprint": "",
18-
"label": "1.3.0",
18+
"label": "1.3.1",
1919
"revision": ""
2020
},
2121
"webpage": "https://github.com/Skycoder42/QPluginFactory"

qpmx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"file": "LICENSE",
66
"name": "BSD_3_CLAUSE"
77
},
8-
"prcFile": "qpluginfactory.prc",
8+
"prcFile": "",
99
"priFile": "qpluginfactory.pri",
1010
"priIncludes": [
1111
],

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy