Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
DlgSettingsColorFilter.h
1 #ifndef DLG_SETTINGS_COLOR_FILTER_H
2 #define DLG_SETTINGS_COLOR_FILTER_H
3 
4 #include "ColorFilterMode.h"
5 #include "DlgSettingsAbstractBase.h"
6 #include <QColor>
7 #include <QImage>
8 #include <QPixmap>
9 
10 class DlgFilterThread;
12 class QComboBox;
13 class QGraphicsScene;
14 class QGridLayout;
15 class QLabel;
16 class QRadioButton;
17 class ViewPreview;
18 class ViewProfile;
19 class ViewProfileDivider;
20 class ViewProfileScale;
21 
24 {
25  Q_OBJECT;
26 
27 public:
30  virtual ~DlgSettingsColorFilter();
31 
32  virtual void createOptionalSaveDefault (QHBoxLayout *layout);
33  virtual QWidget *createSubPanel ();
34  virtual void load (CmdMediator &cmdMediator);
35 
36 public slots:
38  void slotTransferPiece (int xLeft,
39  QImage image);
40 
41 signals:
43  void signalApplyFilter (ColorFilterMode colorFilterMode,
44  double low,
45  double high);
46 
47 private slots:
48  void slotCurveName(const QString &curveName);
49  void slotDividerHigh (double);
50  void slotDividerLow (double);
51  void slotForeground();
52  void slotHue();
53  void slotIntensity();
54  void slotSaturation();
55  void slotValue();
56 
57 protected:
58  virtual void handleOk ();
59 
60 private:
61 
62  void createControls (QGridLayout *layout, int &row);
63  void createPreview (QGridLayout *layout, int &row);
64  void createProfileAndScale (QGridLayout *layout, int &row);
65  QRgb createThread (); // Returns background color
66  void loadForCurveName();
67  static int PROFILE_HEIGHT_IN_ROWS () { return 6; }
68  static int PROFILE_SCENE_WIDTH () { return 100; }
69  static int PROFILE_SCENE_HEIGHT () { return 100; }
70  void updateHistogram();
71  void updatePreview();
72 
73  QComboBox *m_cmbCurveName;
74 
75  QRadioButton *m_btnIntensity;
76  QRadioButton *m_btnForeground;
77  QRadioButton *m_btnHue;
78  QRadioButton *m_btnSaturation;
79  QRadioButton *m_btnValue;
80 
81  QGraphicsScene *m_sceneProfile;
82  ViewProfile *m_viewProfile;
83  ViewProfileScale *m_scale;
84 
85  QGraphicsScene *m_scenePreview;
86  ViewPreview *m_viewPreview;
87  ViewProfileDivider *m_dividerLow;
88  ViewProfileDivider *m_dividerHigh;
89 
90  // Apply filter parameters to preview image in a separate thread so dragging the dividers in the profile
91  // will not be slowed down by the filter parameter processing
92  DlgFilterThread *m_filterThread;
93 
94  QImage m_imagePreview;
95 
96  DocumentModelColorFilter *m_modelColorFilterBefore;
97  DocumentModelColorFilter *m_modelColorFilterAfter;
98 };
99 
100 #endif // DLG_SETTINGS_COLOR_FILTER_H
void slotTransferPiece(int xLeft, QImage image)
Receive processed piece of preview image, to be inserted at xLeft to xLeft+pixmap.width().
virtual void handleOk()
Process slotOk.
void signalApplyFilter(ColorFilterMode colorFilterMode, double low, double high)
Send filter parameters to DlgFilterThread and DlgFilterWorker for processing.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Dialog for editing filtering settings.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:8
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Linear horizontal scale, with the spectrum reflecting the active filter parameter.
Divider that can be dragged, in a dialog QGraphicsView.
Class for processing new filter settings. This is based on http://blog.debao.me/2013/08/how-to-use-qt...
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
Command queue stack.
Definition: CmdMediator.h:16
DlgSettingsColorFilter(MainWindow &mainWindow)
Single constructor.
Abstract base class for all Settings dialogs.
Class that modifies QGraphicsView to present a two-dimensional profile, with movable dividers for sel...
Definition: ViewProfile.h:9
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:66
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.