Merge lp:~jamesh/mediascanner/qml-plugin into lp:mediascanner/v2

Proposed by James Henstridge
Status: Superseded
Proposed branch: lp:~jamesh/mediascanner/qml-plugin
Merge into: lp:mediascanner/v2
Diff against target: 384 lines (+287/-1)
13 files modified
CMakeLists.txt (+2/-0)
debian/control (+16/-0)
debian/copyright (+1/-1)
debian/qtdeclarative5-ubuntu-mediascanner0.1.install (+1/-0)
src/qml/Ubuntu/MediaScanner/CMakeLists.txt (+52/-0)
src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc (+49/-0)
src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh (+39/-0)
src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.cc (+22/-0)
src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.hh (+30/-0)
src/qml/Ubuntu/MediaScanner/plugin.cc (+9/-0)
src/qml/Ubuntu/MediaScanner/plugin.hh (+15/-0)
src/qml/Ubuntu/MediaScanner/plugin.qmltypes (+49/-0)
src/qml/Ubuntu/MediaScanner/qmldir (+2/-0)
To merge this branch: bzr merge lp:~jamesh/mediascanner/qml-plugin
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Timo Jyrinki (community) Approve
Michal Hruby (community) Needs Fixing
Review via email: mp+199078@code.launchpad.net

This proposal has been superseded by a proposal from 2014-01-15.

Commit message

First stages of a QML plugin for the Media Scanner. At present it only exposes the query() and lookup() interfaces.

Description of the change

QML binding for mediascanner library. Not yet complete, but enough to perform a simple query from QML.

Currently work in progress, but I wanted Jenkins to see it.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:195
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jamesh/mediascanner/qml-plugin/+merge/199078/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner-v2-ci/13/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-amd64-ci/13/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/13/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-i386-ci/13/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner-v2-ci/13/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

124 + return new MediaFileWrapper(store.lookup(filename.toStdString()));

This doesn't indicate who's the owner of the object, you should either set parent, or explicitly assign ownership to QML.

review: Needs Fixing
Revision history for this message
Michal Hruby (mhr3) wrote :

You probably want:

QQmlEngine::setObjectOwnership(wrapper, QQmlEngine::JavaScriptOwnership);

Revision history for this message
Michal Hruby (mhr3) wrote :

153 + Q_INVOKABLE QList<QObject*> query(const QString &q, MediaType type);

It'd probably be better if this was returning a real model instance - subclass of QAbstractItemModel, it's not clear to me whether QML would know how to manage the object lifecycle of the List + ObjectPtrs.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

From what I know of QML, looks fine so far.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The documentation says that a QML engine will take ownership of every Qt object without a parent that is passed to it.

Revision history for this message
Michał Sawicz (saviq) wrote :

Added ubuntu-sdk-team to review the QML API.

lp:~jamesh/mediascanner/qml-plugin updated
196. By James Henstridge

Update packaging to cover QML plugin, and set plugin version to 0.1.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:196
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jamesh/mediascanner/qml-plugin/+merge/199078/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner-v2-ci/14/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-amd64-ci/14/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/14/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-i386-ci/14/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner-v2-ci/14/rebuild

review: Needs Fixing (continuous-integration)
lp:~jamesh/mediascanner/qml-plugin updated
197. By James Henstridge

Depend on qtdeclarative5-dev too.

198. By James Henstridge

Correctly namespace the QML file.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:198
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jamesh/mediascanner/qml-plugin/+merge/199078/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner-v2-ci/15/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-amd64-ci/15/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/15/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-i386-ci/15/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner-v2-ci/15/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

A policy for our own QML plugins is that it's installed into a version specific folder (/usr/lib/ARCH/qt5/qml/Foo.0.1) and has a package name of sort "qtdeclarative5-plugin-foo0.1". See Friends for an example http://bazaar.launchpad.net/~super-friends/qml-friends/trunk/files/head:/debian/

review: Needs Fixing
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

(in order to have, if necessary, multiple API versions of the plugin available for backwards compatibility)

lp:~jamesh/mediascanner/qml-plugin updated
199. By James Henstridge

Version the QML plugin package and installation dir.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:199
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jamesh/mediascanner/qml-plugin/+merge/199078/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner-v2-ci/16/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-amd64-ci/16
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/16
        deb: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/16/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-i386-ci/16

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner-v2-ci/16/rebuild

review: Needs Fixing (continuous-integration)
lp:~jamesh/mediascanner/qml-plugin updated
200. By James Henstridge

Explicitly set ownership of MediaFileWrapper objects.

201. By James Henstridge

Add remaining MediaFile properties to QML wrapper.

Revision history for this message
James Henstridge (jamesh) wrote :

Thanks for everyone's feedback.

@mhr3: I've added the explicit QQmlEngine::setObjectOwnership() calls, and verified that the MediaFileWrapper instances are being destroyed when my test program exits. That would seem to indicate that it can handle a QList<QObject*> okay.

I agree that we should provide some QAbstractItemModel based APIs, but at this point I just wanted to get the basics working so we could ask the music-app guys what kind of interface they're after. The alternative would be to spend a lot of time on something they ultimately can't use.

@timo: thanks for the pointers. I think I've got the install directory and package name fixed up now.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:201
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jamesh/mediascanner/qml-plugin/+merge/199078/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner-v2-ci/17/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-amd64-ci/17
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/17
        deb: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-armhf-ci/17/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner-v2-trusty-i386-ci/17

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner-v2-ci/17/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Looks good to me!

review: Approve
lp:~jamesh/mediascanner/qml-plugin updated
202. By James Henstridge

Merge from trunk.

203. By James Henstridge

Rearrange source tree to match QML import paths so we can generate the
plugins.qmltypes file.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~jamesh/mediascanner/qml-plugin updated
204. By James Henstridge

Build-depend on QtQuick, since qmlplugindump seems to need it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~jamesh/mediascanner/qml-plugin updated
205. By James Henstridge

Include the generated plugin.qmltypes file under source control, and add
a "make update-qmltypes" command to update it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

205. By James Henstridge

Include the generated plugin.qmltypes file under source control, and add
a "make update-qmltypes" command to update it.

204. By James Henstridge

Build-depend on QtQuick, since qmlplugindump seems to need it.

203. By James Henstridge

Rearrange source tree to match QML import paths so we can generate the
plugins.qmltypes file.

202. By James Henstridge

Merge from trunk.

201. By James Henstridge

Add remaining MediaFile properties to QML wrapper.

200. By James Henstridge

Explicitly set ownership of MediaFileWrapper objects.

199. By James Henstridge

Version the QML plugin package and installation dir.

198. By James Henstridge

Correctly namespace the QML file.

197. By James Henstridge

Depend on qtdeclarative5-dev too.

196. By James Henstridge

Update packaging to cover QML plugin, and set plugin version to 0.1.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-12-18 10:57:10 +0000
3+++ CMakeLists.txt 2014-01-02 10:16:09 +0000
4@@ -17,6 +17,7 @@
5 pkg_check_modules(GST gstreamer-1.0 gstreamer-pbutils-1.0 REQUIRED)
6 pkg_check_modules(UNITY unity REQUIRED)
7 find_package(Threads REQUIRED)
8+find_package(Qt5Core REQUIRED)
9
10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -std=c99")
11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -std=c++11")
12@@ -32,6 +33,7 @@
13
14 add_subdirectory(src/mediascanner)
15 add_subdirectory(src/daemon)
16+add_subdirectory(src/qml/Ubuntu/MediaScanner)
17 add_subdirectory(src/utils)
18 add_subdirectory(test)
19
20
21=== modified file 'debian/control'
22--- debian/control 2013-12-18 10:42:48 +0000
23+++ debian/control 2014-01-02 10:16:09 +0000
24@@ -10,6 +10,12 @@
25 libgstreamer1.0-dev,
26 libgtest-dev,
27 libsqlite3-dev,
28+ qt5-default,
29+ qtbase5-dev,
30+ qtbase5-dev-tools,
31+ qtdeclarative5-dev,
32+ qtdeclarative5-dev-tools,
33+ qtdeclarative5-qtquick2-plugin,
34 # For running unit tests
35 gstreamer1.0-plugins-base,
36 gstreamer1.0-plugins-good,
37@@ -52,3 +58,13 @@
38 Description: Development files for libmediascanner
39 This package provides the infrastructure for using the media scanner's
40 access library in C++ based projects.
41+
42+Package: qtdeclarative5-ubuntu-mediascanner0.1
43+Architecture: any
44+Pre-Depends: ${misc:Pre-Depends},
45+Depends: mediascanner (= ${binary:Version}),
46+ ${misc:Depends},
47+ ${shlibs:Depends},
48+Description: QML plugin for the Ubuntu Media Scanner
49+ This package provides components that allow access to the media
50+ scanner index from Qt Quick 2 / QML applications.
51
52=== modified file 'debian/copyright'
53--- debian/copyright 2013-12-20 11:11:54 +0000
54+++ debian/copyright 2014-01-02 10:16:09 +0000
55@@ -17,7 +17,7 @@
56 On Debian/Ubuntu systems, the full text of the GPL v3 can be found in
57 `/usr/share/common-licenses/GPL-3'
58
59-Files: src/mediascanner/*
60+Files: src/mediascanner/* src/qml/*
61 Copyright: 2013 Canonical Ltd.
62 License: LGPL-3
63 This library is free software; you can redistribute it and/or
64
65=== added file 'debian/qtdeclarative5-ubuntu-mediascanner0.1.install'
66--- debian/qtdeclarative5-ubuntu-mediascanner0.1.install 1970-01-01 00:00:00 +0000
67+++ debian/qtdeclarative5-ubuntu-mediascanner0.1.install 2014-01-02 10:16:09 +0000
68@@ -0,0 +1,1 @@
69+usr/lib/*/qt5/qml/Ubuntu/MediaScanner.0.1/*
70
71=== added directory 'src/qml'
72=== added directory 'src/qml/Ubuntu'
73=== added directory 'src/qml/Ubuntu/MediaScanner'
74=== added file 'src/qml/Ubuntu/MediaScanner/CMakeLists.txt'
75--- src/qml/Ubuntu/MediaScanner/CMakeLists.txt 1970-01-01 00:00:00 +0000
76+++ src/qml/Ubuntu/MediaScanner/CMakeLists.txt 2014-01-02 10:16:09 +0000
77@@ -0,0 +1,52 @@
78+include_directories(../../..)
79+
80+set(QML_PLUGIN_DIR "${CMAKE_INSTALL_LIBDIR}/qt5/qml/Ubuntu/MediaScanner.0.1")
81+
82+add_library(mediascanner-qml MODULE
83+ plugin.cc
84+ MediaFileWrapper.cc
85+ MediaStoreWrapper.cc
86+)
87+
88+set_target_properties(mediascanner-qml PROPERTIES AUTOMOC TRUE)
89+qt5_use_modules(mediascanner-qml Qml)
90+target_link_libraries(mediascanner-qml mediascanner)
91+
92+install(
93+ TARGETS mediascanner-qml
94+ LIBRARY DESTINATION ${QML_PLUGIN_DIR}
95+)
96+
97+file(GLOB QMLFILES
98+ qmldir
99+)
100+
101+add_custom_target(mediascanner-qmlfiles ALL
102+ COMMAND cp ${QMLFILES} ${CMAKE_CURRENT_BINARY_DIR}
103+ DEPENDS ${QMLFILES}
104+)
105+
106+install(
107+ FILES ${QMLFILES}
108+ DESTINATION ${QML_PLUGIN_DIR}
109+)
110+
111+if(NOT CMAKE_CROSSCOMPILING)
112+ find_program(qmlplugindump_exe qmlplugindump)
113+ if(NOT qmlplugindump_exe)
114+ msg(FATAL_ERROR "Could not locate qmlplugindump.")
115+ endif()
116+
117+ # qmlplugindump doesn't run reliably in the CI environment (it seems
118+ # to be instantiating the types, which fails when there is no media
119+ # database). So add a
120+ add_custom_target(update-qmltypes
121+ COMMAND QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/qml ${qmlplugindump_exe} -notrelocatable Ubuntu.MediaScanner 0.1 > ${CMAKE_CURRENT_SOURCE_DIR}/plugin.qmltypes
122+ DEPENDS mediascanner-qml mediascanner-qmlfiles
123+ )
124+endif()
125+
126+install(
127+ FILES plugin.qmltypes
128+ DESTINATION ${QML_PLUGIN_DIR}
129+)
130
131=== added file 'src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc'
132--- src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc 1970-01-01 00:00:00 +0000
133+++ src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc 2014-01-02 10:16:09 +0000
134@@ -0,0 +1,49 @@
135+#include "MediaFileWrapper.hh"
136+
137+MediaFileWrapper::MediaFileWrapper(const MediaFile media, QObject *parent)
138+ : QObject(parent), media(media) {
139+}
140+
141+QString MediaFileWrapper::filename() const {
142+ return QString::fromStdString(media.getFileName());
143+}
144+
145+QString MediaFileWrapper::uri() const {
146+ return QString::fromStdString(media.getUri());
147+}
148+
149+QString MediaFileWrapper::contentType() const {
150+ return QString::fromStdString(media.getContentType());
151+}
152+
153+QString MediaFileWrapper::eTag() const {
154+ return QString::fromStdString(media.getETag());
155+}
156+
157+QString MediaFileWrapper::title() const {
158+ return QString::fromStdString(media.getTitle());
159+}
160+
161+QString MediaFileWrapper::author() const {
162+ return QString::fromStdString(media.getAuthor());
163+}
164+
165+QString MediaFileWrapper::album() const {
166+ return QString::fromStdString(media.getAlbum());
167+}
168+
169+QString MediaFileWrapper::albumArtist() const {
170+ return QString::fromStdString(media.getAlbumArtist());
171+}
172+
173+QString MediaFileWrapper::date() const {
174+ return QString::fromStdString(media.getDate());
175+}
176+
177+int MediaFileWrapper::trackNumber() const {
178+ return media.getTrackNumber();
179+}
180+
181+int MediaFileWrapper::duration() const {
182+ return media.getDuration();
183+}
184
185=== added file 'src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh'
186--- src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh 1970-01-01 00:00:00 +0000
187+++ src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh 2014-01-02 10:16:09 +0000
188@@ -0,0 +1,39 @@
189+#ifndef MEDIASCANNER_QML_MEDIAFILEWRAPPER_H
190+#define MEDIASCANNER_QML_MEDIAFILEWRAPPER_H
191+
192+#include <QObject>
193+#include <QString>
194+
195+#include <mediascanner/MediaFile.hh>
196+
197+class MediaFileWrapper : public QObject {
198+ Q_OBJECT
199+ Q_PROPERTY(QString filename READ filename CONSTANT)
200+ Q_PROPERTY(QString uri READ uri CONSTANT)
201+ Q_PROPERTY(QString contentType READ contentType CONSTANT)
202+ Q_PROPERTY(QString eTag READ eTag CONSTANT)
203+ Q_PROPERTY(QString title READ title CONSTANT)
204+ Q_PROPERTY(QString author READ author CONSTANT)
205+ Q_PROPERTY(QString album READ album CONSTANT)
206+ Q_PROPERTY(QString albumArtist READ albumArtist CONSTANT)
207+ Q_PROPERTY(QString date READ date CONSTANT)
208+ Q_PROPERTY(int trackNumber READ trackNumber CONSTANT)
209+ Q_PROPERTY(int duration READ duration CONSTANT)
210+public:
211+ MediaFileWrapper(MediaFile media, QObject *parent=0);
212+ QString filename() const;
213+ QString uri() const;
214+ QString contentType() const;
215+ QString eTag() const;
216+ QString title() const;
217+ QString author() const;
218+ QString album() const;
219+ QString albumArtist() const;
220+ QString date() const;
221+ int trackNumber() const;
222+ int duration() const;
223+private:
224+ const MediaFile media;
225+};
226+
227+#endif
228
229=== added file 'src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.cc'
230--- src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.cc 1970-01-01 00:00:00 +0000
231+++ src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.cc 2014-01-02 10:16:09 +0000
232@@ -0,0 +1,22 @@
233+#include "MediaStoreWrapper.hh"
234+#include <QQmlEngine>
235+
236+MediaStoreWrapper::MediaStoreWrapper(QObject *parent)
237+ : QObject(parent), store(MS_READ_ONLY) {
238+}
239+
240+QList<QObject*> MediaStoreWrapper::query(const QString &q, MediaType type) {
241+ QList<QObject*> result;
242+ for (const auto &media : store.query(q.toStdString(), static_cast<::MediaType>(type))) {
243+ auto wrapper = new MediaFileWrapper(media);
244+ QQmlEngine::setObjectOwnership(wrapper, QQmlEngine::JavaScriptOwnership);
245+ result.append(wrapper);
246+ }
247+ return result;
248+}
249+
250+MediaFileWrapper *MediaStoreWrapper::lookup(const QString &filename) {
251+ auto wrapper = new MediaFileWrapper(store.lookup(filename.toStdString()));
252+ QQmlEngine::setObjectOwnership(wrapper, QQmlEngine::JavaScriptOwnership);
253+ return wrapper;
254+}
255
256=== added file 'src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.hh'
257--- src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.hh 1970-01-01 00:00:00 +0000
258+++ src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.hh 2014-01-02 10:16:09 +0000
259@@ -0,0 +1,30 @@
260+#ifndef MEDIASCANNER_QML_MEDIASTOREWRAPPER_H
261+#define MEDIASCANNER_QML_MEDIASTOREWRAPPER_H
262+
263+#include <QList>
264+#include <QObject>
265+#include <QString>
266+
267+#include <mediascanner/MediaStore.hh>
268+#include "MediaFileWrapper.hh"
269+
270+class MediaStoreWrapper : public QObject {
271+ Q_OBJECT
272+ Q_ENUMS(MediaType)
273+public:
274+ enum MediaType {
275+ Audio = AudioMedia,
276+ Video = VideoMedia,
277+ All = AllMedia,
278+ };
279+ typedef enum MediaType MediaType;
280+ MediaStoreWrapper(QObject *parent=0);
281+
282+ Q_INVOKABLE QList<QObject*> query(const QString &q, MediaType type);
283+ Q_INVOKABLE MediaFileWrapper *lookup(const QString &filename);
284+
285+private:
286+ MediaStore store;
287+};
288+
289+#endif
290
291=== added file 'src/qml/Ubuntu/MediaScanner/plugin.cc'
292--- src/qml/Ubuntu/MediaScanner/plugin.cc 1970-01-01 00:00:00 +0000
293+++ src/qml/Ubuntu/MediaScanner/plugin.cc 2014-01-02 10:16:09 +0000
294@@ -0,0 +1,9 @@
295+#include "plugin.hh"
296+#include "MediaFileWrapper.hh"
297+#include "MediaStoreWrapper.hh"
298+
299+void MediaScannerPlugin::registerTypes(const char *uri) {
300+ qmlRegisterType<MediaStoreWrapper>(uri, 0, 1, "MediaStore");
301+ qmlRegisterUncreatableType<MediaFileWrapper>(uri, 0, 1, "MediaFile",
302+ "Use a MediaStore to retrieve MediaFiles");
303+}
304
305=== added file 'src/qml/Ubuntu/MediaScanner/plugin.hh'
306--- src/qml/Ubuntu/MediaScanner/plugin.hh 1970-01-01 00:00:00 +0000
307+++ src/qml/Ubuntu/MediaScanner/plugin.hh 2014-01-02 10:16:09 +0000
308@@ -0,0 +1,15 @@
309+#ifndef PLUGIN_HH_
310+#define PLUGIN_HH_
311+
312+#include <QtQml>
313+
314+class MediaScannerPlugin : public QQmlExtensionPlugin
315+{
316+ Q_OBJECT
317+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
318+
319+public:
320+ virtual void registerTypes(const char *uri) override;
321+};
322+
323+#endif
324
325=== added file 'src/qml/Ubuntu/MediaScanner/plugin.qmltypes'
326--- src/qml/Ubuntu/MediaScanner/plugin.qmltypes 1970-01-01 00:00:00 +0000
327+++ src/qml/Ubuntu/MediaScanner/plugin.qmltypes 2014-01-02 10:16:09 +0000
328@@ -0,0 +1,49 @@
329+import QtQuick.tooling 1.1
330+
331+// This file describes the plugin-supplied types contained in the library.
332+// It is used for QML tooling purposes only.
333+//
334+// This file was auto-generated with the command '/usr/lib/x86_64-linux-gnu/qt5/bin/qmlplugindump -notrelocatable Ubuntu.MediaScanner 0.1'.
335+
336+Module {
337+ Component {
338+ name: "MediaFileWrapper"
339+ prototype: "QObject"
340+ exports: ["Ubuntu.MediaScanner/MediaFile 0.1"]
341+ Property { name: "filename"; type: "string"; isReadonly: true }
342+ Property { name: "uri"; type: "string"; isReadonly: true }
343+ Property { name: "contentType"; type: "string"; isReadonly: true }
344+ Property { name: "eTag"; type: "string"; isReadonly: true }
345+ Property { name: "title"; type: "string"; isReadonly: true }
346+ Property { name: "author"; type: "string"; isReadonly: true }
347+ Property { name: "album"; type: "string"; isReadonly: true }
348+ Property { name: "albumArtist"; type: "string"; isReadonly: true }
349+ Property { name: "date"; type: "string"; isReadonly: true }
350+ Property { name: "trackNumber"; type: "int"; isReadonly: true }
351+ Property { name: "duration"; type: "int"; isReadonly: true }
352+ }
353+ Component {
354+ name: "MediaStoreWrapper"
355+ prototype: "QObject"
356+ exports: ["Ubuntu.MediaScanner/MediaStore 0.1"]
357+ Enum {
358+ name: "MediaType"
359+ values: {
360+ "Audio": 1,
361+ "Video": 2,
362+ "All": 3
363+ }
364+ }
365+ Method {
366+ name: "query"
367+ type: "QList<QObject*>"
368+ Parameter { name: "q"; type: "string" }
369+ Parameter { name: "type"; type: "MediaType" }
370+ }
371+ Method {
372+ name: "lookup"
373+ type: "MediaFileWrapper*"
374+ Parameter { name: "filename"; type: "string" }
375+ }
376+ }
377+}
378
379=== added file 'src/qml/Ubuntu/MediaScanner/qmldir'
380--- src/qml/Ubuntu/MediaScanner/qmldir 1970-01-01 00:00:00 +0000
381+++ src/qml/Ubuntu/MediaScanner/qmldir 2014-01-02 10:16:09 +0000
382@@ -0,0 +1,2 @@
383+module Ubuntu.MediaScanner
384+plugin mediascanner-qml

Subscribers

People subscribed via source and target branches