Engauge Digitizer  2
DlgSettingsExportFormat.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_EXPORT_FORMAT_H
8 #define DLG_SETTINGS_EXPORT_FORMAT_H
9 
11 
13 class QCheckBox;
14 class QComboBox;
15 class QDoubleValidator;
16 class QGridLayout;
17 class QHBoxLayout;
18 class QLineEdit;
19 class QLabel;
20 class QListWidget;
21 class QPushButton;
22 class QRadioButton;
23 class QTabWidget;
24 class QTextEdit;
25 class QVBoxLayout;
26 
29 {
30  Q_OBJECT;
31 
32 public:
35  virtual ~DlgSettingsExportFormat();
36 
37  virtual void createOptionalSaveDefault (QHBoxLayout *layout);
38  virtual QWidget *createSubPanel ();
39  virtual void load (CmdMediator &cmdMediator);
40  virtual void setSmallDialogs (bool smallDialogs);
41 
42 private slots:
43  void slotDelimitersCommas();
44  void slotDelimitersSemicolons();
45  void slotDelimitersSpaces();
46  void slotDelimitersTabs();
47  void slotExclude();
48  void slotFunctionsExtrapolateOutsideEndpoints(int);
49  void slotFunctionsLayoutAllCurves();
50  void slotFunctionsLayoutOneCurve();
51  void slotFunctionsPointsAllCurves();
52  void slotFunctionsPointsEvenlySpaced();
53  void slotFunctionsPointsEvenlySpacedInterval(const QString &);
54  void slotFunctionsPointsEvenlySpacedIntervalUnits(const QString &);
55  void slotFunctionsPointsFirstCurve();
56  void slotFunctionsPointsGridLines();
57  void slotFunctionsPointsRaw();
58  void slotHeaderGnuplot();
59  void slotHeaderNone();
60  void slotHeaderSimple();
61  void slotInclude();
62  void slotListExcluded();
63  void slotListIncluded();
64  void slotLoadDefault();
65  void slotOverrideCsvTsv(int);
66  void slotRelationsPointsEvenlySpaced();
67  void slotRelationsPointsEvenlySpacedInterval(const QString &);
68  void slotRelationsPointsEvenlySpacedIntervalUnits(const QString &);
69  void slotRelationsPointsRaw();
70  void slotSaveDefault();
71  void slotTabChanged (int);
72  void slotXLabel (const QString &);
73 
74 protected:
75  virtual void handleOk ();
76 
77 private:
78 
79  void createCurveSelection (QGridLayout *layout, int &row);
80  void createDelimiters (QHBoxLayout *layoutMisc);
81  void createFileLayout (QHBoxLayout *layoutMisc);
82  void createFunctionsPointsSelection (QHBoxLayout *layout);
83  void createHeader (QHBoxLayout *layoutMisc);
84  void createPreview (QGridLayout *layout, int &row);
85  void createRelationsPointsSelection (QHBoxLayout *layout);
86  void createTabWidget (QGridLayout *layout,
87  int &row);
88  void createXLabel (QGridLayout *layoutHeader,
89  int colLabel);
90  QString exportedTextToExportedHtml (const QString &text,
91  const QString &color) const;
92  bool goodIntervalFunctions() const;
93  bool goodIntervalRelations() const;
94  void initializeIntervalConstraints ();
95  void updateControls();
96  void updateControlsUponLoad();
97  void updateIntervalConstraints(); // Update constraints on intervals to prevent overflows downstream (especially when value is temporarily 0)
98  void updatePreview();
99 
100  QTabWidget *m_tabWidget;
101 
102  QListWidget *m_listIncluded;
103  QListWidget *m_listExcluded;
104 
105  QPushButton *m_btnInclude;
106  QPushButton *m_btnExclude;
107 
108  QRadioButton *m_btnFunctionsPointsAllCurves;
109  QRadioButton *m_btnFunctionsPointsFirstCurve;
110  QRadioButton *m_btnFunctionsPointsEvenlySpaced;
111  QLineEdit *m_editFunctionsPointsEvenlySpacing;
112  QDoubleValidator *m_validatorFunctionsPointsEvenlySpacing;
113  QComboBox *m_cmbFunctionsPointsEvenlySpacingUnits;
114  QRadioButton *m_btnFunctionsPointsGridLines;
115  QRadioButton *m_btnFunctionsPointsRaw;
116  QCheckBox *m_chkExtrapolateOutsideEndpoints;
117 
118  QRadioButton *m_btnCurvesLayoutAllCurves;
119  QRadioButton *m_btnCurvesLayoutOneCurve;
120 
121  QRadioButton *m_btnRelationsPointsEvenlySpaced;
122  QLineEdit *m_editRelationsPointsEvenlySpacing;
123  QDoubleValidator *m_validatorRelationsPointsEvenlySpacing;
124  QComboBox *m_cmbRelationsPointsEvenlySpacingUnits;
125  QRadioButton *m_btnRelationsPointsRaw;
126 
127  QRadioButton *m_btnDelimitersCommas;
128  QRadioButton *m_btnDelimitersSemicolons;
129  QRadioButton *m_btnDelimitersSpaces;
130  QRadioButton *m_btnDelimitersTabs;
131  QCheckBox *m_chkOverrideCsvTsv;
132 
133  QRadioButton *m_btnHeaderNone;
134  QRadioButton *m_btnHeaderSimple;
135  QRadioButton *m_btnHeaderGnuplot;
136 
137  QLineEdit *m_editXLabel;
138 
139  QTextEdit *m_editPreview;
140 
141  QPushButton *m_btnSaveDefault;
142  QPushButton *m_btnLoadDefault;
143 
144  DocumentModelExportFormat *m_modelExportBefore;
145  DocumentModelExportFormat *m_modelExportAfter;
146 
147  // Safe values are computed for intervals and then applied according to the current settings. This prevents
148  // accidentally generating exports with thousands of points. That causes delays and can even overflow resources
149  // with a resulting crash
150  double m_minIntervalGraph;
151  double m_minIntervalScreen;
152 
153  bool m_haveFunction;
154  bool m_haveRelation;
155 };
156 
157 #endif // DLG_SETTINGS_EXPORT_FORMAT_H
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void handleOk()
Process slotOk.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
Dialog for editing exporting settings.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Command queue stack.
Definition: CmdMediator.h:23
Abstract base class for all Settings dialogs.
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:91
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
DlgSettingsExportFormat(MainWindow &mainWindow)
Single constructor.