diff options
author | Laszlo Papp <lpapp@kde.org> | 2013-10-06 06:22:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-09 13:01:51 +0200 |
commit | 50ab4d4a8ff5f882b9699cbde26ad9d8824a4824 (patch) | |
tree | 7455c7af7dd31eb449bc95986d5b7ed20c781080 /src | |
parent | 43f7c62509f71b16b263f4280ee55a350696ca00 (diff) |
Eliminate the ifdef in the code for imported headers (qt4support)
As I previously wrote on Gerrit, this idea of resembling the include hiearchy
inside qt4support has two advantages:
1) The includes are well-separated for Qt 4 that are imported.
2) The code is less complex due to the non-existence of ifdefs for major Qt
variants.
The only disadvantage is that the build system got one additional line, but the
benefits outweigh that.
This has been (only build!) tested on Linux (Arch) with Qt 4 and then 5.
Change-Id: Ic33632cd0e569693a65af094479dac0a02b1a7f7
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialport_p.h | 4 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 4 | ||||
-rw-r--r-- | src/serialport/qt4support/include/QtCore/qwineventnotifier.h (renamed from src/serialport/qt4support/qwineventnotifier_p.h) | 30 | ||||
-rw-r--r-- | src/serialport/qt4support/include/private/qringbuffer_p.h (renamed from src/serialport/qt4support/qringbuffer_p.h) | 0 | ||||
-rw-r--r-- | src/serialport/qt4support/install-helper.pri | 1 |
5 files changed, 10 insertions, 29 deletions
diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h index cb6a7489..41404937 100644 --- a/src/serialport/qserialport_p.h +++ b/src/serialport/qserialport_p.h @@ -46,11 +46,7 @@ #include "qserialport.h" -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include <private/qringbuffer_p.h> -#else -#include "qt4support/qringbuffer_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 834740d9..91630fd6 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -50,11 +50,7 @@ #include <QtCore/qvector.h> #endif -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include <QtCore/qwineventnotifier.h> -#else -#include "qt4support/qwineventnotifier_p.h" -#endif #ifndef CTL_CODE # define CTL_CODE(DeviceType, Function, Method, Access) ( \ diff --git a/src/serialport/qt4support/qwineventnotifier_p.h b/src/serialport/qt4support/include/QtCore/qwineventnotifier.h index bd1203e5..ed31e835 100644 --- a/src/serialport/qt4support/qwineventnotifier_p.h +++ b/src/serialport/qt4support/include/QtCore/qwineventnotifier.h @@ -39,29 +39,21 @@ ** ****************************************************************************/ -#ifndef QWINEVENTNOTIFIER_P_H -#define QWINEVENTNOTIFIER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// +#ifndef QWINEVENTNOTIFIER_H +#define QWINEVENTNOTIFIER_H #include "QtCore/qobject.h" + +#ifdef Q_OS_WIN #include "QtCore/qt_windows.h" QT_BEGIN_NAMESPACE +class QWinEventNotifierPrivate; class Q_CORE_EXPORT QWinEventNotifier : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_PRIVATE(QWinEventNotifier) public: explicit QWinEventNotifier(QObject *parent = 0); @@ -81,14 +73,10 @@ Q_SIGNALS: protected: bool event(QEvent * e); - -private: - Q_DISABLE_COPY(QWinEventNotifier) - - HANDLE handleToEvent; - bool enabled; }; QT_END_NAMESPACE -#endif // QWINEVENTNOTIFIER_P_H +#endif // Q_OS_WIN + +#endif // QWINEVENTNOTIFIER_H diff --git a/src/serialport/qt4support/qringbuffer_p.h b/src/serialport/qt4support/include/private/qringbuffer_p.h index ddd10e54..ddd10e54 100644 --- a/src/serialport/qt4support/qringbuffer_p.h +++ b/src/serialport/qt4support/include/private/qringbuffer_p.h diff --git a/src/serialport/qt4support/install-helper.pri b/src/serialport/qt4support/install-helper.pri index 9ec2e6bb..6037caf5 100644 --- a/src/serialport/qt4support/install-helper.pri +++ b/src/serialport/qt4support/install-helper.pri @@ -36,4 +36,5 @@ target.path = $$[QT_INSTALL_LIBS] INSTALLS += target INCLUDEPATH += $$QTSERIALPORT_BUILD_ROOT/include $$QTSERIALPORT_BUILD_ROOT/include/QtSerialPort +lessThan(QT_MAJOR_VERSION, 5): INCLUDEPATH += $$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/include DEFINES += QT_BUILD_SERIALPORT_LIB |