Debian Codegraph @

tests/mocks/Lomiri/Indicators/fakeplugin.cpp

raw
1 /*
2 * Copyright (C) 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: MichaƂ Sawicz <[email protected]>
17 */
18
19 // Qt
20 #include <QtQml/qqml.h>
21
22 // self
23 #include "fakeplugin.h"
24
25 // local
26 #include "fakeindicatorsmodel.h"
27 #include "indicators.h"
28 #include "menucontentactivator.h"
29 #include "sharedlomirimenumodel.h"
30 #include "fakelomirimenumodelcache.h"
31 #include "lomirimenumodelstack.h"
32 #include "modelprinter.h"
33
34 #include <ayatanamenumodel.h>
35
36 static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
37 Q_UNUSED(engine);
38 Q_UNUSED(scriptEngine);
39 return FakeLomiriMenuModelCache::singleton();
40 }
41
42 void IndicatorsFakePlugin::registerTypes(const char * uri)
43 {
44 qRegisterMetaType<AyatanaMenuModel*>("AyatanaMenuModel*");
45
46 // internal
47 qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel");
48
49 // external
50 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
51 qmlRegisterType<LomiriMenuModelStack>(uri, 0, 1, "LomiriMenuModelStack");
52 qmlRegisterType<SharedLomiriMenuModel>(uri, 0, 1, "SharedLomiriMenuModel");
53 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
54
55 qmlRegisterSingletonType<FakeLomiriMenuModelCache>(uri, 0, 1, "LomiriMenuModelCache", menuModelCacheSingleton);
56
57 // external uncreatables
58 qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class");
59 qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
60 qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
61 qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
62 qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
63 qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
64 }