Krita Source Code Documentation
Loading...
Searching...
No Matches
KoDockRegistry.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "KoDockRegistry.h"
8
9#include <QGlobalStatic>
10#include <QDebug>
11#include <QApplication>
12
13#include <ksharedconfig.h>
14#include <kconfiggroup.h>
15
16#include "KoPluginLoader.h"
17
19
20namespace
21{
22struct SortableDockFactoryBase {
23 QString id;
24 KoDockFactoryBase *factory;
25 int priority;
26
27 bool operator<(const SortableDockFactoryBase &other) const
28 {
29 if (priority == other.priority) {
30 return id.compare(other.id, Qt::CaseInsensitive) < 0;
31 } else {
32 return priority < other.priority;
33 }
34 }
35};
36} // namespace
37
42
44{
46 config.blacklist = "DockerPluginsDisabled";
47 config.group = "krita";
48 KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Dock"),
49 config);
50}
51
53{
54 Q_FOREACH(const KoDockFactoryBase *a, values()) {
55 delete a;
56 }
57}
58
60{
62 sortables.reserve(count());
63 for (const QString &id : keys()) {
64 KoDockFactoryBase *factory = value(id);
65 sortables.append({id, factory, factory->priority()});
66 }
67 std::sort(sortables.begin(), sortables.end());
68
70 factories.reserve(sortables.size());
71 for (const SortableDockFactoryBase &s : sortables) {
72 factories.append(s.factory);
73 }
74 return factories;
75}
76
78{
79
80 if (!s_instance.exists()) {
81 s_instance->init();
82 }
83 return s_instance;
84}
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
bool operator<(KoSnapStrategy::SnapType lhs, KoSnapStrategy::SnapType rhs)
virtual int priority() const
~KoDockRegistry() override
static KoDockRegistry * instance()
QList< KoDockFactoryBase * > sortedDockWidgetFactories()
const KoDockFactoryBase * value(const QString &id) const
QList< KoDockFactoryBase * > values() const
void load(const QString &serviceType, const PluginsConfig &config=PluginsConfig(), QObject *owner=0, bool cache=true)
static KoPluginLoader * instance()
const char * blacklist
This contains the variable name for the list of plugins (by library name) that will not be loaded.