platforms: rename QGenericUnixServices to QDesktopUnixServices
The implementation follows XDG Desktop Portal mostly, and is for desktop, not generic unix. Task-number: QTBUG-130884 Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 3e29267df0e2f332290caad69e5bd5cfd61cf3da) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
78da1f8d00
commit
7ab7d88e8a
@ -1028,7 +1028,7 @@ qt_internal_extend_target(Gui CONDITION QT_FEATURE_glib AND UNIX
|
||||
|
||||
qt_internal_extend_target(Gui CONDITION UNIX AND (QT_FEATURE_xcb OR NOT UIKIT)
|
||||
SOURCES
|
||||
platform/unix/qgenericunixservices.cpp platform/unix/qgenericunixservices_p.h
|
||||
platform/unix/qdesktopunixservices.cpp platform/unix/qdesktopunixservices_p.h
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Gui CONDITION UNIX AND (QT_FEATURE_xcb)
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "qdbusmenuregistrarproxy_p.h"
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qgenericunixservices_p.h>
|
||||
#include <private/qdesktopunixservices_p.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -127,7 +127,7 @@ void QDBusMenuBar::registerMenuBar()
|
||||
connection.unregisterObject(m_objectPath);
|
||||
return;
|
||||
}
|
||||
const auto unixServices = dynamic_cast<QGenericUnixServices *>(
|
||||
const auto unixServices = dynamic_cast<QDesktopUnixServices *>(
|
||||
QGuiApplicationPrivate::platformIntegration()->services());
|
||||
unixServices->registerDBusMenuForWindow(m_window, connection.baseService(), m_objectPath);
|
||||
}
|
||||
@ -144,7 +144,7 @@ void QDBusMenuBar::unregisterMenuBar()
|
||||
qWarning("Failed to unregister window menu, reason: %s (\"%s\")",
|
||||
qUtf8Printable(r.error().name()), qUtf8Printable(r.error().message()));
|
||||
|
||||
const auto unixServices = dynamic_cast<QGenericUnixServices *>(
|
||||
const auto unixServices = dynamic_cast<QDesktopUnixServices *>(
|
||||
QGuiApplicationPrivate::platformIntegration()->services());
|
||||
unixServices->unregisterDBusMenuForWindow(m_window);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#include "qgenericunixservices_p.h"
|
||||
#include "qdesktopunixservices_p.h"
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include "qguiapplication.h"
|
||||
#include "qwindow.h"
|
||||
@ -371,7 +371,7 @@ private:
|
||||
|
||||
#endif // QT_CONFIG(dbus)
|
||||
|
||||
QGenericUnixServices::QGenericUnixServices()
|
||||
QDesktopUnixServices::QDesktopUnixServices()
|
||||
{
|
||||
if (desktopEnvironment() == QByteArrayLiteral("UNKNOWN"))
|
||||
return;
|
||||
@ -400,14 +400,14 @@ QGenericUnixServices::QGenericUnixServices()
|
||||
#endif
|
||||
}
|
||||
|
||||
QGenericUnixServices::~QGenericUnixServices()
|
||||
QDesktopUnixServices::~QDesktopUnixServices()
|
||||
{
|
||||
#if QT_CONFIG(dbus)
|
||||
QObject::disconnect(m_watcherConnection);
|
||||
#endif
|
||||
}
|
||||
|
||||
QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
|
||||
QPlatformServiceColorPicker *QDesktopUnixServices::colorPicker(QWindow *parent)
|
||||
{
|
||||
#if QT_CONFIG(dbus)
|
||||
// Make double sure that we are in a wayland environment. In particular check
|
||||
@ -424,7 +424,7 @@ QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
|
||||
#endif
|
||||
}
|
||||
|
||||
QByteArray QGenericUnixServices::desktopEnvironment() const
|
||||
QByteArray QDesktopUnixServices::desktopEnvironment() const
|
||||
{
|
||||
static const QByteArray result = detectDesktopEnvironment();
|
||||
return result;
|
||||
@ -460,7 +460,7 @@ void runWithXdgActivationToken(F &&functionToCall)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||
bool QDesktopUnixServices::openUrl(const QUrl &url)
|
||||
{
|
||||
auto openUrlInternal = [this](const QUrl &url, const QString &xdgActivationToken) {
|
||||
if (url.scheme() == "mailto"_L1) {
|
||||
@ -509,7 +509,7 @@ bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||
}
|
||||
}
|
||||
|
||||
bool QGenericUnixServices::openDocument(const QUrl &url)
|
||||
bool QDesktopUnixServices::openDocument(const QUrl &url)
|
||||
{
|
||||
auto openDocumentInternal = [this](const QUrl &url, const QString &xdgActivationToken) {
|
||||
|
||||
@ -544,29 +544,29 @@ bool QGenericUnixServices::openDocument(const QUrl &url)
|
||||
}
|
||||
|
||||
#else
|
||||
QGenericUnixServices::QGenericUnixServices() = default;
|
||||
QGenericUnixServices::~QGenericUnixServices() = default;
|
||||
QDesktopUnixServices::QDesktopUnixServices() = default;
|
||||
QDesktopUnixServices::~QDesktopUnixServices() = default;
|
||||
|
||||
QByteArray QGenericUnixServices::desktopEnvironment() const
|
||||
QByteArray QDesktopUnixServices::desktopEnvironment() const
|
||||
{
|
||||
return QByteArrayLiteral("UNKNOWN");
|
||||
}
|
||||
|
||||
bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||
bool QDesktopUnixServices::openUrl(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
qWarning("openUrl() not supported on this platform");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QGenericUnixServices::openDocument(const QUrl &url)
|
||||
bool QDesktopUnixServices::openDocument(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
qWarning("openDocument() not supported on this platform");
|
||||
return false;
|
||||
}
|
||||
|
||||
QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
|
||||
QPlatformServiceColorPicker *QDesktopUnixServices::colorPicker(QWindow *parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return nullptr;
|
||||
@ -574,27 +574,27 @@ QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
|
||||
|
||||
#endif // QT_NO_MULTIPROCESS
|
||||
|
||||
QString QGenericUnixServices::portalWindowIdentifier(QWindow *window)
|
||||
QString QDesktopUnixServices::portalWindowIdentifier(QWindow *window)
|
||||
{
|
||||
Q_UNUSED(window);
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
void QGenericUnixServices::registerDBusMenuForWindow(QWindow *window, const QString &service, const QString &path)
|
||||
void QDesktopUnixServices::registerDBusMenuForWindow(QWindow *window, const QString &service, const QString &path)
|
||||
{
|
||||
Q_UNUSED(window);
|
||||
Q_UNUSED(service);
|
||||
Q_UNUSED(path);
|
||||
}
|
||||
|
||||
void QGenericUnixServices::unregisterDBusMenuForWindow(QWindow *window)
|
||||
void QDesktopUnixServices::unregisterDBusMenuForWindow(QWindow *window)
|
||||
{
|
||||
Q_UNUSED(window);
|
||||
}
|
||||
|
||||
|
||||
bool QGenericUnixServices::hasCapability(Capability capability) const
|
||||
bool QDesktopUnixServices::hasCapability(Capability capability) const
|
||||
{
|
||||
switch (capability) {
|
||||
case Capability::ColorPicking:
|
||||
@ -603,7 +603,7 @@ bool QGenericUnixServices::hasCapability(Capability capability) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void QGenericUnixServices::setApplicationBadge(qint64 number)
|
||||
void QDesktopUnixServices::setApplicationBadge(qint64 number)
|
||||
{
|
||||
#if QT_CONFIG(dbus)
|
||||
if (qGuiApp->desktopFileName().isEmpty()) {
|
||||
@ -636,4 +636,4 @@ void QGenericUnixServices::setApplicationBadge(qint64 number)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qgenericunixservices.moc"
|
||||
#include "qdesktopunixservices.moc"
|
@ -1,8 +1,8 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#ifndef QGENERICUNIXDESKTOPSERVICES_H
|
||||
#define QGENERICUNIXDESKTOPSERVICES_H
|
||||
#ifndef QDESKTOPUNIXSERVICES_H
|
||||
#define QDESKTOPUNIXSERVICES_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
@ -23,11 +23,11 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindow;
|
||||
|
||||
class Q_GUI_EXPORT QGenericUnixServices : public QPlatformServices
|
||||
class Q_GUI_EXPORT QDesktopUnixServices : public QPlatformServices
|
||||
{
|
||||
public:
|
||||
QGenericUnixServices();
|
||||
~QGenericUnixServices();
|
||||
QDesktopUnixServices();
|
||||
~QDesktopUnixServices();
|
||||
|
||||
QByteArray desktopEnvironment() const override;
|
||||
|
||||
@ -53,4 +53,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QGENERICUNIXDESKTOPSERVICES_H
|
||||
#endif // QDESKTOPUNIXSERVICES_H
|
@ -6,7 +6,7 @@
|
||||
#include "qvnc_p.h"
|
||||
|
||||
#include <QtGui/private/qgenericunixfontdatabase_p.h>
|
||||
#include <QtGui/private/qgenericunixservices_p.h>
|
||||
#include <QtGui/private/qdesktopunixservices_p.h>
|
||||
#include <QtGui/private/qgenericunixeventdispatcher_p.h>
|
||||
|
||||
#include <QtFbSupport/private/qfbbackingstore_p.h>
|
||||
@ -105,7 +105,7 @@ QPlatformFontDatabase *QVncIntegration::fontDatabase() const
|
||||
QPlatformServices *QVncIntegration::services() const
|
||||
{
|
||||
if (m_services.isNull())
|
||||
m_services.reset(new QGenericUnixServices);
|
||||
m_services.reset(new QDesktopUnixServices);
|
||||
|
||||
return m_services.data();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include <QtGui/private/qgenericunixfontdatabase_p.h>
|
||||
#include <QtGui/private/qgenericunixservices_p.h>
|
||||
#include <QtGui/private/qdesktopunixservices_p.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -93,7 +93,7 @@ static bool runningUnderDebugger()
|
||||
#endif
|
||||
}
|
||||
|
||||
class QXcbUnixServices : public QGenericUnixServices, public QXcbObject
|
||||
class QXcbUnixServices : public QDesktopUnixServices, public QXcbObject
|
||||
{
|
||||
public:
|
||||
QString portalWindowIdentifier(QWindow *window) override;
|
||||
@ -595,7 +595,7 @@ QPlatformVulkanInstance *QXcbIntegration::createPlatformVulkanInstance(QVulkanIn
|
||||
|
||||
void QXcbIntegration::setApplicationBadge(qint64 number)
|
||||
{
|
||||
auto unixServices = dynamic_cast<QGenericUnixServices *>(services());
|
||||
auto unixServices = dynamic_cast<QDesktopUnixServices *>(services());
|
||||
unixServices->setApplicationBadge(number);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <qfileinfo.h>
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qgenericunixservices_p.h>
|
||||
#include <private/qdesktopunixservices_p.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qplatformfontdatabase.h>
|
||||
|
||||
@ -109,7 +109,7 @@ bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWind
|
||||
if (false) {
|
||||
#if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3, 22, 0)
|
||||
} else if (GDK_IS_WAYLAND_WINDOW(gdkWindow)) {
|
||||
const auto unixServices = dynamic_cast<QGenericUnixServices *>(
|
||||
const auto unixServices = dynamic_cast<QDesktopUnixServices *>(
|
||||
QGuiApplicationPrivate::platformIntegration()->services());
|
||||
if (unixServices) {
|
||||
const auto handle = unixServices->portalWindowIdentifier(parent);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "qxdgdesktopportalfiledialog_p.h"
|
||||
|
||||
#include <private/qgenericunixservices_p.h>
|
||||
#include <private/qdesktopunixservices_p.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
@ -269,7 +269,7 @@ void QXdgDesktopPortalFileDialog::openPortal(Qt::WindowFlags windowFlags, Qt::Wi
|
||||
// TODO choices a(ssa(ss)s)
|
||||
// List of serialized combo boxes to add to the file chooser.
|
||||
|
||||
auto unixServices = dynamic_cast<QGenericUnixServices *>(
|
||||
auto unixServices = dynamic_cast<QDesktopUnixServices *>(
|
||||
QGuiApplicationPrivate::platformIntegration()->services());
|
||||
if (parent && unixServices)
|
||||
message << unixServices->portalWindowIdentifier(parent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user