Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup build with qt6 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ LIBDBUSQEVENTLOOP = $${PWD}/libdbus-qeventloop
LIBRESOURCEQT = $${PWD}/libresourceqt
LIBMEDIAOVERRIDESQT = $${PWD}/libmediaoverridesqt

RESOURCEQTLIB = -L$${LIBRESOURCEQT}/build -lresourceqt5
DBUSQEVENTLOOPLIB = -L$${LIBDBUSQEVENTLOOP}/build -ldbus-qeventloop-qt5
RESOURCEQTLIB = -L$${LIBRESOURCEQT}/build -lresourceqt$${QT_MAJOR_VERSION}
DBUSQEVENTLOOPLIB = -L$${LIBDBUSQEVENTLOOP}/build -ldbus-qeventloop-qt$${QT_MAJOR_VERSION}

PUBLIC_INCLUDE = $${LIBRESOURCEQT}/include/

2 changes: 1 addition & 1 deletion libdbus-qeventloop/dbusconnectioneventloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ dbus_bool_t DBUSConnectionEventLoop::addWatch(DBusWatch *watch, void *data)
loop->connect(watcher.write, SIGNAL(activated(int)), SLOT(writeSocket(int)));
}

loop->watchers.insertMulti(fd, watcher);
loop->watchers.insert(fd, watcher);

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions libdbus-qeventloop/libdbus-qeventloop.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################

include(../common.pri)
TARGET = dbus-qeventloop-qt5
TARGET = dbus-qeventloop-qt$${QT_MAJOR_VERSION}
TEMPLATE = lib
DESTDIR = build
MOC_DIR = .moc
Expand All @@ -42,14 +42,14 @@ INSTALLBASE = $$[QT_INSTALL_PREFIX]
target.path = $$[QT_INSTALL_LIBS]
headers.path = $$INSTALLBASE/include

QMAKE_PKGCONFIG_NAME = libdbus-qeventloop5
QMAKE_PKGCONFIG_NAME = libdbus-qeventloop$${QT_MAJOR_VERSION}
QMAKE_PKGCONFIG_DESCRIPTION = D-Bus - QEventloop binding
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_REQUIRES = dbus-1
QMAKE_PKGCONFIG_VERSION = $$VERSION
QMAKE_PKGCONFIG_FILE = libdbus-qeventloop5
QMAKE_PKGCONFIG_FILE = libdbus-qeventloop$${QT_MAJOR_VERSION}

INSTALLS = target headers

12 changes: 6 additions & 6 deletions libmediaoverridesqt/libmediaoverridesqt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(../common.pri)
TEMPLATE = lib
TARGET = mediaoverridesqt5
TARGET = mediaoverridesqt$${QT_MAJOR_VERSION}
DESTDIR = build
DEPENDPATH += .
INCLUDEPATH += .
Expand Down Expand Up @@ -28,16 +28,16 @@ QMAKE_DISTCLEAN += -r moc build
headers.files = $${PUBLIC_HEADERS}
INSTALLBASE = $$[QT_INSTALL_PREFIX]
target.path = $$[QT_INSTALL_LIBS]
headers.path = $${INSTALLBASE}/include/resource/qt5/policy
headers.path = $${INSTALLBASE}/include/resource/qt$${QT_MAJOR_VERSION}/policy

QMAKE_PKGCONFIG_NAME = libmediaoverridesqt5
QMAKE_PKGCONFIG_NAME = libmediaoverridesqt$${QT_MAJOR_VERSION}
QMAKE_PKGCONFIG_DESCRIPTION = Maemo playback manager Qt API
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $${INSTALLBASE}/include/resource/qt5
QMAKE_PKGCONFIG_INCDIR = $${INSTALLBASE}/include/resource/qt$${QT_MAJOR_VERSION}
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_REQUIRES = Qt5DBus
QMAKE_PKGCONFIG_REQUIRES = Qt$${QT_MAJOR_VERSION}DBus
QMAKE_PKGCONFIG_VERSION = $$VERSION
QMAKE_PKGCONFIG_FILE = libmediaoverridesqt5
QMAKE_PKGCONFIG_FILE = libmediaoverridesqt$${QT_MAJOR_VERSION}

INSTALLS = target headers

8 changes: 8 additions & 0 deletions libresourceqt/include/policy/resource-set.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ USA.
#include <stdarg.h>
#include <stdio.h>

#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
#include <QRecursiveMutex>
#endif

class ResourceSetPrivate;


Expand Down Expand Up @@ -414,7 +418,11 @@ class ResourceSet: public QObject
bool haveAudioProperties;
bool inAcquireMode;
QList<requestType> requestQ;
#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
QRecursiveMutex reqMutex;
#else
QMutex reqMutex;
#endif
bool ignoreQ;
ResourceSetPrivate* d;
bool initialize();
Expand Down
16 changes: 8 additions & 8 deletions libresourceqt/libresourceqt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

include(../common.pri)
TEMPLATE = lib
TARGET = resourceqt5
TARGET = resourceqt$${QT_MAJOR_VERSION}
DESTDIR = build
DEPENDPATH += $${POLICY} src
INCLUDEPATH += $${PUBLIC_INCLUDE} $${LIBDBUSQEVENTLOOP} src
Expand Down Expand Up @@ -55,23 +55,23 @@ PKGCONFIG += dbus-1 libresource
headers.files = $${PUBLIC_HEADERS}
INSTALLBASE = $$[QT_INSTALL_PREFIX]
target.path = $$[QT_INSTALL_LIBS]
headers.path = $${INSTALLBASE}/include/resource/qt5/policy
headers.path = $${INSTALLBASE}/include/resource/qt$${QT_MAJOR_VERSION}/policy

man.files = docs/man
man.path = $${INSTALLBASE}/share
htmldoc.files = docs/html
htmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt5
htmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt$${QT_MAJOR_VERSION}
xmldoc.files = docs/xml
xmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt5
xmldoc.path = $${INSTALLBASE}/share/doc/libresourceqt$${QT_MAJOR_VERSION}

QMAKE_PKGCONFIG_NAME = libresourceqt5
QMAKE_PKGCONFIG_NAME = libresourceqt$${QT_MAJOR_VERSION}
QMAKE_PKGCONFIG_DESCRIPTION = Maemo resource management Qt API
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $${INSTALLBASE}/include/resource/qt5
QMAKE_PKGCONFIG_INCDIR = $${INSTALLBASE}/include/resource/qt$${QT_MAJOR_VERSION}
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_REQUIRES = dbus-1 libdbus-qeventloop5 libresource Qt5Core
QMAKE_PKGCONFIG_REQUIRES = dbus-1 libdbus-qeventloop$${QT_MAJOR_VERSION} libresource Qt$${QT_MAJOR_VERSION}Core
QMAKE_PKGCONFIG_VERSION = $$VERSION
QMAKE_PKGCONFIG_FILE = libresourceqt5
QMAKE_PKGCONFIG_FILE = libresourceqt$${QT_MAJOR_VERSION}

INSTALLS = target headers man htmldoc xmldoc

24 changes: 24 additions & 0 deletions libresourceqt/src/resource-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ USA.
#include <dbus/dbus.h>
#include <res-msg.h>

#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
#include <QRecursiveMutex>
#endif

Q_LOGGING_CATEGORY(lcResourceQt, "resourceQt", QtWarningMsg)

using namespace ResourcePolicy;
Expand All @@ -32,7 +36,11 @@ static QMultiMap<resconn_t *, ResourceEngine *> engineMap;
resconn_t *ResourceEngine::libresourceConnection = NULL;
quint32 ResourceEngine::libresourceUsers = 0;

#if (QT_VERSION > QT_VERSION_CHECK(6,0,0))
static QRecursiveMutex mutex;
#else
static QMutex mutex(QMutex::Recursive);
#endif

static inline quint32 allResourcesToBitmask(const ResourceSet *resourceSet);
static inline quint32 optionalResourcesToBitmask(const ResourceSet *resourceSet);
Expand Down Expand Up @@ -556,7 +564,11 @@ bool ResourceEngine::releaseResources()
bool ResourceEngine::updateResources()
{
qCDebug(lcResourceQt, "ResourceEngine(%d)::%s() - **************** locking....", identifier, __FUNCTION__);
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
QMutexLocker locker(&mutex);
#else
mutex.lock();
#endif
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));
message.record.type = RESMSG_UPDATE;
Expand Down Expand Up @@ -591,7 +603,11 @@ bool ResourceEngine::registerAudioProperties(const QString &audioGroup, quint32
const QString &name, const QString &value)
{
qCDebug(lcResourceQt, "ResourceEngine(%d)::%s() - **************** locking....", identifier, __FUNCTION__);
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
QMutexLocker locker(&mutex);
#else
mutex.lock();
#endif
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));
QByteArray groupBa, nameBa, valueBa;
Expand Down Expand Up @@ -633,7 +649,11 @@ bool ResourceEngine::registerAudioProperties(const QString &audioGroup, quint32
bool ResourceEngine::registerVideoProperties(quint32 pid)
{
qCDebug(lcResourceQt, "ResourceEngine(%d)::%s() - **************** locking....", identifier, __FUNCTION__);
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
QMutexLocker locker(&mutex);
#else
mutex.lock();
#endif
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));

Expand All @@ -660,7 +680,11 @@ bool ResourceEngine::registerVideoProperties(quint32 pid)
static void connectionIsUp(resconn_t *connection)
{
qCDebug(lcResourceQt, "**************** %s() - locking....", __FUNCTION__);
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
QMutexLocker locker(&mutex);
#else
mutex.lock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following why this change? Different behavior too, nothing releases the mutex when the function is exited? Doesn't feel proper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was resolved without explanation, unresolving.

QRecursiveMutex is Qt 5.14 so using that would be better, but I'm not following why a recursive mutex would be needed because of Qt version.

And then QMutexLocker works with a recursive mutex too so I'm not following why these explicit locks which are even missing the unlocks.

#endif

qCDebug(lcResourceQt) << QString("connection is up");

Expand Down
12 changes: 10 additions & 2 deletions libresourceqt/src/resource-set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ ResourceSet::ResourceSet(const QString &applicationClass, QObject * parent,
audioResource(NULL), autoRelease(initialAutoRelease),
alwaysReply(initialAlwaysReply), initialized(false), pendingAcquire(false),
pendingUpdate(false), pendingAudioProperties(false), pendingVideoProperties(false),
inAcquireMode(false), reqMutex(QMutex::Recursive), ignoreQ(false)
inAcquireMode(false),
#if (QT_VERSION < QT_VERSION_CHECK(5,14,0))
reqMutex(QMutex::Recursive),
#endif
ignoreQ(false)
{
identifier = resourceSetId++;
memset(resourceSet, 0, sizeof(Resource *)*NumberOfTypes);
Expand All @@ -46,7 +50,11 @@ ResourceSet::ResourceSet(const QString &applicationClass, QObject * parent)
audioResource(NULL), autoRelease(false),
alwaysReply(false), initialized(false), pendingAcquire(false),
pendingUpdate(false), pendingAudioProperties(false), pendingVideoProperties(false),
inAcquireMode(false), reqMutex(QMutex::Recursive), ignoreQ(false)
inAcquireMode(false),
#if (QT_VERSION < QT_VERSION_CHECK(5,14,0))
reqMutex(QMutex::Recursive),
#endif
ignoreQ(false)
{
identifier = resourceSetId++;
memset(resourceSet, 0, sizeof(Resource *)*NumberOfTypes);
Expand Down
Loading