File indexing completed on 2024-05-12 15:56:40

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include "KoDockRegistry.h"
0008 
0009 #include <QGlobalStatic>
0010 #include <QDebug>
0011 #include <QApplication>
0012 
0013 #include <ksharedconfig.h>
0014 #include <kconfiggroup.h>
0015 
0016 #include "KoPluginLoader.h"
0017 
0018 Q_GLOBAL_STATIC(KoDockRegistry, s_instance)
0019 
0020 KoDockRegistry::KoDockRegistry()
0021     : d(0)
0022 {
0023 }
0024 
0025 void KoDockRegistry::init()
0026 {
0027     KoPluginLoader::PluginsConfig config;
0028     config.whiteList = "DockerPlugins";
0029     config.blacklist = "DockerPluginsDisabled";
0030     config.group = "krita";
0031     KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Dock"),
0032                                      QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
0033                                      config);
0034 }
0035 
0036 KoDockRegistry::~KoDockRegistry()
0037 {
0038     Q_FOREACH(const KoDockFactoryBase *a, values()) {
0039         delete a;
0040     }
0041 }
0042 
0043 KoDockRegistry* KoDockRegistry::instance()
0044 {
0045 
0046     if (!s_instance.exists()) {
0047         s_instance->init();
0048     }
0049     return s_instance;
0050 }