Engauge Digitizer  2
DlgSettingsCurveAddRemove.cpp
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 "CmdMediator.h"
8 #include "CmdSettingsCurveAddRemove.h"
9 #include "CurveNameList.h"
10 #include "DlgSettingsCurveAddRemove.h"
11 #include "EngaugeAssert.h"
12 #include "Logger.h"
13 #include "MainWindow.h"
14 #include <QCheckBox>
15 #include <QDebug>
16 #include <QGridLayout>
17 #include <QLabel>
18 #include <QListView>
19 #include <QMessageBox>
20 #include <QPushButton>
21 #include <QSettings>
22 #include <QSpacerItem>
23 #include <QTableView>
24 #include <QTextStream>
25 #include "QtToString.h"
26 #include "Settings.h"
27 #include "SettingsForGraph.h"
28 
29 const int MINIMUM_HEIGHT = 500;
30 
32  DlgSettingsAbstractBase (tr ("Curve Add/Remove"),
33  "DlgSettingsCurveAddRemove",
34  mainWindow),
35  m_curveNameList (0)
36 {
37  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::DlgSettingsCurveAddRemove";
38 
39  QWidget *subPanel = createSubPanel ();
40  finishPanel (subPanel);
41 }
42 
43 DlgSettingsCurveAddRemove::~DlgSettingsCurveAddRemove()
44 {
45  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::~DlgSettingsCurveAddRemove";
46 }
47 
48 void DlgSettingsCurveAddRemove::appendCurveName (const QString &curveNameNew,
49  const QString &curveNameOriginal,
50  int numPoints)
51 {
52  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::appendCurveName"
53  << " curve=" << curveNameNew.toLatin1().data();
54 
55  ENGAUGE_CHECK_PTR (m_curveNameList);
56 
57  int row = m_curveNameList->rowCount ();
58  insertCurveName (row,
59  curveNameNew,
60  curveNameOriginal,
61  numPoints);
62 }
63 
64 void DlgSettingsCurveAddRemove::createButtons (QGridLayout *layout,
65  int &row)
66 {
67  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::createButtons";
68 
69  m_btnAdd = new QPushButton (tr ("Add..."));
70  m_btnAdd->setWhatsThis (tr ("Adds a new curve to the curve list. The curve name can be edited in the curve name list.\n\n"
71  "Every curve name must be unique"));
72  m_btnAdd->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
73  connect (m_btnAdd, SIGNAL (released ()), this, SLOT (slotNew()));
74  layout->addWidget (m_btnAdd, row, 1, 1, 1, Qt::AlignLeft);
75 
76  m_btnRemove = new QPushButton (tr ("Remove"));
77  m_btnRemove->setWhatsThis (tr ("Removes the currently selected curve from the curve list.\n\n"
78  "There must always be at least one curve"));
79  m_btnRemove->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
80  connect (m_btnRemove, SIGNAL (released ()), this, SLOT (slotRemove()));
81  layout->addWidget (m_btnRemove, row++, 2, 1, 1, Qt::AlignRight);
82 }
83 
84 void DlgSettingsCurveAddRemove::createListCurves (QGridLayout *layout,
85  int &row)
86 {
87  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::createListCurves";
88 
89  QLabel *label = new QLabel (tr ("Curve Names:"));
90  layout->addWidget (label, row++, 1);
91 
92  // There is no Qt::ItemIsEditable flag for QListView, so instead we set that flag for the QListViewItems
93  m_listCurves = new QListView;
94  m_listCurves->setWhatsThis (tr ("List of the curves belonging to this document.\n\n"
95  "Click on a curve name to edit it. Each curve name must be unique.\n\n"
96  "Reorder curves by dragging them around."));
97  m_listCurves->setMinimumHeight (200);
98  m_listCurves->setSelectionBehavior (QAbstractItemView::SelectItems);
99  m_listCurves->setDragDropOverwriteMode (false);
100  m_listCurves->setSelectionMode (QAbstractItemView::SingleSelection);
101  m_listCurves->setDefaultDropAction (Qt::MoveAction);
102  m_listCurves->setDragDropOverwriteMode (false);
103  m_listCurves->setDragEnabled (true);
104  m_listCurves->setDropIndicatorShown (true); // Visible confirmation that each row can be dragged and dropped to move
105  m_listCurves->setDragDropMode (QAbstractItemView::InternalMove);
106  layout->addWidget (m_listCurves, row++, 1, 1, 2);
107 
108  m_curveNameList = new CurveNameList;
109  connect (m_curveNameList, SIGNAL (rowsAboutToBeRemoved (const QModelIndex &, int, int)),
110  this, SLOT (slotRowsAboutToBeRemoved (const QModelIndex &, int, int)));
111  connect (m_curveNameList, SIGNAL (dataChanged (const QModelIndex &, const QModelIndex &, const QVector<int> &)),
112  this, SLOT (slotDataChanged (const QModelIndex &, const QModelIndex &, const QVector<int> &)));
113 
114  m_listCurves->setModel (m_curveNameList);
115 }
116 
118 {
119  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::createOptionalSaveDefault";
120 
121  m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
122  m_btnSaveDefault->setWhatsThis (tr ("Save the curve names for use as defaults for future graph curves."));
123  connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
124  layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
125 
126  m_btnResetDefault = new QPushButton (tr ("Reset Default"));
127  m_btnResetDefault->setWhatsThis (tr ("Reset the defaults for future graph curves to the original settings."));
128  connect (m_btnResetDefault, SIGNAL (released ()), this, SLOT (slotResetDefault()));
129  layout->addWidget (m_btnResetDefault, 0, Qt::AlignRight);
130 
131  QSpacerItem *spacer = new QSpacerItem (40, 2);
132  layout->addItem (spacer);
133 }
134 
136 {
137  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::createSubPanel";
138 
139  const int EMPTY_COLUMN_WIDTH = 30;
140 
141  QWidget *subPanel = new QWidget ();
142  QGridLayout *layout = new QGridLayout (subPanel);
143  subPanel->setLayout (layout);
144 
145  int row = 1;
146  createListCurves (layout, row);
147  createButtons (layout, row);
148 
149  layout->setColumnStretch (0, 0); // Empty first column
150  layout->setColumnMinimumWidth (0, EMPTY_COLUMN_WIDTH);
151  layout->setColumnStretch (1, 1); // New
152  layout->setColumnStretch (2, 1); // Remove
153  layout->setColumnStretch (3, 0); // Empty last column
154  layout->setColumnMinimumWidth (3, EMPTY_COLUMN_WIDTH);
155 
156  return subPanel;
157 }
158 
159 bool DlgSettingsCurveAddRemove::endsWithNumber (const QString &str) const
160 {
161  bool success = false;
162 
163  if (!str.isEmpty ()) {
164 
165  success = (str.right (1).at (0).digitValue() >= 0);
166  }
167 
168  return success;
169 }
170 
172 {
173  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::handleOk";
174 
176  cmdMediator ().document(),
177  *m_curveNameList);
178  cmdMediator ().push (cmd);
179 
180  hide ();
181 }
182 
183 void DlgSettingsCurveAddRemove::insertCurveName (int row,
184  const QString &curveNameNew,
185  const QString &curveNameOriginal,
186  int numPoints)
187 {
188  // Track all entries
189  m_curveNameList->insertRow (row,
190  curveNameNew,
191  curveNameOriginal,
192  numPoints);
193 }
194 
196 {
197  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::load";
198 
199  setCmdMediator (cmdMediator);
200 
201  // Perform comprehensive clearing
202  m_listCurves->reset ();
203  m_curveNameList->reset ();
204 
205  QStringList curveNames = cmdMediator.curvesGraphsNames ();
206  QStringList::const_iterator itr;
207  for (itr = curveNames.begin (); itr != curveNames.end (); itr++) {
208  QString curveName = *itr;
209  appendCurveName (curveName,
210  curveName,
211  cmdMediator.curvesGraphsNumPoints (curveName));
212  }
213 
214  selectCurveName (curveNames.first());
215 
216  enableOk (false); // Disable Ok button since there not yet any changes
217 }
218 
219 int DlgSettingsCurveAddRemove::newRowFromSelection () const
220 {
221  int numSelectedItems = m_listCurves->selectionModel ()->selectedIndexes ().count ();
222  int numItems = m_listCurves->model ()->rowCount ();
223 
224  // Determine index where new entry will be inserted
225  int newRow = -1;
226  if ((numSelectedItems == 0) &&
227  (numItems > 0)) {
228 
229  // Append after list which has at least one entry
230  newRow = numItems;
231 
232  } else if (numSelectedItems == 1) {
233 
234  // Insert after the selected index
235  newRow = 1 + m_listCurves->selectionModel ()->selectedIndexes ().at (0).row ();
236 
237  }
238 
239  return newRow;
240 }
241 
242 QString DlgSettingsCurveAddRemove::nextCurveName () const
243 {
244  const QString DASH_ONE ("-1"); // Nice value to start a new range at a lower level than the current level
245 
246  ENGAUGE_CHECK_PTR (m_listCurves);
247 
248  int newRow = newRowFromSelection ();
249  int numItems = m_listCurves->model ()->rowCount ();
250 
251  // Curves names of existing before/after curves
252  QString curveNameBefore, curveNameAfter;
253  if (newRow > 0) {
254 
255  QModelIndex index = m_curveNameList->index (newRow - 1, 0);
256  curveNameBefore = m_curveNameList->data (index).toString ();
257 
258  }
259 
260  if ((0 <= newRow) && (newRow < numItems)) {
261 
262  QModelIndex index = m_curveNameList->index (newRow, 0);
263  curveNameAfter = m_curveNameList->data (index).toString ();
264 
265  }
266 
267  // New curve name computed from previous curve name
268  QString curveNameNext;
269  if (curveNameBefore.isEmpty () && !curveNameAfter.isEmpty () && endsWithNumber (curveNameAfter)) {
270 
271  // Pick a name before curveNameAfter
272  int numberAfter = numberAtEnd (curveNameAfter);
273  int numberNew = numberAfter - 1;
274  int pos = curveNameAfter.lastIndexOf (QString::number (numberAfter));
275  if (pos >= 0) {
276 
277  curveNameNext = QString ("%1%2")
278  .arg (curveNameAfter.left (pos))
279  .arg (numberNew);
280 
281  } else {
282 
283  curveNameNext = curveNameAfter; // Better than nothing
284 
285  }
286 
287  } else if (curveNameBefore.isEmpty ()) {
288 
289  curveNameNext = DEFAULT_GRAPH_CURVE_NAME; // If necessary, this will be deconflicted below
290 
291  } else {
292 
293  curveNameNext = curveNameBefore; // This will be deconflicted below
294 
295  if (endsWithNumber (curveNameBefore)) {
296 
297  // Curve name ends with a number. Pick a name after curveNameBefore, being sure to not match curveNameAfter
298  int numberBefore = numberAtEnd (curveNameBefore);
299  int numberNew = numberBefore + 1;
300  int pos = curveNameBefore.lastIndexOf (QString::number (numberBefore));
301  if (pos >= 0) {
302 
303  curveNameNext = QString ("%1%2")
304  .arg (curveNameBefore.left (pos))
305  .arg (numberNew);
306  if (curveNameNext == curveNameAfter) {
307 
308  // The difference between before and after is exactly one so we go to a lower level
309  curveNameNext = QString ("%1%2")
310  .arg (curveNameBefore)
311  .arg (DASH_ONE);
312  }
313  }
314  }
315  }
316 
317  // Curve name from settings takes precedence
318  SettingsForGraph settingsForGraph;
319  int indexOneBasedNext = numItems + 1;
320  curveNameNext = settingsForGraph.defaultCurveName (indexOneBasedNext,
321  curveNameNext);
322 
323  // At this point we have curveNameNext which does not conflict with curveNameBefore or
324  // curveNameAfter, but it may in rare cases conflict with some other curve name. We keep
325  // adding to the name until there is no conflict
326  while (m_curveNameList->containsCurveNameCurrent (curveNameNext)) {
327  curveNameNext += DASH_ONE;
328  }
329 
330  return curveNameNext;
331 }
332 
333 int DlgSettingsCurveAddRemove::numberAtEnd (const QString &str) const
334 {
335  ENGAUGE_ASSERT (endsWithNumber (str));
336 
337  // Go backward until the first nondigit
338  int sign = +1;
339  int ch = str.size () - 1;
340  while (str.at (ch).digitValue() >= 0) {
341  --ch;
342 
343  if (ch < 0) {
344  break;
345  }
346  }
347  ++ch;
348 
349  return sign * str.mid (ch).toInt ();
350 }
351 
352 unsigned int DlgSettingsCurveAddRemove::numPointsForSelectedCurves () const
353 {
354  QList<unsigned int > rowsSelected;
355 
356  // Create a list of curves that are currently selected
357  for (int i = 0; i < m_listCurves->selectionModel()->selectedIndexes ().count (); i++) {
358 
359  int row = m_listCurves->selectionModel()->selectedIndexes ().at (i).row ();
360  rowsSelected << row;
361  }
362 
363  return m_curveNameList->numPointsForSelectedCurves (rowsSelected);
364 }
365 
366 void DlgSettingsCurveAddRemove::printStream(QTextStream &str) const
367 {
368  str << m_curveNameList->currentCurvesAsString();
369 }
370 
371 void DlgSettingsCurveAddRemove::removeSelectedCurves ()
372 {
373  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::removeSelectedCurves";
374 
375  ENGAUGE_ASSERT (m_listCurves->selectionModel ()->selectedIndexes ().count () > 0); // Also guarantees number of indexes > 0
376 
377  // Identify the first index after the last selected index
378  QString firstCurveAfter; // Empty case means there was no index afer the last selected index
379  for (int row = m_listCurves->model()->rowCount() - 1; row >= 0; row--) {
380 
381  QModelIndex indexCurrent = m_listCurves->model()->index(row, CURVE_NAME_LIST_COLUMN_CURRENT);
382  if (indexCurrent == m_listCurves->selectionModel()->selectedIndexes().last()) {
383 
384  // This is the last selected index, which will be removed below. Exit immediately with firstCurveAfter set
385  break;
386  }
387 
388  firstCurveAfter = indexCurrent.data().toString();
389  }
390 
391  // Delete the selected indexes from last to first
392  for (int i = m_listCurves->selectionModel ()->selectedIndexes ().count () - 1; i >= 0; i--) {
393 
394  int row = m_listCurves->selectionModel ()->selectedIndexes ().at (i).row ();
395 
396  m_curveNameList->removeRow (row);
397  }
398 
399  if (firstCurveAfter.isEmpty ()) {
400 
401  // Select the last remaining curve. These steps seem more complicated than necessary
402  int numItems = m_listCurves->model()->rowCount();
403  QModelIndex indexLast = m_listCurves->model()->index (numItems - 1, CURVE_NAME_LIST_COLUMN_CURRENT);
404  firstCurveAfter = m_listCurves->model()->data (indexLast).toString();
405 
406  }
407 
408  // Select an item
409  selectCurveName(firstCurveAfter);
410 }
411 
412 void DlgSettingsCurveAddRemove::selectCurveName (const QString &curveWanted)
413 {
414  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::selectCurveName"
415  << " curve=" << curveWanted.toLatin1().data();
416 
417  for (int row = 0; row < m_listCurves->model()->rowCount(); row++) {
418 
419  QModelIndex index = m_listCurves->model()->index (row, CURVE_NAME_LIST_COLUMN_CURRENT);
420  QString curveGot = index.data ().toString ();
421 
422  if (curveWanted == curveGot) {
423 
424  // Found the curve we want to select
425  m_listCurves->setCurrentIndex (index);
426  break;
427 
428  }
429  }
430 }
431 
433 {
434  if (!smallDialogs) {
435  setMinimumHeight (MINIMUM_HEIGHT);
436  }
437 }
438 
439 void DlgSettingsCurveAddRemove::slotDataChanged (const QModelIndex &topLeft,
440  const QModelIndex &bottomRight,
441  const QVector<int> &roles)
442 {
443  // LOG4CPP_INFO_S is below
444 
445  // Since list just changed we dump all of it, including the visible and hidden data
446  QString curveEntries;
447  QTextStream str (&curveEntries);
448  printStream (str);
449 
450  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotDataChanged"
451  << " topLeft=(" << topLeft.row () << "," << topLeft.column () << ")"
452  << " bottomRight=(" << bottomRight.row () << "," << bottomRight.column () << ")"
453  << " roles=" << rolesAsString (roles).toLatin1 ().data ()
454  << " defaultDragOption=" << (m_listCurves->defaultDropAction() == Qt::MoveAction ? "MoveAction" : "CopyAction")
455  << " curveEntries=(" << curveEntries.toLatin1().data() << ")";
456 
457  updateControls ();
458 }
459 
461  int rowFirst,
462  int rowLast)
463 {
464  LOG4CPP_DEBUG_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotRowsAboutToBeRemoved"
465  << " parentValid=" << (parent.isValid() ? "yes" : "no")
466  << " rowFirst=" << rowFirst
467  << " rowLast=" << rowLast;
468 
469  updateControls ();
470 }
471 
472 void DlgSettingsCurveAddRemove::slotNew ()
473 {
474  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotNew";
475 
476  const QString NO_ORIGINAL_CURVE_NAME;
477  const int NO_POINTS = 0;
478 
479  QString curveNameSuggestion = nextCurveName ();
480 
481  int row = newRowFromSelection();
482 
483  insertCurveName (row,
484  curveNameSuggestion,
485  NO_ORIGINAL_CURVE_NAME,
486  NO_POINTS);
487 
488  selectCurveName (curveNameSuggestion);
489 
490  updateControls();
491 }
492 
493 void DlgSettingsCurveAddRemove::slotRemove ()
494 {
495  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotRemove";
496 
497  // Count the number of curve points to be deleted
498  int numPoints = numPointsForSelectedCurves ();
499 
500  int rtn = QMessageBox::Ok;
501  if (numPoints > 0) {
502 
503  QString msg;
504  if (m_listCurves->selectionModel ()->selectedIndexes ().count () == 1) {
505  msg = QString ("%1 %2 %3")
506  .arg (tr ("Removing this curve will also remove"))
507  .arg (numPoints)
508  .arg (tr ("points. Continue?"));
509  } else {
510  msg = QString ("%1 %2 %3")
511  .arg (tr ("Removing these curves will also remove"))
512  .arg (numPoints)
513  .arg (tr ("points. Continue?"));
514  }
515 
516  rtn = QMessageBox::warning (0,
517  tr ("Curves With Points"),
518  msg,
519  QMessageBox::Ok,
520  QMessageBox::Cancel);
521  }
522 
523  if (rtn == QMessageBox::Ok) {
524  removeSelectedCurves ();
525  }
526 
527  updateControls();
528 }
529 
530 void DlgSettingsCurveAddRemove::slotResetDefault()
531 {
532  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotResetDefault";
533 
534  const QString REMOVE_ALL_SETTINGS_IN_GROUP; // Empty string
535 
536  QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
537 
538  int indexOneBased = 1;
539 
540  SettingsForGraph settingsForGraph;
541  QString groupName = settingsForGraph.groupNameForNthCurve (indexOneBased);
542  while (settings.childGroups().contains (groupName)) {
543 
544  settings.beginGroup (groupName);
545  settings.remove (REMOVE_ALL_SETTINGS_IN_GROUP); // Remove this group by removing its settings
546  settings.endGroup ();
547 
548  ++indexOneBased;
549  groupName = settingsForGraph.groupNameForNthCurve (indexOneBased);
550  }
551 }
552 
553 void DlgSettingsCurveAddRemove::slotSaveDefault()
554 {
555  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::slotSaveDefault";
556 
557  QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
558 
559  for (int row = 0; row < m_curveNameList->rowCount (); row++) {
560 
561  QModelIndex idxCurrent = m_curveNameList->index (row, 0);
562 
563  QString curveNameCurrent = m_curveNameList->data (idxCurrent).toString ();
564 
565  int indexOneBased = row + 1;
566 
567  SettingsForGraph settingsForGraph;
568  QString groupName = settingsForGraph.groupNameForNthCurve (indexOneBased);
569 
570  settings.beginGroup (groupName);
571  settings.setValue (SETTINGS_CURVE_NAME,
572  curveNameCurrent);
573  settings.endGroup ();
574  }
575 }
576 
577 void DlgSettingsCurveAddRemove::updateControls ()
578 {
579  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveAddRemove::updateControls";
580 
581  enableOk (true);
582 
583  ENGAUGE_CHECK_PTR (m_listCurves);
584 
585  int numSelectedItems = m_listCurves->selectionModel ()->selectedIndexes ().count ();
586  int numItems = m_curveNameList->rowCount ();
587 
588  // Leave at least one curve
589  m_btnRemove->setEnabled ((numSelectedItems > 0) && (numSelectedItems < numItems));
590 }
Manage storage and retrieval of the settings for the curves.
void slotRowsAboutToBeRemoved(const QModelIndex &parent, int rowFirst, int rowLast)
Cleanup after rows have been removed in the model. We remove the corresponding rows in the QListView...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
bool containsCurveNameCurrent(const QString &curveName) const
Return true if specified curve name is already in the list.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
QString currentCurvesAsString() const
For debugging we dump the curve names.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
Command for DlgSettingsCurveAddRemove.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
unsigned int numPointsForSelectedCurves(const QList< unsigned int > &rowsSelected) const
Return the number of points associated with the selected curves, as specified by their row numbers...
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
One row per curve name.
void load(CmdMediator &cmdMediator)
Load settings from Document.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
QString groupNameForNthCurve(int indexOneBased) const
Return the group name, that appears in the settings file/registry, for the specified curve index...
Command queue stack.
Definition: CmdMediator.h:23
Abstract base class for all Settings dialogs.
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
Definition: CmdMediator.cpp:67
void insertRow(int row, const QString &curveCurrent, const QString &curveOriginal, unsigned int pointCount)
Create a new entry at the specified row.
Model for DlgSettingsCurveAddRemove and CmdSettingsCurveAddRemove.
Definition: CurveNameList.h:27
MainWindow & mainWindow()
Get method for MainWindow.
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:89
DlgSettingsCurveAddRemove(MainWindow &mainWindow)
Single constructor.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: CmdMediator.cpp:62
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void reset()
Clear all information.
virtual void handleOk()
Process slotOk.