Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator 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 
41 private slots:
42  void slotDelimitersCommas();
43  void slotDelimitersSpaces();
44  void slotDelimitersTabs();
45  void slotExclude();
46  void slotFunctionsLayoutAllCurves();
47  void slotFunctionsLayoutOneCurve();
48  void slotFunctionsPointsAllCurves();
49  void slotFunctionsPointsEvenlySpaced();
50  void slotFunctionsPointsEvenlySpacedInterval(const QString &);
51  void slotFunctionsPointsEvenlySpacedIntervalUnits(const QString &);
52  void slotFunctionsPointsFirstCurve();
53  void slotFunctionsPointsRaw();
54  void slotHeaderGnuplot();
55  void slotHeaderNone();
56  void slotHeaderSimple();
57  void slotInclude();
58  void slotListExcluded();
59  void slotListIncluded();
60  void slotOverrideCsvTsv(int);
61  void slotRelationsPointsEvenlySpaced();
62  void slotRelationsPointsEvenlySpacedInterval(const QString &);
63  void slotRelationsPointsEvenlySpacedIntervalUnits(const QString &);
64  void slotRelationsPointsRaw();
65  void slotSaveDefault();
66  void slotTabChanged (int);
67  void slotXLabel (const QString &);
68 
69 protected:
70  virtual void handleOk ();
71 
72 private:
73 
74  void createCurveSelection (QGridLayout *layout, int &row);
75  void createDelimiters (QHBoxLayout *layoutMisc);
76  void createFileLayout (QHBoxLayout *layoutMisc);
77  void createFunctionsPointsSelection (QHBoxLayout *layout);
78  void createHeader (QHBoxLayout *layoutMisc);
79  void createPreview (QGridLayout *layout, int &row);
80  void createRelationsPointsSelection (QHBoxLayout *layout);
81  void createTabWidget (QGridLayout *layout,
82  int &row);
83  void createXLabel (QGridLayout *layoutHeader,
84  int colLabel);
85  bool goodIntervalFunctions() const;
86  bool goodIntervalRelations() const;
87  void initializeIntervalConstraints ();
88  void updateControls();
89  void updateIntervalConstraints(); // Update constraints on intervals to prevent overflows downstream (especially when value is temporarily 0)
90  void updatePreview();
91 
92  QTabWidget *m_tabWidget;
93 
94  QListWidget *m_listIncluded;
95  QListWidget *m_listExcluded;
96 
97  QPushButton *m_btnInclude;
98  QPushButton *m_btnExclude;
99 
100  QRadioButton *m_btnFunctionsPointsAllCurves;
101  QRadioButton *m_btnFunctionsPointsFirstCurve;
102  QRadioButton *m_btnFunctionsPointsEvenlySpaced;
103  QLineEdit *m_editFunctionsPointsEvenlySpacing;
104  QDoubleValidator *m_validatorFunctionsPointsEvenlySpacing;
105  QComboBox *m_cmbFunctionsPointsEvenlySpacingUnits;
106  QRadioButton *m_btnFunctionsPointsRaw;
107 
108  QRadioButton *m_btnFunctionsLayoutAllCurves;
109  QRadioButton *m_btnFunctionsLayoutOneCurve;
110 
111  QRadioButton *m_btnRelationsPointsEvenlySpaced;
112  QLineEdit *m_editRelationsPointsEvenlySpacing;
113  QDoubleValidator *m_validatorRelationsPointsEvenlySpacing;
114  QComboBox *m_cmbRelationsPointsEvenlySpacingUnits;
115  QRadioButton *m_btnRelationsPointsRaw;
116 
117  QRadioButton *m_btnDelimitersCommas;
118  QRadioButton *m_btnDelimitersSpaces;
119  QRadioButton *m_btnDelimitersTabs;
120  QCheckBox *m_chkOverrideCsvTsv;
121 
122  QRadioButton *m_btnHeaderNone;
123  QRadioButton *m_btnHeaderSimple;
124  QRadioButton *m_btnHeaderGnuplot;
125 
126  QLineEdit *m_editXLabel;
127 
128  QTextEdit *m_editPreview;
129 
130  QPushButton *m_btnSaveDefault;
131 
132  DocumentModelExportFormat *m_modelExportBefore;
133  DocumentModelExportFormat *m_modelExportAfter;
134 
135  // Safe values are computed for intervals and then applied according to the current settings. This prevents
136  // accidentally generating exports with thousands of points. That causes delays and can even overflow resources
137  // with a resulting crash
138  double m_minIntervalGraph;
139  double m_minIntervalScreen;
140 };
141 
142 #endif // DLG_SETTINGS_EXPORT_FORMAT_H
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:77
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
DlgSettingsExportFormat(MainWindow &mainWindow)
Single constructor.