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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-08-21
0007  * Description : Editor tool settings template box
0008  *
0009  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2008-2014 by Andi Clemens <andi dot clemens at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IMAGE_EDITOR_TOOL_SETTINGS_H
0017 #define DIGIKAM_IMAGE_EDITOR_TOOL_SETTINGS_H
0018 
0019 // Qt includes
0020 
0021 #include <QScrollArea>
0022 
0023 // Local includes
0024 
0025 #include "digikam_export.h"
0026 #include "digikam_debug.h"
0027 #include "histogrambox.h"
0028 #include "digikam_globals.h"
0029 
0030 class QPushButton;
0031 class QPixmap;
0032 class QString;
0033 class QIcon;
0034 
0035 namespace Digikam
0036 {
0037 
0038 class HistogramBox;
0039 class EditorTool;
0040 
0041 class DIGIKAM_EXPORT EditorToolSettings : public QScrollArea
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046 
0047     enum ButtonCode
0048     {
0049         Default = 0x00000001,
0050         Try     = 0x00000002,
0051         Ok      = 0x00000004,
0052         Cancel  = 0x00000008,
0053         SaveAs  = 0x00000010,
0054         Load    = 0x00000020
0055     };
0056     Q_DECLARE_FLAGS(Buttons, ButtonCode)
0057 
0058     enum ToolCode
0059     {
0060         NoTool     = 0x00000000,
0061         ColorGuide = 0x00000001,
0062         Histogram  = 0x00000002
0063     };
0064     Q_DECLARE_FLAGS(Tools, ToolCode)
0065 
0066 public:
0067 
0068     explicit EditorToolSettings(QWidget* const parent);
0069     ~EditorToolSettings()                     override;
0070 
0071     void setButtons(Buttons buttonMask);
0072     void setTools(Tools toolMask);
0073     void setHistogramType(HistogramBoxType type);
0074     void setTool(EditorTool* const tool);
0075 
0076     int marginHint();
0077     int spacingHint();
0078 
0079     QWidget*      plainPage()           const;
0080     HistogramBox* histogramBox()        const;
0081 
0082     QColor guideColor()                 const;
0083     void setGuideColor(const QColor& color);
0084 
0085     int guideSize()                     const;
0086     void setGuideSize(int size);
0087 
0088     QPushButton* button(int buttonCode) const;
0089     void enableButton(int buttonCode, bool state);
0090 
0091     QSize minimumSizeHint()             const override;
0092     virtual void setBusy(bool)   {};
0093     virtual void writeSettings() {};
0094     virtual void readSettings()  {};
0095     virtual void resetSettings() {};
0096 
0097 Q_SIGNALS:
0098 
0099     void signalOkClicked();
0100     void signalCancelClicked();
0101     void signalTryClicked();
0102     void signalDefaultClicked();
0103     void signalSaveAsClicked();
0104     void signalLoadClicked();
0105     void signalColorGuideChanged();
0106     void signalChannelChanged();
0107     void signalScaleChanged();
0108 
0109 private Q_SLOTS:
0110 
0111     void slotAboutPlugin();
0112     void slotHelpPlugin();
0113 
0114 private:
0115 
0116     // Disable
0117     EditorToolSettings() = delete;
0118 
0119 private:
0120 
0121     class Private;
0122     Private* const d;
0123 };
0124 
0125 } // namespace Digikam
0126 
0127 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::EditorToolSettings::Buttons)
0128 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::EditorToolSettings::Tools)
0129 
0130 #endif // DIGIKAM_IMAGE_EDITOR_TOOL_SETTINGS_H