File indexing completed on 2025-01-19 03:59:43

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-02-06
0007  * Description : setup Image Editor page
0008  *
0009  * SPDX-FileCopyrightText: 2007-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 "setupeditor.h"
0016 
0017 // Qt includes
0018 
0019 #include <QTabWidget>
0020 
0021 // KDE includes
0022 
0023 #include <klocalizedstring.h>
0024 
0025 // Local includes
0026 
0027 #include "setupeditoriface.h"
0028 #include "setupiofiles.h"
0029 #include "setupversioning.h"
0030 #include "setupraw.h"
0031 
0032 namespace Digikam
0033 {
0034 
0035 class Q_DECL_HIDDEN SetupEditor::Private
0036 {
0037 public:
0038 
0039     explicit Private()
0040       : tab         (nullptr),
0041         iface       (nullptr),
0042         iofiles     (nullptr),
0043         versioning  (nullptr),
0044         raw         (nullptr)
0045     {
0046     }
0047 
0048     QTabWidget*       tab;
0049 
0050     SetupEditorIface* iface;
0051     SetupIOFiles*     iofiles;
0052     SetupVersioning*  versioning;
0053     SetupRaw*         raw;
0054 };
0055 
0056 SetupEditor::SetupEditor(QWidget* const parent)
0057     : QScrollArea(parent),
0058       d          (new Private)
0059 {
0060     d->tab        = new QTabWidget;
0061 
0062     // --------------------------------------------------------
0063 
0064     d->iface      = new SetupEditorIface(d->tab);
0065     d->versioning = new SetupVersioning(d->tab);
0066     d->iofiles    = new SetupIOFiles(d->tab);
0067 
0068     // --------------------------------------------------------
0069 
0070     d->tab->insertTab(EditorWindow, d->iface,      i18nc("@title:tab", "Editor Window"));
0071     d->tab->insertTab(Versioning,   d->versioning, i18nc("@title:tab", "Versioning"));
0072     d->tab->insertTab(SaveSettings, d->iofiles,    i18nc("@title:tab", "Save Settings"));
0073 
0074     d->raw        = new SetupRaw(d->tab);
0075 
0076     // --------------------------------------------------------
0077 
0078     setWidget(d->tab);
0079     setWidgetResizable(true);
0080     readSettings();
0081 }
0082 
0083 SetupEditor::~SetupEditor()
0084 {
0085     delete d;
0086 }
0087 
0088 void SetupEditor::setActiveTab(EditorTab tab)
0089 {
0090     d->tab->setCurrentIndex(tab);
0091 }
0092 
0093 SetupEditor::EditorTab SetupEditor::activeTab() const
0094 {
0095     return (EditorTab)d->tab->currentIndex();
0096 }
0097 
0098 void SetupEditor::applySettings()
0099 {
0100     d->iface->applySettings();
0101     d->versioning->applySettings();
0102     d->iofiles->applySettings();
0103     d->raw->applySettings();
0104 }
0105 
0106 void SetupEditor::readSettings()
0107 {
0108     // Nothing todo. All is already processed in widget constructors
0109 }
0110 
0111 } // namespace Digikam
0112 
0113 #include "moc_setupeditor.cpp"