Unity 8
 All Classes Functions
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 "indicators.h"
28 #include "indicatorsmanager.h"
29 #include "indicatorsmodel.h"
30 #include "menucontentactivator.h"
31 #include "modelprinter.h"
32 #include "rootactionstate.h"
33 #include "unitymenumodelcache.h"
34 #include "unitymenumodelstack.h"
35 #include "visibleindicatorsmodel.h"
36 
37 static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
38  Q_UNUSED(engine);
39  Q_UNUSED(scriptEngine);
40  return new UnityMenuModelCache;
41 }
42 
43 void Indicators2Plugin::registerTypes(const char *uri)
44 {
45  qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
46  qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
47  qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
48  qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack");
49  qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
50  qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
51  qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
52 
53  qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
54 
55  qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class");
56  qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
57  qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
58  qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
59  qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
60  qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
61 }