Lomiri
Loading...
Searching...
No Matches
plugin.cpp
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 * Nick Dedekind <nick.dedekind@canonical.com>
18 */
19
20// Qt
21#include <QtQml/qqml.h>
22
23// self
24#include "plugin.h"
25
26// local
27#include "actionrootstate.h"
28#include "indicators.h"
29#include "indicatorsmanager.h"
30#include "indicatorsmodel.h"
31#include "menucontentactivator.h"
32#include "modelactionrootstate.h"
33#include "modelprinter.h"
34#include "sharedlomirimenumodel.h"
35#include "lomirimenumodelcache.h"
36#include "lomirimenumodelstack.h"
37
38#include <ayatanamenumodel.h>
39
40static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
41 Q_UNUSED(engine);
42 Q_UNUSED(scriptEngine);
43 return LomiriMenuModelCache::singleton();
44}
45
46void IndicatorsPlugin::registerTypes(const char *uri)
47{
48 qRegisterMetaType<AyatanaMenuModel*>("AyatanaMenuModel*");
49
50 qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
51 qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
52 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
53 qmlRegisterType<LomiriMenuModelStack>(uri, 0, 1, "LomiriMenuModelStack");
54 qmlRegisterType<ModelActionRootState>(uri, 0, 1, "ModelActionRootState");
55 qmlRegisterType<ActionRootState>(uri, 0, 1, "ActionRootState");
56 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
57 qmlRegisterType<SharedLomiriMenuModel>(uri, 0, 1, "SharedLomiriMenuModel");
58
59 qmlRegisterSingletonType<LomiriMenuModelCache>(uri, 0, 1, "LomiriMenuModelCache", menuModelCacheSingleton);
60
61 qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", QStringLiteral("Can't create MenuContentState class"));
62 qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", QStringLiteral("Can't create ActionState class"));
63 qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", QStringLiteral("Can't create NetworkActionState class"));
64 qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", QStringLiteral("Can't create NetworkConnection class"));
65 qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", QStringLiteral("Can't create IndicatorsModelRole class"));
66 qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", QStringLiteral("Can't create FlatMenuProxyModelRole class"));
67}