File indexing completed on 2025-01-19 03:55:36

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2018-12-31
0007  * Description : configuration view for external generic plugin
0008  *
0009  * SPDX-FileCopyrightText: 2018-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "dpluginconfviewgeneric.h"
0016 
0017 // Local includes
0018 
0019 #include "dplugingeneric.h"
0020 #include "dpluginloader.h"
0021 
0022 namespace Digikam
0023 {
0024 
0025 DPluginConfViewGeneric::DPluginConfViewGeneric(QWidget* const parent)
0026     : DPluginConfView(parent)
0027 {
0028     this->loadPlugins();
0029 }
0030 
0031 DPluginConfViewGeneric::~DPluginConfViewGeneric()
0032 {
0033 }
0034 
0035 void DPluginConfViewGeneric::loadPlugins()
0036 {
0037     DPluginLoader* const loader = DPluginLoader::instance();
0038 
0039     if (loader)
0040     {
0041         Q_FOREACH (DPlugin* const tool, loader->allPlugins())
0042         {
0043             DPluginGeneric* const gene = dynamic_cast<DPluginGeneric*>(tool);
0044 
0045             if (gene)
0046             {
0047                 appendPlugin(gene);
0048             }
0049         }
0050     }
0051 
0052     // Sort items by plugin names.
0053 
0054     sortItems(0, Qt::AscendingOrder);
0055 }
0056 
0057 } // namespace Digikam
0058 
0059 #include "moc_dpluginconfviewgeneric.cpp"