Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsColorFilter.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef DLG_SETTINGS_COLOR_FILTER_H
8#define DLG_SETTINGS_COLOR_FILTER_H
9
10#include "ColorFilterMode.h"
12#include <QColor>
13#include <QImage>
14#include <QPixmap>
15
16class DlgFilterThread;
18class QComboBox;
19class QGraphicsScene;
20class QGridLayout;
21class QLabel;
22class QRadioButton;
23class ViewPreview;
24class ViewProfile;
27
30{
31 Q_OBJECT;
32
33public:
37
38 virtual void createOptionalSaveDefault (QHBoxLayout *layout);
39 virtual QWidget *createSubPanel ();
40 virtual void load (CmdMediator &cmdMediator);
41 virtual void setSmallDialogs (bool smallDialogs);
42
43public slots:
45 void slotTransferPiece (int xLeft,
46 QImage image);
47
48signals:
50 void signalApplyFilter (ColorFilterMode colorFilterMode,
51 double low,
52 double high);
53
54private slots:
55 void slotCurveName(const QString &curveName);
56 void slotDividerHigh (double);
57 void slotDividerLow (double);
58 void slotForeground();
59 void slotHue();
60 void slotIntensity();
61 void slotSaturation();
62 void slotValue();
63
64protected:
65 virtual void handleOk ();
66
67private:
68
69 void createControls (QGridLayout *layout, int &row);
70 void createPreview (QGridLayout *layout, int &row);
71 void createProfileAndScale (QGridLayout *layout, int &row);
72 QRgb createThread (); // Returns background color
73 void loadForCurveName();
74 static int PROFILE_HEIGHT_IN_ROWS () { return 6; }
75 static int PROFILE_SCENE_WIDTH () { return 100; }
76 static int PROFILE_SCENE_HEIGHT () { return 100; }
77 void updateHistogram();
78 void updatePreview();
79
80 QComboBox *m_cmbCurveName;
81
82 QRadioButton *m_btnIntensity;
83 QRadioButton *m_btnForeground;
84 QRadioButton *m_btnHue;
85 QRadioButton *m_btnSaturation;
86 QRadioButton *m_btnValue;
87
88 QGraphicsScene *m_sceneProfile;
89 ViewProfile *m_viewProfile;
90 ViewProfileScale *m_scale;
91
92 QGraphicsScene *m_scenePreview;
93 ViewPreview *m_viewPreview;
94 ViewProfileDivider *m_dividerLow;
95 ViewProfileDivider *m_dividerHigh;
96
97 // Apply filter parameters to preview image in a separate thread so dragging the dividers in the profile
98 // will not be slowed down by the filter parameter processing
99 DlgFilterThread *m_filterThread;
100
101 QImage m_imagePreview;
102
103 DocumentModelColorFilter *m_modelColorFilterBefore;
104 DocumentModelColorFilter *m_modelColorFilterAfter;
105};
106
107#endif // DLG_SETTINGS_COLOR_FILTER_H
ColorFilterMode
Command queue stack.
Definition CmdMediator.h:24
Class for processing new filter settings. This is based on http://blog.debao.me/2013/08/how-to-use-qt...
Abstract base class for all Settings dialogs.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
MainWindow & mainWindow()
Get method for MainWindow.
Dialog for editing filtering settings.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
DlgSettingsColorFilter(MainWindow &mainWindow)
Single constructor.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void slotTransferPiece(int xLeft, QImage image)
Receive processed piece of preview image, to be inserted at xLeft to xLeft+pixmap....
virtual void handleOk()
Process slotOk.
void signalApplyFilter(ColorFilterMode colorFilterMode, double low, double high)
Send filter parameters to DlgFilterThread and DlgFilterWorker for processing.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:92
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...
Definition ViewPreview.h:15
Divider that can be dragged, in a dialog QGraphicsView.
Linear horizontal scale, with the spectrum reflecting the active filter parameter.
Class that modifies QGraphicsView to present a two-dimensional profile, with movable dividers for sel...
Definition ViewProfile.h:16