on e4400a2 help sign in
unity8/tests/mocks/Unity/fake_unity_plugin.cpp
62 lines 3.2 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_filters.h"
26#include "fake_navigation.h"
27#include "fake_optionselectoroptions.h"
28#include "fake_previewmodel.h"
29#include "fake_previewwidgetmodel.h"
30#include "fake_resultsmodel.h"
31#include "fake_settingsmodel.h"
32#include "fake_valueslidervalues.h"
34// External
35#include <glib-object.h>
37#include <QtQml/qqml.h>
39void FakeUnityPlugin::registerTypes(const char *uri)
41#ifndef GLIB_VERSION_2_36
42 g_type_init();
43#endif
45 Q_ASSERT(uri == QLatin1String("Unity"));
47 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
48 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
49 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
50 qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML.");
51 qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
52 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
53 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from Scope instance.");
54 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
55 qmlRegisterType<ResultsModel>(uri, 0, 2, "FakeResultsModel");
56 qmlRegisterType<PreviewModel>(uri, 0, 2, "FakePreviewModel");
57 qmlRegisterUncreatableType<PreviewWidgetModel>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance.");
58 qmlRegisterUncreatableType<unity::shell::scopes::FiltersInterface>(uri, 0, 2, "Filters", "Can't create Filters object in QML. Get them from Scope instance.");
59 qmlRegisterUncreatableType<unity::shell::scopes::FilterBaseInterface>(uri, 0, 2, "Filter", "Can't create Filter object in QML. Get them from Scope instance.");
60 qmlRegisterUncreatableType<unity::shell::scopes::OptionSelectorOptionsInterface>(uri, 0, 2, "OptionSelectorOptions", "Can't create OptionSelectorOptions object in QML");
61 qmlRegisterUncreatableType<unity::shell::scopes::ValueSliderValuesInterface>(uri, 0, 2, "ValueSliderValues", "Can't create ValueSliderValuesInterface object in QML");