on daa5708 help sign in
unity8/tests/mocks/Unity/fake_unity_plugin.cpp
56 lines 2.6 kB history raw
1/*
2 * Copyright (C) 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 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: Nick Dedekind <nick.dedekind@canonical.com>
17 */
19// Self
20#include "fake_unity_plugin.h"
22// local
23#include "fake_scopes.h"
24#include "fake_categories.h"
25#include "fake_navigation.h"
26#include "fake_previewmodel.h"
27#include "fake_previewwidgetmodel.h"
28#include "fake_resultsmodel.h"
29#include "fake_settingsmodel.h"
31// External
32#include <glib-object.h>
34#include <QtQml/qqml.h>
36void FakeUnityPlugin::registerTypes(const char *uri)
38#ifndef GLIB_VERSION_2_36
39 g_type_init();
40#endif
42 Q_ASSERT(uri == QLatin1String("Unity"));
44 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
45 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
46 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
47 qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML.");
48 qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
49 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
50 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
51 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
52 qmlRegisterType<ResultsModel>(uri, 0, 2, "FakeResultsModel");
53 qmlRegisterType<PreviewModel>(uri, 0, 2, "FakePreviewModel");
54 qmlRegisterUncreatableType<PreviewWidgetModel>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance.");
55 qmlRegisterUncreatableType<PreviewStack>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance.");