1 #pragma once
2 
3 #ifndef CLEANUPSETTINGSPOPUP__H
4 #define CLEANUPSETTINGSPOPUP__H
5 
6 // ToonzQt includes
7 #include "toonzqt/dvdialog.h"
8 #include "toonzqt/cleanupcamerasettingswidget.h"
9 
10 // ToonzLib includes
11 #include "toonz/cleanupparameters.h"
12 
13 // TnzCore includes
14 #include "tfilepath.h"
15 
16 // Qt includes
17 #include <QFrame>
18 
19 //================================================
20 
21 //  Forward declarations
22 
23 class QComboBox;
24 
25 class CleanupTab;
26 class ProcessingTab;
27 class CameraTab;
28 class CleanupSwatch;
29 class CleanupCameraSettingsWidget;
30 class CleanupPaletteViewer;
31 
32 namespace DVGui {
33 
34 class CheckBox;
35 class DoubleLineEdit;
36 class FileField;
37 class MeasuredDoubleLineEdit;
38 class DoubleField;
39 class IntField;
40 }
41 
42 //================================================
43 
44 //*****************************************************************************
45 //    CleanupSettingsPopup declaration
46 //*****************************************************************************
47 
48 class CleanupSettings final : public QWidget {
49   Q_OBJECT
50 
51   CleanupTab *m_cleanupTab;
52   ProcessingTab *m_processingTab;
53   CameraTab *m_cameraTab;
54 
55   CleanupSwatch *m_swatch;
56   QAction *m_swatchAct, *m_opacityAct;
57 
58   CleanupParameters m_backupParams;
59 
60   bool m_attached;  //!< Whether the settomgs are attached to the
61                     //!< cleanup model
62 public:
63   CleanupSettings(QWidget *parent = 0);
64 
65 signals:
66 
67   /*! \details   The window title may change to reflect updates of the
68      underlying
69            cleanup settings model.                                            */
70   void windowTitleChanged(
71       const QString &title);  //!< Signals a change of the window title.
72 
73 public slots:
74 
75   void updateGui(bool postProcessPreviews);
76 
77   void enableSwatch(bool);
78   void enableOpacityCheck(bool);
79 
80 protected:
81   void showEvent(QShowEvent *) override;
82   void hideEvent(QHideEvent *) override;
83 
84 private slots:
85 
86   void onImageSwitched();
87   void onPreviewDataChanged();
88   void postProcess();
89   void onClnLoaded();
90   void onRestoreSceneSettings();
91 };
92 
93 //**********************************************************************
94 //    Cleanup Tab declaration
95 //**********************************************************************
96 
97 class CleanupTab final : public QFrame {
98   Q_OBJECT
99 
100   DVGui::CheckBox *m_autoCenter, *m_flipX, *m_flipY;
101   QComboBox *m_pegHolesOm, *m_fieldGuideOm, *m_rotateOm;
102 
103   DVGui::FileField *m_pathField;
104   TFilePath m_path;  //!< Actual params' path, may be different
105                      //!< from the field
106 
107 public:
108   CleanupTab();
109 
110   void updateGui(CleanupParameters *params, CleanupParameters *oldParams);
111 
112 private slots:
113 
114   void onGenericSettingsChange();
115   void onPathChange();
116 
117 private:
118   QString pathString(const TFilePath &path, bool lpNone);
119 };
120 
121 //**********************************************************************
122 //    ProcessingTab declaration
123 //**********************************************************************
124 
125 class ProcessingTab final : public QFrame {
126   Q_OBJECT
127 
128   CleanupPaletteViewer *m_paletteViewer;
129 
130   QComboBox *m_lineProcessing;
131   QLabel *m_antialiasLabel;
132   QComboBox *m_antialias;
133   QLabel *m_sharpLabel;
134   DVGui::DoubleField *m_sharpness;
135   QLabel *m_despeckLabel;
136   DVGui::IntField *m_despeckling;
137   QLabel *m_aaValueLabel;
138   DVGui::IntField *m_aaValue;
139   QLabel *m_autoadjustLabel;
140   QComboBox *m_autoadjustOm;
141   DVGui::Separator *m_paletteSep;
142   QWidget *m_settingsFrame;
143 
144 public:
145   ProcessingTab();
146 
147   void updateGui(CleanupParameters *params, CleanupParameters *oldParams);
148 
149 private:
150   void updateVisibility();
151 
152 private slots:
153 
154   void onGenericSettingsChange();
155   void onSharpnessChange(bool dragging);
156 };
157 
158 //**********************************************************************
159 //    CameraTab declaration
160 //**********************************************************************
161 
162 class CameraTab final : public CleanupCameraSettingsWidget {
163   Q_OBJECT
164 
165 public:
166   CameraTab();
167 
168   void updateGui(CleanupParameters *params, CleanupParameters *oldParams);
169   void updateImageInfo();
170 
171 private slots:
172 
173   void onLevelSwitched();
174   void onGenericSettingsChange();
175 };
176 
177 #endif  // CLEANUPSETTINGSPOPUP__H
178