Loading...
Searching...
No Matches
hub.h
Go to the documentation of this file.
/*
* Copyright © 2013,2016 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef COM_LOMIRI_CONTENT_HUB_H_
#define COM_LOMIRI_CONTENT_HUB_H_
#include <com/lomiri/content/peer.h>
#include <com/lomiri/content/scope.h>
#include <com/lomiri/content/type.h>
#include <QObject>
#include <QMimeData>
#include <QStringList>
class QDBusPendingCall;
namespace com
{
namespace lomiri
{
namespace content
{
class ImportExportHandler;
class Store;
class Transfer;
class Hub : public QObject
{
Q_OBJECT
Q_PROPERTY(QStringList pasteFormats READ pasteFormats NOTIFY pasteFormatsChanged)
public:
struct Client
{
static Hub* instance();
};
Hub(const Hub&) = delete;
virtual ~Hub();
Hub& operator=(const Hub&) = delete;
Q_INVOKABLE virtual void register_import_export_handler(ImportExportHandler* handler);
Q_DECL_DEPRECATED_X("Set store by scope and content type on transfer directly instead")
Q_INVOKABLE virtual const Store* store_for_scope_and_type(Scope scope, Type type);
Q_INVOKABLE virtual Peer default_source_for_type(Type type);
Q_INVOKABLE virtual QVector<Peer> known_sources_for_type(Type type);
Q_INVOKABLE virtual QVector<Peer> known_destinations_for_type(Type type);
Q_INVOKABLE virtual QVector<Peer> known_shares_for_type(Type type);
Q_INVOKABLE virtual Transfer* create_import_from_peer(Peer peer);
Q_INVOKABLE virtual Transfer* create_export_to_peer(Peer peer);
Q_INVOKABLE virtual Transfer* create_share_to_peer(Peer peer);
Q_INVOKABLE virtual void quit();
Q_INVOKABLE virtual Transfer* create_import_from_peer_for_type(Peer peer, Type type);
Q_INVOKABLE virtual Transfer* create_export_to_peer_for_type(Peer peer, Type type);
Q_INVOKABLE virtual Transfer* create_share_to_peer_for_type(Peer peer, Type type);
Q_INVOKABLE virtual bool has_pending(QString peer_id);
Q_INVOKABLE virtual Peer peer_for_app_id(QString app_id);
// Copy & Paste
QDBusPendingCall createPaste(const QString &surfaceId, const QMimeData& data);
QDBusPendingCall requestLatestPaste(const QString &surfaceId);
QDBusPendingCall requestPasteById(const QString &surfaceId, int pasteId);
QMimeData* paste(QDBusPendingCall requestPeply);
// synchronous versions
bool createPasteSync(const QString &surfaceId, const QMimeData& data);
QMimeData* latestPaste(const QString &surfaceId);
QMimeData* pasteById(const QString &surfaceId, int id);
QStringList pasteFormats();
Q_SIGNALS:
void pasteFormatsChanged();
void pasteboardChanged();
private Q_SLOTS:
void onPasteFormatsChanged(const QStringList &);
protected:
Hub(QObject* = nullptr);
private:
void requestPasteFormats();
struct Private;
QScopedPointer<Private> d;
bool eventFilter(QObject *obj, QEvent *event);
};
}
}
}
#endif // COM_LOMIRI_CONTENT_HUB_H_
QObject
com::lomiri::content::Hub::createPaste
QDBusPendingCall createPaste(const QString &surfaceId, const QMimeData &data)
com::lomiri::content::Hub::Hub
Hub(const Hub &)=delete
com::lomiri::content::Hub::~Hub
virtual ~Hub()
com::lomiri::content::Hub::requestPasteById
QDBusPendingCall requestPasteById(const QString &surfaceId, int pasteId)
com::lomiri::content::Hub::create_share_to_peer_for_type
virtual Q_INVOKABLE Transfer * create_share_to_peer_for_type(Peer peer, Type type)
com::lomiri::content::Hub::known_shares_for_type
virtual Q_INVOKABLE QVector< Peer > known_shares_for_type(Type type)
com::lomiri::content::Hub::pasteFormatsChanged
void pasteFormatsChanged()
com::lomiri::content::Hub::create_import_from_peer_for_type
virtual Q_INVOKABLE Transfer * create_import_from_peer_for_type(Peer peer, Type type)
com::lomiri::content::Hub::createPasteSync
bool createPasteSync(const QString &surfaceId, const QMimeData &data)
com::lomiri::content::Hub::create_export_to_peer
virtual Q_INVOKABLE Transfer * create_export_to_peer(Peer peer)
com::lomiri::content::Hub::create_import_from_peer
virtual Q_INVOKABLE Transfer * create_import_from_peer(Peer peer)
com::lomiri::content::Hub::pasteboardChanged
void pasteboardChanged()
com::lomiri::content::Hub::peer_for_app_id
virtual Q_INVOKABLE Peer peer_for_app_id(QString app_id)
com::lomiri::content::Hub::pasteFormats
QStringList pasteFormats
Definition hub.h:44
com::lomiri::content::Hub::create_share_to_peer
virtual Q_INVOKABLE Transfer * create_share_to_peer(Peer peer)
com::lomiri::content::Hub::paste
QMimeData * paste(QDBusPendingCall requestPeply)
com::lomiri::content::Hub::latestPaste
QMimeData * latestPaste(const QString &surfaceId)
com::lomiri::content::Hub::quit
virtual Q_INVOKABLE void quit()
com::lomiri::content::Hub::pasteById
QMimeData * pasteById(const QString &surfaceId, int id)
com::lomiri::content::Hub::register_import_export_handler
virtual Q_INVOKABLE void register_import_export_handler(ImportExportHandler *handler)
com::lomiri::content::Hub::create_export_to_peer_for_type
virtual Q_INVOKABLE Transfer * create_export_to_peer_for_type(Peer peer, Type type)
com::lomiri::content::Hub::requestLatestPaste
QDBusPendingCall requestLatestPaste(const QString &surfaceId)
com::lomiri::content::Hub::known_sources_for_type
virtual Q_INVOKABLE QVector< Peer > known_sources_for_type(Type type)
com::lomiri::content::Hub::store_for_scope_and_type
virtual Q_INVOKABLE const Store * store_for_scope_and_type(Scope scope, Type type)
com::lomiri::content::Hub::operator=
Hub & operator=(const Hub &)=delete
com::lomiri::content::Hub::has_pending
virtual Q_INVOKABLE bool has_pending(QString peer_id)
com::lomiri::content::Hub::default_source_for_type
virtual Q_INVOKABLE Peer default_source_for_type(Type type)
com::lomiri::content::Hub::known_destinations_for_type
virtual Q_INVOKABLE QVector< Peer > known_destinations_for_type(Type type)
com::lomiri::content::ImportExportHandler
Definition import_export_handler.h:32
com::lomiri::content::Peer
Definition peer.h:32
com::lomiri::content::Store
Definition store.h:34
com::lomiri::content::Transfer
Definition transfer.h:54
com::lomiri::content::Type
Definition type.h:38
com::lomiri::content
Definition hub.h:36
com::lomiri::content::Scope
Scope
Definition scope.h:30
com::lomiri
Definition hub.h:34
com
Definition hub.h:32
peer.h
scope.h
com::lomiri::content::Hub::Client
Definition hub.h:48
com::lomiri::content::Hub::Client::instance
static Hub * instance()
type.h