digiKam
curvesbox.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-06-14
7  * Description : a curves widget with additional control elements
8  *
9  * Copyright (C) 2009-2010 by Andi Clemens <andi dot clemens at gmail dot com>
10  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_CURVES_BOX_H
26 #define DIGIKAM_CURVES_BOX_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "digikam_globals.h"
36 
37 class KConfigGroup;
38 
39 namespace Digikam
40 {
41 
42 class ImageCurves;
43 class DColor;
44 class DImg;
45 
46 class DIGIKAM_EXPORT CurvesBox : public QWidget
47 {
48  Q_OBJECT
49 
50 public:
51 
53  {
54  NoPicker = -1,
55  BlackTonal = 0,
57  WhiteTonal
58  };
59 
61  {
62  SmoothDrawing = 0,
63  FreeDrawing
64  };
65 
66 public:
67 
68  CurvesBox(int w, int h, // Widget size.
69  QWidget* const parent = nullptr, // Parent widget instance.
70  bool readOnly=false); // If true : widget with full edition mode capabilities.
71  // If false : display curve data only without edition.
72 
73  CurvesBox(int w, int h, // Widget size.
74  const DImg& img, // Image data.
75  QWidget* const parent = nullptr, // Parent widget instance.
76  bool readOnly=false); // If true : widget with full edition mode capabilities.
77  // If false : display curve data only without edition.
78  ~CurvesBox() override;
79 
80  void enablePickers(bool enable);
81  void enableHGradient(bool enable);
82  void enableVGradient(bool enable);
83  void enableGradients(bool enable);
84  void enableResetButton(bool enable);
85  void enableCurveTypes(bool enable);
86  void enableControlWidgets(bool enable);
87 
88  void setCurveGuide(const DColor& color);
89 
90  void resetPickers();
91  void resetChannel(int channel);
92  void resetChannels();
93  void reset();
94 
95  void readCurveSettings(KConfigGroup& group, const QString& prefix);
96  void writeCurveSettings(KConfigGroup& group, const QString& prefix);
97 
98  int picker() const;
99  ChannelType channel() const;
100  int curvesLeftOffset() const;
101  ImageCurves* curves() const;
102 
103 Q_SIGNALS:
104 
109 
110 public Q_SLOTS:
111 
112  void setChannel(ChannelType channel);
113  void setScale(HistogramScale scale);
114 
115 private Q_SLOTS:
116 
117  void slotCurveTypeChanged(int type);
118  void slotResetChannel();
119  void slotResetChannels();
120 
121 private:
122 
123  void setup();
124 
125 private:
126 
127  class Private;
128  Private* const d;
129 };
130 
131 } // namespace Digikam
132 
133 #endif // DIGIKAM_CURVES_BOX_H
Definition: curvesbox.h:47
void signalPickerChanged(int)
void signalCurvesChanged()
ColorPicker
Definition: curvesbox.h:53
@ GrayTonal
Definition: curvesbox.h:56
void signalChannelReset(int)
void signalCurveTypeChanged(int)
CurvesDrawingType
Definition: curvesbox.h:61
Definition: dcolor.h:43
Definition: dimg.h:62
Definition: imagecurves.h:45
QStringView prefix
Definition: itemviewutilities.cpp:593
Definition: datefolderview.cpp:43
ChannelType
Definition: digikam_globals.h:159
HistogramScale
Definition: digikam_globals.h:145