~unity-2d-team/bamf-qt/trunk

333 by Olivier Tilloy
License and copyright headers in source files.
1
/*
2
 * Copyright (C) 2010 Canonical, Ltd.
3
 *
4
 * Authors:
5
 *  Olivier Tilloy <olivier.tilloy@canonical.com>
6
 *
7
 * This library is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License
9
 * as published by the Free Software Foundation; version 3.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this program.  If not, see
18
 * <http://www.gnu.org/licenses/>.
19
 */
20
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
21
#include "bamf-plugin.h"
22
23
#include <QtDeclarative/qdeclarative.h>
24
#include <QDeclarativeEngine>
338 by Florian Boucault
Moved BamfMatcher context property setting from test program to libQtBamf QML plugin.
25
#include <QDeclarativeContext>
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
26
27
#include "bamf-view.h"
28
#include "bamf-application.h"
29
#include "bamf-window.h"
360.1.1 by Florian Boucault
Added support for indicators (new BamfIndicator class).
30
#include "bamf-indicator.h"
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
31
#include "bamf-control.h"
32
#include "bamf-matcher.h"
33
329 by Olivier Tilloy
Thin wrappers around QList<T> inheriting from QObject.
34
#include "bamf-list.h"
35
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
36
void
37
BamfPlugin::registerTypes(const char *uri)
38
{
328 by Olivier Tilloy
Restore the privacy of constructors and destructors, thanks to qmlRegisterUncreatableType(…).
39
    const QString message("This type is not meant to be instantiated.");
329 by Olivier Tilloy
Thin wrappers around QList<T> inheriting from QObject.
40
    qmlRegisterUncreatableType<BamfUintList>(uri, 0, 2, "BamfUintList", message);
328 by Olivier Tilloy
Restore the privacy of constructors and destructors, thanks to qmlRegisterUncreatableType(…).
41
    qmlRegisterUncreatableType<BamfView>(uri, 0, 2, "BamfView", message);
329 by Olivier Tilloy
Thin wrappers around QList<T> inheriting from QObject.
42
    qmlRegisterUncreatableType<BamfViewList>(uri, 0, 2, "BamfViewList", message);
328 by Olivier Tilloy
Restore the privacy of constructors and destructors, thanks to qmlRegisterUncreatableType(…).
43
    qmlRegisterUncreatableType<BamfApplication>(uri, 0, 2, "BamfApplication", message);
329 by Olivier Tilloy
Thin wrappers around QList<T> inheriting from QObject.
44
    qmlRegisterUncreatableType<BamfApplicationList>(uri, 0, 2, "BamfApplicationList", message);
328 by Olivier Tilloy
Restore the privacy of constructors and destructors, thanks to qmlRegisterUncreatableType(…).
45
    qmlRegisterUncreatableType<BamfWindow>(uri, 0, 2, "BamfWindow", message);
360.1.1 by Florian Boucault
Added support for indicators (new BamfIndicator class).
46
    qmlRegisterUncreatableType<BamfIndicator>(uri, 0, 2, "BamfIndicator", message);
329 by Olivier Tilloy
Thin wrappers around QList<T> inheriting from QObject.
47
    qmlRegisterUncreatableType<BamfWindowList>(uri, 0, 2, "BamfWindowList", message);
328 by Olivier Tilloy
Restore the privacy of constructors and destructors, thanks to qmlRegisterUncreatableType(…).
48
    qmlRegisterUncreatableType<BamfControl>(uri, 0, 2, "BamfControl", message);
49
    qmlRegisterUncreatableType<BamfMatcher>(uri, 0, 2, "BamfMatcher", message);
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
50
}
51
338 by Florian Boucault
Moved BamfMatcher context property setting from test program to libQtBamf QML plugin.
52
void BamfPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
53
{
54
    BamfMatcher& matcher = BamfMatcher::get_default();
55
    engine->rootContext()->setContextProperty("BamfMatcher", &matcher);
56
}
57
327 by Olivier Tilloy
Export QtBamf as a Qt declarative extension plugin,
58
Q_EXPORT_PLUGIN2(QtBamf, BamfPlugin);
59