1 /* ============================================================
2  *
3  * Date        : 2008-02-10
4  * Description : a tool to fix automatically camera lens aberrations
5  *
6  * Copyright (C) 2008      by Adrian Schroeter <adrian at suse dot de>
7  * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
8  *
9  * This program is free software; you can redistribute it
10  * and/or modify it under the terms of the GNU General
11  * Public License as published by the Free Software Foundation;
12  * either version 2, or (at your option)
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * ============================================================ */
21 
22 #ifndef DIGIKAM_LENS_FUN_CAMERA_SELECTOR_H
23 #define DIGIKAM_LENS_FUN_CAMERA_SELECTOR_H
24 
25 // Qt includes
26 
27 #include <QWidget>
28 
29 // Local includes
30 
31 #include "dmetadata.h"
32 #include "digikam_export.h"
33 #include "lensfunfilter.h"
34 #include "lensfuniface.h"
35 
36 class KConfigGroup;
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT LensFunCameraSelector : public QWidget
42 {
43     Q_OBJECT
44 
45 public:
46 
47     typedef QMap<QString, QString> Device;
48 
49 public:
50 
51     explicit LensFunCameraSelector(QWidget* const parent = nullptr);
52     ~LensFunCameraSelector() override;
53 
54     void setEnabledUseMetadata(bool b);
55 
56     void setUseMetadata(bool b);
57     bool useMetadata()      const;
58 
59     LensFunContainer settings();
60     void             setSettings(const LensFunContainer& settings);
61 
62     void readSettings(KConfigGroup& group);
63     void writeSettings(KConfigGroup& group);
64 
65     void resetToDefault();
66 
67     /**
68      * Special mode used with BQM which processes multiple items at the same time.
69      */
70     void setPassiveMetadataUsage(bool b);
71 
72     LensFunIface* iface()   const;
73 
74     void setMetadata(const MetaEngineData&);
75 
76 Q_SIGNALS:
77 
78     void signalLensSettingsChanged();
79 
80 private Q_SLOTS:
81 
82     void slotUseMetadata(bool);
83     void slotMakeSelected();
84     void slotModelChanged();
85     void slotModelSelected();
86     void slotLensSelected();
87     void slotFocalChanged();
88     void slotApertureChanged();
89     void slotDistanceChanged();
90 
91 private:
92 
93     LensFunIface::MetadataMatch findFromMetadata();
94     void refreshSettingsView();
95     void populateDeviceCombos();
96     void populateLensCombo();
97 
98 private:
99 
100     class Private;
101     Private* const d;
102 };
103 
104 } // namespace Digikam
105 
106 #endif // DIGIKAM_LENS_FUN_CAMERA_SELECTOR_H
107