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("FileDialog.qml")), uri, 1, 0, "FileDialog");
46 qmlRegisterType(componentUrl(QStringLiteral("FileListingDialog.qml")), uri, 1, 0, "FileListingDialog");
47
48 qmlRegisterType<OpenWithModel>(uri, 1, 3, "OpenWithModel");
49 qmlRegisterType(componentUrl(QStringLiteral("OpenWithDialog.qml")), uri, 1, 0, "OpenWithDialog");
50
51 qmlRegisterSingletonType<FMStatic>(uri, 1, 0, "FM", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
52 Q_UNUSED(engine)
53 Q_UNUSED(scriptEngine)
54 return new FMStatic;
55 });
56
57 //File Tagging components
58 qmlRegisterSingletonType<Tagging>(uri, 1, 3, "Tagging", &Tagging::qmlInstance);
59
60 qmlRegisterType<TagsList>(uri, 1, 0, "TagsListModel");
61 qmlRegisterType(componentUrl(QStringLiteral("private/TagList.qml")), uri, 1, 0, "TagList");
62 qmlRegisterType(componentUrl(QStringLiteral("TagsBar.qml")), uri, 1, 0, "TagsBar");
63 qmlRegisterType(componentUrl(QStringLiteral("TagsDialog.qml")), uri, 1, 0, "TagsDialog");
64 qmlRegisterType(componentUrl(QStringLiteral("NewTagDialog.qml")), uri, 1, 3, "NewTagDialog");
65
66 //File Syncing components
67}
68
69void FileBrowsingPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
70{
71 Q_UNUSED(uri);
72
73 /** IMAGE PROVIDERS **/
74 engine->addImageProvider(QStringLiteral("thumbnailer"), new Thumbnailer());
75}
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 Oct 11 2024 12:11:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.