1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2004-11-17
7  * Description : a tab to display item colors information
8  *
9  * Copyright (C) 2004-2021 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_ITEM_PROPERTIES_COLORS_TAB_H
25 #define DIGIKAM_ITEM_PROPERTIES_COLORS_TAB_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QByteArray>
31 #include <QTabWidget>
32 #include <QUrl>
33 #include <QRect>
34 
35 // Local includes
36 
37 #include "dimg.h"
38 #include "digikam_export.h"
39 
40 class KConfigGroup;
41 
42 namespace Digikam
43 {
44 
45 class DImg;
46 class LoadingDescription;
47 
48 class DIGIKAM_EXPORT ItemPropertiesColorsTab : public QTabWidget
49 {
50     Q_OBJECT
51 
52 public:
53 
54     explicit ItemPropertiesColorsTab(QWidget* const parent);
55     ~ItemPropertiesColorsTab() override;
56 
57     void setData(const QUrl& url=QUrl(),
58                  const QRect& selectionArea = QRect(),
59                  DImg* const img=nullptr);
60 
61     void setSelection(const QRect& selectionArea);
62 
63     void readSettings(const KConfigGroup& group);
64     void writeSettings(KConfigGroup& group);
65 
66 private:
67 
68     void loadImageFromUrl(const QUrl& url);
69     void updateInformation();
70     void updateStatistics();
71     void getICCData();
72 
73 private Q_SLOTS:
74 
75     void slotRefreshOptions();
76     void slotHistogramComputationFailed();
77     void slotChannelChanged();
78     void slotScaleChanged();
79     void slotRenderingChanged(int rendering);
80     void slotMinValueChanged(int);
81     void slotMaxValueChanged(int);
82 
83     void slotUpdateInterval(int min, int max);
84     void slotUpdateIntervalFromRGB(int min, int max);
85     void slotUpdateIntervRange(int range);
86 
87     void slotLoadImageFromUrlComplete(const LoadingDescription& loadingDescription, const DImg& img);
88     void slotMoreCompleteLoadingAvailable(const LoadingDescription& oldLoadingDescription,
89                                           const LoadingDescription& newLoadingDescription);
90 
91 private:
92 
93     class Private;
94     Private* const d;
95 };
96 
97 } // namespace Digikam
98 
99 #endif // DIGIKAM_ITEM_PROPERTIES_COLORS_TAB_H
100