Loading...
Searching...
No Matches
transfer.h
Go to the documentation of this file.
/*
* Copyright © 2013 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_TRANSFER_H_
#define COM_LOMIRI_CONTENT_TRANSFER_H_
#include <com/lomiri/content/item.h>
#include <com/lomiri/content/scope.h>
#include <com/lomiri/content/store.h>
#include <com/lomiri/content/type.h>
#include <QObject>
#include <QSharedPointer>
#include <QVector>
#include <QString>
namespace com
{
namespace lomiri
{
namespace content
{
namespace detail
{
class Handler;
}
}
}
}
namespace com
{
namespace lomiri
{
namespace content
{
class Item;
class Transfer : public QObject
{
Q_OBJECT
Q_ENUMS(State)
Q_ENUMS(SelectionType)
Q_ENUMS(Direction)
Q_PROPERTY(int id READ id)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_PROPERTY(QVector<Item> items READ collect WRITE charge)
Q_PROPERTY(Store store READ store NOTIFY storeChanged)
Q_PROPERTY(SelectionType selectionType READ selectionType WRITE setSelectionType NOTIFY selectionTypeChanged)
Q_PROPERTY(Direction direction READ direction)
Q_PROPERTY(QString downloadId READ downloadId WRITE setDownloadId NOTIFY downloadIdChanged)
Q_PROPERTY(QString contentType READ contentType)
Q_PROPERTY(QString source READ source)
Q_PROPERTY(QString destination READ destination)
public:
enum State
{
created,
initiated,
in_progress,
charged,
collected,
aborted,
finalized,
downloading,
downloaded
};
enum SelectionType
{
single,
multiple
};
enum Direction
{
Import,
Export,
Share
};
Transfer(const Transfer&) = delete;
virtual ~Transfer();
Transfer& operator=(const Transfer&) = delete;
Q_INVOKABLE virtual int id() const;
Q_INVOKABLE virtual State state() const;
Q_INVOKABLE virtual SelectionType selectionType() const;
Q_INVOKABLE virtual Direction direction() const;
Q_INVOKABLE virtual bool start();
Q_INVOKABLE virtual bool abort();
Q_INVOKABLE virtual bool finalize();
Q_INVOKABLE virtual bool charge(const QVector<Item>& items);
Q_INVOKABLE virtual QVector<Item> collect();
Q_INVOKABLE virtual Store store() const;
Q_DECL_DEPRECATED_X("Set store by scope and content type instead")
Q_INVOKABLE virtual bool setStore(const Store*);
Q_INVOKABLE virtual QString setStore(Scope, const QString&);
Q_INVOKABLE virtual bool setSelectionType(const SelectionType&);
Q_INVOKABLE virtual QString downloadId() const;
Q_INVOKABLE virtual bool setDownloadId(const QString);
Q_INVOKABLE virtual bool download();
Q_INVOKABLE virtual QString contentType() const;
Q_INVOKABLE virtual QString source() const;
Q_INVOKABLE virtual QString destination() const;
Q_SIGNAL void stateChanged();
Q_SIGNAL void storeChanged();
Q_SIGNAL void selectionTypeChanged();
Q_SIGNAL void downloadIdChanged();
private:
struct Private;
friend struct Private;
friend class Hub;
friend class com::lomiri::content::detail::Handler;
QSharedPointer<Private> d;
Transfer(const QSharedPointer<Private>&, QObject* parent = nullptr);
};
}
}
}
#endif // COM_LOMIRI_CONTENT_TRANSFER_H_
QObject
com::lomiri::content::Item
Definition item.h:34
com::lomiri::content::Store
Definition store.h:34
com::lomiri::content::Transfer::download
virtual Q_INVOKABLE bool download()
com::lomiri::content::Transfer::selectionType
SelectionType selectionType
Definition transfer.h:63
com::lomiri::content::Transfer::Private
friend struct Private
Definition transfer.h:130
com::lomiri::content::Transfer::id
virtual Q_INVOKABLE int id() const
com::lomiri::content::Transfer::collect
virtual Q_INVOKABLE QVector< Item > collect()
com::lomiri::content::Transfer::finalize
virtual Q_INVOKABLE bool finalize()
com::lomiri::content::Transfer::items
QVector< Item > items
Definition transfer.h:61
com::lomiri::content::Transfer::Direction
Direction
Definition transfer.h:91
com::lomiri::content::Transfer::Import
@ Import
Definition transfer.h:92
com::lomiri::content::Transfer::Export
@ Export
Definition transfer.h:93
com::lomiri::content::Transfer::Share
@ Share
Definition transfer.h:94
com::lomiri::content::Transfer::state
virtual Q_INVOKABLE State state() const
com::lomiri::content::Transfer::store
virtual Q_INVOKABLE Store store() const
com::lomiri::content::Transfer::setStore
virtual Q_INVOKABLE bool setStore(const Store *)
com::lomiri::content::Transfer::charge
virtual Q_INVOKABLE bool charge(const QVector< Item > &items)
com::lomiri::content::Transfer::selectionTypeChanged
Q_SIGNAL void selectionTypeChanged()
com::lomiri::content::Transfer::selectionType
virtual Q_INVOKABLE SelectionType selectionType() const
com::lomiri::content::Transfer::operator=
Transfer & operator=(const Transfer &)=delete
com::lomiri::content::Transfer::downloadIdChanged
Q_SIGNAL void downloadIdChanged()
com::lomiri::content::Transfer::storeChanged
Q_SIGNAL void storeChanged()
com::lomiri::content::Transfer::contentType
QString contentType
Definition transfer.h:66
com::lomiri::content::Transfer::state
State state
Definition transfer.h:60
com::lomiri::content::Transfer::source
QString source
Definition transfer.h:67
com::lomiri::content::Transfer::~Transfer
virtual ~Transfer()
com::lomiri::content::Transfer::Handler
friend class com::lomiri::content::detail::Handler
Definition transfer.h:132
com::lomiri::content::Transfer::Transfer
Transfer(const Transfer &)=delete
com::lomiri::content::Transfer::destination
QString destination
Definition transfer.h:68
com::lomiri::content::Transfer::State
State
Definition transfer.h:72
com::lomiri::content::Transfer::created
@ created
Definition transfer.h:73
com::lomiri::content::Transfer::initiated
@ initiated
Definition transfer.h:74
com::lomiri::content::Transfer::collected
@ collected
Definition transfer.h:77
com::lomiri::content::Transfer::downloaded
@ downloaded
Definition transfer.h:81
com::lomiri::content::Transfer::aborted
@ aborted
Definition transfer.h:78
com::lomiri::content::Transfer::charged
@ charged
Definition transfer.h:76
com::lomiri::content::Transfer::finalized
@ finalized
Definition transfer.h:79
com::lomiri::content::Transfer::in_progress
@ in_progress
Definition transfer.h:75
com::lomiri::content::Transfer::downloading
@ downloading
Definition transfer.h:80
com::lomiri::content::Transfer::downloadId
QString downloadId
Definition transfer.h:65
com::lomiri::content::Transfer::store
Store store
Definition transfer.h:62
com::lomiri::content::Transfer::abort
virtual Q_INVOKABLE bool abort()
com::lomiri::content::Transfer::setDownloadId
virtual Q_INVOKABLE bool setDownloadId(const QString)
com::lomiri::content::Transfer::direction
Direction direction
Definition transfer.h:64
com::lomiri::content::Transfer::start
virtual Q_INVOKABLE bool start()
com::lomiri::content::Transfer::stateChanged
Q_SIGNAL void stateChanged()
com::lomiri::content::Transfer::direction
virtual Q_INVOKABLE Direction direction() const
com::lomiri::content::Transfer::setSelectionType
virtual Q_INVOKABLE bool setSelectionType(const SelectionType &)
com::lomiri::content::Transfer::Hub
friend class Hub
Definition transfer.h:131
com::lomiri::content::Transfer::SelectionType
SelectionType
Definition transfer.h:85
com::lomiri::content::Transfer::multiple
@ multiple
Definition transfer.h:87
com::lomiri::content::Transfer::single
@ single
Definition transfer.h:86
item.h
com::lomiri::content::detail
Definition transfer.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
scope.h
store.h
type.h