on e4400a2 help sign in
52 lines 2.4 kB history raw
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 <michael.zanetti@canonical.com>
18 */
20#include "plugin.h"
21#include "MockLauncherModel.h"
22#include "MockLauncherItem.h"
23#include "MockQuickListModel.h"
24#include "MockAppDrawerModel.h"
26#include <unity/shell/launcher/LauncherModelInterface.h>
27#include <unity/shell/launcher/LauncherItemInterface.h>
28#include <unity/shell/launcher/AppDrawerModelInterface.h>
30#include <QtQml/qqml.h>
32using namespace unity::shell::launcher;
34static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
36 return new MockLauncherModel();
39// cppcheck-suppress unusedFunction
40void TestLauncherPlugin::registerTypes(const char* uri)
42 // @uri Unity.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.");
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");