~unity-ui-team/ubuntu-ui-toolkit/trunk-ubuntu-ui-toolkit-image-extension-crash-workaround

« back to all changes in this revision

Viewing changes to tests/api/Extinct/Animals/plugin/plugin.cpp

  • Committer: CI Train Bot
  • Author(s): Albert Astals Cid, Zsombor Egri, Loïc Molinari, Tim Peeters, Zoltán Balogh, Christian Dywan
  • Date: 2015-12-16 10:01:43 UTC
  • mfrom: (1000.720.21 OTA9-landing-2015-12-11)
  • Revision ID: ci-train-bot@canonical.com-20151216100143-hhgmd51xeu09z0np
OTA9-landing-2015-12-11
Approved by: Zoltan Balogh

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2015 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
 * Author: Christian Dywan <christian.dywan@canonical.com>
 
17
 */
 
18
 
 
19
#include "plugin.h"
 
20
#include "smilodon.h"
 
21
#include "pangaea.h"
 
22
#include "rune.h"
 
23
#include "europe.h"
 
24
 
 
25
#include <QtQuick/private/qquickimagebase_p.h>
 
26
 
 
27
static QObject *registerPangaea(QQmlEngine *engine, QJSEngine *scriptEngine)
 
28
{
 
29
    Q_UNUSED(engine)
 
30
    Q_UNUSED(scriptEngine)
 
31
 
 
32
    return new EAPangaea();
 
33
}
 
34
 
 
35
static QObject *registerPangaea4(QQmlEngine *engine, QJSEngine *scriptEngine)
 
36
{
 
37
    Q_UNUSED(engine)
 
38
    Q_UNUSED(scriptEngine)
 
39
 
 
40
    return new EAPangaea4();
 
41
}
 
42
 
 
43
void ExtinctAnimalsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
 
44
{
 
45
    Q_UNUSED(uri);
 
46
    Q_UNUSED(engine);
 
47
}
 
48
 
 
49
void ExtinctAnimalsPlugin::registerTypes(const char *uri)
 
50
{
 
51
    Q_ASSERT(uri == QLatin1String("Extinct.Animals"));
 
52
 
 
53
    qmlRegisterType<EASmilodon>(uri, 1, 0, "Smilodon");
 
54
    qmlRegisterType<EASmilodon>(uri, 0, 1, "ScimitarCat");
 
55
 
 
56
    qmlRegisterType(QUrl(baseUrl().toString() + "/Andrewsarchus.qml"), uri, 0, 1, "Andrewsarchus");
 
57
    // The second call overrrides the previous one, only the last version will show up
 
58
    qmlRegisterType(QUrl(baseUrl().toString() + "/Paratriisodon.qml"), uri, 2, 0, "Andrewsarchus");
 
59
 
 
60
    qmlRegisterType(QUrl("qrc:///ea/Paratriisodon.qml"), uri, 2, 3, "AndrewsarchusMongoliensis");
 
61
    // The second call overrrides the previous one, only the last version will show up
 
62
    qmlRegisterType(QUrl("qrc:///ea/Paratriisodon.qml"), uri, 2, 4, "AndrewsarchusMongoliensis");
 
63
 
 
64
    qmlRegisterSingletonType<EAPangaea>(uri, 1, 0, "Pangaea", registerPangaea);
 
65
    qmlRegisterSingletonType<EAPangaea4>(uri, 4, 0, "Pangaea", registerPangaea4);
 
66
 
 
67
    qmlRegisterUncreatableType<EAEurope>(uri, 4, 1, "Europe", "");
 
68
    qmlRegisterUncreatableType<EAEurope42, 1>(uri, 4, 2, "Europe", "");
 
69
 
 
70
    qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, 3, 3, "QQuickImageBase");
 
71
}