Merge lp:~vthompson/ubuntu-filemanager-app/qml-folderlistmodel into lp:ubuntu-filemanager-app

Proposed by Victor Thompson
Status: Superseded
Proposed branch: lp:~vthompson/ubuntu-filemanager-app/qml-folderlistmodel
Merge into: lp:ubuntu-filemanager-app
Diff against target: 1171 lines (+1106/-0) (has conflicts)
13 files modified
README (+6/-0)
dirmodel.cpp (+431/-0)
dirmodel.h (+136/-0)
iorequest.cpp (+36/-0)
iorequest.h (+51/-0)
iorequestworker.cpp (+92/-0)
iorequestworker.h (+61/-0)
ioworkerthread.cpp (+64/-0)
ioworkerthread.h (+52/-0)
plugin.cpp (+53/-0)
plugin.h (+82/-0)
qml-folderlistmodel.pro (+39/-0)
qmldir (+3/-0)
Conflict adding file README.  Moved existing file to README.moved.
To merge this branch: bzr merge lp:~vthompson/ubuntu-filemanager-app/qml-folderlistmodel
Reviewer Review Type Date Requested Status
Arto Jalkanen Pending
Review via email: mp+153700@code.launchpad.net

This proposal has been superseded by a proposal from 2013-03-18.

Description of the change

This fixes Bug #1154369 by using the QT_INSTALL_QML (qmldir) directory for installation rather than the QT_INSTALL_IMPORTS (importsdir).

To post a comment you must log in.
10. By Victor Thompson

Fix name filtering so if the filter has more than entry any one of the entries will match the filename. Also, added a filterDirectories bool, which defaults to false, so a user can choose to filter directories. Qt labs version did not filter directories, while this version did. Typical use case is to filter filename extensions which do not apply to directories.

11. By Victor Thompson

Add TagLib to the building of the plugin and use TagLib to read metadata

Unmerged revisions

11. By Victor Thompson

Add TagLib to the building of the plugin and use TagLib to read metadata

10. By Victor Thompson

Fix name filtering so if the filter has more than entry any one of the entries will match the filename. Also, added a filterDirectories bool, which defaults to false, so a user can choose to filter directories. Qt labs version did not filter directories, while this version did. Typical use case is to filter filename extensions which do not apply to directories.

9. By Victor Thompson

fix install path to correctly use qmldir.

8. By Arto Jalkanen

Added homePath function. ParentPath property is refreshed when path changes.

7. By Arto Jalkanen

Added parentPath property.

6. By Arto Jalkanen

Some small cleanup between separation of Qt4 and Qt5 code.

5. By Arto Jalkanen

Made the code a bit cleaner, separating qt4/qt5 code into one block.

4. By Arto Jalkanen

Restored metatype registration that was removed during testing.

3. By Arto Jalkanen

Added basic README

2. By Arto Jalkanen

Corrections by Carlos J Mazieri to build files to make the library importable.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'README'
--- README 1970-01-01 00:00:00 +0000
+++ README 2013-03-18 00:30:30 +0000
@@ -0,0 +1,6 @@
1Building and installing
2=======================
3
4qmake && make
5sudo make install
6
07
=== renamed file 'README' => 'README.moved'
=== added file 'dirmodel.cpp'
--- dirmodel.cpp 1970-01-01 00:00:00 +0000
+++ dirmodel.cpp 2013-03-18 00:30:30 +0000
@@ -0,0 +1,431 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#include <QDirIterator>
33#include <QDir>
34#include <QDebug>
35#include <QDateTime>
36#include <QUrl>
37
38#include <errno.h>
39#include <string.h>
40
41#include "dirmodel.h"
42#include "ioworkerthread.h"
43
44Q_GLOBAL_STATIC(IOWorkerThread, ioWorkerThread);
45
46class DirListWorker : public IORequest
47{
48 Q_OBJECT
49public:
50 DirListWorker(const QString &pathName)
51 : mPathName(pathName)
52 { }
53
54 void run()
55 {
56 qDebug() << Q_FUNC_INFO << "Running on: " << QThread::currentThreadId();
57
58 QDir tmpDir = QDir(mPathName);
59 QDirIterator it(tmpDir);
60 QVector<QFileInfo> directoryContents;
61
62 while (it.hasNext()) {
63 it.next();
64
65 // skip hidden files
66 if (it.fileName()[0] == QLatin1Char('.'))
67 continue;
68
69 directoryContents.append(it.fileInfo());
70 if (directoryContents.count() >= 50) {
71 emit itemsAdded(directoryContents);
72
73 // clear() would force a deallocation, micro-optimisation
74 directoryContents.erase(directoryContents.begin(), directoryContents.end());
75 }
76 }
77
78 // last batch
79 emit itemsAdded(directoryContents);
80
81 //std::sort(directoryContents.begin(), directoryContents.end(), DirModel::fileCompare);
82 }
83
84signals:
85 void itemsAdded(const QVector<QFileInfo> &files);
86
87private:
88 QString mPathName;
89};
90
91DirModel::DirModel(QObject *parent)
92 : QAbstractListModel(parent)
93 , mAwaitingResults(false)
94 , mShowDirectories(true)
95{
96 mNameFilters = QStringList() << "*";
97
98#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
99 // There's no setRoleNames in Qt5.
100 setRoleNames(buildRoleNames());
101#endif
102
103 // populate reverse mapping
104 const QHash<int, QByteArray> &roles = roleNames();
105 QHash<int, QByteArray>::ConstIterator it = roles.constBegin();
106 for (;it != roles.constEnd(); ++it)
107 mRoleMapping.insert(it.value(), it.key());
108
109 // make sure we cover all roles
110// Q_ASSERT(roles.count() == IsFileRole - FileNameRole);
111}
112
113#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
114// roleNames has changed between Qt4 and Qt5. In Qt5 it is a virtual
115// function and setRoleNames should not be used.
116QHash<int, QByteArray> DirModel::roleNames() const
117{
118 static QHash<int, QByteArray> roles;
119 if (roles.isEmpty()) {
120 roles = buildRoleNames();
121 }
122
123 return roles;
124}
125#endif
126
127QHash<int, QByteArray> DirModel::buildRoleNames() const
128{
129 QHash<int, QByteArray> roles;
130 roles.insert(FileNameRole, QByteArray("fileName"));
131 roles.insert(CreationDateRole, QByteArray("creationDate"));
132 roles.insert(ModifiedDateRole, QByteArray("modifiedDate"));
133 roles.insert(FileSizeRole, QByteArray("fileSize"));
134 roles.insert(IconSourceRole, QByteArray("iconSource"));
135 roles.insert(FilePathRole, QByteArray("filePath"));
136 roles.insert(IsDirRole, QByteArray("isDir"));
137 roles.insert(IsFileRole, QByteArray("isFile"));
138 roles.insert(IsReadableRole, QByteArray("isReadable"));
139 roles.insert(IsWritableRole, QByteArray("isWritable"));
140 roles.insert(IsExecutableRole, QByteArray("isExecutable"));
141
142 return roles;
143}
144
145QVariant DirModel::data(int row, const QByteArray &stringRole) const
146{
147 QHash<QByteArray, int>::ConstIterator it = mRoleMapping.constFind(stringRole);
148
149 if (it == mRoleMapping.constEnd())
150 return QVariant();
151
152 return data(index(row, 0), *it);
153}
154
155QVariant DirModel::data(const QModelIndex &index, int role) const
156{
157 if (role < FileNameRole || role > IsExecutableRole) {
158 qWarning() << Q_FUNC_INFO << "Got an out of range role: " << role;
159 return QVariant();
160 }
161
162 if (index.row() < 0 || index.row() >= mDirectoryContents.count()) {
163 qWarning() << "Attempted to access out of range row: " << index.row();
164 return QVariant();
165 }
166
167 if (index.column() != 0)
168 return QVariant();
169
170 const QFileInfo &fi = mDirectoryContents.at(index.row());
171
172 switch (role) {
173 case FileNameRole:
174 return fi.fileName();
175 case CreationDateRole:
176 return fi.created();
177 case ModifiedDateRole:
178 return fi.lastModified();
179 case FileSizeRole: {
180 qint64 kb = fi.size() / 1024;
181 if (kb < 1)
182 return QString::number(fi.size()) + " bytes";
183 else if (kb < 1024)
184 return QString::number(kb) + " kb";
185
186 kb /= 1024;
187 return QString::number(kb) + "mb";
188 }
189 case IconSourceRole: {
190 const QString &fileName = fi.fileName();
191
192 if (fi.isDir())
193 return "image://theme/icon-m-common-directory";
194
195 if (fileName.endsWith(".jpg", Qt::CaseInsensitive) ||
196 fileName.endsWith(".png", Qt::CaseInsensitive)) {
197 return "image://nemoThumbnail/" + fi.filePath();
198 }
199
200 return "image://theme/icon-m-content-document";
201 }
202 case FilePathRole:
203 return fi.filePath();
204 case IsDirRole:
205 return fi.isDir();
206 case IsFileRole:
207 return !fi.isDir();
208 case IsReadableRole:
209 return fi.isReadable();
210 case IsWritableRole:
211 return fi.isWritable();
212 case IsExecutableRole:
213 return fi.isExecutable();
214 default:
215 // this should not happen, ever
216 Q_ASSERT(false);
217 qWarning() << Q_FUNC_INFO << "Got an unknown role: " << role;
218 return QVariant();
219 }
220}
221
222void DirModel::setPath(const QString &pathName)
223{
224 if (pathName.isEmpty())
225 return;
226
227 if (mAwaitingResults) {
228 // TODO: handle the case where pathName != our current path, cancel old
229 // request, start a new one
230 qDebug() << Q_FUNC_INFO << "Ignoring path change request, request already running";
231 return;
232 }
233
234 mAwaitingResults = true;
235 emit awaitingResultsChanged();
236 qDebug() << Q_FUNC_INFO << "Changing to " << pathName << " on " << QThread::currentThreadId();
237
238 beginResetModel();
239 mDirectoryContents.clear();
240 endResetModel();
241
242 // TODO: we need to set a spinner active before we start getting results from DirListWorker
243 DirListWorker *dlw = new DirListWorker(pathName);
244 connect(dlw, SIGNAL(itemsAdded(QVector<QFileInfo>)), SLOT(onItemsAdded(QVector<QFileInfo>)));
245 ioWorkerThread()->addRequest(dlw);
246
247 mCurrentDir = pathName;
248 emit pathChanged();
249}
250
251static bool fileCompare(const QFileInfo &a, const QFileInfo &b)
252{
253 if (a.isDir() && !b.isDir())
254 return true;
255
256 if (b.isDir() && !a.isDir())
257 return false;
258
259 return QString::localeAwareCompare(a.fileName(), b.fileName()) < 0;
260}
261
262void DirModel::onItemsAdded(const QVector<QFileInfo> &newFiles)
263{
264 qDebug() << Q_FUNC_INFO << "Got new files: " << newFiles.count();
265
266 if (mAwaitingResults) {
267 qDebug() << Q_FUNC_INFO << "No longer awaiting results";
268 mAwaitingResults = false;
269 emit awaitingResultsChanged();
270 }
271
272 foreach (const QFileInfo &fi, newFiles) {
273 if (!mShowDirectories && fi.isDir())
274 continue;
275
276 bool doAdd = true;
277 foreach (const QString &nameFilter, mNameFilters) {
278 // TODO: using QRegExp for wildcard matching is slow
279 QRegExp re(nameFilter, Qt::CaseInsensitive, QRegExp::Wildcard);
280 if (!re.exactMatch(fi.fileName())) {
281 doAdd = false;
282 break;
283 }
284 }
285
286 if (!doAdd)
287 continue;
288
289 QVector<QFileInfo>::Iterator it = qLowerBound(mDirectoryContents.begin(),
290 mDirectoryContents.end(),
291 fi,
292 fileCompare);
293
294 if (it == mDirectoryContents.end()) {
295 beginInsertRows(QModelIndex(), mDirectoryContents.count(), mDirectoryContents.count());
296 mDirectoryContents.append(fi);
297 endInsertRows();
298 } else {
299 int idx = it - mDirectoryContents.begin();
300 beginInsertRows(QModelIndex(), idx, idx);
301 mDirectoryContents.insert(it, fi);
302 endInsertRows();
303 }
304 }
305}
306
307void DirModel::rm(const QStringList &paths)
308{
309 // TODO: handle directory deletions?
310 bool error = false;
311
312 foreach (const QString &path, paths) {
313 error |= QFile::remove(path);
314
315 if (error) {
316 qWarning() << Q_FUNC_INFO << "Failed to remove " << path;
317 error = false;
318 }
319 }
320
321 // TODO: just remove removed items; don't reload the entire model
322 refresh();
323}
324
325bool DirModel::rename(int row, const QString &newName)
326{
327 qDebug() << Q_FUNC_INFO << "Renaming " << row << " to " << newName;
328 Q_ASSERT(row >= 0 && row < mDirectoryContents.count());
329 if (row < 0 || row >= mDirectoryContents.count()) {
330 qWarning() << Q_FUNC_INFO << "Out of bounds access";
331 return false;
332 }
333
334 const QFileInfo &fi = mDirectoryContents.at(row);
335
336 if (!fi.isDir()) {
337 QFile f(fi.absoluteFilePath());
338 bool retval = f.rename(fi.absolutePath() + QDir::separator() + newName);
339
340 if (!retval)
341 qDebug() << Q_FUNC_INFO << "Rename returned error code: " << f.error() << f.errorString();
342 else
343 refresh();
344 // TODO: just change the affected item... ^^
345
346 return retval;
347 } else {
348 QDir d(fi.absoluteFilePath());
349 bool retval = d.rename(fi.absoluteFilePath(), fi.absolutePath() + QDir::separator() + newName);
350
351 // QDir has no way to detect what went wrong. woohoo!
352
353 // TODO: just change the affected item...
354 refresh();
355
356 return retval;
357 }
358
359 // unreachable (we hope)
360 Q_ASSERT(false);
361 return false;
362}
363
364void DirModel::mkdir(const QString &newDir)
365{
366 qDebug() << Q_FUNC_INFO << "Creating new folder " << newDir << " to " << mCurrentDir;
367
368 QDir dir(mCurrentDir);
369 bool retval = dir.mkdir(newDir);
370 if (!retval) {
371 const char *errorStr = strerror(errno);
372 qDebug() << Q_FUNC_INFO << "Error creating new directory: " << errno << " (" << errorStr << ")";
373 emit error("Error creating new folder", errorStr);
374 } else {
375 refresh();
376 }
377}
378
379bool DirModel::showDirectories() const
380{
381 return mShowDirectories;
382}
383
384void DirModel::setShowDirectories(bool showDirectories)
385{
386 mShowDirectories = showDirectories;
387 refresh();
388 emit showDirectoriesChanged();
389}
390
391QStringList DirModel::nameFilters() const
392{
393 return mNameFilters;
394}
395
396void DirModel::setNameFilters(const QStringList &nameFilters)
397{
398 mNameFilters = nameFilters;
399 refresh();
400 emit nameFiltersChanged();
401}
402
403bool DirModel::awaitingResults() const
404{
405 return mAwaitingResults;
406}
407
408QString DirModel::parentPath() const
409{
410 QDir dir(mCurrentDir);
411 if (dir.isRoot()) {
412 qDebug() << Q_FUNC_INFO << "already at root";
413 return mCurrentDir;
414 }
415
416 bool success = dir.cdUp();
417 if (!success) {
418 qWarning() << Q_FUNC_INFO << "Failed to to go to parent of " << mCurrentDir;
419 return mCurrentDir;
420 }
421 qDebug() << Q_FUNC_INFO << "returning" << dir.absolutePath();
422 return dir.absolutePath();
423}
424
425QString DirModel::homePath() const
426{
427 return QDir::homePath();
428}
429
430// for dirlistworker
431#include "dirmodel.moc"
0432
=== added file 'dirmodel.h'
--- dirmodel.h 1970-01-01 00:00:00 +0000
+++ dirmodel.h 2013-03-18 00:30:30 +0000
@@ -0,0 +1,136 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#ifndef DIRMODEL_H
33#define DIRMODEL_H
34
35#include <QAbstractListModel>
36#include <QFileInfo>
37#include <QVector>
38#include <QStringList>
39
40#include "iorequest.h"
41
42class DirModel : public QAbstractListModel
43{
44 Q_OBJECT
45
46 enum Roles {
47 FileNameRole = Qt::UserRole,
48 CreationDateRole,
49 ModifiedDateRole,
50 FileSizeRole,
51 IconSourceRole,
52 FilePathRole,
53 IsDirRole,
54 IsFileRole,
55 IsReadableRole,
56 IsWritableRole,
57 IsExecutableRole
58 };
59
60public:
61 DirModel(QObject *parent = 0);
62
63 int rowCount(const QModelIndex &index) const
64 {
65 if (index.parent() != QModelIndex())
66 return 0;
67
68 return mDirectoryContents.count();
69 }
70
71 // TODO: this won't be safe if the model can change under the holder of the row
72 Q_INVOKABLE QVariant data(int row, const QByteArray &stringRole) const;
73
74 QVariant data(const QModelIndex &index, int role) const;
75
76 Q_INVOKABLE void refresh()
77 {
78 // just some syntactical sugar really
79 setPath(path());
80 }
81
82 Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged);
83 inline QString path() const { return mCurrentDir; }
84
85 Q_PROPERTY(QString parentPath READ parentPath NOTIFY pathChanged);
86 Q_INVOKABLE QString parentPath() const;
87
88 Q_INVOKABLE QString homePath() const;
89
90 Q_PROPERTY(bool awaitingResults READ awaitingResults NOTIFY awaitingResultsChanged);
91 bool awaitingResults() const;
92
93 void setPath(const QString &pathName);
94
95 Q_INVOKABLE void rm(const QStringList &paths);
96
97 Q_INVOKABLE bool rename(int row, const QString &newName);
98
99 Q_INVOKABLE void mkdir(const QString &newdir);
100
101 Q_PROPERTY(bool showDirectories READ showDirectories WRITE setShowDirectories NOTIFY showDirectoriesChanged)
102 bool showDirectories() const;
103 void setShowDirectories(bool showDirectories);
104
105 Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
106 QStringList nameFilters() const;
107 void setNameFilters(const QStringList &nameFilters);
108
109public slots:
110 void onItemsAdded(const QVector<QFileInfo> &newFiles);
111
112signals:
113 void awaitingResultsChanged();
114 void nameFiltersChanged();
115 void showDirectoriesChanged();
116 void pathChanged();
117 void error(const QString &errorTitle, const QString &errorMessage);
118
119private:
120 QHash<int, QByteArray> buildRoleNames() const;
121
122#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
123 // In Qt5, the roleNames() is virtual and will work just fine. On qt4 setRoleNames must be used with buildRoleNames.
124 QHash<int, QByteArray> roleNames() const;
125#endif
126
127 QStringList mNameFilters;
128 bool mShowDirectories;
129 bool mAwaitingResults;
130 QString mCurrentDir;
131 QVector<QFileInfo> mDirectoryContents;
132 QHash<QByteArray, int> mRoleMapping;
133};
134
135
136#endif // DIRMODEL_H
0137
=== added file 'iorequest.cpp'
--- iorequest.cpp 1970-01-01 00:00:00 +0000
+++ iorequest.cpp 2013-03-18 00:30:30 +0000
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#include "iorequest.h"
33
34IORequest::IORequest() : QObject()
35{
36}
037
=== added file 'iorequest.h'
--- iorequest.h 1970-01-01 00:00:00 +0000
+++ iorequest.h 2013-03-18 00:30:30 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#ifndef IOREQUEST_H
33#define IOREQUEST_H
34
35#include <QObject>
36
37class IORequest : public QObject
38{
39 Q_OBJECT
40public:
41 explicit IORequest();
42
43public:
44 virtual void run() = 0;
45
46private:
47 // hide this because IORequest should *NOT* be parented directly
48 using QObject::setParent;
49};
50
51#endif // IOREQUEST_H
052
=== added file 'iorequestworker.cpp'
--- iorequestworker.cpp 1970-01-01 00:00:00 +0000
+++ iorequestworker.cpp 2013-03-18 00:30:30 +0000
@@ -0,0 +1,92 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#include <QMutexLocker>
33#include <QDebug>
34
35#include "iorequestworker.h"
36#include "iorequest.h"
37
38/*!
39 Lives on an IOWorkerThread.
40
41 Responsible for running IORequest jobs on the thread instance, and
42 disposing of their resources once they are done.
43 */
44IORequestWorker::IORequestWorker()
45 : QThread()
46 , mTimeToQuit(false)
47{
48}
49
50void IORequestWorker::addRequest(IORequest *request)
51{
52 request->moveToThread(this);
53
54 // TODO: queue requests so we run the most important one first
55 QMutexLocker lock(&mMutex);
56 mRequests.append(request);
57
58 // wake run()
59 mWaitCondition.wakeOne();
60}
61
62void IORequestWorker::run()
63{
64 forever {
65 QMutexLocker lock(&mMutex);
66
67 if (mTimeToQuit)
68 return;
69
70 if (mRequests.empty())
71 mWaitCondition.wait(&mMutex);
72
73 while (!mRequests.isEmpty()) {
74 IORequest *request = mRequests.takeFirst();
75
76 lock.unlock();
77
78 request->run();
79 request->deleteLater();
80
81 lock.relock();
82 }
83 }
84}
85
86void IORequestWorker::exit()
87{
88 qDebug() << Q_FUNC_INFO << "Quitting";
89 QMutexLocker lock(&mMutex);
90 mTimeToQuit = true;
91 mWaitCondition.wakeOne();
92}
093
=== added file 'iorequestworker.h'
--- iorequestworker.h 1970-01-01 00:00:00 +0000
+++ iorequestworker.h 2013-03-18 00:30:30 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#ifndef IOREQUESTWORKER_H
33#define IOREQUESTWORKER_H
34
35#include <QObject>
36#include <QThread>
37#include <QMutex>
38#include <QWaitCondition>
39
40#include "iorequest.h"
41
42class IORequestWorker : public QThread
43{
44 Q_OBJECT
45public:
46 explicit IORequestWorker();
47
48 void addRequest(IORequest *request);
49
50 void run();
51
52 void exit();
53
54private:
55 QMutex mMutex;
56 QWaitCondition mWaitCondition;
57 QList<IORequest *> mRequests;
58 bool mTimeToQuit;
59};
60
61#endif // IOREQUESTWORKER_H
062
=== added file 'ioworkerthread.cpp'
--- ioworkerthread.cpp 1970-01-01 00:00:00 +0000
+++ ioworkerthread.cpp 2013-03-18 00:30:30 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#include "ioworkerthread.h"
33
34
35/*!
36 Hosts a thread, lives on the main thread.
37
38 Responsible for relaying interaction between the main thread and an IOWorkerThread.
39 */
40IOWorkerThread::IOWorkerThread(QObject *parent) :
41 QObject(parent)
42{
43 mWorker.start(QThread::IdlePriority);
44}
45
46/*!
47 Destroys an IOWorkerThread instance.
48 */
49IOWorkerThread::~IOWorkerThread()
50{
51 mWorker.exit();
52 mWorker.wait();
53}
54
55/*!
56 Attempts an asynchronous attempt to start a \a request.
57
58 If the request may be run, it is queued, and true is returned, otherwise, false.
59 */
60bool IOWorkerThread::addRequest(IORequest *request)
61{
62 mWorker.addRequest(request);
63 return true;
64}
065
=== added file 'ioworkerthread.h'
--- ioworkerthread.h 1970-01-01 00:00:00 +0000
+++ ioworkerthread.h 2013-03-18 00:30:30 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#ifndef IOWORKERTHREAD_H
33#define IOWORKERTHREAD_H
34
35#include <QObject>
36#include <QThread>
37
38#include "iorequestworker.h"
39
40class IOWorkerThread : public QObject
41{
42 Q_OBJECT
43public:
44 explicit IOWorkerThread(QObject *parent = 0);
45 virtual ~IOWorkerThread();
46 bool addRequest(IORequest *request);
47
48private:
49 IORequestWorker mWorker;
50};
51
52#endif // IOWORKERTHREAD_H
053
=== added file 'plugin.cpp'
--- plugin.cpp 1970-01-01 00:00:00 +0000
+++ plugin.cpp 2013-03-18 00:30:30 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#include <QVector>
33#include <QFileInfo>
34
35#include "plugin.h"
36
37NemoFolderListModelPlugin::NemoFolderListModelPlugin() { }
38
39NemoFolderListModelPlugin::~NemoFolderListModelPlugin() { }
40
41void NemoFolderListModelPlugin::initializeEngine(QmlEngine *engine, const char *uri)
42{
43 Q_UNUSED(engine)
44 Q_ASSERT(uri == QLatin1String("org.nemomobile.folderlistmodel"));
45}
46
47void NemoFolderListModelPlugin::registerTypes(const char *uri)
48{
49 Q_ASSERT(uri == QLatin1String("org.nemomobile.folderlistmodel"));
50 qRegisterMetaType<QVector<QFileInfo> >();
51 qmlRegisterType<DirModel>(uri, 1, 0, "FolderListModel");
52}
53
054
=== added file 'plugin.h'
--- plugin.h 1970-01-01 00:00:00 +0000
+++ plugin.h 2013-03-18 00:30:30 +0000
@@ -0,0 +1,82 @@
1/*
2 * Copyright (C) 2012 Robin Burchell <robin+nemo@viroteck.net>
3 *
4 * You may use this file under the terms of the BSD license as follows:
5 *
6 * "Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Nemo Mobile nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30 */
31
32#ifndef NEMO_QML_PLUGINS_FOLDERLISTMODEL
33#define NEMO_QML_PLUGINS_FOLDERLISTMODEL
34
35#include <QtGlobal>
36
37#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
38#include <QtDeclarative>
39#include <QDeclarativeEngine>
40#include <QDeclarativeExtensionPlugin>
41#include <QVector>
42#include <QFileInfo>
43
44#define PLUGIN_CLASS_EXPORT
45#define PLUGIN_CLASS_EXTERNAL_EXPORT Q_EXPORT_PLUGIN2(nemofolderlistmodel, NemoFolderListModelPlugin);
46#define PLUGIN_CLASS_EXTEND
47typedef QDeclarativeExtensionPlugin QmlPluginParent;
48typedef QDeclarativeEngine QmlEngine;
49Q_DECLARE_METATYPE(QVector<QFileInfo>)
50
51#else
52#include <QQmlComponent>
53#include <QQmlEngine>
54#include <QQmlContext>
55#include <QQmlExtensionPlugin>
56
57#define PLUGIN_CLASS_EXPORT Q_DECL_EXPORT
58#define PLUGIN_CLASS_EXTERNAL_EXPORT
59#define PLUGIN_CLASS_EXTEND \
60 Q_OBJECT \
61 Q_PLUGIN_METADATA(IID "org.nemomobile.folderlistmodel")
62typedef QQmlExtensionPlugin QmlPluginParent;
63typedef QQmlEngine QmlEngine;
64#endif
65
66#include "dirmodel.h"
67
68class PLUGIN_CLASS_EXPORT NemoFolderListModelPlugin : public QmlPluginParent
69{
70 PLUGIN_CLASS_EXTEND
71
72public:
73 NemoFolderListModelPlugin();
74 virtual ~NemoFolderListModelPlugin();
75
76 void initializeEngine(QmlEngine *engine, const char *uri);
77 void registerTypes(const char *uri);
78};
79
80PLUGIN_CLASS_EXTERNAL_EXPORT
81
82#endif // NEMO_QML_PLUGINS_FOLDERLISTMODEL
083
=== added file 'qml-folderlistmodel.pro'
--- qml-folderlistmodel.pro 1970-01-01 00:00:00 +0000
+++ qml-folderlistmodel.pro 2013-03-18 00:30:30 +0000
@@ -0,0 +1,39 @@
1TEMPLATE = lib
2TARGET = folderlistmodel
3QT += qml quick
4CONFIG += qt plugin
5
6TARGET = $$qtLibraryTarget($$TARGET)
7uri = org.nemomobile.folderlistmodel
8
9# Input
10SOURCES += plugin.cpp \
11 dirmodel.cpp \
12 iorequest.cpp \
13 iorequestworker.cpp \
14 ioworkerthread.cpp
15
16HEADERS += plugin.h \
17 dirmodel.h \
18 iorequest.h \
19 iorequestworker.h \
20 ioworkerthread.h
21
22OTHER_FILES = qmldir
23
24!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
25 copy_qmldir.target = $$OUT_PWD/qmldir
26 copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
27 copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
28 QMAKE_EXTRA_TARGETS += copy_qmldir
29 PRE_TARGETDEPS += $$copy_qmldir.target
30}
31
32qmldir.files = qmldir
33unix {
34 installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
35 qmldir.path = $$installPath
36 target.path = $$installPath
37 INSTALLS += target qmldir
38}
39
040
=== added file 'qmldir'
--- qmldir 1970-01-01 00:00:00 +0000
+++ qmldir 2013-03-18 00:30:30 +0000
@@ -0,0 +1,3 @@
1module org.nemomobile.folderlistmodel
2plugin folderlistmodel
3

Subscribers

People subscribed via source and target branches