summaryrefslogtreecommitdiffstats
path: root/src/gui/platform
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-28 06:11:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-28 13:20:23 +0200
commit2405aa9d6797dcfb2e47f45f113ee1ebbc201dda (patch)
treeea2b49501545cc98d63304b2751c2840bcf1dffd /src/gui/platform
parent904eaec9de3ed9efd446f2ef83c15055d2b2a871 (diff)
Windows QPA: Move mime-type related classes to the new interface
Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA plugin in Qt 5) to the platform namespace and add register functions to the native application. Move in test code from QtWinExtras. Task-number: QTBUG-83252 Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/platform')
-rw-r--r--src/gui/platform/windows/qwindowsmime_p.h74
-rw-r--r--src/gui/platform/windows/qwindowsplatforminterface.cpp1
-rw-r--r--src/gui/platform/windows/windows.pri5
3 files changed, 79 insertions, 1 deletions
diff --git a/src/gui/platform/windows/qwindowsmime_p.h b/src/gui/platform/windows/qwindowsmime_p.h
new file mode 100644
index 0000000000..e90f596d1d
--- /dev/null
+++ b/src/gui/platform/windows/qwindowsmime_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSMIME_P_H
+#define QWINDOWSMIME_P_H
+
+#include <QtCore/qt_windows.h>
+#include <QtCore/qvariant.h>
+
+#include <QtGui/qtguiglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMimeData;
+
+namespace QPlatformInterface::Private {
+
+class Q_GUI_EXPORT QWindowsMime
+{
+public:
+ virtual ~QWindowsMime() = default;
+
+ // for converting from Qt
+ virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0;
+ virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0;
+ virtual QList<FORMATETC> formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0;
+
+ // for converting to Qt
+ virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0;
+ virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const = 0;
+ virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0;
+};
+
+} // QPlatformInterface::Private
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSMIME_P_H
diff --git a/src/gui/platform/windows/qwindowsplatforminterface.cpp b/src/gui/platform/windows/qwindowsplatforminterface.cpp
index a8ee0b55d6..e1aa3b6970 100644
--- a/src/gui/platform/windows/qwindowsplatforminterface.cpp
+++ b/src/gui/platform/windows/qwindowsplatforminterface.cpp
@@ -39,6 +39,7 @@
#include <QtGui/qopenglcontext.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qwindowsmime_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformwindow.h>
diff --git a/src/gui/platform/windows/windows.pri b/src/gui/platform/windows/windows.pri
index b1e80f6538..94a6a2ff41 100644
--- a/src/gui/platform/windows/windows.pri
+++ b/src/gui/platform/windows/windows.pri
@@ -1,4 +1,7 @@
-HEADERS += platform/windows/qwindowsguieventdispatcher_p.h
+HEADERS += \
+ platform/windows/qwindowsguieventdispatcher_p.h \
+ platform/windows/qwindowsmime_p.h
+
SOURCES += \
platform/windows/qwindowsguieventdispatcher.cpp \
platform/windows/qwindowsplatforminterface.cpp