digiKam
curveswidget.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 : 2004-12-01
7  * Description : a widget to draw histogram curves
8  *
9  * Copyright (C) 2004-2022 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 #ifndef DIGIKAM_CURVES_WIDGET_H
25 #define DIGIKAM_CURVES_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QEvent>
31 #include <QMouseEvent>
32 #include <QPaintEvent>
33 
34 // Local includes
35 
36 #include "dcolor.h"
37 #include "digikam_export.h"
38 #include "digikam_globals.h"
39 
40 class KConfigGroup;
41 
42 namespace Digikam
43 {
44 
45 class ImageCurves;
46 class DImg;
47 
48 class DIGIKAM_EXPORT CurvesWidget : public QWidget
49 {
50  Q_OBJECT
51 
52 public:
53 
54  explicit CurvesWidget(int w, int h, QWidget* const parent, bool readOnly=false);
55  ~CurvesWidget() override;
56 
57  void setup(int w, int h, bool readOnly);
58 
66  void saveCurve(KConfigGroup& group, const QString& prefix);
67 
75  void restoreCurve(KConfigGroup& group, const QString& prefix);
76 
82  void updateData(const DImg& img);
83 
87  void stopHistogramComputation();
88 
89  void setDataLoading();
90  void setLoadingFailed();
91 
95  void reset();
96 
100  void resetUI();
101  void curveTypeChanged();
102  void setCurveGuide(const DColor& color);
103 
104  ImageCurves* curves() const;
105  bool isSixteenBits() const;
106 
107 Q_SIGNALS:
108 
109  void signalMouseMoved(int x, int y);
113 
114 public Q_SLOTS:
115 
116  void setChannelType(ChannelType channel);
117  void setScaleType(HistogramScale scale);
118 
119 protected Q_SLOTS:
120 
121  void slotProgressTimerDone();
122  void slotCalculationStarted();
123  void slotCalculationFinished(bool success);
124 
125 protected:
126 
127  void paintEvent(QPaintEvent*) override;
128  void mousePressEvent(QMouseEvent*) override;
129  void mouseReleaseEvent(QMouseEvent*) override;
130  void mouseMoveEvent(QMouseEvent*) override;
131  void leaveEvent(QEvent*) override;
132 
133 private:
134 
135  class Private;
136  Private* const d;
137 };
138 
139 } // namespace Digikam
140 
141 #endif // DIGIKAM_CURVES_WIDGET_H
Definition: curveswidget.h:49
void signalHistogramComputationFailed()
void signalMouseMoved(int x, int y)
void signalHistogramComputationDone()
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