| 1 | /* Copyright (C) 2017 Dan Chapman <[email protected]> |
| 2 | |
| 3 | This file is part of Dekko email client for Ubuntu devices |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License as |
| 7 | published by the Free Software Foundation; either version 2 of |
| 8 | the License or (at your option) version 3 |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | #include "MazDBPlugin.h" |
| 19 | |
| 20 | #include <QtQml/QtQml> |
| 21 | #include <QtQml/QQmlContext> |
| 22 | #include <MazDB.h> |
| 23 | #include <MazDBBatch.h> |
| 24 | #include <MazDBListModel.h> |
| 25 | #include <MazDBSettings.h> |
| 26 | #include <MazDBSortProxy.h> |
| 27 | #include <MazOptions.h> |
| 28 | #include <MazDBQueryEngine.h> |
| 29 | #include <MazDBQuery.h> |
| 30 | |
| 31 | void MazDBPlugin::registerTypes(const char *uri) |
| 32 | { |
| 33 | Q_ASSERT(uri == QLatin1String("MazDB")); |
| 34 | // @uri MazDB |
| 35 | qmlRegisterType<MazDB>("MazDB", 1, 0, "MazDB"); |
| 36 | qmlRegisterType<MazDBListModel>("MazDB", 1, 0, "MazDBListModel"); |
| 37 | qmlRegisterType<MazDBSettings>("MazDB", 1, 0, "MazDBSettings"); |
| 38 | qmlRegisterType<MazDBSortProxy>("MazDB", 1, 0, "MazDBSortProxy"); |
| 39 | qmlRegisterType<MazDBQueryEngine>("MazDB", 1, 0, "MazDBQueryEngine"); |
| 40 | qmlRegisterType<MazDBQuery>("MazDB", 1, 0, "MazDBQuery"); |
| 41 | qmlRegisterType<WhereQuery>("MazDB", 1, 0, "WHERE"); |
| 42 | qmlRegisterType<AndQuery>("MazDB", 1, 0, "AND"); |
| 43 | qmlRegisterType<OrQuery>("MazDB", 1, 0, "OR"); |
| 44 | qmlRegisterUncreatableType<MazOptions>("MazDB", 1, 0, "MazOptions", QObject::tr("Cannot create separate instance of Options")); |
| 45 | qmlRegisterUncreatableType<MazDBBatch>("MazDB", 1, 0, "MazDBBatch", QObject::tr("Cannot create separate instance of Batch")); |
| 46 | qmlRegisterUncreatableType<QueryBase>("MazDB", 1, 0, "Query", QObject::tr("Cannot create separate instance of QueryBase")); |
| 47 | qmlRegisterUncreatableType<Range>("MazDB", 1, 0, "Range", QObject::tr("Cannot create separate instance of Range")); |
| 48 | } |
| 49 | |
| 50 | void MazDBPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
| 51 | { |
| 52 | QQmlExtensionPlugin::initializeEngine(engine, uri); |
| 53 | } |