1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2006-05-15
7  * Description : a dialog to see preview ICC color correction
8  *               before to apply color profile.
9  *
10  * Copyright (C) 2006-2021 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_COLOR_CORRECTION_DLG_H
26 #define DIGIKAM_COLOR_CORRECTION_DLG_H
27 
28 // Qt includes
29 
30 #include <QString>
31 #include <QDialog>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 #include "iccprofile.h"
37 #include "iccsettingscontainer.h"
38 
39 namespace Digikam
40 {
41 
42 class DImg;
43 class IccProfile;
44 class IccTransform;
45 
46 class DIGIKAM_EXPORT ColorCorrectionDlg : public QDialog
47 {
48     Q_OBJECT
49 
50 public:
51 
52     enum Mode
53     {
54         ProfileMismatch,
55         MissingProfile,
56         UncalibratedColor
57     };
58 
59 public:
60 
61     explicit ColorCorrectionDlg(Mode mode,
62                                 const DImg& preview,
63                                 const QString& file,
64                                 QWidget* const parent = nullptr);
65     ~ColorCorrectionDlg() override;
66 
67     ICCSettingsContainer::Behavior behavior()        const;
68     IccProfile specifiedProfile()                    const;
69 
70 private Q_SLOTS:
71 
72     void slotWorkspaceProfInfo();
73     void slotImageProfInfo();
74 
75     void imageProfileToggled(bool);
76     void imageProfileChanged();
77     void missingProfileToggled(bool);
78     void missingProfileChanged();
79     void usedProfileToggled(bool);
80     void usedProfileChanged();
81     void inputProfileChanged();
82     void slotHelp();
83     void slotOk();
84 
85 private:
86 
87     ICCSettingsContainer::Behavior currentBehavior() const;
88 
89     QLayout* createHeading()                         const;
90     QLayout* createProfilesInfo()                    const;
91     QLayout* createPreviews()                        const;
92     QWidget* createAssumeOptions()                   const;
93     QWidget* createOptions()                         const;
94 
95     void updateInfo();
96     void updateUsedProfileUI();
97     void updateImageProfileUI();
98 
99     void readSettings();
100     void setSettings();
101 
102 private:
103 
104     class Private;
105     Private* const d;
106 };
107 
108 } // namespace Digikam
109 
110 #endif // DIGIKAM_COLOR_CORRECTION_DLG_H
111