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