MauiKit File Browsing

filebrowsing_plugin.cpp
1
2// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#include "filebrowsing_plugin.h"
7
8#include <QQmlEngine>
9#include <QResource>
10#include <QDebug>
11
12#include "thumbnailer.h"
13
14#include "fmstatic.h"
15
16#include "tagslist.h"
17#include "tagging.h"
18
19#include "placeslist.h"
20#include "fmlist.h"
21#include "openwithmodel.h"
22
23QUrl FileBrowsingPlugin::componentUrl(const QString &fileName) const
24{
25 return QUrl(resolveFileUrl(fileName));
26}
27
28void FileBrowsingPlugin::registerTypes(const char *uri)
29{
30 qDebug() << "REGISTER MAUIKITFILEBROWSING TYPES <<<<<<<<<<<<<<<<<<<<<<";
31
32#if defined(Q_OS_ANDROID)
33 QResource::registerResource(QStringLiteral("assets:/android_rcc_bundle.rcc"));
34#endif
35
36 Q_ASSERT(QLatin1String(uri) == QLatin1String("org.mauikit.filebrowsing"));
37
38 //File Browsing components
39 qmlRegisterType<FMList>(uri, 1, 0, "FMList");
40 qmlRegisterType<PlacesList>(uri, 1, 0, "PlacesList");
41 qmlRegisterUncreatableType<PathStatus>(uri, 1, 0, "PathStatus", QStringLiteral("cannot be created :: PathStatus"));
42
43 qmlRegisterType(componentUrl(QStringLiteral("FileBrowser.qml")), uri, 1, 0, "FileBrowser");
44 qmlRegisterType(componentUrl(QStringLiteral("PlacesListBrowser.qml")), uri, 1, 0, "PlacesListBrowser");
45 qmlRegisterType(componentUrl(QStringLiteral("FavButton.qml")), uri, 1, 0, "FavButton");
46 qmlRegisterType(componentUrl(QStringLiteral("FileDialog.qml")), uri, 1, 0, "FileDialog");
47 qmlRegisterType(componentUrl(QStringLiteral("FileListingDialog.qml")), uri, 1, 0, "FileListingDialog");
48
49 qmlRegisterType<OpenWithModel>(uri, 1, 3, "OpenWithModel");
50 qmlRegisterType(componentUrl(QStringLiteral("OpenWithDialog.qml")), uri, 1, 0, "OpenWithDialog");
51
52 qmlRegisterSingletonType<FMStatic>(uri, 1, 0, "FM", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
53 Q_UNUSED(engine)
54 Q_UNUSED(scriptEngine)
55 return new FMStatic;
56 });
57
58 //File Tagging components
59 qmlRegisterSingletonType<Tagging>(uri, 1, 3, "Tagging", &Tagging::qmlInstance);
60
61 qmlRegisterType<TagsList>(uri, 1, 0, "TagsListModel");
62 qmlRegisterType(componentUrl(QStringLiteral("private/TagList.qml")), uri, 1, 0, "TagList");
63 qmlRegisterType(componentUrl(QStringLiteral("TagsBar.qml")), uri, 1, 0, "TagsBar");
64 qmlRegisterType(componentUrl(QStringLiteral("TagsDialog.qml")), uri, 1, 0, "TagsDialog");
65 qmlRegisterType(componentUrl(QStringLiteral("NewTagDialog.qml")), uri, 1, 3, "NewTagDialog");
66
67 //File Syncing components
68}
69
70void FileBrowsingPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
71{
72 Q_UNUSED(uri);
73
74 /** IMAGE PROVIDERS **/
75 engine->addImageProvider(QStringLiteral("thumbnailer"), new Thumbnailer());
76}
The FMStatic class is a group of static file management methods, this class has a constructor only as...
Definition fmstatic.h:30
void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider)
bool registerResource(const QString &rccFileName, const QString &mapRoot)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:48:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.