File indexing completed on 2025-01-05 03:52:04
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-04-04 0007 * Description : a tool to generate HTML image galleries 0008 * 0009 * SPDX-FileCopyrightText: 2006-2010 by Aurelien Gateau <aurelien dot gateau at free dot fr> 0010 * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_ABSTRACT_THEME_PARAMETER_H 0017 #define DIGIKAM_ABSTRACT_THEME_PARAMETER_H 0018 0019 // Qt includes 0020 0021 #include <QByteArray> 0022 #include <QString> 0023 #include <QWidget> 0024 0025 class KConfigGroup; 0026 0027 namespace DigikamGenericHtmlGalleryPlugin 0028 { 0029 0030 /** 0031 * Represents a theme parameter. For each type of parameter, one should inherit 0032 * from this class and add the necessary code in the Theme class to load the 0033 * new type. 0034 */ 0035 class AbstractThemeParameter 0036 { 0037 public: 0038 0039 explicit AbstractThemeParameter(); 0040 virtual ~AbstractThemeParameter(); 0041 0042 /** 0043 * Reads theme parameters from configGroup. Initializes the internalName, 0044 * name and defaultValue fields. 0045 */ 0046 virtual void init(const QByteArray& internalName, const KConfigGroup* configGroup); 0047 0048 QByteArray internalName() const; 0049 QString name() const; 0050 QString defaultValue() const; 0051 0052 /** 0053 * This method should return a QWidget representing the parameter, 0054 * initialized with value. 0055 */ 0056 virtual QWidget* createWidget(QWidget* parent, const QString& value) const = 0; 0057 0058 /** 0059 * The opposite of createWidget: given a widget previously created with 0060 * createWidget, this method returns the current widget value. 0061 */ 0062 virtual QString valueFromWidget(QWidget*) const = 0; 0063 0064 private: 0065 0066 // Disable 0067 AbstractThemeParameter(const AbstractThemeParameter&) = delete; 0068 AbstractThemeParameter& operator=(const AbstractThemeParameter&) = delete; 0069 0070 private: 0071 0072 class Private; 0073 Private* const d; 0074 }; 0075 0076 } // namespace DigikamGenericHtmlGalleryPlugin 0077 0078 #endif // DIGIKAM_ABSTRACT_THEME_PARAMETER_H