Engauge Digitizer  2
DlgSettingsExportFormat.cpp
1 #include "CallbackBoundingRects.h"
2 #include "CmdMediator.h"
3 #include "CmdSettingsExportFormat.h"
4 #include "DocumentModelExportFormat.h"
5 #include "DlgSettingsExportFormat.h"
6 #include "ExportFileFunctions.h"
7 #include "ExportFileRelations.h"
8 #include "Logger.h"
9 #include "MainWindow.h"
10 #include <QComboBox>
11 #include <QDoubleValidator>
12 #include <QGridLayout>
13 #include <QGroupBox>
14 #include <QHBoxLayout>
15 #include <QLabel>
16 #include <QLineEdit>
17 #include <QListWidget>
18 #include <QPushButton>
19 #include <QRadioButton>
20 #include <QScrollBar>
21 #include <QTabWidget>
22 #include <QTextEdit>
23 #include <QTextStream>
24 #include <QVBoxLayout>
25 #include "Transformation.h"
26 
27 const int MIN_INDENT_COLUMN_WIDTH = 20;
28 const int MIN_HEADER_EMPTY_COLUMN_WIDTH = 10;
29 const int MIN_EDIT_WIDTH = 110;
30 const int MAX_EDIT_WIDTH = 180;
31 
32 const int TAB_WIDGET_INDEX_FUNCTIONS = 0;
33 const int TAB_WIDGET_INDEX_RELATIONS = 1;
34 
35 const QString EMPTY_PREVIEW;
36 
38  DlgSettingsAbstractBase ("Export Format",
39  "DlgSettingsExportFormat",
40  mainWindow),
41  m_modelExportBefore (0),
42  m_modelExportAfter (0)
43 {
44  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::DlgSettingsExportFormat";
45 
46  QWidget *subPanel = createSubPanel ();
47  finishPanel (subPanel);
48 }
49 
50 DlgSettingsExportFormat::~DlgSettingsExportFormat()
51 {
52  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::~DlgSettingsExportFormat";
53 }
54 
55 void DlgSettingsExportFormat::createCurveSelection (QGridLayout *layout, int &row)
56 {
57  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createCurveSelection";
58 
59  QLabel *labelIncluded = new QLabel (tr ("Included"));
60  layout->addWidget (labelIncluded, row, 0);
61 
62  QLabel *labelExcluded = new QLabel (tr ("Not included"));
63  layout->addWidget (labelExcluded, row++, 2);
64 
65  m_listIncluded = new QListWidget;
66  m_listIncluded->setWhatsThis (tr ("List of curves to be included in the exported file.\n\n"
67  "The order of the curves here does not affect the order in the exported file. That "
68  "order is determined by the Curves settings."));
69  m_listIncluded->setSelectionMode (QAbstractItemView::MultiSelection);
70  layout->addWidget (m_listIncluded, row, 0, 4, 1);
71  connect (m_listIncluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListIncluded()));
72 
73  m_listExcluded = new QListWidget;
74  m_listExcluded->setWhatsThis (tr ("List of curves to be excluded from the exported file"));
75  m_listExcluded->setSelectionMode (QAbstractItemView::MultiSelection);
76  layout->addWidget (m_listExcluded, row++, 2, 4, 1);
77  connect (m_listExcluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListExcluded()));
78 
79  m_btnInclude = new QPushButton (tr ("<<Include"));
80  m_btnInclude->setEnabled (false);
81  m_btnInclude->setWhatsThis (tr ("Move the currently selected curve(s) from the excluded list"));
82  layout->addWidget (m_btnInclude, row++, 1);
83  connect (m_btnInclude, SIGNAL (released ()), this, SLOT (slotInclude()));
84 
85  m_btnExclude = new QPushButton (tr ("Exclude>"));
86  m_btnExclude->setEnabled (false);
87  m_btnExclude->setWhatsThis (tr ("Move the currently selected curve(s) from the included list"));
88  layout->addWidget (m_btnExclude, row++, 1);
89  connect (m_btnExclude, SIGNAL (released ()), this, SLOT (slotExclude()));
90 
91  row++;
92 }
93 
94 void DlgSettingsExportFormat::createDelimiters (QHBoxLayout *layoutMisc)
95 {
96  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createDelimiters";
97 
98  QGroupBox *groupDelimiters = new QGroupBox (tr ("Delimiters"));
99  layoutMisc->addWidget (groupDelimiters, 1);
100 
101  QVBoxLayout *layoutDelimiters = new QVBoxLayout;
102  groupDelimiters->setLayout (layoutDelimiters);
103 
104  m_btnDelimitersCommas = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_COMMA));
105  m_btnDelimitersCommas->setWhatsThis (tr ("Exported file will have commas between adjacent values"));
106  layoutDelimiters->addWidget (m_btnDelimitersCommas);
107  connect (m_btnDelimitersCommas, SIGNAL (released ()), this, SLOT (slotDelimitersCommas()));
108 
109  m_btnDelimitersSpaces = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_SPACE));
110  m_btnDelimitersSpaces->setWhatsThis (tr ("Exported file will have spaces between adjacent values"));
111  layoutDelimiters->addWidget (m_btnDelimitersSpaces);
112  connect (m_btnDelimitersSpaces, SIGNAL (released ()), this, SLOT (slotDelimitersSpaces()));
113 
114  m_btnDelimitersTabs = new QRadioButton (exportDelimiterToString (EXPORT_DELIMITER_TAB));
115  m_btnDelimitersTabs->setWhatsThis (tr ("Exported file will have tabs between adjacent values"));
116  layoutDelimiters->addWidget (m_btnDelimitersTabs);
117  connect (m_btnDelimitersTabs, SIGNAL (released ()), this, SLOT (slotDelimitersTabs()));
118 }
119 
120 void DlgSettingsExportFormat::createFileLayout (QHBoxLayout *layoutMisc)
121 {
122  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createFileLayout";
123 
124  QGroupBox *groupLayout = new QGroupBox (tr ("Layout"));
125  layoutMisc->addWidget (groupLayout, 1);
126 
127  QVBoxLayout *layoutLayout = new QVBoxLayout;
128  groupLayout->setLayout (layoutLayout);
129 
130  m_btnFunctionsLayoutAllCurves = new QRadioButton (tr ("All curves on each line"));
131  m_btnFunctionsLayoutAllCurves->setWhatsThis (tr ("Exported file will have, on each line, "
132  "an X value, the Y value for the first curve, the Y value for the second curve,..."));
133  layoutLayout->addWidget (m_btnFunctionsLayoutAllCurves);
134  connect (m_btnFunctionsLayoutAllCurves, SIGNAL (released()), this, SLOT (slotFunctionsLayoutAllCurves ()));
135 
136  m_btnFunctionsLayoutOneCurve = new QRadioButton (tr ("One curve on each line"));
137  m_btnFunctionsLayoutOneCurve->setWhatsThis (tr ("Exported file will have all the points for "
138  "the first curve, with one X-Y pair on each line, then the points for the second curve,..."));
139  layoutLayout->addWidget (m_btnFunctionsLayoutOneCurve);
140  connect (m_btnFunctionsLayoutOneCurve, SIGNAL (released()), this, SLOT (slotFunctionsLayoutOneCurve ()));
141 }
142 
143 void DlgSettingsExportFormat::createFunctionsPointsSelection (QHBoxLayout *layoutFunctions)
144 {
145  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createFunctionsPointsSelection";
146 
147  QGroupBox *groupPointsSelection = new QGroupBox (tr ("Points Selection"));
148  layoutFunctions->addWidget (groupPointsSelection, 1);
149 
150  QGridLayout *layoutPointsSelections = new QGridLayout;
151  groupPointsSelection->setLayout (layoutPointsSelections);
152 
153  layoutPointsSelections->setColumnMinimumWidth(0, MIN_INDENT_COLUMN_WIDTH);
154  layoutPointsSelections->setColumnStretch (0, 0);
155  layoutPointsSelections->setColumnStretch (1, 0);
156  layoutPointsSelections->setColumnStretch (2, 0);
157  layoutPointsSelections->setColumnStretch (3, 1);
158 
159  int row = 0;
160  m_btnFunctionsPointsAllCurves = new QRadioButton (tr ("Interpolate Ys at Xs from all curves"));
161  m_btnFunctionsPointsAllCurves->setWhatsThis (tr ("Exported file will have values at every unique X "
162  "value from every curve. Y values will be linearly interpolated if necessary"));
163  layoutPointsSelections->addWidget (m_btnFunctionsPointsAllCurves, row++, 0, 1, 4);
164  connect (m_btnFunctionsPointsAllCurves, SIGNAL (released()), this, SLOT (slotFunctionsPointsAllCurves()));
165 
166  m_btnFunctionsPointsFirstCurve = new QRadioButton (tr ("Interpolate Ys at Xs from first curve"));
167  m_btnFunctionsPointsFirstCurve->setWhatsThis (tr ("Exported file will have values at every unique X "
168  "value from the first curve. Y values will be linearly interpolated if necessary"));
169  layoutPointsSelections->addWidget (m_btnFunctionsPointsFirstCurve, row++, 0, 1, 4);
170  connect (m_btnFunctionsPointsFirstCurve, SIGNAL (released()), this, SLOT (slotFunctionsPointsFirstCurve()));
171 
172  m_btnFunctionsPointsEvenlySpaced = new QRadioButton (tr ("Interpolate Ys at evenly spaced X values."));
173  m_btnFunctionsPointsEvenlySpaced->setWhatsThis (tr ("Exported file will have values at evenly spaced X values, separated by the interval selected below."));
174  layoutPointsSelections->addWidget (m_btnFunctionsPointsEvenlySpaced, row++, 0, 1, 4);
175  connect (m_btnFunctionsPointsEvenlySpaced, SIGNAL (released()), this, SLOT (slotFunctionsPointsEvenlySpaced()));
176 
177  QLabel *labelInterval = new QLabel ("Interval:");
178  layoutPointsSelections->addWidget (labelInterval, row, 1, 1, 1, Qt::AlignRight);
179 
180  m_editFunctionsPointsEvenlySpacing = new QLineEdit;
181  m_validatorFunctionsPointsEvenlySpacing = new QDoubleValidator; // Minimum value, to prevent overflow, is set later according to settings
182  m_editFunctionsPointsEvenlySpacing->setValidator (m_validatorFunctionsPointsEvenlySpacing);
183  m_editFunctionsPointsEvenlySpacing->setMinimumWidth (MIN_EDIT_WIDTH);
184  m_editFunctionsPointsEvenlySpacing->setMaximumWidth (MAX_EDIT_WIDTH);
185  m_editFunctionsPointsEvenlySpacing->setWhatsThis (tr ("Interval, in the units of X, between successive points in the X direction.\n\n"
186  "If the scale is linear, then this interval is added to successive X values. If the scale is "
187  "logarithmic, then this interval is multiplied to successive X values.\n\n"
188  "The X values will be automatically aligned along simple numbers. If the first and/or last "
189  "points are not along the aligned X values, then one or two additional points are added "
190  "as necessary."));
191  layoutPointsSelections->addWidget (m_editFunctionsPointsEvenlySpacing, row, 2, 1, 1, Qt::AlignLeft);
192  connect (m_editFunctionsPointsEvenlySpacing, SIGNAL (textChanged(const QString &)), this, SLOT (slotFunctionsPointsEvenlySpacedInterval(const QString &)));
193 
194  m_cmbFunctionsPointsEvenlySpacingUnits = new QComboBox;
195  m_cmbFunctionsPointsEvenlySpacingUnits->setWhatsThis ("Units for spacing interval.\n\n"
196  "Pixel units are preferred when the spacing is to be independent of the X scale. The spacing will be "
197  "consistent across the graph, even if the X scale is logarithmic.\n\n"
198  "Graph units are preferred when the spacing is to depend on the X scale.");
199  m_cmbFunctionsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_GRAPH),
200  QVariant (EXPORT_POINTS_INTERVAL_UNITS_GRAPH));
201  m_cmbFunctionsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_SCREEN),
202  QVariant (EXPORT_POINTS_INTERVAL_UNITS_SCREEN));
203  connect (m_cmbFunctionsPointsEvenlySpacingUnits, SIGNAL (activated (const QString &)),
204  this, SLOT (slotFunctionsPointsEvenlySpacedIntervalUnits (const QString &))); // activated() ignores code changes
205  layoutPointsSelections->addWidget (m_cmbFunctionsPointsEvenlySpacingUnits, row++, 3, 1, 1, Qt::AlignLeft);
206 
207  m_btnFunctionsPointsRaw = new QRadioButton (tr ("Raw Xs and Ys"));
208  m_btnFunctionsPointsRaw->setWhatsThis (tr ("Exported file will have only original X and Y values"));
209  layoutPointsSelections->addWidget (m_btnFunctionsPointsRaw, row++, 0, 1, 4);
210  connect (m_btnFunctionsPointsRaw, SIGNAL (released()), this, SLOT (slotFunctionsPointsRaw()));
211 }
212 
213 void DlgSettingsExportFormat::createHeader (QHBoxLayout *layoutMisc)
214 {
215  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createHeader";
216 
217  const int COLUMN_RADIO_BUTTONS = 0, COLUMN_EMPTY = 1, COLUMN_LABEL = 2;
218 
219  QGroupBox *groupHeader = new QGroupBox (tr ("Header"));
220  layoutMisc->addWidget (groupHeader, 1);
221 
222  QGridLayout *layoutHeader = new QGridLayout;
223  layoutHeader->setColumnMinimumWidth(COLUMN_EMPTY,
224  MIN_HEADER_EMPTY_COLUMN_WIDTH);
225  groupHeader->setLayout (layoutHeader);
226  int row = 0;
227 
228  m_btnHeaderNone = new QRadioButton (exportHeaderToString (EXPORT_HEADER_NONE));
229  m_btnHeaderNone->setWhatsThis (tr ("Exported file will have no header line"));
230  layoutHeader->addWidget (m_btnHeaderNone, row++, COLUMN_RADIO_BUTTONS, 1, 1);
231  connect (m_btnHeaderNone, SIGNAL (released ()), this, SLOT (slotHeaderNone()));
232 
233  m_btnHeaderSimple = new QRadioButton (exportHeaderToString (EXPORT_HEADER_SIMPLE));
234  m_btnHeaderSimple->setWhatsThis (tr ("Exported file will have simple header line"));
235  layoutHeader->addWidget (m_btnHeaderSimple, row++, COLUMN_RADIO_BUTTONS, 1, 1);
236  connect (m_btnHeaderSimple, SIGNAL (released ()), this, SLOT (slotHeaderSimple()));
237 
238  m_btnHeaderGnuplot = new QRadioButton (exportHeaderToString (EXPORT_HEADER_GNUPLOT));
239  m_btnHeaderGnuplot->setWhatsThis (tr ("Exported file will have gnuplot header line"));
240  layoutHeader->addWidget (m_btnHeaderGnuplot, row++, COLUMN_RADIO_BUTTONS, 1, 1);
241  connect (m_btnHeaderGnuplot, SIGNAL (released()), this, SLOT (slotHeaderGnuplot()));
242 
243  createXLabel (layoutHeader,
244  COLUMN_LABEL);
245 }
246 
247 void DlgSettingsExportFormat::createPreview(QGridLayout *layout, int &row)
248 {
249  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createPreview";
250 
251  QLabel *label = new QLabel (tr ("Preview"));
252  layout->addWidget (label, row++, 0, 1, 3);
253 
254  m_editPreview = new QTextEdit;
255  m_editPreview->setReadOnly (true);
256  m_editPreview->setWhatsThis (tr ("Preview window shows how current settings affect the exported file"));
257  m_editPreview->setMinimumHeight (MINIMUM_PREVIEW_HEIGHT);
258 
259  layout->addWidget (m_editPreview, row++, 0, 1, 3);
260 }
261 
262 void DlgSettingsExportFormat::createRelationsPointsSelection (QHBoxLayout *layoutRelations)
263 {
264  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createRelationsPointsSelection";
265 
266  QGroupBox *groupPointsSelection = new QGroupBox (tr ("Points Selection"));
267  layoutRelations->addWidget (groupPointsSelection);
268 
269  QGridLayout *layoutPointsSelections = new QGridLayout;
270  groupPointsSelection->setLayout (layoutPointsSelections);
271 
272  layoutPointsSelections->setColumnMinimumWidth(0, MIN_INDENT_COLUMN_WIDTH);
273  layoutPointsSelections->setColumnStretch (0, 0);
274  layoutPointsSelections->setColumnStretch (1, 0);
275  layoutPointsSelections->setColumnStretch (2, 0);
276  layoutPointsSelections->setColumnStretch (3, 1);
277 
278  int row = 0;
279  m_btnRelationsPointsEvenlySpaced = new QRadioButton (tr ("Interpolate Xs and Ys at evenly spaced intervals."));
280  m_btnRelationsPointsEvenlySpaced->setWhatsThis (tr ("Exported file will have points evenly spaced along each relation, separated by the interval "
281  "selected below. If the last interval does not end at the last point, then a shorter last interval "
282  "is added that ends on the last point."));
283  layoutPointsSelections->addWidget (m_btnRelationsPointsEvenlySpaced, row++, 0, 1, 4);
284  connect (m_btnRelationsPointsEvenlySpaced, SIGNAL (released()), this, SLOT (slotRelationsPointsEvenlySpaced()));
285 
286  QLabel *labelInterval = new QLabel ("Interval:");
287  layoutPointsSelections->addWidget (labelInterval, row, 1, 1, 1, Qt::AlignRight);
288 
289  m_editRelationsPointsEvenlySpacing = new QLineEdit;
290  m_validatorRelationsPointsEvenlySpacing = new QDoubleValidator; // Minimum value, to prevent overflow, is set later according to settings
291  m_editRelationsPointsEvenlySpacing->setValidator (m_validatorRelationsPointsEvenlySpacing);
292  m_editRelationsPointsEvenlySpacing->setMinimumWidth (MIN_EDIT_WIDTH);
293  m_editRelationsPointsEvenlySpacing->setMaximumWidth (MAX_EDIT_WIDTH);
294  m_editRelationsPointsEvenlySpacing->setWhatsThis (tr ("Interval between successive points when "
295  "exporting at evenly spaced (X,Y) coordinates."));
296  layoutPointsSelections->addWidget (m_editRelationsPointsEvenlySpacing, row, 2, 1, 1, Qt::AlignLeft);
297  connect (m_editRelationsPointsEvenlySpacing, SIGNAL (textChanged(const QString &)), this, SLOT (slotRelationsPointsEvenlySpacedInterval(const QString &)));
298 
299  m_cmbRelationsPointsEvenlySpacingUnits = new QComboBox;
300  m_cmbRelationsPointsEvenlySpacingUnits->setWhatsThis ("Units for spacing interval.\n\n"
301  "Pixel units are preferred when the spacing is to be independent of the X and Y scales. The spacing will be "
302  "consistent across the graph, even if a scale is logarithmic or the X and Y scales are different.\n\n"
303  "Graph units are usually preferred when the X and Y scales are identical.");
304  m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_GRAPH),
305  QVariant (EXPORT_POINTS_INTERVAL_UNITS_GRAPH));
306  m_cmbRelationsPointsEvenlySpacingUnits->addItem(exportPointsIntervalUnitsToString (EXPORT_POINTS_INTERVAL_UNITS_SCREEN),
307  QVariant (EXPORT_POINTS_INTERVAL_UNITS_SCREEN));
308  connect (m_cmbRelationsPointsEvenlySpacingUnits, SIGNAL (activated (const QString &)),
309  this, SLOT (slotRelationsPointsEvenlySpacedIntervalUnits (const QString &))); // activated() ignores code changes
310  layoutPointsSelections->addWidget (m_cmbRelationsPointsEvenlySpacingUnits, row++, 3, 1, 1, Qt::AlignLeft);
311 
312  m_btnRelationsPointsRaw = new QRadioButton (tr ("Raw Xs and Ys"));
313  m_btnRelationsPointsRaw->setWhatsThis (tr ("Exported file will have only original X and Y values"));
314  layoutPointsSelections->addWidget (m_btnRelationsPointsRaw, row++, 0, 1, 4);
315  connect (m_btnRelationsPointsRaw, SIGNAL (released()), this, SLOT (slotRelationsPointsRaw()));
316 }
317 
319 {
320  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";
321 
322  QWidget *subPanel = new QWidget ();
323  QGridLayout *layout = new QGridLayout (subPanel);
324  subPanel->setLayout (layout);
325 
326  int row = 0;
327  createCurveSelection (layout, row);
328 
329  createTabWidget (layout,
330  row);
331 
332  QWidget *widgetMisc = new QWidget;
333  layout->addWidget (widgetMisc, row++, 0, 1, 3);
334  QHBoxLayout *layoutMisc = new QHBoxLayout;
335  widgetMisc->setLayout (layoutMisc);
336 
337  createDelimiters (layoutMisc); // One row of radio buttons
338  createHeader (layoutMisc); // Two rows with radio buttons and then header label
339  createFileLayout (layoutMisc); // One row of radio buttons
340 
341  createPreview (layout, row);
342 
343  return subPanel;
344 }
345 
346 void DlgSettingsExportFormat::createTabWidget (QGridLayout *layout,
347  int &row)
348 {
349  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createTabWidget";
350 
351  m_tabWidget = new QTabWidget;
352  // This gets connected below, after the tabs have been added
353  layout->addWidget (m_tabWidget, row++, 0, 1, 3);
354 
355  QWidget *widgetFunctions = new QWidget;
356  int indexFunctions = m_tabWidget->addTab (widgetFunctions, tr ("Functions"));
357  QWidget *tabFunctions = m_tabWidget->widget (indexFunctions);
358  tabFunctions->setWhatsThis (tr ("Functions Tab\n\n"
359  "Controls for specifying the format of functions during export"));
360  QHBoxLayout *layoutFunctions = new QHBoxLayout;
361  widgetFunctions->setLayout (layoutFunctions);
362 
363  QWidget *widgetRelations = new QWidget;
364  int indexRelations = m_tabWidget->addTab (widgetRelations, tr ("Relations"));
365  QWidget *tabRelations = m_tabWidget->widget (indexRelations);
366  tabRelations->setWhatsThis (tr ("Relations Tab\n\n"
367  "Controls for specifying the format of relations during export"));
368  QHBoxLayout *layoutRelations = new QHBoxLayout;
369  widgetRelations->setLayout (layoutRelations);
370 
371  // Now that the tabs have been added we can connect this signal
372  connect (m_tabWidget, SIGNAL (currentChanged (int)), this, SLOT (slotTabChanged (int)));
373 
374  createFunctionsPointsSelection (layoutFunctions);
375  createRelationsPointsSelection (layoutRelations);
376 }
377 
378 void DlgSettingsExportFormat::createXLabel (QGridLayout *layoutHeader,
379  int colLabel)
380 {
381  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createXLabel";
382 
383  int row = 1; // Skip first row
384 
385  QLabel *title;
386  if (true) {
387  title = new QLabel (tr ("X Label:"));
388  } else {
389  title = new QLabel (tr ("Theta Label:"));
390  }
391  layoutHeader->addWidget (title, row++, colLabel, 1, 1);
392 
393  m_editXLabel = new QLineEdit;
394  if (true) {
395  m_editXLabel->setWhatsThis (tr ("Label in the header for x values"));
396  } else {
397  m_editXLabel->setWhatsThis (tr ("Label in the header for theta values"));
398  }
399  layoutHeader->addWidget (m_editXLabel, row++, colLabel, 1, 1);
400  connect (m_editXLabel, SIGNAL (textChanged (const QString &)), this, SLOT (slotXLabel(const QString &)));
401 }
402 
403 bool DlgSettingsExportFormat::goodIntervalFunctions() const
404 {
405  QString textFunctions = m_editFunctionsPointsEvenlySpacing->text();
406  int posFunctions;
407 
408  bool isGood = (m_validatorFunctionsPointsEvenlySpacing->validate (textFunctions, posFunctions) == QValidator::Acceptable);
409 
410  return isGood;
411 }
412 
413 bool DlgSettingsExportFormat::goodIntervalRelations() const
414 {
415  QString textRelations = m_editRelationsPointsEvenlySpacing->text();
416  int posRelations;
417 
418  return (m_validatorRelationsPointsEvenlySpacing->validate (textRelations, posRelations) == QValidator::Acceptable);
419 }
420 
422 {
423  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk";
424 
426  cmdMediator ().document(),
427  *m_modelExportBefore,
428  *m_modelExportAfter);
429  cmdMediator ().push (cmd);
430 
431  hide ();
432 }
433 
434 void DlgSettingsExportFormat::initializeIntervalConstraints ()
435 {
436  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::initializeIntervalConstraints";
437 
438  const int MAX_POINTS_ACROSS_RANGE = 1000;
439 
440  // Get min and max of graph and screen coordinates
441  CallbackBoundingRects ftor (mainWindow().transformation());
442 
443  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
445  cmdMediator().iterateThroughCurvesPointsGraphs (ftorWithCallback);
446 
447  // If there are no points, then interval will be zero. That special case must be handled downstream to prevent infinite loops
448  bool isEmpty;
449  double maxSizeGraph = qMax (ftor.boundingRectGraph(isEmpty).width(),
450  ftor.boundingRectGraph(isEmpty).height());
451  double maxSizeScreen = qMax (ftor.boundingRectScreen(isEmpty).width(),
452  ftor.boundingRectScreen(isEmpty).height());
453  m_minIntervalGraph = maxSizeGraph / MAX_POINTS_ACROSS_RANGE;
454  m_minIntervalScreen = maxSizeScreen / MAX_POINTS_ACROSS_RANGE;
455 }
456 
458 {
459  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::load";
460 
461  setCmdMediator (cmdMediator);
462 
463  // Flush old data
464  if (m_modelExportBefore != 0) {
465  delete m_modelExportBefore;
466  }
467  if (m_modelExportAfter != 0) {
468  delete m_modelExportAfter;
469  }
470 
471  // Save new data
472  m_modelExportBefore = new DocumentModelExportFormat (cmdMediator.document());
473  m_modelExportAfter = new DocumentModelExportFormat (cmdMediator.document());
474 
475  // Populate controls. First load excluded curves
476  m_listExcluded->clear();
477  QStringList curveNamesExcluded = m_modelExportAfter->curveNamesNotExported();
478  QStringList::const_iterator itr;
479  for (itr = curveNamesExcluded.begin (); itr != curveNamesExcluded.end(); ++itr) {
480  QString curveNameNotExported = *itr;
481  m_listExcluded->addItem (curveNameNotExported);
482  }
483 
484  // Include curves that are not excluded
485  m_listIncluded->clear();
486  QStringList curveNamesAll = cmdMediator.document().curvesGraphsNames();
487  for (itr = curveNamesAll.begin (); itr != curveNamesAll.end(); itr++) {
488  QString curveName = *itr;
489  if (!curveNamesExcluded.contains (curveName)) {
490  m_listIncluded->addItem (curveName);
491  }
492  }
493 
494  ExportPointsSelectionFunctions pointsSelectionFunctions = m_modelExportAfter->pointsSelectionFunctions();
495  m_btnFunctionsPointsAllCurves->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
496  m_btnFunctionsPointsFirstCurve->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
497  m_btnFunctionsPointsEvenlySpaced->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
498  m_btnFunctionsPointsRaw->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
499 
500  ExportLayoutFunctions layoutFunctions = m_modelExportAfter->layoutFunctions ();
501  m_btnFunctionsLayoutAllCurves->setChecked (layoutFunctions == EXPORT_LAYOUT_ALL_PER_LINE);
502  m_btnFunctionsLayoutOneCurve->setChecked (layoutFunctions == EXPORT_LAYOUT_ONE_PER_LINE);
503 
504  ExportPointsSelectionRelations pointsSelectionRelations = m_modelExportAfter->pointsSelectionRelations();
505  m_btnRelationsPointsEvenlySpaced->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
506  m_btnRelationsPointsRaw->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_RAW);
507 
508  ExportDelimiter delimiter = m_modelExportAfter->delimiter ();
509  m_btnDelimitersCommas->setChecked (delimiter == EXPORT_DELIMITER_COMMA);
510  m_btnDelimitersSpaces->setChecked (delimiter == EXPORT_DELIMITER_SPACE);
511  m_btnDelimitersTabs->setChecked (delimiter == EXPORT_DELIMITER_TAB);
512 
513  ExportHeader header = m_modelExportAfter->header ();
514  m_btnHeaderNone->setChecked (header == EXPORT_HEADER_NONE);
515  m_btnHeaderSimple->setChecked (header == EXPORT_HEADER_SIMPLE);
516  m_btnHeaderGnuplot->setChecked (header == EXPORT_HEADER_GNUPLOT);
517 
518  m_editXLabel->setText (m_modelExportAfter->xLabel());
519  m_editFunctionsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalFunctions()));
520  m_editRelationsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalRelations()));
521 
522  ExportPointsIntervalUnits pointsIntervalUnitsFunctions = m_modelExportAfter->pointsIntervalUnitsRelations();
523  ExportPointsIntervalUnits pointsIntervalUnitsRelations = m_modelExportAfter->pointsIntervalUnitsRelations();
524  int indexFunctions = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsFunctions));
525  int indexRelations = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsRelations));
526  m_cmbFunctionsPointsEvenlySpacingUnits->setCurrentIndex (indexFunctions);
527  m_cmbRelationsPointsEvenlySpacingUnits->setCurrentIndex (indexRelations);
528 
529  initializeIntervalConstraints ();
530 
531  updateControls();
532  updateIntervalConstraints();
533  enableOk (false); // Disable Ok button since there not yet any changes
534  updatePreview();
535 }
536 
537 void DlgSettingsExportFormat::slotDelimitersCommas()
538 {
539  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersCommas";
540 
541  m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_COMMA);
542  updateControls();
543  updatePreview();
544 }
545 
546 void DlgSettingsExportFormat::slotDelimitersSpaces()
547 {
548  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersSpaces";
549 
550  m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_SPACE);
551  updateControls();
552  updatePreview();
553 }
554 
555 void DlgSettingsExportFormat::slotDelimitersTabs()
556 {
557  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotDelimitersTabs";
558 
559  m_modelExportAfter->setDelimiter(EXPORT_DELIMITER_TAB);
560  updateControls();
561  updatePreview();
562 }
563 
564 void DlgSettingsExportFormat::slotExclude ()
565 {
566  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotExclude";
567 
568  // Perform forward pass to get excluded curves in the proper order
569  int i;
570  QStringList excluded;
571  for (i = 0; i < m_listIncluded->count(); i++) {
572  if (m_listIncluded->item(i)->isSelected()) {
573  excluded += m_listIncluded->item(i)->text();
574  }
575  }
576 
577  // Add the excluded curves to the excluded list
578  for (i = 0; i < excluded.count(); i++) {
579  QString curveName = excluded.at (i);
580  m_listExcluded->addItem (curveName);
581  }
582 
583  // Perform backwards pass to remove the excluded curves from the included list
584  for (i = m_listIncluded->count() - 1; i>= 0; i--) {
585  QString curveName = m_listIncluded->item(i)->text();
586  if (excluded.contains (curveName)) {
587  QListWidgetItem *item = m_listIncluded->item (i);
588  m_listIncluded->removeItemWidget (item);
589  delete item;
590  }
591  }
592 
593  m_modelExportAfter->setCurveNamesNotExported(excluded);
594  updateControls();
595  updatePreview();
596 }
597 
598 void DlgSettingsExportFormat::slotFunctionsLayoutAllCurves()
599 {
600  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsLayoutAllCurves";
601 
602  m_modelExportAfter->setLayoutFunctions(EXPORT_LAYOUT_ALL_PER_LINE);
603  updateControls();
604  updatePreview();
605 }
606 
607 void DlgSettingsExportFormat::slotFunctionsLayoutOneCurve()
608 {
609  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsLayoutOneCurve";
610 
611  m_modelExportAfter->setLayoutFunctions(EXPORT_LAYOUT_ONE_PER_LINE);
612  updateControls();
613  updatePreview();
614 }
615 
616 void DlgSettingsExportFormat::slotFunctionsPointsAllCurves()
617 {
618  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsAllCurves";
619 
620  m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
621  updateControls();
622  updatePreview();
623 }
624 
625 void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpaced()
626 {
627  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpaced";
628 
629  m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
630  updateControls();
631  updatePreview();
632 }
633 
634 void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedInterval(const QString &)
635 {
636  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedInterval";
637 
638  // Prevent infinite loop on empty and "-" values which get treated as zero interval
639  if (goodIntervalFunctions()) {
640  m_modelExportAfter->setPointsIntervalFunctions(m_editFunctionsPointsEvenlySpacing->text().toDouble());
641  updateControls();
642  updatePreview();
643  } else {
644  m_editPreview->setText(EMPTY_PREVIEW);
645  }
646 }
647 
648 void DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedIntervalUnits(const QString &)
649 {
650  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsEvenlySpacedIntervalUnits";
651 
652  int index = m_cmbFunctionsPointsEvenlySpacingUnits->currentIndex();
653  ExportPointsIntervalUnits units = (ExportPointsIntervalUnits) m_cmbFunctionsPointsEvenlySpacingUnits->itemData (index).toInt();
654 
655  m_modelExportAfter->setPointsIntervalUnitsFunctions(units);
656  updateIntervalConstraints(); // Call this before updateControls so constraint checking is updated for ok button
657  updateControls();
658  updatePreview();
659 }
660 
661 void DlgSettingsExportFormat::slotFunctionsPointsFirstCurve()
662 {
663  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsFirstCurve";
664 
665  m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
666  updateControls();
667  updatePreview();
668 }
669 
670 void DlgSettingsExportFormat::slotFunctionsPointsRaw()
671 {
672  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotFunctionsPointsRaw";
673 
674  m_modelExportAfter->setPointsSelectionFunctions(EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
675  updateControls();
676  updatePreview();
677 }
678 
679 void DlgSettingsExportFormat::slotHeaderGnuplot()
680 {
681  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderGnuplot";
682 
683  m_modelExportAfter->setHeader(EXPORT_HEADER_GNUPLOT);
684  updateControls();
685  updatePreview();
686 }
687 
688 void DlgSettingsExportFormat::slotHeaderNone()
689 {
690  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderNone";
691 
692  m_modelExportAfter->setHeader(EXPORT_HEADER_NONE);
693  updateControls();
694  updatePreview();
695 }
696 
697 void DlgSettingsExportFormat::slotHeaderSimple()
698 {
699  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotHeaderSimple";
700 
701  m_modelExportAfter->setHeader(EXPORT_HEADER_SIMPLE);
702  updateControls();
703  updatePreview();
704 }
705 
706 void DlgSettingsExportFormat::slotInclude ()
707 {
708  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotInclude";
709 
710  // Perform forward pass to get included curves in the proper order
711  int i;
712  QStringList included;
713  for (i = 0; i < m_listExcluded->count(); i++) {
714  if (m_listExcluded->item(i)->isSelected()) {
715  included += m_listExcluded->item(i)->text();
716  }
717  }
718 
719  // Add the included curves to the included list
720  for (i = 0; i < included.count(); i++) {
721  QString curveName = included.at (i);
722  m_listIncluded->addItem (curveName);
723  }
724 
725  // Perform backwards pass to remove the included curves from the excluded list
726  QStringList excluded;
727  for (i = m_listExcluded->count() - 1; i>= 0; i--) {
728  QString curveName = m_listExcluded->item(i)->text();
729  QListWidgetItem *item = m_listExcluded->item (i);
730  if (included.contains (curveName)) {
731  m_listExcluded->removeItemWidget (item);
732  delete item;
733  } else {
734  excluded += item->text();
735  }
736  }
737 
738  m_modelExportAfter->setCurveNamesNotExported(excluded);
739  updateControls();
740  updatePreview();
741 }
742 
743 void DlgSettingsExportFormat::slotListExcluded()
744 {
745  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotListExcluded";
746 
747  updateControls();
748  // Do not call updatePreview since this method changes nothing
749 }
750 
751 void DlgSettingsExportFormat::slotListIncluded()
752 {
753  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotListIncluded";
754 
755  updateControls();
756  // Do not call updatePreview since this method changes nothing
757 }
758 
759 void DlgSettingsExportFormat::slotRelationsPointsEvenlySpaced()
760 {
761  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpaced";
762 
763  m_modelExportAfter->setPointsSelectionRelations(EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
764  updateControls();
765  updatePreview();
766 }
767 
768 void DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedInterval(const QString &)
769 {
770  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedInterval";
771 
772  m_modelExportAfter->setPointsIntervalRelations(m_editRelationsPointsEvenlySpacing->text().toDouble());
773  updateControls();
774  updatePreview();
775 }
776 
777 void DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedIntervalUnits(const QString &)
778 {
779  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsEvenlySpacedIntervalUnits";
780 
781  int index = m_cmbRelationsPointsEvenlySpacingUnits->currentIndex();
782  ExportPointsIntervalUnits units = (ExportPointsIntervalUnits) m_cmbRelationsPointsEvenlySpacingUnits->itemData (index).toInt();
783 
784  m_modelExportAfter->setPointsIntervalUnitsRelations(units);
785  updateIntervalConstraints(); // Call this before updateControls so constraint checking is updated for ok button
786  updateControls();
787  updatePreview();
788 }
789 
790 void DlgSettingsExportFormat::slotRelationsPointsRaw()
791 {
792  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotRelationsPointsRaw";
793 
794  m_modelExportAfter->setPointsSelectionRelations(EXPORT_POINTS_SELECTION_RELATIONS_RAW);
795  updateControls();
796  updatePreview();
797 }
798 
799 void DlgSettingsExportFormat::slotTabChanged (int)
800 {
801  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotTabChanged";
802 
803  updatePreview();
804 }
805 
806 void DlgSettingsExportFormat::slotXLabel(const QString &)
807 {
808  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::slotXLabel";
809 
810  m_modelExportAfter->setXLabel (m_editXLabel->text());
811  updateControls();
812  updatePreview();
813 }
814 
815 void DlgSettingsExportFormat::updateControls ()
816 {
817  bool isGoodState = goodIntervalFunctions() &&
818  goodIntervalRelations();
819  enableOk (isGoodState);
820 
821  m_listIncluded->sortItems (Qt::AscendingOrder);
822  m_listExcluded->sortItems (Qt::AscendingOrder);
823 
824  int selectedForInclude = m_listExcluded->selectedItems().count();
825  int selectedForExclude = m_listIncluded->selectedItems().count();
826  int inInclude = m_listIncluded->count();
827 
828  m_btnInclude->setEnabled (selectedForInclude > 0); // Need at least one selection
829  m_btnExclude->setEnabled ((selectedForExclude > 0) && (inInclude - selectedForExclude > 0)); // Need at least one selection, and one left after the move
830 
831  m_editFunctionsPointsEvenlySpacing->setEnabled (m_btnFunctionsPointsEvenlySpaced->isChecked ());
832  m_editRelationsPointsEvenlySpacing->setEnabled (m_btnRelationsPointsEvenlySpaced->isChecked ());
833 
834  m_editXLabel->setEnabled (!m_btnHeaderNone->isChecked());
835 }
836 
837 void DlgSettingsExportFormat::updateIntervalConstraints ()
838 {
839  double functionsMin = (m_modelExportAfter->pointsIntervalUnitsFunctions() == EXPORT_POINTS_INTERVAL_UNITS_GRAPH ?
840  m_minIntervalGraph :
841  m_minIntervalScreen);
842  double relationsMin = (m_modelExportAfter->pointsIntervalUnitsRelations() == EXPORT_POINTS_INTERVAL_UNITS_GRAPH ?
843  m_minIntervalGraph :
844  m_minIntervalScreen);
845 
846  if (m_tabWidget->currentIndex() == TAB_WIDGET_INDEX_FUNCTIONS) {
847 
848  if (m_modelExportAfter->pointsIntervalFunctions() < functionsMin) {
849 
850  m_editFunctionsPointsEvenlySpacing->setText (QString::number (functionsMin));
851 
852  }
853 
854  m_validatorFunctionsPointsEvenlySpacing->setBottom (functionsMin);
855 
856  } else {
857 
858  if (m_modelExportAfter->pointsIntervalRelations() < relationsMin) {
859 
860  m_editRelationsPointsEvenlySpacing->setText (QString::number (relationsMin));
861  m_validatorFunctionsPointsEvenlySpacing->setBottom (relationsMin);
862 
863  }
864 
865  m_validatorRelationsPointsEvenlySpacing->setBottom (relationsMin);
866  }
867 }
868 
869 void DlgSettingsExportFormat::updatePreview()
870 {
871  // Save the scroll position for continuity before and after the preview update
872  int scrollPosition = m_editPreview->verticalScrollBar()->value();
873 
874  QString exportedText;
875  QTextStream str (&exportedText);
876 
877  if (mainWindow().transformation().transformIsDefined()) {
878 
879  // Transformaiton is defined so we can create a preview
880  if (m_tabWidget->currentIndex() == TAB_WIDGET_INDEX_FUNCTIONS) {
881 
882  ExportFileFunctions exportStrategy;
883  exportStrategy.exportToFile (*m_modelExportAfter,
884  cmdMediator().document(),
885  mainWindow().transformation(),
886  str);
887 
888  } else {
889 
890  ExportFileRelations exportStrategy;
891  exportStrategy.exportToFile (*m_modelExportAfter,
892  cmdMediator().document(),
893  mainWindow().transformation(),
894  str);
895 
896  }
897  } else {
898 
899  str << "Preview is unavailable until axis points are defined.";
900  }
901 
902  m_editPreview->setText (exportedText);
903 
904  // Restore scroll position
905  m_editPreview->verticalScrollBar()->setValue (scrollPosition);
906 }
void setPointsSelectionFunctions(ExportPointsSelectionFunctions exportPointsSelectionFunctions)
Set method for point selection for functions.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
ExportPointsSelectionFunctions pointsSelectionFunctions() const
Get method for point selection for functions.
ExportLayoutFunctions layoutFunctions() const
Get method for functions layout.
ExportPointsIntervalUnits pointsIntervalUnitsRelations() const
Get method for points interval units for relations.
virtual void handleOk()
Process slotOk.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
ExportPointsIntervalUnits pointsIntervalUnitsFunctions() const
Get method for points interval units for functions.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
void setPointsSelectionRelations(ExportPointsSelectionRelations exportPointsSelectionRelations)
Set method for point selection for relations.
void setCurveNamesNotExported(const QStringList &curveNamesNotExported)
Set method for curve names not exported.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:61
void setDelimiter(ExportDelimiter exportDelimiter)
Set method for delimiter.
void setPointsIntervalFunctions(double pointsIntervalFunctions)
Set method for points interval for functions.
double pointsIntervalFunctions() const
Get method for points interval for functions.
ExportHeader header() const
Get method for header.
void setLayoutFunctions(ExportLayoutFunctions exportLayoutFunctions)
Set method for functions layout.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
QString xLabel() const
Get method for x label.
void setPointsIntervalUnitsFunctions(ExportPointsIntervalUnits pointsIntervalUnitsFunctions)
Set method for points interval units for functions.
ExportDelimiter delimiter() const
Get method for delimiter.
QStringList curveNamesNotExported() const
Get method for curve names not exported.
void setPointsIntervalRelations(double pointsIntervalRelations)
Set method for relations interval for relations.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
double pointsIntervalRelations() const
Get method for relations interval for relations.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: Document.cpp:317
void finishPanel(QWidget *subPanel)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
Command queue stack.
Definition: CmdMediator.h:16
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
void setPointsIntervalUnitsRelations(ExportPointsIntervalUnits pointsIntervalUnitsRelations)
Set method for points interval units for relations.
Abstract base class for all Settings dialogs.
void setHeader(ExportHeader exportHeader)
Set method for header.
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Definition: CmdMediator.cpp:86
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
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:60
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
ExportPointsSelectionRelations pointsSelectionRelations() const
Get method for point selection for relations.
Command for DlgSettingsExportFormat.
void setXLabel(const QString &xLabel)
Set method for x label.
DlgSettingsExportFormat(MainWindow &mainWindow)
Single constructor.