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