Skip to content

Commit

Permalink
fix build with qt6
Browse files Browse the repository at this point in the history
Co-authored-by: Christophe Chapuis <[email protected]>
  • Loading branch information
jmlich and Tofee committed Aug 8, 2023
1 parent 8014186 commit fc84fcc
Show file tree
Hide file tree
Showing 62 changed files with 230 additions and 45 deletions.
2 changes: 1 addition & 1 deletion adaptors/alsadaptor/alsadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void ALSAdaptor::processSample(int pathId, int fd)
sensordLogW() << id() << "read(): " << strerror(errno);
return;
}
QVariant value(buffer);
QVariant value = QVariant::fromValue(QByteArray(buffer));
bool ok;
double fValue(value.toDouble(&ok));
if(!ok) {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrisaccelerometer/hybrisaccelerometer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HEADERS += hybrisaccelerometeradaptor.h \

SOURCES += hybrisaccelerometeradaptor.cpp \
hybrisaccelerometeradaptorplugin.cpp
LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrisalsadaptor/hybrisalsadaptor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HEADERS += hybrisalsadaptor.h \

SOURCES += hybrisalsadaptor.cpp \
hybrisalsadaptorplugin.cpp
LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrisgeorotationadaptor.h \
SOURCES += hybrisgeorotationadaptor.cpp \
hybrisgeorotationadaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrisgyroscopeadaptor.h \
SOURCES += hybrisgyroscopeadaptor.cpp \
hybrisgyroscopeadaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrismagnetometeradaptor.h \
SOURCES += hybrismagnetometeradaptor.cpp \
hybrismagnetometeradaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrisorientationadaptor.h \
SOURCES += hybrisorientationadaptor.cpp \
hybrisorientationadaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrispressureadaptor/hybrispressureadaptor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HEADERS += hybrispressureadaptor.h \

SOURCES += hybrispressureadaptor.cpp \
hybrispressureadaptorplugin.cpp
LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrisproximityadaptor/hybrisproximityadaptor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrisproximityadaptor.h \
SOURCES += hybrisproximityadaptor.cpp \
hybrisproximityadaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/hybrisrotationadaptor/hybrisrotationadaptor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADERS += hybrisrotationadaptor.h \
SOURCES += hybrisrotationadaptor.cpp \
hybrisrotationadaptorplugin.cpp

LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HEADERS += hybrisstepcounteradaptor.h \

SOURCES += hybrisstepcounteradaptor.cpp \
hybrisstepcounteradaptorplugin.cpp
LIBS+= -L../../core -lhybrissensorfw-qt5
LIBS+= -L../../core -lhybrissensorfw-qt$${QT_MAJOR_VERSION}

include( ../adaptor-config.pri )
config_hybris {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/iioadaptor/iioadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void IioAdaptor::setup()

iioDevice.channelTypeName = "proximity";
devNodeNumber = findSensor(inputMatch);
proximityThreshold = SensorFrameworkConfig::configuration()->value<QString>(name + "/threshold", QString(PROXIMITY_DEFAULT_THRESHOLD)).toInt();
proximityThreshold = SensorFrameworkConfig::configuration()->value<QString>(name + "/threshold", QString("%1").arg(PROXIMITY_DEFAULT_THRESHOLD)).toInt();
if (devNodeNumber!= -1) {
QString desc = "Industrial I/O proximity sensor (" + iioDevice.name +")";
qDebug() << id() << desc;
Expand Down
4 changes: 4 additions & 0 deletions chains/accelerometerchain/accelerometerchainplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ void AccelerometerChainPlugin::Register(class Loader&)
}

QStringList AccelerometerChainPlugin::Dependencies() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("coordinatealignfilter:accelerometeradaptor").split(":", Qt::SkipEmptyParts);
#else
return QString("coordinatealignfilter:accelerometeradaptor").split(":", QString::SkipEmptyParts);
#endif
}
8 changes: 8 additions & 0 deletions chains/compasschain/compasschainplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ void CompassChainPlugin::Register(class Loader&)
QStringList CompassChainPlugin::Dependencies() {
QByteArray orientationConfiguration = SensorFrameworkConfig::configuration()->value("plugins/orientationadaptor").toByteArray();
if (orientationConfiguration.isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("accelerometerchain:magcalibrationchain:declinationfilter:downsamplefilter:avgaccfilter").split(":", Qt::SkipEmptyParts);
#else
return QString("accelerometerchain:magcalibrationchain:declinationfilter:downsamplefilter:avgaccfilter").split(":", QString::SkipEmptyParts);
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("accelerometerchain:magcalibrationchain:declinationfilter:downsamplefilter:avgaccfilter:orientationadaptor").split(":", Qt::SkipEmptyParts);
#else
return QString("accelerometerchain:magcalibrationchain:declinationfilter:downsamplefilter:avgaccfilter:orientationadaptor").split(":", QString::SkipEmptyParts);
#endif
}
}
4 changes: 4 additions & 0 deletions chains/magcalibrationchain/magcalibrationchainplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ void MagCalibrationChainPlugin::Register(class Loader&)
}

QStringList MagCalibrationChainPlugin::Dependencies() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("magcoordinatealignfilter:magnetometeradaptor").split(":", Qt::SkipEmptyParts);
#else
return QString("magcoordinatealignfilter:magnetometeradaptor").split(":", QString::SkipEmptyParts);
#endif
}
4 changes: 4 additions & 0 deletions chains/orientationchain/orientationchainplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ void OrientationChainPlugin::Register(class Loader&)
}

QStringList OrientationChainPlugin::Dependencies() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("orientationinterpreter:accelerometerchain").split(":", Qt::SkipEmptyParts);
#else
return QString("orientationinterpreter:accelerometerchain").split(":", QString::SkipEmptyParts);
#endif
}
2 changes: 1 addition & 1 deletion common-config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ profile-libc {
QMAKE_LFLAGS += -lc_p
}

TARGET = $$TARGET-qt5
TARGET = $$TARGET-qt$${QT_MAJOR_VERSION}

OTHER_FILES += \
../../common.pri
Expand Down
4 changes: 2 additions & 2 deletions common-install.pri
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
QT -= gui

# Path for headers - remember to add files if they should be installed
publicheaders.path = /usr/include/sensord-qt5
PLUGINPATH = $$[QT_INSTALL_LIBS]/sensord-qt5
publicheaders.path = /usr/include/sensord-qt$${QT_MAJOR_VERSION}
PLUGINPATH = $$[QT_INSTALL_LIBS]/sensord-qt$${QT_MAJOR_VERSION}

# Path for shared libraries
SHAREDLIBPATH = $$[QT_INSTALL_LIBS]
Expand Down
2 changes: 1 addition & 1 deletion common.pri
Original file line number Diff line number Diff line change
@@ -1 +1 @@
QMAKE_LIBDIR_FLAGS += -lsensordatatypes-qt5 -lsensorfw-qt5
QMAKE_LIBDIR_FLAGS += -lsensordatatypes-qt$${QT_MAJOR_VERSION} -lsensorfw-qt$${QT_MAJOR_VERSION}
6 changes: 3 additions & 3 deletions core/core.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ SENSORFW_INCLUDEPATHS = .. \
DEPENDPATH += $$SENSORFW_INCLUDEPATHS
INCLUDEPATH += $$SENSORFW_INCLUDEPATHS

DEFINES += PLUGIN_DIRECTORY=\"\\\"$$[QT_INSTALL_LIBS]/sensord-qt5\\\"\"
DEFINES += PLUGIN_DIRECTORY=\"\\\"$$[QT_INSTALL_LIBS]/sensord-qt$${QT_MAJOR_VERSION}\\\"\"

QMAKE_LIBDIR_FLAGS += -L../datatypes\
-lsensordatatypes-qt5
-lsensordatatypes-qt$${QT_MAJOR_VERSION}

SOURCES += sensormanager.cpp \
sensormanager_a.cpp \
Expand Down Expand Up @@ -85,7 +85,7 @@ lunaservice {
SOURCES += lsclient.cpp
HEADERS += lsclient.h
DEFINES += SENSORFW_LUNA_SERVICE_CLIENT
PKGCONFIG += Qt5Gui json-c
PKGCONFIG += Qt$${QT_MAJOR_VERSION}Gui json-c
PKGCONFIG += luna-service2 LunaSysMgrCommon LunaSysMgrIpcMessages
}

Expand Down
2 changes: 1 addition & 1 deletion core/hybris.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ INCLUDEPATH += $$SENSORFW_INCLUDEPATHS

SOURCES += hybrisadaptor.cpp
HEADERS += hybrisadaptor.h
LIBS += -L$$[QT_INSTALL_LIBS] -L../datatypes -lsensordatatypes-qt5 -L. -lsensorfw-qt5
LIBS += -L$$[QT_INSTALL_LIBS] -L../datatypes -lsensordatatypes-qt$${QT_MAJOR_VERSION} -L. -lsensorfw-qt$${QT_MAJOR_VERSION}

CONFIG += link_pkgconfig

Expand Down
4 changes: 4 additions & 0 deletions core/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ Loader& Loader::instance()

#define PLUGIN_PREFIX_ENV "SENSORFW_LIBRARY_PATH"
#define PLUGIN_PREFIX "lib"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#define PLUGIN_SUFFIX "-qt6.so"
#else
#define PLUGIN_SUFFIX "-qt5.so"
#endif
#define SENSOR_SUFFIX "sensor"

static QString getPluginDirectory()
Expand Down
4 changes: 4 additions & 0 deletions core/nodebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ bool NodeBase::hasLocalRange() const
DataRangeList NodeBase::parseDataRangeList(const QString& input, int defaultResolution) const
{
DataRangeList list;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
foreach(const QString& fragment, input.split(",", Qt::SkipEmptyParts))
#else
foreach(const QString& fragment, input.split(",", QString::SkipEmptyParts))
#endif
{
QStringList pair(fragment.split("=>"));
QStringList pair2(fragment.split(":"));
Expand Down
2 changes: 1 addition & 1 deletion doc/doc.pri
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for( folder, DOC_FOLDERS ) {
QMAKE_EXTRA_TARGETS += doccleantarget

# Documentation install target
documentation.path = /usr/share/doc/sensord-qt5
documentation.path = /usr/share/doc/sensord-qt$${QT_MAJOR_VERSION}
documentation.files = doc/html
documentation.depends = docs

Expand Down
4 changes: 4 additions & 0 deletions examples/chainplugin/samplechainplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ void SampleChainPlugin::Register(class Loader&)
//
// Here we have one adaptor and one filter that we need.
QStringList SampleChainPlugin::Dependencies() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("sampleadaptor:samplefilter").split(":", Qt::SkipEmptyParts);
#else
return QString("sampleadaptor:samplefilter").split(":", QString::SkipEmptyParts);
#endif
}
1 change: 1 addition & 0 deletions examples/filterplugin/samplefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#ifndef SAMPLEFILTER_H
#define SAMPLEFILTER_H

#include <QObject>
// Include base
#include "filter.h"

Expand Down
4 changes: 4 additions & 0 deletions examples/sensorplugin/sampleplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ void SamplePlugin::Register(class Loader&)
// dependency here. We can rely on it to provide further dependencies to
// any plugins it may need.
QStringList SamplePlugin::Dependencies() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QString("samplechain").split(":", Qt::SkipEmptyParts);
#else
return QString("samplechain").split(":", QString::SkipEmptyParts);
#endif
}
Loading

0 comments on commit fc84fcc

Please sign in to comment.