Skip to content

Commit

Permalink
fix build with qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Jul 21, 2023
1 parent 8014186 commit 4e068ff
Show file tree
Hide file tree
Showing 62 changed files with 229 additions and 49 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/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
}
45 changes: 44 additions & 1 deletion qt-api/abstractsensor_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ QDBusReply<void> AbstractSensorChannelInterface::start(int sessionId)
connect(pimpl_->m_socketReader.socket(), SIGNAL(readyRead()), this, SLOT(dataReceived()));

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId);
#else
argumentList << qVariantFromValue(sessionId);
#endif

QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("start"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
Expand Down Expand Up @@ -177,8 +181,11 @@ QDBusReply<void> AbstractSensorChannelInterface::stop(int sessionId)
disconnect(pimpl_->m_socketReader.socket(), SIGNAL(readyRead()), this, SLOT(dataReceived()));

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId);
#else
argumentList << qVariantFromValue(sessionId);

#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("stop"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand All @@ -202,7 +209,11 @@ QDBusReply<void> AbstractSensorChannelInterface::setInterval(int sessionId, int
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(interval_ms);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(interval_ms);
#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setInterval"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand All @@ -226,7 +237,11 @@ QDBusReply<void> AbstractSensorChannelInterface::setDataRate(int sessionId, doub
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(dataRate_Hz);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(dataRate_Hz);
#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setDataRate"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand All @@ -250,7 +265,11 @@ QDBusReply<void> AbstractSensorChannelInterface::setBufferInterval(int sessionId
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(interval_ms);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(interval_ms);
#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setBufferInterval"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand All @@ -275,7 +294,11 @@ QDBusReply<void> AbstractSensorChannelInterface::setBufferSize(int sessionId, un
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(value);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(value);
#endif

QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setBufferSize"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
Expand All @@ -300,7 +323,11 @@ QDBusReply<bool> AbstractSensorChannelInterface::setStandbyOverride(int sessionI
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(value);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(value);
#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setStandbyOverride"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand Down Expand Up @@ -332,13 +359,21 @@ DataRange AbstractSensorChannelInterface::getCurrentDataRange()
void AbstractSensorChannelInterface::requestDataRange(DataRange range)
{
clearError();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
call(QDBus::NoBlock, QLatin1String("requestDataRange"), QVariant::fromValue(pimpl_->m_sessionId), QVariant::fromValue(range));
#else
call(QDBus::NoBlock, QLatin1String("requestDataRange"), qVariantFromValue(pimpl_->m_sessionId), qVariantFromValue(range));
#endif
}

void AbstractSensorChannelInterface::removeDataRangeRequest()
{
clearError();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
call(QDBus::NoBlock, QLatin1String("removeDataRangeRequest"), QVariant::fromValue(pimpl_->m_sessionId));
#else
call(QDBus::NoBlock, QLatin1String("removeDataRangeRequest"), qVariantFromValue(pimpl_->m_sessionId));
#endif
}

DataRangeList AbstractSensorChannelInterface::getAvailableIntervals()
Expand Down Expand Up @@ -499,7 +534,11 @@ bool AbstractSensorChannelInterface::setDataRangeIndex(int dataRangeIndex)
{
clearError();
QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(pimpl_->m_sessionId) << QVariant::fromValue(dataRangeIndex);
#else
argumentList << qVariantFromValue(pimpl_->m_sessionId) << qVariantFromValue(dataRangeIndex);
#endif

QDBusPendingReply <bool> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setDataRangeIndex"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
Expand Down Expand Up @@ -564,7 +603,11 @@ QDBusReply<void> AbstractSensorChannelInterface::setDownsampling(int sessionId,
clearError();

QList<QVariant> argumentList;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
argumentList << QVariant::fromValue(sessionId) << QVariant::fromValue(value);
#else
argumentList << qVariantFromValue(sessionId) << qVariantFromValue(value);
#endif
QDBusPendingReply <void> returnValue = pimpl_->asyncCallWithArgumentList(QLatin1String("setDownsampling"), argumentList);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(returnValue, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
Expand Down
Loading

0 comments on commit 4e068ff

Please sign in to comment.