Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwldatasource.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qwldatasource_p.h"
5#include "qwldataoffer_p.h"
6#include "qwldatadevice_p.h"
8#include <QtWaylandCompositor/private/qwaylandutils_p.h>
9
10#include <unistd.h>
11#include <QtWaylandCompositor/private/wayland-wayland-server-protocol.h>
12
14
15namespace QtWayland {
16
17DataSource::DataSource(struct wl_client *client, uint32_t id, uint32_t time)
18 : QtWaylandServer::wl_data_source(client, id, 1)
19 , m_time(time)
20{
21}
22
24{
25 if (m_manager)
26 m_manager->sourceDestroyed(this);
27 if (m_device)
28 m_device->sourceDestroyed(this);
29}
30
31uint32_t DataSource::time() const
32{
33 return m_time;
34}
35
36QList<QString> DataSource::mimeTypes() const
37{
38 return m_mimeTypes;
39}
40
42{
43 send_target(mimeType);
44}
45
47{
48 send_send(mimeType, fd);
49 close(fd);
50}
51
53{
54 send_cancelled();
55}
56
58{
59 m_manager = mgr;
60}
61
63{
64 m_device = device;
65}
66
67DataSource *DataSource::fromResource(struct ::wl_resource *resource)
68{
69 return QtWayland::fromResource<DataSource *>(resource);
70}
71
72void DataSource::data_source_offer(Resource *, const QString &mime_type)
73{
74 m_mimeTypes.append(mime_type);
75}
76
77void DataSource::data_source_destroy(Resource *resource)
78{
79 wl_resource_destroy(resource->handle);
80}
81
82void DataSource::data_source_destroy_resource(QtWaylandServer::wl_data_source::Resource *resource)
83{
84 Q_UNUSED(resource);
85 delete this;
86}
87
88}
89
IOBluetoothDevice * device
void append(parameter_type t)
Definition qlist.h:458
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void sourceDestroyed(DataSource *source)
void send(const QString &mimeType, int fd)
uint32_t time() const
void setManager(DataDeviceManager *mgr)
DataSource(struct wl_client *client, uint32_t id, uint32_t time)
static DataSource * fromResource(struct ::wl_resource *resource)
void data_source_destroy_resource(Resource *resource) override
void data_source_offer(Resource *resource, const QString &mime_type) override
void setDevice(DataDevice *device)
void accept(const QString &mimeType)
void data_source_destroy(Resource *resource) override
QList< QString > mimeTypes() const
Combined button and popup list for selecting options.
const char * mimeType
GLenum GLuint id
[7]
GLuint64 GLenum GLint fd
#define Q_UNUSED(x)
void sourceDestroyed(DataSource *source)