diff options
Diffstat (limited to 'src/manager-lib')
-rw-r--r-- | src/manager-lib/application.cpp | 4 | ||||
-rw-r--r-- | src/manager-lib/application.h | 6 | ||||
-rw-r--r-- | src/manager-lib/applicationipcinterface.cpp | 8 | ||||
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 3 | ||||
-rw-r--r-- | src/manager-lib/intentaminterface.cpp | 7 | ||||
-rw-r--r-- | src/manager-lib/nativeruntime.cpp | 2 | ||||
-rw-r--r-- | src/manager-lib/processcontainer.cpp | 32 | ||||
-rw-r--r-- | src/manager-lib/processcontainer.h | 6 | ||||
-rw-r--r-- | src/manager-lib/qmlinprocessapplicationmanagerwindow.cpp | 2 | ||||
-rw-r--r-- | src/manager-lib/qmlinprocessruntime.cpp | 3 | ||||
-rw-r--r-- | src/manager-lib/sudo.cpp | 12 |
11 files changed, 41 insertions, 44 deletions
diff --git a/src/manager-lib/application.cpp b/src/manager-lib/application.cpp index 8f8f6694..fca17725 100644 --- a/src/manager-lib/application.cpp +++ b/src/manager-lib/application.cpp @@ -492,6 +492,8 @@ void Application::setLastExitCodeAndStatus(int exitCode, Am::ExitStatus exitStat QT_END_NAMESPACE_AM +QT_BEGIN_NAMESPACE + QDebug operator<<(QDebug debug, const QT_PREPEND_NAMESPACE_AM(Application) *app) { debug << "Application Object:"; @@ -502,4 +504,6 @@ QDebug operator<<(QDebug debug, const QT_PREPEND_NAMESPACE_AM(Application) *app) return debug; } +QT_END_NAMESPACE + #include "moc_application.cpp" diff --git a/src/manager-lib/application.h b/src/manager-lib/application.h index 696068df..8cf791ec 100644 --- a/src/manager-lib/application.h +++ b/src/manager-lib/application.h @@ -182,6 +182,10 @@ private: QT_END_NAMESPACE_AM -Q_DECLARE_METATYPE(const QT_PREPEND_NAMESPACE_AM(Application *)) +QT_BEGIN_NAMESPACE QDebug operator<<(QDebug debug, const QT_PREPEND_NAMESPACE_AM(Application) *app); + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(const QT_PREPEND_NAMESPACE_AM(Application *)) diff --git a/src/manager-lib/applicationipcinterface.cpp b/src/manager-lib/applicationipcinterface.cpp index 7928a851..d3dd8e45 100644 --- a/src/manager-lib/applicationipcinterface.cpp +++ b/src/manager-lib/applicationipcinterface.cpp @@ -534,11 +534,11 @@ bool IpcProxyObject::handleMessage(const QDBusMessage &message, const QDBusConne // parameter types need to match - the only exception is if we expect // a QVariant, since we can convert the parameter implicitly - if (argsCopy[ai].typeName() != QMetaType::typeName(expectedTypes.at(ai + 1))) { + if (argsCopy[ai].typeName() != QMetaType(expectedTypes.at(ai + 1)).name()) { if (expectedTypes.at(ai + 1) != QMetaType::QVariant) { matched = false; qWarning() << "MISMATCHED PARAMETER" << ai + 1 << "ON FUNCTION" << function - << "- EXPECTED" << QMetaType::typeName(expectedTypes.at(ai + 1)) + << "- EXPECTED" << QMetaType(expectedTypes.at(ai + 1)).name() << "- RECEIVED" << argsCopy[ai].typeName(); break; } @@ -573,8 +573,6 @@ bool IpcProxyObject::handleMessage(const QDBusMessage &message, const QDBusConne if (message.arguments().at(0) != m_interfaceName) return false; - const QMetaObject *mo = m_object->metaObject(); - if (function == "Get") { QByteArray name = message.arguments().at(1).toString().toLatin1(); QVariant result; @@ -660,7 +658,7 @@ void IpcProxyObject::relaySignal(int signalIndex, void **argv) QList<QVariant> args; for (int i = 0; i < mm.parameterCount(); ++i) { - args << convertFromJSVariant(QVariant(mm.parameterType(i), argv[i + 1])); + args << convertFromJSVariant(QVariant(mm.parameterMetaType(i), argv[i + 1])); } QDBusMessage message = QDBusMessage::createSignal(pathName, m_interfaceName, qL1S(mm.name())); diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index d0565130..68a97dd8 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -43,6 +43,7 @@ #include <QCoreApplication> #include <QUrl> +#include <QRegularExpression> #include <QFileInfo> #include <QProcess> #include <QDir> @@ -691,7 +692,7 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS if ((hasAsterisk && key.length() == 1) || (!hasAsterisk && key == app->id()) - || QRegExp(key, Qt::CaseSensitive, QRegExp::Wildcard).exactMatch(app->id())) { + || QRegularExpression(QRegularExpression::wildcardToRegularExpression(key)).match(app->id()).hasMatch()) { containerId = value; break; } diff --git a/src/manager-lib/intentaminterface.cpp b/src/manager-lib/intentaminterface.cpp index 66b97546..5df42163 100644 --- a/src/manager-lib/intentaminterface.cpp +++ b/src/manager-lib/intentaminterface.cpp @@ -133,7 +133,6 @@ IntentServer *IntentAMImplementation::createIntentServerAndClientInstance(Packag QObject::connect(&packageManager->internalSignals, &PackageManagerInternalSignals::registerIntent, intentServer, [intentServer](IntentInfo *intentInfo, Package *package) { - if (!intentServer->addIntent(intentInfo->id(), package->id(), intentInfo->handlingApplicationId(), intentInfo->requiredCapabilities(), intentInfo->visibility() == IntentInfo::Public ? Intent::Public @@ -434,7 +433,7 @@ void IntentServerInProcessIpcConnection::requestToApplication(IntentServerReques // behavior in single- and multi-process mode QMetaObject::invokeMethod(this, [this, irs]() { auto clientInterface = m_interface->intentClientSystemInterface(); - emit clientInterface->requestToApplication(irs->requestId().toString(), irs->intentId(), + emit clientInterface->requestToApplication(irs->requestId(), irs->intentId(), irs->requestingApplicationId(), irs->handlingApplicationId(), irs->parameters()); }, Qt::QueuedConnection); @@ -446,7 +445,7 @@ void IntentServerInProcessIpcConnection::replyFromSystem(IntentServerRequest *ir // behavior in single- and multi-process mode QMetaObject::invokeMethod(this, [this, irs]() { auto clientInterface = m_interface->intentClientSystemInterface(); - emit clientInterface->replyFromSystem(irs->requestId().toString(), !irs->succeeded(), irs->result()); + emit clientInterface->replyFromSystem(irs->requestId(), !irs->succeeded(), irs->result()); }, Qt::QueuedConnection); } @@ -526,7 +525,7 @@ QString IntentServerDBusIpcConnection::requestToSystem(const QString &intentId, void IntentServerDBusIpcConnection::replyFromApplication(const QString &requestId, bool error, const QVariantMap &result) { - emit m_interface->replyFromApplication(application()->id(), requestId, error, + emit m_interface->replyFromApplication(application()->id(), QUuid::fromString(requestId), error, convertFromDBusVariant(result).toMap()); } diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp index 2e232989..8d0f05ae 100644 --- a/src/manager-lib/nativeruntime.cpp +++ b/src/manager-lib/nativeruntime.cpp @@ -194,7 +194,7 @@ bool NativeRuntime::initialize() // try the main binaries directory possibleLocations.append(QCoreApplication::applicationDirPath()); // try Qt's bin folder - possibleLocations.append(QLibraryInfo::location(QLibraryInfo::BinariesPath)); + possibleLocations.append(QLibraryInfo::path(QLibraryInfo::BinariesPath)); // try the AM's build directory possibleLocations.append(qApp->property("_am_build_dir").toString() + qSL("/bin")); // set by main.cpp // if everything fails, try to locate it in $PATH diff --git a/src/manager-lib/processcontainer.cpp b/src/manager-lib/processcontainer.cpp index 05e2ad58..96584054 100644 --- a/src/manager-lib/processcontainer.cpp +++ b/src/manager-lib/processcontainer.cpp @@ -56,12 +56,14 @@ QT_BEGIN_NAMESPACE_AM -class HostQProcess : public QProcess // clazy:exclude=missing-qobject-macro + +HostProcess::HostProcess() + : m_process(new QProcess) { -protected: - void setupChildProcess() override - { + m_process->setProcessChannelMode(QProcess::ForwardedChannels); + m_process->setInputChannelMode(QProcess::ForwardedInputChannel); #if defined(Q_OS_UNIX) + m_process->setChildProcessModifier([this]() { if (m_stopBeforeExec) { fprintf(stderr, "\n*** a 'process' container was started in stopped state ***\nthe process is suspended via SIGSTOP and you can attach a debugger to it via\n\n gdb -p %d\n\n", getpid()); raise(SIGSTOP); @@ -75,20 +77,8 @@ protected: ::close(fd); } } + }); #endif - } - -public: - bool m_stopBeforeExec = false; - QVector<int> m_stdioRedirections; -}; - - -HostProcess::HostProcess() - : m_process(new HostQProcess) -{ - m_process->setProcessChannelMode(QProcess::ForwardedChannels); - m_process->setInputChannelMode(QProcess::ForwardedInputChannel); } HostProcess::~HostProcess() @@ -119,7 +109,7 @@ void HostProcess::start(const QString &program, const QStringList &arguments) #if defined(Q_OS_UNIX) // make sure that the redirection fds do not have a close-on-exec flag, since we need them // in the child process. - for (int fd : qAsConst(m_process->m_stdioRedirections)) { + for (int fd : qAsConst(m_stdioRedirections)) { if (fd < 0) continue; int flags = fcntl(fd, F_GETFD); @@ -134,7 +124,7 @@ void HostProcess::start(const QString &program, const QStringList &arguments) // we are forked now and the child process has received a copy of all redirected fds // now it's time to close our fds, since we don't need them anymore (plus we would block // the tty where they originated from) - for (int fd : qAsConst(m_process->m_stdioRedirections)) { + for (int fd : qAsConst(m_stdioRedirections)) { if (fd >= 0) ::close(fd); } @@ -173,12 +163,12 @@ Am::RunState HostProcess::state() const void HostProcess::setStdioRedirections(const QVector<int> &stdioRedirections) { - m_process->m_stdioRedirections = stdioRedirections; + m_stdioRedirections = stdioRedirections; } void HostProcess::setStopBeforeExec(bool stopBeforeExec) { - m_process->m_stopBeforeExec = stopBeforeExec; + m_stopBeforeExec = stopBeforeExec; } diff --git a/src/manager-lib/processcontainer.h b/src/manager-lib/processcontainer.h index 99348a25..2eaa3a67 100644 --- a/src/manager-lib/processcontainer.h +++ b/src/manager-lib/processcontainer.h @@ -66,8 +66,6 @@ public: }; -class HostQProcess; - class HostProcess : public AbstractContainerProcess { Q_OBJECT @@ -91,8 +89,10 @@ public slots: void setStopBeforeExec(bool stopBeforeExec); private: - HostQProcess *m_process; + QProcess *m_process; qint64 m_pid = 0; + bool m_stopBeforeExec = false; + QVector<int> m_stdioRedirections; }; class ProcessContainer : public AbstractContainer diff --git a/src/manager-lib/qmlinprocessapplicationmanagerwindow.cpp b/src/manager-lib/qmlinprocessapplicationmanagerwindow.cpp index 58462ed7..563461ce 100644 --- a/src/manager-lib/qmlinprocessapplicationmanagerwindow.cpp +++ b/src/manager-lib/qmlinprocessapplicationmanagerwindow.cpp @@ -203,7 +203,7 @@ void QmlInProcessApplicationManagerWindow::componentComplete() // called, so we don't depend on the existence of onCompleted handlers (and conform to multi- // process mode; there is no guarantee though, since multi-process is inherently asynchronous). - for (auto a = QQmlComponent::qmlAttachedProperties(this); a; a = a->next) { + for (auto a = QQmlComponent::qmlAttachedProperties(this); a; a = a->next()) { auto appWindow = qobject_cast<QmlInProcessApplicationManagerWindow *>(a->parent()); if (!appWindow || appWindow != this) continue; diff --git a/src/manager-lib/qmlinprocessruntime.cpp b/src/manager-lib/qmlinprocessruntime.cpp index 68c03072..59999727 100644 --- a/src/manager-lib/qmlinprocessruntime.cpp +++ b/src/manager-lib/qmlinprocessruntime.cpp @@ -48,6 +48,7 @@ #include <QMetaObject> #include <private/qv4engine_p.h> #include <private/qqmlcontext_p.h> +#include <private/qqmlcontextdata_p.h> #if !defined(AM_HEADLESS) # include <QQuickView> @@ -367,7 +368,7 @@ QmlInProcessRuntime *QmlInProcessRuntime::determineRuntime(QObject *object) // if this didn't work out, check out the calling context if (QQmlEngine *engine = qmlEngine(object)) { if (QV4::ExecutionEngine *v4 = engine->handle()) { - if (QQmlContextData *callingContext = v4->callingQmlContext()) + if (QQmlContextData *callingContext = v4->callingQmlContext().data()) runtime = findRuntime(callingContext->asQQmlContext()); } } diff --git a/src/manager-lib/sudo.cpp b/src/manager-lib/sudo.cpp index 26602c28..74769752 100644 --- a/src/manager-lib/sudo.cpp +++ b/src/manager-lib/sudo.cpp @@ -255,7 +255,7 @@ SudoInterface::SudoInterface() bool SudoInterface::sendMessage(int socket, const QByteArray &msg, MessageType type, const QString &errorString) { QByteArray packet; - QDataStream ds(&packet, QIODevice::WriteOnly); + QDataStream ds(&packet, QDataStream::WriteOnly); ds << errorString << msg; packet.prepend((type == Request) ? "RQST" : "RPLY"); @@ -278,7 +278,7 @@ QByteArray SudoInterface::receiveMessage(int socket, MessageType type, QString * QByteArray packet(recvBuffer + headerSize, int(bytesReceived) - headerSize); - QDataStream ds(&packet, QIODevice::ReadOnly); + QDataStream ds(&packet, QDataStream::ReadOnly); QByteArray msg; ds >> *errorString >> msg; return msg; @@ -318,9 +318,9 @@ template <typename R, typename C, typename ...Ps> R returnType(R (C::*)(Ps...)); #define CALL(FUNC_NAME, PARAM) \ QByteArray msg; \ - QDataStream(&msg, QIODevice::WriteOnly) << #FUNC_NAME << PARAM; \ + QDataStream(&msg, QDataStream::WriteOnly) << #FUNC_NAME << PARAM; \ QByteArray reply = call(msg); \ - QDataStream result(&reply, QIODevice::ReadOnly); \ + QDataStream result(&reply, QDataStream::ReadOnly); \ decltype(returnType(&SudoClient::FUNC_NAME)) r; \ result >> r; \ return r @@ -340,7 +340,7 @@ void SudoClient::stopServer() #ifdef Q_OS_LINUX if (!m_shortCircuit && m_socket >= 0) { QByteArray msg; - QDataStream(&msg, QIODevice::WriteOnly) << "stopServer"; + QDataStream(&msg, QDataStream::WriteOnly) << "stopServer"; sendMessage(m_socket, msg, Request); } #endif @@ -419,7 +419,7 @@ QByteArray SudoServer::receive(const QByteArray &msg) QByteArray function(functionArray); delete [] functionArray; QByteArray reply; - QDataStream result(&reply, QIODevice::WriteOnly); + QDataStream result(&reply, QDataStream::WriteOnly); m_errorString.clear(); if (function == "removeRecursive") { |