1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2007-02-06
7  * Description : Setup view panel for dplugins.
8  *
9  * Copyright (C) 2018-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #include "showfotosetupplugins.h"
25 
26 // Qt includes
27 
28 #include <QTabWidget>
29 
30 // KDE includes
31 
32 #include <klocalizedstring.h>
33 
34 // Local includes
35 
36 #include "dpluginsetup.h"
37 #include "dpluginconfviewgeneric.h"
38 #include "dpluginconfvieweditor.h"
39 #include "dpluginconfviewdimg.h"
40 
41 using namespace Digikam;
42 
43 namespace ShowFoto
44 {
45 
46 class Q_DECL_HIDDEN ShowfotoSetupPlugins::Private
47 {
48 public:
49 
Private()50     explicit Private()
51       : tab         (nullptr),
52         setupGeneric(nullptr),
53         setupEditor (nullptr),
54         setupDImg   (nullptr)
55     {
56     }
57 
58     QTabWidget*   tab;
59 
60     DPluginSetup* setupGeneric;
61     DPluginSetup* setupEditor;
62     DPluginSetup* setupDImg;
63 };
64 
ShowfotoSetupPlugins(QWidget * const parent)65 ShowfotoSetupPlugins::ShowfotoSetupPlugins(QWidget* const parent)
66     : QScrollArea(parent),
67       d          (new Private)
68 {
69     d->tab          = new QTabWidget(viewport());
70     setWidget(d->tab);
71     setWidgetResizable(true);
72 
73     // --------------------
74 
75     d->setupGeneric = new DPluginSetup(d->tab);
76     d->setupGeneric->setPluginConfView(new Digikam::DPluginConfViewGeneric(d->setupGeneric));
77     d->tab->insertTab(Generic, d->setupGeneric, i18nc("@title:tab generic plugins list", "Generic"));
78 
79     // --------------------
80 
81     d->setupEditor  = new DPluginSetup(d->tab);
82     d->setupEditor->setPluginConfView(new Digikam::DPluginConfViewEditor(d->setupEditor));
83     d->tab->insertTab(Editor, d->setupEditor, i18nc("@title:tab editor plugins list", "Image Editor"));
84 
85     // --------------------
86 
87     d->setupDImg    = new DPluginSetup(d->tab);
88     d->setupDImg->setPluginConfView(new Digikam::DPluginConfViewDImg(d->setupEditor));
89     d->tab->insertTab(Loaders, d->setupDImg, i18nc("@title:tab loader plugins list", "Image Loaders"));
90 }
91 
~ShowfotoSetupPlugins()92 ShowfotoSetupPlugins::~ShowfotoSetupPlugins()
93 {
94     delete d;
95 }
96 
applySettings()97 void ShowfotoSetupPlugins::applySettings()
98 {
99     d->setupGeneric->applySettings();
100     d->setupEditor->applySettings();
101     d->setupDImg->applySettings();
102 }
103 
104 } // namespace ShowFoto
105