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