summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-10-21 13:30:47 +0200
committerAndy Shaw <andy.shaw@qt.io>2019-10-22 06:00:16 +0200
commitf129107e472c179e47b37d8fdaff120d1eccc7f8 (patch)
tree16f69650f8223ac6a6d15edf4d8581d9575f83a1
parent80144b89ca1adede0db9d6e485037f5e431216c3 (diff)
Avoid conflicting class names if the plugins are linked statically
QtSerialBus is already using QtSerialPort which has a WriteNotifier and ReadNotifier class in place. Therefore it is possible that if these were linked in together into one application that there would be multiple instances of the same class name which caused problems as it would think that the WriteNotifier in QtSerialPort was a QTimer and not a QSocketNotifier. So keep the names unique to be on the safe side. Change-Id: I8667e3d4230b316d47e266ad1b4319cf5e74444b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/plugins/canbus/peakcan/peakcanbackend.cpp18
-rw-r--r--src/plugins/canbus/tinycan/tinycanbackend.cpp8
-rw-r--r--src/plugins/canbus/vectorcan/vectorcanbackend.cpp14
3 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/canbus/peakcan/peakcanbackend.cpp b/src/plugins/canbus/peakcan/peakcanbackend.cpp
index 411223a..172de14 100644
--- a/src/plugins/canbus/peakcan/peakcanbackend.cpp
+++ b/src/plugins/canbus/peakcan/peakcanbackend.cpp
@@ -1,4 +1,4 @@
-/****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2017 The Qt Company Ltd.
@@ -151,11 +151,11 @@ QList<QCanBusDeviceInfo> PeakCanBackend::interfaces()
}
#if defined(Q_OS_WIN32)
-class ReadNotifier : public QWinEventNotifier
+class PeakCanReadNotifier : public QWinEventNotifier
{
// no Q_OBJECT macro!
public:
- explicit ReadNotifier(PeakCanBackendPrivate *d, QObject *parent)
+ explicit PeakCanReadNotifier(PeakCanBackendPrivate *d, QObject *parent)
: QWinEventNotifier(parent)
, dptr(d)
{
@@ -176,11 +176,11 @@ private:
PeakCanBackendPrivate * const dptr;
};
#else
-class ReadNotifier : public QSocketNotifier
+class PeakCanReadNotifier : public QSocketNotifier
{
// no Q_OBJECT macro!
public:
- explicit ReadNotifier(PeakCanBackendPrivate *d, QObject *parent)
+ explicit PeakCanReadNotifier(PeakCanBackendPrivate *d, QObject *parent)
: QSocketNotifier(d->readHandle, QSocketNotifier::Read, parent)
, dptr(d)
{
@@ -201,11 +201,11 @@ private:
};
#endif
-class WriteNotifier : public QTimer
+class PeakCanWriteNotifier : public QTimer
{
// no Q_OBJECT macro!
public:
- WriteNotifier(PeakCanBackendPrivate *d, QObject *parent)
+ PeakCanWriteNotifier(PeakCanBackendPrivate *d, QObject *parent)
: QTimer(parent)
, dptr(d)
{
@@ -358,10 +358,10 @@ bool PeakCanBackendPrivate::open()
}
#endif
- writeNotifier = new WriteNotifier(this, q);
+ writeNotifier = new PeakCanWriteNotifier(this, q);
writeNotifier->setInterval(0);
- readNotifier = new ReadNotifier(this, q);
+ readNotifier = new PeakCanReadNotifier(this, q);
readNotifier->setEnabled(true);
isOpen = true;
diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp
index 496770a..6453826 100644
--- a/src/plugins/canbus/tinycan/tinycanbackend.cpp
+++ b/src/plugins/canbus/tinycan/tinycanbackend.cpp
@@ -1,4 +1,4 @@
-/****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com>
** Copyright (C) 2017 The Qt Company Ltd.
@@ -89,11 +89,11 @@ struct TinyCanGlobal {
Q_GLOBAL_STATIC(TinyCanGlobal, gTinyCan)
-class WriteNotifier : public QTimer
+class TinyCanWriteNotifier : public QTimer
{
// no Q_OBJECT macro!
public:
- WriteNotifier(TinyCanBackendPrivate *d, QObject *parent)
+ TinyCanWriteNotifier(TinyCanBackendPrivate *d, QObject *parent)
: QTimer(parent)
, dptr(d)
{
@@ -211,7 +211,7 @@ bool TinyCanBackendPrivate::open()
}
}
- writeNotifier = new WriteNotifier(this, q);
+ writeNotifier = new TinyCanWriteNotifier(this, q);
writeNotifier->setInterval(0);
isOpen = true;
diff --git a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp
index 40ba0ac..0e6d3ae 100644
--- a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp
+++ b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp
@@ -1,4 +1,4 @@
-/****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com>
** Contact: http://www.qt.io/licensing/
@@ -103,11 +103,11 @@ QList<QCanBusDeviceInfo> VectorCanBackend::interfaces()
static int driverRefCount = 0;
-class ReadNotifier : public QWinEventNotifier
+class VectorCanReadNotifier : public QWinEventNotifier
{
// no Q_OBJECT macro!
public:
- explicit ReadNotifier(VectorCanBackendPrivate *d, QObject *parent)
+ explicit VectorCanReadNotifier(VectorCanBackendPrivate *d, QObject *parent)
: QWinEventNotifier(parent)
, dptr(d)
{
@@ -128,11 +128,11 @@ private:
VectorCanBackendPrivate * const dptr;
};
-class WriteNotifier : public QTimer
+class VectorCanWriteNotifier : public QTimer
{
// no Q_OBJECT macro!
public:
- WriteNotifier(VectorCanBackendPrivate *d, QObject *parent)
+ VectorCanWriteNotifier(VectorCanBackendPrivate *d, QObject *parent)
: QTimer(parent)
, dptr(d)
{
@@ -202,10 +202,10 @@ bool VectorCanBackendPrivate::open()
}
}
- readNotifier = new ReadNotifier(this, q);
+ readNotifier = new VectorCanReadNotifier(this, q);
readNotifier->setEnabled(true);
- writeNotifier = new WriteNotifier(this, q);
+ writeNotifier = new VectorCanWriteNotifier(this, q);
return true;
}