| 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 |
* Authors: |
| 17 |
* Michael Zanetti <[email protected]> |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "plugin.h" |
| 21 |
#include "MockLauncherModel.h" |
| 22 |
#include "MockLauncherItem.h" |
| 23 |
#include "MockQuickListModel.h" |
| 24 |
#include "MockAppDrawerModel.h" |
| 25 |
|
| 26 |
#include <lomiri/shell/launcher/LauncherModelInterface.h> |
| 27 |
#include <lomiri/shell/launcher/LauncherItemInterface.h> |
| 28 |
#include <lomiri/shell/launcher/AppDrawerModelInterface.h> |
| 29 |
|
| 30 |
#include <QtQml/qqml.h> |
| 31 |
|
| 32 |
using namespace lomiri::shell::launcher; |
| 33 |
|
| 34 |
static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) |
| 35 |
{ |
| 36 |
return new MockLauncherModel(); |
| 37 |
} |
| 38 |
|
| 39 |
// cppcheck-suppress unusedFunction |
| 40 |
void TestLauncherPlugin::registerTypes(const char* uri) |
| 41 |
{ |
| 42 |
// @uri Lomiri.Launcher |
| 43 |
qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated."); |
| 44 |
qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated."); |
| 45 |
qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Abstract Interface. Cannot be instantiated."); |
| 46 |
qmlRegisterUncreatableType<AppDrawerModelInterface>(uri, 0, 1, "AppDrawerModelInterface", "Abstract Interface. Cannot be instantiated."); |
| 47 |
|
| 48 |
qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider); |
| 49 |
qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel"); |
| 50 |
qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickLists in QML. Get them from the LauncherItems"); |
| 51 |
qmlRegisterType<MockAppDrawerModel>(uri, 0, 1, "AppDrawerModel"); |
| 52 |
} |