Engauge Digitizer  2
 All Classes Functions Variables Typedefs Enumerations Friends Pages
DlgSettingsExportFormat.h
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 
10 #include "DlgSettingsAbstractBase.h"
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 slotOverrideCsvTsv(int);
65  void slotRelationsPointsEvenlySpaced();
66  void slotRelationsPointsEvenlySpacedInterval(const QString &);
67  void slotRelationsPointsEvenlySpacedIntervalUnits(const QString &);
68  void slotRelationsPointsRaw();
69  void slotSaveDefault();
70  void slotTabChanged (int);
71  void slotXLabel (const QString &);
72 
73 protected:
74  virtual void handleOk ();
75 
76 private:
77 
78  void createCurveSelection (QGridLayout *layout, int &row);
79  void createDelimiters (QHBoxLayout *layoutMisc);
80  void createFileLayout (QHBoxLayout *layoutMisc);
81  void createFunctionsPointsSelection (QHBoxLayout *layout);
82  void createHeader (QHBoxLayout *layoutMisc);
83  void createPreview (QGridLayout *layout, int &row);
84  void createRelationsPointsSelection (QHBoxLayout *layout);
85  void createTabWidget (QGridLayout *layout,
86  int &row);
87  void createXLabel (QGridLayout *layoutHeader,
88  int colLabel);
89  QString exportedTextToExportedHtml (const QString &text,
90  const QString &color) const;
91  bool goodIntervalFunctions() const;
92  bool goodIntervalRelations() const;
93  void initializeIntervalConstraints ();
94  void updateControls();
95  void updateControlsUponLoad();
96  void updateIntervalConstraints(); // Update constraints on intervals to prevent overflows downstream (especially when value is temporarily 0)
97  void updatePreview();
98 
99  QTabWidget *m_tabWidget;
100 
101  QListWidget *m_listIncluded;
102  QListWidget *m_listExcluded;
103 
104  QPushButton *m_btnInclude;
105  QPushButton *m_btnExclude;
106 
107  QRadioButton *m_btnFunctionsPointsAllCurves;
108  QRadioButton *m_btnFunctionsPointsFirstCurve;
109  QRadioButton *m_btnFunctionsPointsEvenlySpaced;
110  QLineEdit *m_editFunctionsPointsEvenlySpacing;
111  QDoubleValidator *m_validatorFunctionsPointsEvenlySpacing;
112  QComboBox *m_cmbFunctionsPointsEvenlySpacingUnits;
113  QRadioButton *m_btnFunctionsPointsGridLines;
114  QRadioButton *m_btnFunctionsPointsRaw;
115  QCheckBox *m_chkExtrapolateOutsideEndpoints;
116 
117  QRadioButton *m_btnCurvesLayoutAllCurves;
118  QRadioButton *m_btnCurvesLayoutOneCurve;
119 
120  QRadioButton *m_btnRelationsPointsEvenlySpaced;
121  QLineEdit *m_editRelationsPointsEvenlySpacing;
122  QDoubleValidator *m_validatorRelationsPointsEvenlySpacing;
123  QComboBox *m_cmbRelationsPointsEvenlySpacingUnits;
124  QRadioButton *m_btnRelationsPointsRaw;
125 
126  QRadioButton *m_btnDelimitersCommas;
127  QRadioButton *m_btnDelimitersSemicolons;
128  QRadioButton *m_btnDelimitersSpaces;
129  QRadioButton *m_btnDelimitersTabs;
130  QCheckBox *m_chkOverrideCsvTsv;
131 
132  QRadioButton *m_btnHeaderNone;
133  QRadioButton *m_btnHeaderSimple;
134  QRadioButton *m_btnHeaderGnuplot;
135 
136  QLineEdit *m_editXLabel;
137 
138  QTextEdit *m_editPreview;
139 
140  QPushButton *m_btnSaveDefault;
141 
142  DocumentModelExportFormat *m_modelExportBefore;
143  DocumentModelExportFormat *m_modelExportAfter;
144 
145  // Safe values are computed for intervals and then applied according to the current settings. This prevents
146  // accidentally generating exports with thousands of points. That causes delays and can even overflow resources
147  // with a resulting crash
148  double m_minIntervalGraph;
149  double m_minIntervalScreen;
150 
151  bool m_haveFunction;
152  bool m_haveRelation;
153 };
154 
155 #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.