File indexing completed on 2025-01-26 04:15:00

0001 /*
0002  * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) version 3, or any
0008  * later version accepted by the membership of KDE e.V. (or its
0009  * successor approved by the membership of KDE e.V.), which shall
0010  * act as a proxy defined in Section 6 of version 3 of the license.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019  *
0020  */
0021 
0022 #include "qmlplugin.h"
0023 
0024 #include "ArchiveBookModel.h"
0025 #include "BookListModel.h"
0026 #include "BookModel.h"
0027 #include "ComicCoverImageProvider.h"
0028 #include "FolderBookModel.h"
0029 #include "PeruseConfig.h"
0030 #include "PreviewImageProvider.h"
0031 #ifdef USE_PERUSE_PDFTHUMBNAILER
0032 #include "PDFCoverImageProvider.h"
0033 #endif
0034 #include "FilterProxy.h"
0035 #include "PropertyContainer.h"
0036 #include "TextDocumentEditor.h"
0037 #include "TextViewerItem.h"
0038 
0039 #include "AcbfBinary.h"
0040 #include "AcbfReference.h"
0041 #include "AcbfStyle.h"
0042 #include "AcbfIdentifiedObjectModel.h"
0043 
0044 #include <QQmlEngine>
0045 #include <QtQml/qqml.h>
0046 
0047 void QmlPlugins::initializeEngine(QQmlEngine *engine, const char *)
0048 {
0049     engine->addImageProvider("preview", new PreviewImageProvider());
0050     engine->addImageProvider("comiccover", new ComicCoverImageProvider());
0051 #ifdef USE_PERUSE_PDFTHUMBNAILER
0052     engine->addImageProvider("pdfcover", new PDFCoverImageProvider());
0053 #endif
0054 }
0055 
0056 void QmlPlugins::registerTypes(const char *uri)
0057 {
0058     qmlRegisterType<CategoryEntriesModel>(uri, 0, 1, "CategoryEntriesModel");
0059     qmlRegisterType<BookListModel>(uri, 0, 1, "BookListModel");
0060     qmlRegisterType<BookModel>(uri, 0, 1, "BookModel");
0061     qmlRegisterType<ArchiveBookModel>(uri, 0, 1, "ArchiveBookModel");
0062     qmlRegisterType<FolderBookModel>(uri, 0, 1, "FolderBookModel");
0063     qmlRegisterType<PeruseConfig>(uri, 0, 1, "Config");
0064     qmlRegisterType<PropertyContainer>(uri, 0, 1, "PropertyContainer");
0065     qmlRegisterType<FilterProxy>(uri, 0, 1, "FilterProxy");
0066 
0067     qmlRegisterType<TextDocumentEditor>(uri, 0, 1, "TextDocumentEditor");
0068     qmlRegisterType<TextViewerItem>(uri, 0, 1, "TextViewerItem");
0069 
0070     qmlRegisterUncreatableType<AdvancedComicBookFormat::Reference>(uri, 0, 1, "Reference", "Don't attempt to create ACBF types directly, use the convenience functions on their container types for creating them");
0071     qmlRegisterUncreatableType<AdvancedComicBookFormat::Binary>(uri, 0, 1, "Binary", "Don't attempt to create ACBF types directly, use the convenience functions on their container types for creating them");
0072     qmlRegisterUncreatableType<AdvancedComicBookFormat::Style>(uri, 0, 1, "Style", "Don't attempt to create ACBF types directly, use the convenience functions on their container types for creating them");
0073     qmlRegisterType<AdvancedComicBookFormat::IdentifiedObjectModel>(uri, 0, 1, "IdentifiedObjectModel");
0074 }