~kdub/content-hub/mir-deprecations

« back to all changes in this revision

Viewing changes to import/contenthub.cpp

  • Committer: Guenter Schwann
  • Date: 2013-08-21 12:08:58 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: guenter.schwann@canonical.com-20130821120858-ayn3xoxoo1wqs0gq
Add QML binding (interface only for now)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#include "contenthub.h"
 
18
 
 
19
#include <QDebug>
 
20
 
 
21
/*!
 
22
 * \qmltype ContentHub
 
23
 * \instantiates ContentHub
 
24
 * \inqmlmodule Ubuntu.Content 0.1
 
25
 * \brief FIXME documentation
 
26
 *
 
27
 * FIXME documentation
 
28
 *
 
29
 * Example usage:
 
30
 * \qml
 
31
 * import QtQuick 2.0
 
32
 * import Ubuntu.Content 0.1
 
33
 *
 
34
 * Rectangle {
 
35
 *     width: units.gu(40)
 
36
 *     height: units.gu(20)
 
37
 *
 
38
 *     Button {
 
39
 *         text: "Import"
 
40
 *          onClicked: {
 
41
 *              var transfer = ContentHub.importContent(ContentType.Pictures)
 
42
 *         }
 
43
 *     }
 
44
 * }
 
45
 * \endqml
 
46
 *
 
47
 */
 
48
 
 
49
ContentHub::ContentHub(QObject *parent)
 
50
    : QObject(parent)
 
51
{
 
52
}
 
53
 
 
54
/*!
 
55
 * \qmlmethod ContentHub::defaultSourceForType()
 
56
 *
 
57
 *  FIXME add documentation
 
58
 */
 
59
ContentPeer *ContentHub::defaultSourceForType(int type)
 
60
{
 
61
    qDebug() << Q_FUNC_INFO;
 
62
    Q_UNUSED(type);
 
63
    return new ContentPeer(this);
 
64
}
 
65
 
 
66
/*!
 
67
 * \qmlmethod ContentHub::knownSourcesForType()
 
68
 *
 
69
 *  FIXME add documentation
 
70
 */
 
71
QList<ContentPeer *> ContentHub::knownSourcesForType(int type)
 
72
{
 
73
    qDebug() << Q_FUNC_INFO;
 
74
    Q_UNUSED(type);
 
75
    QList<ContentPeer *> list;
 
76
    return list;
 
77
}
 
78
 
 
79
/*!
 
80
 * \qmlmethod ContentHub::importContent()
 
81
 *
 
82
 *  FIXME add documentation
 
83
 */
 
84
ContentTransfer *ContentHub::importContent(int type)
 
85
{
 
86
    qDebug() << Q_FUNC_INFO << (ContentType::Type)type;
 
87
    return new ContentTransfer(this);
 
88
}
 
89
 
 
90
/*!
 
91
 * \qmlmethod ContentHub::importContent()
 
92
 *
 
93
 *  FIXME add documentation
 
94
 */
 
95
ContentTransfer *ContentHub::importContent(int type, ContentPeer *peer)
 
96
{
 
97
    qDebug() << Q_FUNC_INFO << (ContentType::Type)type << peer;
 
98
    return new ContentTransfer(this);
 
99
}
 
100
 
 
101
/*!
 
102
 * \qmlmethod ContentHub::restoreImports()
 
103
 *
 
104
 *  FIXME add documentation
 
105
 */
 
106
void ContentHub::restoreImports()
 
107
{
 
108
    qDebug() << Q_FUNC_INFO;
 
109
}
 
110
 
 
111
/*!
 
112
 * \qmlproperty list<ContentTransfer> ContentHub::finishedImports
 
113
 *
 
114
 * FIXME add documentation
 
115
 */
 
116
QQmlListProperty<ContentTransfer> ContentHub::finishedImports()
 
117
{
 
118
    qDebug() << Q_FUNC_INFO;
 
119
    return QQmlListProperty<ContentTransfer>(this, m_finishedImports);
 
120
}