Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsExportFormat.cpp
Go to the documentation of this file.
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#include "ButtonWhatsThis.h"
9#include "CmdMediator.h"
13#include "ExportFileExtension.h"
15#include "ExportFileFunctions.h"
16#include "ExportFileRelations.h"
17#include "ExportToFile.h"
18#include "Logger.h"
19#include "MainWindow.h"
20#include "MainWindowModel.h"
21#include <QCheckBox>
22#include <QComboBox>
23#include <QDoubleValidator>
24#include <QGridLayout>
25#include <QGroupBox>
26#include <QHBoxLayout>
27#include <QLabel>
28#include <QLineEdit>
29#include <QListWidget>
30#include <QPushButton>
31#include <QRadioButton>
32#include <QScrollBar>
33#include <QSettings>
34#include <QTabWidget>
35#include <QTextEdit>
36#include <QTextStream>
37#include <QVBoxLayout>
38#include <QWhatsThis>
39#include "Settings.h"
40#include "Transformation.h"
41
42// Colors that should match the help text for m_editPreview
43const QString COLOR_FUNCTIONS = ("#DDDDFF");
44const QString COLOR_RELATIONS = ("#DDFFDD");
45
48const int MIN_EDIT_WIDTH = 110;
49const int MAX_EDIT_WIDTH = 180;
50
53
54const QString EMPTY_PREVIEW;
55
57const int MINIMUM_HEIGHT = 780;
58
60 DlgSettingsAbstractBase (tr ("Export Format"),
61 "DlgSettingsExportFormat",
63 m_validatorFunctionsPointsEvenlySpacing (nullptr),
64 m_validatorRelationsPointsEvenlySpacing (nullptr),
65 m_modelExportBefore (nullptr),
66 m_modelExportAfter (nullptr),
67 m_haveFunction (false),
68 m_haveRelation (false)
69{
70 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::DlgSettingsExportFormat";
71
72 QWidget *subPanel = createSubPanel ();
73 finishPanel (subPanel,
75}
76
78{
79 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::~DlgSettingsExportFormat";
80
81 delete m_validatorFunctionsPointsEvenlySpacing;
82 delete m_validatorRelationsPointsEvenlySpacing;
83}
84
85void DlgSettingsExportFormat::createCurveSelection (QGridLayout *layout, int &row)
86{
87 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createCurveSelection";
88
89 QLabel *labelIncluded = new QLabel (tr ("Included"));
90 layout->addWidget (labelIncluded, row, 0);
91
92 QLabel *labelExcluded = new QLabel (tr ("Not included"));
93 layout->addWidget (labelExcluded, row++, 2);
94
95 m_listIncluded = new QListWidget;
96 m_listIncluded->setSortingEnabled (false); // Preserve order from Document
97 m_listIncluded->setWhatsThis (tr ("List of curves to be included in the exported file.\n\n"
98 "The order of the curves here does not affect the order in the exported file. That "
99 "order is determined by the Curves settings."));
100 m_listIncluded->setSelectionMode (QAbstractItemView::MultiSelection);
101 layout->addWidget (m_listIncluded, row, 0, 4, 1);
102 connect (m_listIncluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListIncluded()));
103
104 m_listExcluded = new QListWidget;
105 m_listExcluded->setSortingEnabled (false); // Preserve order from Document
106 m_listExcluded->setWhatsThis (tr ("List of curves to be excluded from the exported file"));
107 m_listExcluded->setSelectionMode (QAbstractItemView::MultiSelection);
108 layout->addWidget (m_listExcluded, row++, 2, 4, 1);
109 connect (m_listExcluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListExcluded()));
110
111 m_btnInclude = new QPushButton (QString ("<<%1").arg (tr ("Include")));
112 m_btnInclude->setEnabled (false);
113 m_btnInclude->setWhatsThis (tr ("Move the currently selected curve(s) from the excluded list"));
114 layout->addWidget (m_btnInclude, row++, 1);
115 connect (m_btnInclude, SIGNAL (released ()), this, SLOT (slotInclude()));
116
117 m_btnExclude = new QPushButton (QString ("%1>>").arg (tr ("Exclude")));
118 m_btnExclude->setEnabled (false);
119 m_btnExclude->setWhatsThis (tr ("Move the currently selected curve(s) from the included list"));
120 layout->addWidget (m_btnExclude, row++, 1);
121 connect (m_btnExclude, SIGNAL (released ()), this, SLOT (slotExclude()));
122
123 row++;
124}
125
126void DlgSettingsExportFormat::createDelimiters (QHBoxLayout *layoutMisc)
127{
128 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createDelimiters";
129
130 QGroupBox *groupDelimiters = new QGroupBox (tr ("Delimiters"));
131 layoutMisc->addWidget (groupDelimiters, 1);
132
133 QVBoxLayout *layoutDelimiters = new QVBoxLayout;
134 groupDelimiters->setLayout (layoutDelimiters);
135
136 m_btnDelimitersCommas = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_COMMA));
137 m_btnDelimitersCommas->setWhatsThis (tr ("Exported file will have commas between adjacent values, unless overridden by tabs in TSV files."));
138 layoutDelimiters->addWidget (m_btnDelimitersCommas);
139 connect (m_btnDelimitersCommas, SIGNAL (released ()), this, SLOT (slotDelimitersCommas()));
140
141 m_btnDelimitersSpaces = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_SPACE));
142 m_btnDelimitersSpaces->setWhatsThis (tr ("Exported file will have spaces between adjacent values, unless overridden by commas in CSV files, "
143 "or tabs in TSV files."));
144 layoutDelimiters->addWidget (m_btnDelimitersSpaces);
145 connect (m_btnDelimitersSpaces, SIGNAL (released ()), this, SLOT (slotDelimitersSpaces()));
146
147 m_btnDelimitersTabs = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_TAB));
148 m_btnDelimitersTabs->setWhatsThis (tr ("Exported file will have tabs between adjacent values, unless overridden by commas in CSV files."));
149 layoutDelimiters->addWidget (m_btnDelimitersTabs);
150 connect (m_btnDelimitersTabs, SIGNAL (released ()), this, SLOT (slotDelimitersTabs()));
151
152 m_btnDelimitersSemicolons = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_SEMICOLON));
153 m_btnDelimitersSemicolons->setWhatsThis (tr ("Exported file will have semicolons between adjacent values, unless overridden by commas in CSV files."));
154 layoutDelimiters->addWidget (m_btnDelimitersSemicolons);
155 connect (m_btnDelimitersSemicolons, SIGNAL (released ()), this, SLOT (slotDelimitersSemicolons()));
156
157 m_chkOverrideCsvTsv = new QCheckBox (tr ("Override in CSV/TSV files"));
158 m_chkOverrideCsvTsv->setWhatsThis (tr ("Comma-separated value (CSV) files and tab-separated value (TSV) files will use commas and tabs "
159 "respectively, unless this setting is selected. Selecting this setting will apply the delimiter setting "
160 "to every file."));
161 connect (m_chkOverrideCsvTsv, SIGNAL (stateChanged (int)), this, SLOT (slotOverrideCsvTsv(int)));
162 layoutDelimiters->addWidget (m_chkOverrideCsvTsv);
163}
164
165void DlgSettingsExportFormat::createFileLayout (QHBoxLayout *layoutMisc)
166{
167 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createFileLayout";
168
169 QGroupBox *groupLayout = new QGroupBox (tr ("Layout"));
170 layoutMisc->addWidget (groupLayout, 1);
171
172 QVBoxLayout *layoutLayout = new QVBoxLayout;
173 groupLayout->setLayout (layoutLayout);
174
175 m_btnCurvesLayoutAllCurves = new QRadioButton (tr ("All curves on each line"));
176 m_btnCurvesLayoutAllCurves->setWhatsThis (tr ("Exported file will have, on each line, "
177 "an X value, the Y value for the first curve, the Y value for the second curve,..."));
178 layoutLayout->addWidget (m_btnCurvesLayoutAllCurves);
179 connect (m_btnCurvesLayoutAllCurves, SIGNAL (released()), this, SLOT (slotFunctionsLayoutAllCurves ()));
180
181 m_btnCurvesLayoutOneCurve = new QRadioButton (tr ("One curve on each line"));
182 m_btnCurvesLayoutOneCurve->setWhatsThis (tr ("Exported file will have all the points for "
183 "the first curve, with one X-Y pair on each line, then the points for the second curve,..."));
184 layoutLayout->addWidget (m_btnCurvesLayoutOneCurve);
185 connect (m_btnCurvesLayoutOneCurve, SIGNAL (released()), this, SLOT (slotFunctionsLayoutOneCurve ()));
186}
187
188void DlgSettingsExportFormat::createFunctionsPointsSelection (QHBoxLayout *layoutFunctions)
189{
190 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createFunctionsPointsSelection";
191
192 QGroupBox *groupPointsSelection = new QGroupBox (tr ("Function Points Selection"));
193 layoutFunctions->addWidget (groupPointsSelection, 1);
194
195 QGridLayout *layoutPointsSelections = new QGridLayout;
196 groupPointsSelection->setLayout (layoutPointsSelections);
197
198 layoutPointsSelections->setColumnMinimumWidth(0, MIN_INDENT_COLUMN_WIDTH);
199 layoutPointsSelections->setColumnStretch (0, 0);
200 layoutPointsSelections->setColumnStretch (1, 0);
201 layoutPointsSelections->setColumnStretch (2, 0);
202 layoutPointsSelections->setColumnStretch (3, 0);
203 layoutPointsSelections->setColumnStretch (4, 1);
204
205 int row = 0;
206
207 m_btnFunctionsPointsAllCurves = new QRadioButton (tr ("Interpolate Ys at Xs from all curves"));
208 m_btnFunctionsPointsAllCurves->setWhatsThis (tr ("Exported file will have values at every unique X "
209 "value from every curve. Y values will be linearly interpolated if necessary"));
210 layoutPointsSelections->addWidget (m_btnFunctionsPointsAllCurves, row, 0, 1, 2);
211 connect (m_btnFunctionsPointsAllCurves, SIGNAL (released()), this, SLOT (slotFunctionsPointsAllCurves()));
212
213 // Put extrapolation control up near interpolation controls and away from raw control which never uses extrapolation
214 m_chkExtrapolateOutsideEndpoints = new QCheckBox (tr ("Extrapolate outside endpoints"));
215 m_chkExtrapolateOutsideEndpoints->setWhatsThis (tr ("Enable or disable extrapolation outside of endpoints of each curve. If disabled, "
216 "only points between the endpoints of each curve are exported"));
217 layoutPointsSelections->addWidget (m_chkExtrapolateOutsideEndpoints, row++, 4, 1, 1, Qt::AlignRight);
218 connect (m_chkExtrapolateOutsideEndpoints, SIGNAL (stateChanged (int)), this, SLOT (slotFunctionsExtrapolateOutsideEndpoints(int)));
219
220 m_btnFunctionsPointsFirstCurve = new QRadioButton (tr ("Interpolate Ys at Xs from first curve"));
221 m_btnFunctionsPointsFirstCurve->setWhatsThis (tr ("Exported file will have values at every unique X "
222 "value from the first curve. Y values will be linearly interpolated if necessary"));
223 layoutPointsSelections->addWidget (m_btnFunctionsPointsFirstCurve, row++, 0, 1, 4);
224 connect (m_btnFunctionsPointsFirstCurve, SIGNAL (released()), this, SLOT (slotFunctionsPointsFirstCurve()));
225
226 m_btnFunctionsPointsEvenlySpaced = new QRadioButton (tr ("Interpolate Ys at evenly spaced X values that are automatically selected"));
227 m_btnFunctionsPointsEvenlySpaced->setWhatsThis (tr ("Exported file will have values at evenly spaced X values, separated by the interval selected below."));
228 layoutPointsSelections->addWidget (m_btnFunctionsPointsEvenlySpaced, row++, 0, 1, 4);
229 connect (m_btnFunctionsPointsEvenlySpaced, SIGNAL (released()), this, SLOT (slotFunctionsPointsEvenlySpaced()));
230
231 QLabel *labelInterval = new QLabel (QString ("%1:").arg (tr ("Interval")));
232 layoutPointsSelections->addWidget (labelInterval, row, 1, 1, 1, Qt::AlignRight);
233
234 m_editFunctionsPointsEvenlySpacing = new QLineEdit;
235 m_validatorFunctionsPointsEvenlySpacing = new QDoubleValidator; // Minimum value, to prevent overflow, is set later according to settings
236 m_editFunctionsPointsEvenlySpacing->setValidator (m_validatorFunctionsPointsEvenlySpacing);
237 m_editFunctionsPointsEvenlySpacing->setMinimumWidth (MIN_EDIT_WIDTH);
238 m_editFunctionsPointsEvenlySpacing->setMaximumWidth (MAX_EDIT_WIDTH);
239 m_editFunctionsPointsEvenlySpacing->setWhatsThis (tr ("Interval, in the units of X, between successive points in the X direction.\n\n"
240 "If the scale is linear, then this interval is added to successive X values. If the scale is "
241 "logarithmic, then this interval is multiplied to successive X values.\n\n"
242 "The X values will be automatically aligned along simple numbers. If the first and/or last "
243 "points are not along the aligned X values, then one or two additional points are added "
244 "as necessary."));
245 layoutPointsSelections->addWidget (m_editFunctionsPointsEvenlySpacing, row, 2, 1, 1, Qt::AlignLeft);
246 connect (m_editFunctionsPointsEvenlySpacing, SIGNAL (textChanged(const QString &)), this, SLOT (slotFunctionsPointsEvenlySpacedInterval(const QString &)));
247
248 m_cmbFunctionsPointsEvenlySpacingUnits = new QComboBox;
249 m_cmbFunctionsPointsEvenlySpacingUnits->setWhatsThis (tr ("Units for spacing interval.\n\n"
250 "Pixel units are preferred when the spacing is to be independent of the X scale. The spacing will be "
251 "consistent across the graph, even if the X scale is logarithmic.\n\n"
252 "Graph units are preferred when the spacing is to depend on the X scale."));
253 m_cmbFunctionsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_GRAPH),
255 m_cmbFunctionsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_SCREEN),
257 connect (m_cmbFunctionsPointsEvenlySpacingUnits, SIGNAL (activated (const QString &)),
258 this, SLOT (slotFunctionsPointsEvenlySpacedIntervalUnits (const QString &))); // activated() ignores code changes
259 layoutPointsSelections->addWidget (m_cmbFunctionsPointsEvenlySpacingUnits, row, 3, 1, 1, Qt::AlignLeft);
260
261 m_lblOverflowFunctions = new QLabel (tr ("Too many points"));
262 m_lblOverflowFunctions->setStyleSheet ("QLabel { color : red; }");
263 m_lblOverflowFunctions->setWhatsThis (tr ("Warning that interval is too small. Adjust interval or increase point limit in Main Window settings"));
264 layoutPointsSelections->addWidget (m_lblOverflowFunctions, row++, 4, 1, 1, Qt::AlignLeft);
265
266 m_btnFunctionsPointsGridLines = new QRadioButton (tr ("Interpolate Ys at evenly spaced X values on grid lines"));
267 m_btnFunctionsPointsGridLines->setWhatsThis (tr ("Exported file will have values at evenly spaced X values at the vertical grid lines."));
268 layoutPointsSelections->addWidget (m_btnFunctionsPointsGridLines, row++, 0, 1, 4);
269 connect (m_btnFunctionsPointsGridLines, SIGNAL (released()), this, SLOT (slotFunctionsPointsGridLines()));
270
271 m_btnFunctionsPointsRaw = new QRadioButton (tr ("Raw Xs and Ys"));
272 m_btnFunctionsPointsRaw->setWhatsThis (tr ("Exported file will have only original X and Y values"));
273 layoutPointsSelections->addWidget (m_btnFunctionsPointsRaw, row++, 0, 1, 4);
274 connect (m_btnFunctionsPointsRaw, SIGNAL (released()), this, SLOT (slotFunctionsPointsRaw()));
275}
276
277void DlgSettingsExportFormat::createHeader (QHBoxLayout *layoutMisc)
278{
279 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createHeader";
280
281 const int COLUMN_RADIO_BUTTONS = 0, COLUMN_EMPTY = 1, COLUMN_LABEL = 2;
282
283 QGroupBox *groupHeader = new QGroupBox (tr ("Header"));
284 layoutMisc->addWidget (groupHeader, 1);
285
286 QGridLayout *layoutHeader = new QGridLayout;
287 layoutHeader->setColumnMinimumWidth(COLUMN_EMPTY,
289 groupHeader->setLayout (layoutHeader);
290 int row = 0;
291
292 m_btnHeaderNone = new QRadioButton (exportHeaderToString (EXPORT_HEADER_NONE));
293 m_btnHeaderNone->setWhatsThis (tr ("Exported file will have no header line"));
294 layoutHeader->addWidget (m_btnHeaderNone, row++, COLUMN_RADIO_BUTTONS, 1, 1);
295 connect (m_btnHeaderNone, SIGNAL (released ()), this, SLOT (slotHeaderNone()));
296
297 m_btnHeaderSimple = new QRadioButton (exportHeaderToString (EXPORT_HEADER_SIMPLE));
298 m_btnHeaderSimple->setWhatsThis (tr ("Exported file will have simple header line"));
299 layoutHeader->addWidget (m_btnHeaderSimple, row++, COLUMN_RADIO_BUTTONS, 1, 1);
300 connect (m_btnHeaderSimple, SIGNAL (released ()), this, SLOT (slotHeaderSimple()));
301
302 m_btnHeaderGnuplot = new QRadioButton (exportHeaderToString (EXPORT_HEADER_GNUPLOT));
303 m_btnHeaderGnuplot->setWhatsThis (tr ("Exported file will have gnuplot header line"));
304 layoutHeader->addWidget (m_btnHeaderGnuplot, row++, COLUMN_RADIO_BUTTONS, 1, 1);
305 connect (m_btnHeaderGnuplot, SIGNAL (released()), this, SLOT (slotHeaderGnuplot()));
306
307 createXLabel (layoutHeader,
308 COLUMN_LABEL);
309}
310
312{
313 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createOptionalSaveDefault";
314
315 m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
316 m_btnSaveDefault->setWhatsThis (tr ("Save the settings for use as future defaults."));
317 connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
318 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
319
320 m_btnLoadDefault = new QPushButton (tr ("Load Default"));
321 m_btnLoadDefault->setWhatsThis (tr ("Load the default settings."));
322 connect (m_btnLoadDefault, SIGNAL (released ()), this, SLOT (slotLoadDefault ()));
323 layout->addWidget (m_btnLoadDefault, 0, Qt::AlignLeft);
324}
325
326void DlgSettingsExportFormat::createPreview(QGridLayout *layout, int &row)
327{
328 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createPreview";
329
330 // Be sure to let user know that future (=unpredictable) selection of CSV or TSV file extension
331 // during export may change the the format, by allowing them to specify a file extension here
332 m_cmbFileExtension = new QComboBox;
333 m_cmbFileExtension->setWhatsThis (tr ("File extension used for preview. The CSV and TSV file extensions "
334 "normally use commas and tabs respectively, but that can be changed "
335 "in this dialog."));
337 QVariant (EXPORT_FILE_EXTENSION_CSV));
339 QVariant (EXPORT_FILE_EXTENSION_TSV));
342 connect (m_cmbFileExtension, SIGNAL (activated (const QString &)),
343 this, SLOT (slotFileExtension (const QString &))); // activated() ignores code changes
344 layout->addWidget (m_cmbFileExtension, row, 0, 1, 1, Qt::AlignLeft);
345
346 // Legend. Padding and margin in rich text do not work so &nbsp; is used for spacing
347 QLabel *labelLegend = new QLabel;
348 labelLegend->setTextFormat (Qt::RichText);
349 QString legendHtml = QString ("<span style=\"background-color: %1\">&nbsp;Functions&nbsp;</span>"
350 "&nbsp;&nbsp;&nbsp;"
351 "<span style=\"background-color: %2\">&nbsp;Relations&nbsp;</span>")
352 .arg (COLOR_FUNCTIONS)
353 .arg (COLOR_RELATIONS);
354 labelLegend->setText (legendHtml);
355 layout->addWidget (labelLegend, row++, 2, 1, 1, Qt::AlignRight);
356
357 m_editPreview = new QTextEdit;
358 m_editPreview->setReadOnly (true);
359 m_editPreview->setWhatsThis (tr ("Preview window shows how current settings affect the exported file.\n\n"
360 "Functions (shown here in blue) are output first, followed by relations "
361 "(shown here in green) if any exist."));
362 m_editPreview->setMinimumHeight (MINIMUM_PREVIEW_HEIGHT);
363 m_editPreview->document()->setDefaultStyleSheet("div { padding-left: 20px; }");
364 QPalette p = m_editPreview->palette();
365 p.setColor (QPalette::Base, QColor (240, 240, 240)); // Replace attention-getting white border by gray
366 m_editPreview->setPalette (p);
367
368 layout->addWidget (m_editPreview, row++, 0, 1, 3);
369}
370
371void DlgSettingsExportFormat::createRelationsPointsSelection (QHBoxLayout *layoutRelations)
372{
373 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createRelationsPointsSelection";
374
375 QGroupBox *groupPointsSelection = new QGroupBox (tr ("Relation Points Selection"));
376 layoutRelations->addWidget (groupPointsSelection);
377
378 QGridLayout *layoutPointsSelections = new QGridLayout;
379 groupPointsSelection->setLayout (layoutPointsSelections);
380
381 layoutPointsSelections->setColumnMinimumWidth(0, MIN_INDENT_COLUMN_WIDTH);
382 layoutPointsSelections->setColumnStretch (0, 0);
383 layoutPointsSelections->setColumnStretch (1, 0);
384 layoutPointsSelections->setColumnStretch (2, 0);
385 layoutPointsSelections->setColumnStretch (3, 0);
386 layoutPointsSelections->setColumnStretch (4, 1);
387
388 int row = 0;
389
390 m_btnRelationsPointsEvenlySpaced = new QRadioButton (tr ("Interpolate Xs and Ys at evenly spaced intervals."));
391 m_btnRelationsPointsEvenlySpaced->setWhatsThis (tr ("Exported file will have points evenly spaced along each relation, separated by the interval "
392 "selected below. If the last interval does not end at the last point, then a shorter last interval "
393 "is added that ends on the last point."));
394 layoutPointsSelections->addWidget (m_btnRelationsPointsEvenlySpaced, row++, 0, 1, 4);
395 connect (m_btnRelationsPointsEvenlySpaced, SIGNAL (released()), this, SLOT (slotRelationsPointsEvenlySpaced()));
396
397 QLabel *labelInterval = new QLabel (QString ("%1:").arg (tr ("Interval")));
398 layoutPointsSelections->addWidget (labelInterval, row, 1, 1, 1, Qt::AlignRight);
399
400 m_editRelationsPointsEvenlySpacing = new QLineEdit;
401 m_validatorRelationsPointsEvenlySpacing = new QDoubleValidator; // Minimum value, to prevent overflow, is set later according to settings
402 m_editRelationsPointsEvenlySpacing->setValidator (m_validatorRelationsPointsEvenlySpacing);
403 m_editRelationsPointsEvenlySpacing->setMinimumWidth (MIN_EDIT_WIDTH);
404 m_editRelationsPointsEvenlySpacing->setMaximumWidth (MAX_EDIT_WIDTH);
405 m_editRelationsPointsEvenlySpacing->setWhatsThis (tr ("Interval between successive points when "
406 "exporting at evenly spaced (X,Y) coordinates."));
407 layoutPointsSelections->addWidget (m_editRelationsPointsEvenlySpacing, row, 2, 1, 1, Qt::AlignLeft);
408 connect (m_editRelationsPointsEvenlySpacing, SIGNAL (textChanged(const QString &)), this, SLOT (slotRelationsPointsEvenlySpacedInterval(const QString &)));
409
410 m_cmbRelationsPointsEvenlySpacingUnits = new QComboBox;
411 m_cmbRelationsPointsEvenlySpacingUnits->setWhatsThis (tr ("Units for spacing interval.\n\n"
412 "Pixel units are preferred when the spacing is to be independent of the X and Y scales. The spacing will be "
413 "consistent across the graph, even if a scale is logarithmic or the X and Y scales are different.\n\n"
414 "Graph units are usually preferred when the X and Y scales are identical."));
415 m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_GRAPH),
417 m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_SCREEN),
419 connect (m_cmbRelationsPointsEvenlySpacingUnits, SIGNAL (activated (const QString &)),
420 this, SLOT (slotRelationsPointsEvenlySpacedIntervalUnits (const QString &))); // activated() ignores code changes
421 layoutPointsSelections->addWidget (m_cmbRelationsPointsEvenlySpacingUnits, row, 3, 1, 1, Qt::AlignLeft);
422
423 m_lblOverflowRelations = new QLabel (tr ("Too many points"));
424 m_lblOverflowRelations->setStyleSheet ("QLabel { color : red; }");
425 m_lblOverflowRelations->setWhatsThis (tr ("Warning that interval is too small. Adjust interval or increase point limit in Main Window settings"));
426 layoutPointsSelections->addWidget (m_lblOverflowRelations, row++, 4, 1, 1, Qt::AlignLeft);
427
428 m_btnRelationsPointsRaw = new QRadioButton (tr ("Raw Xs and Ys"));
429 m_btnRelationsPointsRaw->setWhatsThis (tr ("Exported file will have only original X and Y values"));
430 layoutPointsSelections->addWidget (m_btnRelationsPointsRaw, row++, 0, 1, 4);
431 connect (m_btnRelationsPointsRaw, SIGNAL (released()), this, SLOT (slotRelationsPointsRaw()));
432}
433
435{
436 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";
437
438 QWidget *subPanel = new QWidget ();
439 QGridLayout *layout = new QGridLayout (subPanel);
440 subPanel->setLayout (layout);
441
442 int row = 0;
443
444 createWhatsThis (layout,
445 m_btnWhatsThis,
446 row++,
447 3);
448
449 createCurveSelection (layout, row);
450
451 createTabWidget (layout,
452 row);
453
454 QWidget *widgetMisc = new QWidget;
455 layout->addWidget (widgetMisc, row++, 0, 1, 3);
456 QHBoxLayout *layoutMisc = new QHBoxLayout;
457 widgetMisc->setLayout (layoutMisc);
458
459 createDelimiters (layoutMisc); // One row of radio buttons
460 createHeader (layoutMisc); // Two rows with radio buttons and then header label
461 createFileLayout (layoutMisc); // One row of radio buttons
462
463 createPreview (layout, row);
464
465 return subPanel;
466}
467
468void DlgSettingsExportFormat::createTabWidget (QGridLayout *layout,
469 int &row)
470{
471 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createTabWidget";
472
473 m_tabWidget = new QTabWidget;
474 // This gets connected below, after the tabs have been added
475 layout->addWidget (m_tabWidget, row++, 0, 1, 3);
476
477 QWidget *widgetFunctions = new QWidget;
478 int indexFunctions = m_tabWidget->addTab (widgetFunctions, tr ("Functions"));
479 QWidget *tabFunctions = m_tabWidget->widget (indexFunctions);
480 tabFunctions->setWhatsThis (tr ("Functions Tab\n\n"
481 "Controls for specifying the format of functions during export"));
482 QHBoxLayout *layoutFunctions = new QHBoxLayout;
483 widgetFunctions->setLayout (layoutFunctions);
484
485 QWidget *widgetRelations = new QWidget;
486 int indexRelations = m_tabWidget->addTab (widgetRelations, tr ("Relations"));
487 QWidget *tabRelations = m_tabWidget->widget (indexRelations);
488 tabRelations->setWhatsThis (tr ("Relations Tab\n\n"
489 "Controls for specifying the format of relations during export"));
490 QHBoxLayout *layoutRelations = new QHBoxLayout;
491 widgetRelations->setLayout (layoutRelations);
492
493 // Now that the tabs have been added we can connect this signal
494 connect (m_tabWidget, SIGNAL (currentChanged (int)), this, SLOT (slotTabChanged (int)));
495
496 createFunctionsPointsSelection (layoutFunctions);
497 createRelationsPointsSelection (layoutRelations);
498}
499
500void DlgSettingsExportFormat::createXLabel (QGridLayout *layoutHeader,
501 int colLabel)
502{
503 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createXLabel";
504
505 int row = 1; // Skip first row
506
507 QLabel *title = new QLabel (QString ("%1:").arg (tr ("X Label")));
508 layoutHeader->addWidget (title, row++, colLabel, 1, 1);
509
510 m_editXLabel = new QLineEdit;
511 m_editXLabel->setWhatsThis (tr ("Label in the header for x values"));
512 layoutHeader->addWidget (m_editXLabel, row++, colLabel, 1, 1);
513 connect (m_editXLabel, SIGNAL (textChanged (const QString &)), this, SLOT (slotXLabel(const QString &)));
514}
515
516QString DlgSettingsExportFormat::exportedTextToExportedHtml (const QString &text,
517 const QString &color) const
518{
519 QRegularExpression re ("<br>$");
520
521 QString textCopy (text);
522 QString replaced = textCopy
523 .replace ("\n", "<br>")
524 .replace (" ", "&nbsp;")
525 .replace (re, "")
526 .replace ("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
527
528 QString html = QString ("<div style=\"display: inline; background-color: %1\">%2</div>")
529 .arg (color)
530 .arg (replaced);
531
532 return html;
533}
534
535bool DlgSettingsExportFormat::goodIntervalFunctions() const
536{
537 // LOG4CPP_INFO_S is below
538
539 QString textFunctions = m_editFunctionsPointsEvenlySpacing->text();
540 int posFunctions;
541
542 bool isGood = (m_validatorFunctionsPointsEvenlySpacing->validate (textFunctions, posFunctions) == QValidator::Acceptable);
543
544 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::goodIntervalFunctions"
545 << " text=" << textFunctions.toLatin1().data()
546 << " good=" << (isGood ? "true" : "false")
547 << " bottom=" << m_validatorFunctionsPointsEvenlySpacing->bottom()
548 << " top=" << m_validatorFunctionsPointsEvenlySpacing->top();
549
550 return isGood;
551}
552
553bool DlgSettingsExportFormat::goodIntervalRelations() const
554{
555 // LOG4CPP_INFO_S is below
556
557 QString textRelations = m_editRelationsPointsEvenlySpacing->text();
558 int posRelations;
559
560 bool isGood = (m_validatorRelationsPointsEvenlySpacing->validate (textRelations, posRelations) == QValidator::Acceptable);
561
562 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::goodIntervalRelations"
563 << " text=" << textRelations.toLatin1().data()
564 << " good=" << (isGood ? "true" : "false")
565 << " bottom=" << m_validatorRelationsPointsEvenlySpacing->bottom()
566 << " top=" << m_validatorRelationsPointsEvenlySpacing->top();
567
568 return isGood;
569}
570
572{
573 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk";
574
576 cmdMediator ().document(),
577 *m_modelExportBefore,
578 *m_modelExportAfter);
579 cmdMediator ().push (cmd);
580
581 hide ();
582}
583
584void DlgSettingsExportFormat::initializeIntervalConstraints ()
585{
586 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::initializeIntervalConstraints";
587
588 const int maxPointsAcrossRange = mainWindow().modelMainWindow().maximumExportedPointsPerCurve ();
589
590 // Get min and max of graph and screen coordinates
591 CallbackBoundingRects ftor (cmdMediator().document().documentAxesPointsRequired(),
592 mainWindow().transformation());
593
594 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
597
598 // If there are no points, then interval will be zero. That special case must be handled downstream to prevent infinite loops
599 bool isEmpty;
600 QPointF boundingRectGraphMin = ftor.boundingRectGraphMin (isEmpty);
601 QPointF boundingRectGraphMax = ftor.boundingRectGraphMax (isEmpty);
602 double maxSizeGraph = boundingRectGraphMax.x() - boundingRectGraphMin.x();
603 double maxSizeScreen = ftor.boundingRectScreen(isEmpty).width();
604 m_minIntervalGraph = maxSizeGraph / maxPointsAcrossRange; // Should be unaffected by y range
605 m_minIntervalScreen = maxSizeScreen / maxPointsAcrossRange; // Should be unaffected by y range
606}
607
609{
610 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::load";
611
613
614 // Flush old data
615 delete m_modelExportBefore;
616 delete m_modelExportAfter;
617
618 // Save new data
619 m_modelExportBefore = new DocumentModelExportFormat (cmdMediator.document());
620 m_modelExportAfter = new DocumentModelExportFormat (cmdMediator.document());
621
622 // Populate controls. First load excluded curves
623 m_listExcluded->clear();
624 QStringList curveNamesExcluded = m_modelExportAfter->curveNamesNotExported();
625 QStringList::const_iterator itr;
626 for (itr = curveNamesExcluded.begin (); itr != curveNamesExcluded.end(); ++itr) {
627 QString curveNameNotExported = *itr;
628 m_listExcluded->addItem (curveNameNotExported);
629 }
630
631 // Include curves that are not excluded
632 m_listIncluded->clear();
633 QStringList curveNamesAll = cmdMediator.document().curvesGraphsNames();
634 for (itr = curveNamesAll.begin (); itr != curveNamesAll.end(); itr++) {
635 QString curveName = *itr;
636 if (!curveNamesExcluded.contains (curveName)) {
637 m_listIncluded->addItem (curveName);
638 }
639 }
640
641 ExportPointsSelectionFunctions pointsSelectionFunctions = m_modelExportAfter->pointsSelectionFunctions();
642 m_btnFunctionsPointsAllCurves->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
643 m_btnFunctionsPointsFirstCurve->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
644 m_btnFunctionsPointsEvenlySpaced->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
645 m_btnFunctionsPointsGridLines->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES);
646 m_btnFunctionsPointsRaw->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
647
648 ExportLayoutFunctions layoutFunctions = m_modelExportAfter->layoutFunctions ();
649 m_btnCurvesLayoutAllCurves->setChecked (layoutFunctions == EXPORT_LAYOUT_ALL_PER_LINE);
650 m_btnCurvesLayoutOneCurve->setChecked (layoutFunctions == EXPORT_LAYOUT_ONE_PER_LINE);
651
652 ExportPointsSelectionRelations pointsSelectionRelations = m_modelExportAfter->pointsSelectionRelations();
653 m_btnRelationsPointsEvenlySpaced->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
654 m_btnRelationsPointsRaw->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_RAW);
655
656 ExportDelimiter delimiter = m_modelExportAfter->delimiter ();
657 m_btnDelimitersCommas->setChecked (delimiter == EXPORT_DELIMITER_COMMA);
658 m_btnDelimitersSpaces->setChecked (delimiter == EXPORT_DELIMITER_SPACE);
659 m_btnDelimitersTabs->setChecked (delimiter == EXPORT_DELIMITER_TAB);
660 m_btnDelimitersSemicolons->setChecked (delimiter == EXPORT_DELIMITER_SEMICOLON);
661
662 m_chkExtrapolateOutsideEndpoints->setChecked (m_modelExportAfter->extrapolateOutsideEndpoints ());
663
664 m_chkOverrideCsvTsv->setChecked (m_modelExportAfter->overrideCsvTsv());
665
666 ExportHeader header = m_modelExportAfter->header ();
667 m_btnHeaderNone->setChecked (header == EXPORT_HEADER_NONE);
668 m_btnHeaderSimple->setChecked (header == EXPORT_HEADER_SIMPLE);
669 m_btnHeaderGnuplot->setChecked (header == EXPORT_HEADER_GNUPLOT);
670
671 m_editXLabel->setText (m_modelExportAfter->xLabel());
672
673 m_editFunctionsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalFunctions()));
674 m_editRelationsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalRelations()));
675
676 ExportPointsIntervalUnits pointsIntervalUnitsFunctions = m_modelExportAfter->pointsIntervalUnitsFunctions();
677 ExportPointsIntervalUnits pointsIntervalUnitsRelations = m_modelExportAfter->pointsIntervalUnitsRelations();
678 int indexFunctions = m_cmbFunctionsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsFunctions));
679 int indexRelations = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsRelations));
680 m_cmbFunctionsPointsEvenlySpacingUnits->setCurrentIndex (indexFunctions);
681 m_cmbRelationsPointsEvenlySpacingUnits->setCurrentIndex (indexRelations);
682
683 m_cmbFileExtension->setCurrentText (exportFileExtensionToPreviewString (EXPORT_FILE_EXTENSION_CSV));
684
685 initializeIntervalConstraints ();
686
687 updateControlsUponLoad (); // Before updateControls so m_haveFunction and m_haveRelation are set
688 updateControls();
689 updateIntervalConstraints();
690 enableOk (false); // Disable Ok button since there not yet any changes
691 updatePreview();
692}
693
695{
696 if (!smallDialogs) {
697 setMinimumHeight (MINIMUM_HEIGHT);
698 }
699}
700
701void DlgSettingsExportFormat::slotDelimitersCommas()
702{
703 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersCommas";
704
705 m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_COMMA);
706 updateControls();
707 updatePreview();
708}
709
710void DlgSettingsExportFormat::slotDelimitersSemicolons()
711{
712 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersSemicolons";
713
714 m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_SEMICOLON);
715 updateControls();
716 updatePreview();
717}
718
719void DlgSettingsExportFormat::slotDelimitersSpaces()
720{
721 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersSpaces";
722
723 m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_SPACE);
724 updateControls();
725 updatePreview();
726}
727
728void DlgSettingsExportFormat::slotDelimitersTabs()
729{
730 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersTabs";
731
732 m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_TAB);
733 updateControls();
734 updatePreview();
735}
736
737void DlgSettingsExportFormat::slotExclude ()
738{
739 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotExclude";
740
741 // Perform forward pass to get excluded curves in the proper order
742 int i;
743 QStringList excluded;
744 for (i = 0; i < m_listIncluded->count(); i++) {
745 if (m_listIncluded->item(i)->isSelected()) {
746 excluded += m_listIncluded->item(i)->text();
747 }
748 }
749
750 // Add the excluded curves to the excluded list
751 for (i = 0; i < excluded.count(); i++) {
752 QString curveName = excluded.at (i);
753 m_listExcluded->addItem (curveName);
754 }
755
756 // Perform backwards pass to remove the excluded curves from the included list
757 for (i = m_listIncluded->count() - 1; i>= 0; i--) {
758 QString curveName = m_listIncluded->item(i)->text();
759 if (excluded.contains (curveName)) {
760 QListWidgetItem *item = m_listIncluded->item (i);
761 m_listIncluded->removeItemWidget (item);
762 delete item;
763 }
764 }
765
766 m_modelExportAfter->setCurveNamesNotExported(excluded);
767 updateControls();
768 updatePreview();
769}
770
771void DlgSettingsExportFormat::slotFileExtension (const QString &)
772{
773 updatePreview();
774}
775
776void DlgSettingsExportFormat::slotFunctionsExtrapolateOutsideEndpoints(int)
777{
778 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsExtrapolateOutsideEndpoints";
779
780 m_modelExportAfter->setExtrapolateOutsideEndpoints (m_chkExtrapolateOutsideEndpoints->isChecked());
781 updateControls();
782 updatePreview();
783}
784
785void DlgSettingsExportFormat::slotFunctionsLayoutAllCurves()
786{
787 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsLayoutAllCurves";
788
789 m_modelExportAfter->setLayoutFunctions(EXPORT_LAYOUT_ALL_PER_LINE);
790 updateControls();
791 updatePreview();
792}
793
794void DlgSettingsExportFormat::slotFunctionsLayoutOneCurve()
795{
796 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsLayoutOneCurve";
797
798 m_modelExportAfter->setLayoutFunctions(EXPORT_LAYOUT_ONE_PER_LINE);
799 updateControls();
800 updatePreview();
801}
802
803void DlgSettingsExportFormat::slotFunctionsPointsAllCurves()
804{
805 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsAllCurves";
806
807 m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
808 updateControls();
809 updatePreview();
810}
811
812void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpaced()
813{
814 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpaced";
815
816 m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
817 updateControls();
818 updatePreview();
819}
820
821void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedInterval(const QString &)
822{
823 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedInterval";
824
825 if (m_editFunctionsPointsEvenlySpacing->text().trimmed() == "") {
826 // Undefined value which is (1) not a problem and (2) an intermediate state
827 m_lblOverflowFunctions->hide ();
828 m_editPreview->setText(EMPTY_PREVIEW);
829 } else {
830 m_lblOverflowFunctions->hide (); // State transition
831 m_modelExportAfter->setPointsIntervalFunctions(m_editFunctionsPointsEvenlySpacing->text().toDouble());
832 updateControls();
833 updatePreview();
834 }
835}
836
837void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedIntervalUnits(const QString &)
838{
839 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedIntervalUnits";
840
841 int index = m_cmbFunctionsPointsEvenlySpacingUnits->currentIndex();
842 ExportPointsIntervalUnits units = static_cast<ExportPointsIntervalUnits> (m_cmbFunctionsPointsEvenlySpacingUnits->itemData (index).toInt());
843
844 m_lblOverflowFunctions->hide (); // State transition
845 m_modelExportAfter->setPointsIntervalUnitsFunctions(units);
846 updateIntervalConstraints(); // Call this before updateControls so constraint checking is updated for ok button
847 updateControls();
848 updatePreview();
849}
850
851void DlgSettingsExportFormat::slotFunctionsPointsFirstCurve()
852{
853 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsFirstCurve";
854
855 m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
856 updateControls();
857 updatePreview();
858}
859
860void DlgSettingsExportFormat::slotFunctionsPointsGridLines()
861{
862 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsGridLines";
863
864 m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES);
865 updateControls();
866 updatePreview();
867}
868
869void DlgSettingsExportFormat::slotFunctionsPointsRaw()
870{
871 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsRaw";
872
873 m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
874 updateControls();
875 updatePreview();
876}
877
878void DlgSettingsExportFormat::slotHeaderGnuplot()
879{
880 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderGnuplot";
881
882 m_modelExportAfter->setHeader(EXPORT_HEADER_GNUPLOT);
883 updateControls();
884 updatePreview();
885}
886
887void DlgSettingsExportFormat::slotHeaderNone()
888{
889 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderNone";
890
891 m_modelExportAfter->setHeader(EXPORT_HEADER_NONE);
892 updateControls();
893 updatePreview();
894}
895
896void DlgSettingsExportFormat::slotHeaderSimple()
897{
898 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderSimple";
899
900 m_modelExportAfter->setHeader(EXPORT_HEADER_SIMPLE);
901 updateControls();
902 updatePreview();
903}
904
905void DlgSettingsExportFormat::slotInclude ()
906{
907 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotInclude";
908
909 // Perform forward pass to get included curves in the proper order
910 int i;
911 QStringList included;
912 for (i = 0; i < m_listExcluded->count(); i++) {
913 if (m_listExcluded->item(i)->isSelected()) {
914 included += m_listExcluded->item(i)->text();
915 }
916 }
917
918 // Add the included curves to the included list
919 for (i = 0; i < included.count(); i++) {
920 QString curveName = included.at (i);
921 m_listIncluded->addItem (curveName);
922 }
923
924 // Perform backwards pass to remove the included curves from the excluded list
925 QStringList excluded;
926 for (i = m_listExcluded->count() - 1; i>= 0; i--) {
927 QString curveName = m_listExcluded->item(i)->text();
928 QListWidgetItem *item = m_listExcluded->item (i);
929 if (included.contains (curveName)) {
930 m_listExcluded->removeItemWidget (item);
931 delete item;
932 } else {
933 excluded += item->text();
934 }
935 }
936
937 m_modelExportAfter->setCurveNamesNotExported(excluded);
938 updateControls();
939 updatePreview();
940}
941
942void DlgSettingsExportFormat::slotListExcluded()
943{
944 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotListExcluded";
945
946 updateControls();
947 // Do not call updatePreview since this method changes nothing
948}
949
950void DlgSettingsExportFormat::slotListIncluded()
951{
952 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotListIncluded";
953
954 updateControls();
955 // Do not call updatePreview since this method changes nothing
956}
957
958void DlgSettingsExportFormat::slotLoadDefault()
959{
960 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotLoadDefault";
961
962 // Get defaults from constructor
963 DocumentModelExportFormat modelExportDefaults;
964
965 // Apply defaults to controls. That will trigger updates to m_modelExportAfter
966
967 m_btnHeaderGnuplot->setChecked (modelExportDefaults.header() == EXPORT_HEADER_GNUPLOT);
968 m_btnHeaderNone->setChecked (modelExportDefaults.header() == EXPORT_HEADER_NONE);
969 m_btnHeaderSimple->setChecked (modelExportDefaults.header() == EXPORT_HEADER_SIMPLE);
970
971 m_editXLabel->setText (modelExportDefaults.xLabel());
972
973 m_btnDelimitersCommas->setChecked (modelExportDefaults.delimiter() == EXPORT_DELIMITER_COMMA);
974 m_btnDelimitersSemicolons->setChecked (modelExportDefaults.delimiter() == EXPORT_DELIMITER_SEMICOLON);
975 m_btnDelimitersSpaces->setChecked (modelExportDefaults.delimiter() == EXPORT_DELIMITER_SPACE);
976 m_btnDelimitersTabs->setChecked (modelExportDefaults.delimiter() == EXPORT_DELIMITER_TAB);
977
978 m_chkOverrideCsvTsv->setChecked (modelExportDefaults.overrideCsvTsv());
979
980 m_btnCurvesLayoutAllCurves->setChecked (modelExportDefaults.layoutFunctions() == EXPORT_LAYOUT_ALL_PER_LINE);
981 m_btnCurvesLayoutOneCurve->setChecked (modelExportDefaults.layoutFunctions() == EXPORT_LAYOUT_ONE_PER_LINE);
982
983 m_editFunctionsPointsEvenlySpacing->setText (QString::number (modelExportDefaults.pointsIntervalFunctions ()));
984 m_editRelationsPointsEvenlySpacing->setText (QString::number (modelExportDefaults.pointsIntervalRelations ()));
985
986 m_btnFunctionsPointsAllCurves->setChecked (modelExportDefaults.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
987 m_btnFunctionsPointsFirstCurve->setChecked (modelExportDefaults.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
988 m_btnFunctionsPointsEvenlySpaced->setChecked (modelExportDefaults.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
989 m_btnFunctionsPointsGridLines->setChecked (modelExportDefaults.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES);
990 m_btnFunctionsPointsRaw->setChecked (modelExportDefaults.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
991
992 m_btnRelationsPointsEvenlySpaced->setChecked (modelExportDefaults.pointsSelectionRelations() == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
993 m_btnRelationsPointsRaw->setChecked (modelExportDefaults.pointsSelectionRelations() == EXPORT_POINTS_SELECTION_RELATIONS_RAW);
994
995 m_chkExtrapolateOutsideEndpoints->setChecked (modelExportDefaults.extrapolateOutsideEndpoints());
996
997 int indexFunctions = m_cmbFunctionsPointsEvenlySpacingUnits->findData (QVariant (modelExportDefaults.pointsIntervalUnitsFunctions ()));
998 int indexRelations = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (modelExportDefaults.pointsIntervalUnitsRelations ()));
999 m_cmbFunctionsPointsEvenlySpacingUnits->setCurrentIndex (indexFunctions);
1000 m_cmbRelationsPointsEvenlySpacingUnits->setCurrentIndex (indexRelations);
1001
1002 // Apply defaults to 'after' settings
1003 *m_modelExportAfter = modelExportDefaults;
1004
1005 updateControls();
1006 updatePreview();
1007}
1008
1009void DlgSettingsExportFormat::slotOverrideCsvTsv(int)
1010{
1011 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotOverrideCsvTsv";
1012
1013 m_modelExportAfter->setOverrideCsvTsv(m_chkOverrideCsvTsv->isChecked());
1014 updateControls();
1015 updatePreview();
1016}
1017
1018void DlgSettingsExportFormat::slotRelationsPointsEvenlySpaced()
1019{
1020 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpaced";
1021
1022 m_modelExportAfter->setPointsSelectionRelations(EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
1023 updateControls();
1024 updatePreview();
1025}
1026
1027void DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedInterval(const QString &)
1028{
1029 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedInterval";
1030
1031 if (m_editRelationsPointsEvenlySpacing->text().trimmed() == "") {
1032 // Undefined value which is (1) not a problem and (2) an intermediate state
1033 m_lblOverflowRelations->hide ();
1034 m_editPreview->setText(EMPTY_PREVIEW);
1035 } else {
1036 if (goodIntervalRelations()) {
1037 m_lblOverflowRelations->hide (); // State transition
1038 m_modelExportAfter->setPointsIntervalRelations(m_editRelationsPointsEvenlySpacing->text().toDouble());
1039 updateControls();
1040 updatePreview();
1041 } else {
1042 m_lblOverflowRelations->show (); // State transition
1043 m_editPreview->setText(EMPTY_PREVIEW);
1044 }
1045 }
1046}
1047
1048void DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedIntervalUnits(const QString &)
1049{
1050 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedIntervalUnits";
1051
1052 int index = m_cmbRelationsPointsEvenlySpacingUnits->currentIndex();
1053 ExportPointsIntervalUnits units = static_cast<ExportPointsIntervalUnits> (m_cmbRelationsPointsEvenlySpacingUnits->itemData (index).toInt());
1054
1055 m_modelExportAfter->setPointsIntervalUnitsRelations(units);
1056 updateIntervalConstraints(); // Call this before updateControls so constraint checking is updated for ok button
1057 updateControls();
1058 updatePreview();
1059}
1060
1061void DlgSettingsExportFormat::slotRelationsPointsRaw()
1062{
1063 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsRaw";
1064
1065 m_modelExportAfter->setPointsSelectionRelations(EXPORT_POINTS_SELECTION_RELATIONS_RAW);
1066 updateControls();
1067 updatePreview();
1068}
1069
1070void DlgSettingsExportFormat::slotSaveDefault()
1071{
1072 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotSaveDefault";
1073
1074 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1075 settings.beginGroup (SETTINGS_GROUP_EXPORT);
1076
1077 // Sync these settings with DocumentModelExportFormat::DocumentModelExportFormat()
1078 // and DlgSettingsExportFormat::slotLoadDefault()
1079 settings.setValue (SETTINGS_EXPORT_DELIMITER,
1080 QVariant (m_modelExportAfter->delimiter()));
1082 QVariant (m_modelExportAfter->overrideCsvTsv()));
1084 QVariant (m_modelExportAfter->extrapolateOutsideEndpoints()));
1085 settings.setValue (SETTINGS_EXPORT_HEADER,
1086 QVariant (m_modelExportAfter->header()));
1087 settings.setValue (SETTINGS_EXPORT_LAYOUT_FUNCTIONS,
1088 QVariant (m_modelExportAfter->layoutFunctions()));
1090 QVariant (m_modelExportAfter->pointsIntervalFunctions()));
1092 QVariant (m_modelExportAfter->pointsIntervalRelations()));
1094 QVariant (m_modelExportAfter->pointsIntervalUnitsFunctions()));
1096 QVariant (m_modelExportAfter->pointsIntervalUnitsRelations()));
1098 QVariant (m_modelExportAfter->pointsSelectionFunctions()));
1100 QVariant (m_modelExportAfter->pointsSelectionRelations()));
1101 settings.setValue (SETTINGS_EXPORT_X_LABEL,
1102 QVariant (m_modelExportAfter->xLabel()));
1103
1104 settings.endGroup ();
1105}
1106
1107void DlgSettingsExportFormat::slotTabChanged (int)
1108{
1109 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotTabChanged";
1110
1111 updatePreview();
1112}
1113
1114void DlgSettingsExportFormat::slotWhatsThis ()
1115{
1116 QWhatsThis::enterWhatsThisMode();
1117}
1118
1119void DlgSettingsExportFormat::slotXLabel(const QString &)
1120{
1121 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotXLabel";
1122
1123 m_modelExportAfter->setXLabel (m_editXLabel->text());
1124 updateControls();
1125 updatePreview();
1126}
1127
1128void DlgSettingsExportFormat::updateControls ()
1129{
1130 bool isGoodState = goodIntervalFunctions() &&
1131 goodIntervalRelations();
1132 enableOk (isGoodState);
1133
1134 // Function extrapolation never applies when using raw points
1135 m_chkExtrapolateOutsideEndpoints->setEnabled (!m_btnFunctionsPointsRaw->isChecked ());
1136
1137 int selectedForInclude = m_listExcluded->selectedItems().count();
1138 int selectedForExclude = m_listIncluded->selectedItems().count();
1139 int inInclude = m_listIncluded->count();
1140
1141 m_btnInclude->setEnabled (selectedForInclude > 0); // Need at least one selection
1142 m_btnExclude->setEnabled ((selectedForExclude > 0) && (inInclude - selectedForExclude > 0)); // Need at least one selection, and one left after the move
1143
1144 m_editFunctionsPointsEvenlySpacing->setEnabled (m_haveFunction && m_btnFunctionsPointsEvenlySpaced->isChecked ());
1145 m_editRelationsPointsEvenlySpacing->setEnabled (m_haveRelation && m_btnRelationsPointsEvenlySpaced->isChecked ());
1146
1147 m_editXLabel->setEnabled (!m_btnHeaderNone->isChecked());
1148}
1149
1150void DlgSettingsExportFormat::updateControlsUponLoad ()
1151{
1152 CurveStyles curveStyles = cmdMediator().document().modelCurveStyles();
1153
1154 m_haveFunction = false;
1155 m_haveRelation = false;
1156
1157 QStringList curveNames = curveStyles.curveNames();
1158
1159 QStringList::const_iterator itr;
1160 for (itr = curveNames.begin(); itr != curveNames.end (); itr++) {
1161 QString curveName = *itr;
1162 CurveStyle curveStyle = curveStyles.curveStyle (curveName);
1163 CurveConnectAs curveConnectAs = curveStyle.lineStyle().curveConnectAs();
1164 if (curveConnectAs == CONNECT_AS_FUNCTION_SMOOTH || curveConnectAs == CONNECT_AS_FUNCTION_STRAIGHT) {
1165 m_haveFunction = true;
1166 } else if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH || curveConnectAs == CONNECT_AS_RELATION_STRAIGHT) {
1167 m_haveRelation = true;
1168 }
1169 }
1170
1171 // Enable function-specific widgets if appropriate
1172 m_btnFunctionsPointsAllCurves->setEnabled (m_haveFunction);
1173 m_btnFunctionsPointsFirstCurve->setEnabled (m_haveFunction);
1174 m_btnFunctionsPointsEvenlySpaced->setEnabled (m_haveFunction);
1175 m_editFunctionsPointsEvenlySpacing->setEnabled (m_haveFunction);
1176 m_cmbFunctionsPointsEvenlySpacingUnits->setEnabled (m_haveFunction);
1177 m_btnFunctionsPointsRaw->setEnabled (m_haveFunction);
1178
1179 // Enable relation-specific widgets if appropriate
1180 m_btnRelationsPointsEvenlySpaced->setEnabled (m_haveRelation);
1181 m_editRelationsPointsEvenlySpacing->setEnabled (m_haveRelation);
1182 m_cmbRelationsPointsEvenlySpacingUnits->setEnabled (m_haveRelation);
1183 m_btnRelationsPointsRaw->setEnabled (m_haveRelation);
1184
1185 // Do not start with a tab that does not apply to the current set of functions/relations
1186 if (!m_haveRelation) {
1187 m_tabWidget->setCurrentIndex (TAB_WIDGET_INDEX_FUNCTIONS);
1188 } else if (!m_haveFunction) {
1189 m_tabWidget->setCurrentIndex (TAB_WIDGET_INDEX_RELATIONS);
1190 }
1191}
1192
1193void DlgSettingsExportFormat::updateIntervalConstraints ()
1194{
1195 double functionsMin = (m_modelExportAfter->pointsIntervalUnitsFunctions() == EXPORT_POINTS_INTERVAL_UNITS_GRAPH ?
1196 m_minIntervalGraph :
1197 m_minIntervalScreen);
1198 double relationsMin = (m_modelExportAfter->pointsIntervalUnitsRelations() == EXPORT_POINTS_INTERVAL_UNITS_GRAPH ?
1199 m_minIntervalGraph :
1200 m_minIntervalScreen);
1201
1202 if (cmdMediator().document().modelCoords().coordScaleYRadius() == COORD_SCALE_LOG) {
1203 // Override scale factor with log scale so Export classes are assured that multiplying by the scale factor will
1204 // cause an increase
1205 functionsMin = qMax (1.00000001, functionsMin);
1206 }
1207
1208 if (m_tabWidget->currentIndex() == TAB_WIDGET_INDEX_FUNCTIONS) {
1209
1210 m_validatorFunctionsPointsEvenlySpacing->setBottom (functionsMin);
1211
1212 } else {
1213
1214 m_validatorRelationsPointsEvenlySpacing->setBottom (relationsMin);
1215 }
1216}
1217
1218void DlgSettingsExportFormat::updatePreview()
1219{
1220 // Save the scroll position for continuity before and after the preview update
1221 int scrollPosition = m_editPreview->verticalScrollBar()->value();
1222
1223 QString exportedTextFunctions, exportedTextRelations, exportedHtml;
1224
1225 // Initialize assuming no overruns
1226 m_lblOverflowFunctions->hide ();
1227 m_lblOverflowRelations->hide ();
1228
1229 if (mainWindow().transformation().transformIsDefined()) {
1230
1231 QTextStream strFunctions (&exportedTextFunctions);
1232 QTextStream strRelations (&exportedTextRelations);
1233
1234 unsigned int numWritesSoFar = 0;
1235 bool isOverrunFunctions = false, isOverrunRelations = false;
1236
1237 // Cobble together enough of a filename, given the extension, to be parsable as a filename
1238 ExportFileExtension exportFileExtension = static_cast<ExportFileExtension> (m_cmbFileExtension->currentData().toInt());
1239 QString filename = exportFileExtensionToFilename (exportFileExtension);
1240
1241 ExportFileExtensionOverride extensionOverride;
1242 ExportToFile exportToFile;
1243 DocumentModelExportFormat modelAfterWithFileExtension = extensionOverride.modelExportOverride(*m_modelExportAfter,
1244 exportToFile,
1245 filename);
1246
1247 ExportFileFunctions exportStrategyFunctions;
1248 exportStrategyFunctions.exportToFile (modelAfterWithFileExtension,
1249 cmdMediator().document(),
1250 mainWindow().modelMainWindow(),
1251 mainWindow().transformation(),
1252 strFunctions,
1253 numWritesSoFar,
1254 isOverrunFunctions);
1255
1256 ExportFileRelations exportStrategyRelations;
1257 exportStrategyRelations.exportToFile (modelAfterWithFileExtension,
1258 cmdMediator().document(),
1259 mainWindow().modelMainWindow(),
1260 mainWindow().transformation(),
1261 strRelations,
1262 numWritesSoFar,
1263 isOverrunRelations);
1264
1265 m_lblOverflowFunctions->setVisible(isOverrunFunctions);
1266 m_lblOverflowRelations->setVisible(isOverrunRelations);
1267
1268 // Use html to set background color. A <div> fills the whole background, unlike a <span>.
1269 // Final carriage return is removed to prevent unwanted blank line. A requirement is that
1270 // if there are no functions then no empty <div> appears (too confusing), and likewise if
1271 // there are no relations
1272 QString exportedHtmlFunctions, exportedHtmlRelations;
1273 if (! exportedTextFunctions.isEmpty ()) {
1274
1275 exportedHtmlFunctions = exportedTextToExportedHtml (exportedTextFunctions, COLOR_FUNCTIONS);
1276 }
1277 if (! exportedTextRelations.isEmpty ()) {
1278
1279 exportedHtmlRelations = exportedTextToExportedHtml (exportedTextRelations, COLOR_RELATIONS);
1280 }
1281
1282 exportedHtml = exportedHtmlFunctions + exportedHtmlRelations;
1283
1284 } else {
1285
1286 exportedHtml = tr ("Preview is unavailable until axis points are defined.");
1287 }
1288
1289 m_editPreview->setHtml (exportedHtml);
1290
1291 // Restore scroll position
1292 m_editPreview->verticalScrollBar()->setValue (scrollPosition);
1293}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
CurveConnectAs
@ CONNECT_AS_FUNCTION_STRAIGHT
@ CONNECT_AS_RELATION_STRAIGHT
@ CONNECT_AS_RELATION_SMOOTH
@ CONNECT_AS_FUNCTION_SMOOTH
const int MINIMUM_HEIGHT
const QString COLOR_RELATIONS
const QString EMPTY_PREVIEW
const int MINIMUM_DIALOG_WIDTH_EXPORT_FORMAT
const int MIN_INDENT_COLUMN_WIDTH
const int MIN_EDIT_WIDTH
const QString COLOR_FUNCTIONS
const int TAB_WIDGET_INDEX_FUNCTIONS
const int MIN_HEADER_EMPTY_COLUMN_WIDTH
const int TAB_WIDGET_INDEX_RELATIONS
const int MAX_EDIT_WIDTH
QString exportDelimiterToString(ExportDelimiter exportDelimiter)
ExportDelimiter
Delimiter values that may or may not be overridden by DOCUMENT_SERIALIZE_EXPORT_DELIMITER_OVERRIDE_CS...
@ EXPORT_DELIMITER_SPACE
@ EXPORT_DELIMITER_COMMA
@ EXPORT_DELIMITER_TAB
@ EXPORT_DELIMITER_SEMICOLON
QString exportFileExtensionToFilename(ExportFileExtension exportFileExtension)
Internally-used sample file name for each ExportFileExtension value.
QString exportFileExtensionToPreviewString(ExportFileExtension exportFileExtension)
Displayed text for each ExportFileExtension value.
ExportFileExtension
@ EXPORT_FILE_EXTENSION_NOT_CSV_TSV
@ EXPORT_FILE_EXTENSION_CSV
@ EXPORT_FILE_EXTENSION_TSV
QString exportHeaderToString(ExportHeader exportHeader)
ExportHeader
@ EXPORT_HEADER_SIMPLE
@ EXPORT_HEADER_NONE
@ EXPORT_HEADER_GNUPLOT
ExportLayoutFunctions
@ EXPORT_LAYOUT_ALL_PER_LINE
@ EXPORT_LAYOUT_ONE_PER_LINE
QString exportPointsIntervalUnitsToString(ExportPointsIntervalUnits exportPointsIntervalUnits)
@ EXPORT_POINTS_INTERVAL_UNITS_GRAPH
@ EXPORT_POINTS_INTERVAL_UNITS_SCREEN
@ EXPORT_POINTS_SELECTION_FUNCTIONS_RAW
@ EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE
@ EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC
@ EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES
@ EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES
@ EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE
@ EXPORT_POINTS_SELECTION_RELATIONS_RAW
log4cpp::Category * mainCat
Definition Logger.cpp:14
const QString SETTINGS_EXPORT_POINTS_INTERVAL_UNITS_RELATIONS
const QString SETTINGS_EXPORT_POINTS_SELECTION_FUNCTIONS
const QString SETTINGS_ENGAUGE
const QString SETTINGS_EXPORT_POINTS_INTERVAL_FUNCTIONS
const QString SETTINGS_EXPORT_X_LABEL
const QString SETTINGS_EXPORT_DELIMITER
const QString SETTINGS_GROUP_EXPORT
const QString SETTINGS_EXPORT_POINTS_INTERVAL_RELATIONS
const QString SETTINGS_EXPORT_LAYOUT_FUNCTIONS
const QString SETTINGS_EXPORT_POINTS_SELECTION_RELATIONS
const QString SETTINGS_EXPORT_EXTRAPOLATE_OUTSIDE_ENDPOINTS
const QString SETTINGS_EXPORT_HEADER
const QString SETTINGS_EXPORT_POINTS_INTERVAL_UNITS_FUNCTIONS
const QString SETTINGS_EXPORT_DELIMITER_OVERRIDE_CSV_TSV
const QString SETTINGS_DIGITIZER
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Command queue stack.
Definition CmdMediator.h:24
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Command for DlgSettingsExportFormat.
LineStyle lineStyle() const
Get method for LineStyle.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
QStringList curveNames() const
List of all curve names.
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
MainWindow & mainWindow()
Get method for MainWindow.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
DlgSettingsExportFormat(MainWindow &mainWindow)
Single constructor.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual void handleOk()
Process slotOk.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
bool extrapolateOutsideEndpoints() const
Get methods for extrapolation.
ExportHeader header() const
Get method for header.
ExportPointsSelectionRelations pointsSelectionRelations() const
Get method for point selection for relations.
double pointsIntervalRelations() const
Get method for relations interval for relations.
bool overrideCsvTsv() const
Get method for csv/tsv format override.
QString xLabel() const
Get method for x label.
ExportPointsSelectionFunctions pointsSelectionFunctions() const
Get method for point selection for functions.
void setDelimiter(ExportDelimiter exportDelimiter)
Set method for delimiter.
double pointsIntervalFunctions() const
Get method for points interval for functions.
ExportPointsIntervalUnits pointsIntervalUnitsRelations() const
Get method for points interval units for relations.
ExportDelimiter delimiter() const
Get method for delimiter.
ExportLayoutFunctions layoutFunctions() const
Get method for functions layout.
ExportPointsIntervalUnits pointsIntervalUnitsFunctions() const
Get method for points interval units for functions.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
Definition Document.cpp:714
DocumentModelExportFormat modelExportOverride(const DocumentModelExportFormat &modelExportFormatBefore, const ExportToFile &exportStrategy, const QString &selectedNameFilter) const
Adjust export settings given filename extension.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar, bool &isOverrun) const
Export Document points according to the settings.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar, bool &isOverrun) const
Export Document points according to the settings.
CurveConnectAs curveConnectAs() const
Get method for connect type.
Definition LineStyle.cpp:63
int maximumExportedPointsPerCurve() const
Get method for maximum number of exported points per curve.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
MainWindowModel modelMainWindow() const
Get method for main window model.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18