2
* Copyright (C) 2012,2013 Canonical, Ltd.
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.
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.
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/>.
16
* Authors: Gerry Boland <gerry.boland@canonical.com>
17
* Michael Terry <michael.terry@canonical.com>
22
#include "UsersModel.h"
23
#include <QLightDM/UsersModel>
24
#include "InfographicModel.h"
26
#include <QtCore/QAbstractItemModel>
29
static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
32
Q_UNUSED(scriptEngine)
36
static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
39
Q_UNUSED(scriptEngine)
40
return new UsersModel();
43
static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
46
Q_UNUSED(scriptEngine)
47
return InfographicModel::getInstance();
50
void LightDMPlugin::registerTypes(const char *uri)
52
qmlRegisterType<QAbstractItemModel>();
53
qmlRegisterType<InfographicColorTheme>();
55
Q_ASSERT(uri == QLatin1String("LightDM"));
56
qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
57
qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
58
qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
59
qmlRegisterSingletonType<InfographicModel>(uri, 0, 1, "Infographic", infographic_provider);