Engauge Digitizer  2
Public Member Functions | Protected Member Functions | List of all members
DlgSettingsExportFormat Class Reference

Dialog for editing exporting settings. More...

#include <DlgSettingsExportFormat.h>

Inheritance diagram for DlgSettingsExportFormat:
Inheritance graph
Collaboration diagram for DlgSettingsExportFormat:
Collaboration graph

Public Member Functions

 DlgSettingsExportFormat (MainWindow &mainWindow)
 Single constructor. More...
 
virtual ~DlgSettingsExportFormat ()
 
virtual void createOptionalSaveDefault (QHBoxLayout *layout)
 Let subclass define an optional Save As Default button. More...
 
virtual QWidget * createSubPanel ()
 Create dialog-specific panel to which base class will add Ok and Cancel buttons. More...
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document. More...
 
virtual void setSmallDialogs (bool smallDialogs)
 If false then dialogs have a minimum size so all controls are visible. More...
 
- Public Member Functions inherited from DlgSettingsAbstractBase
 DlgSettingsAbstractBase (const QString &title, const QString &dialogName, MainWindow &mainWindow)
 Single constructor. More...
 
virtual ~DlgSettingsAbstractBase ()
 

Protected Member Functions

virtual void handleOk ()
 Process slotOk. More...
 
- Protected Member Functions inherited from DlgSettingsAbstractBase
CmdMediatorcmdMediator ()
 Provide access to Document information wrapped inside CmdMediator. More...
 
void enableOk (bool enable)
 Let leaf subclass control the Ok button. More...
 
void finishPanel (QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
 Add Ok and Cancel buttons to subpanel to get the whole dialog. More...
 
MainWindowmainWindow ()
 Get method for MainWindow. More...
 
const MainWindowmainWindow () const
 Const get method for MainWindow. More...
 
void populateColorComboWithoutTransparent (QComboBox &combo)
 Add colors in color palette to combobox, without transparent entry at end. More...
 
void populateColorComboWithTransparent (QComboBox &combo)
 Add colors in color palette to combobox, with transparent entry at end. More...
 
void setCmdMediator (CmdMediator &cmdMediator)
 Store CmdMediator for easy access by the leaf class. More...
 
void setDisableOkAtStartup (bool disableOkAtStartup)
 Override the default Ok button behavior applied in showEvent. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from DlgSettingsAbstractBase
static int MINIMUM_DIALOG_WIDTH = 380
 Dialog layout constant that guarantees every widget has sufficient room. Can be increased by finishPanel. More...
 
static int MINIMUM_PREVIEW_HEIGHT = 100
 Dialog layout constant that guarantees preview has sufficent room. More...
 

Detailed Description

Dialog for editing exporting settings.

Definition at line 28 of file DlgSettingsExportFormat.h.

Constructor & Destructor Documentation

◆ DlgSettingsExportFormat()

DlgSettingsExportFormat::DlgSettingsExportFormat ( MainWindow mainWindow)

Single constructor.

Definition at line 54 of file DlgSettingsExportFormat.cpp.

54  :
55  DlgSettingsAbstractBase (tr ("Export Format"),
56  "DlgSettingsExportFormat",
57  mainWindow),
58  m_validatorFunctionsPointsEvenlySpacing (nullptr),
59  m_validatorRelationsPointsEvenlySpacing (nullptr),
60  m_modelExportBefore (nullptr),
61  m_modelExportAfter (nullptr),
62  m_haveFunction (false),
63  m_haveRelation (false)
64 {
65  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::DlgSettingsExportFormat";
66 
67  QWidget *subPanel = createSubPanel ();
68  finishPanel (subPanel,
70 }
const int MINIMUM_DIALOG_WIDTH_EXPORT_FORMAT
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Abstract base class for all Settings dialogs.
MainWindow & mainWindow()
Get method for MainWindow.

◆ ~DlgSettingsExportFormat()

DlgSettingsExportFormat::~DlgSettingsExportFormat ( )
virtual

Definition at line 72 of file DlgSettingsExportFormat.cpp.

73 {
74  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::~DlgSettingsExportFormat";
75 
76  delete m_validatorFunctionsPointsEvenlySpacing;
77  delete m_validatorRelationsPointsEvenlySpacing;
78 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsExportFormat::createOptionalSaveDefault ( QHBoxLayout *  layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 300 of file DlgSettingsExportFormat.cpp.

301 {
302  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createOptionalSaveDefault";
303 
304  m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
305  m_btnSaveDefault->setWhatsThis (tr ("Save the settings for use as future defaults."));
306  connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
307  layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
308 
309  m_btnLoadDefault = new QPushButton (tr ("Load Default"));
310  m_btnLoadDefault->setWhatsThis (tr ("Load the default settings."));
311  connect (m_btnLoadDefault, SIGNAL (released ()), this, SLOT (slotLoadDefault ()));
312  layout->addWidget (m_btnLoadDefault, 0, Qt::AlignLeft);
313 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ createSubPanel()

QWidget * DlgSettingsExportFormat::createSubPanel ( )
virtual

Create dialog-specific panel to which base class will add Ok and Cancel buttons.

Implements DlgSettingsAbstractBase.

Definition at line 404 of file DlgSettingsExportFormat.cpp.

405 {
406  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";
407 
408  QWidget *subPanel = new QWidget ();
409  QGridLayout *layout = new QGridLayout (subPanel);
410  subPanel->setLayout (layout);
411 
412  int row = 0;
413  createCurveSelection (layout, row);
414 
415  createTabWidget (layout,
416  row);
417 
418  QWidget *widgetMisc = new QWidget;
419  layout->addWidget (widgetMisc, row++, 0, 1, 3);
420  QHBoxLayout *layoutMisc = new QHBoxLayout;
421  widgetMisc->setLayout (layoutMisc);
422 
423  createDelimiters (layoutMisc); // One row of radio buttons
424  createHeader (layoutMisc); // Two rows with radio buttons and then header label
425  createFileLayout (layoutMisc); // One row of radio buttons
426 
427  createPreview (layout, row);
428 
429  return subPanel;
430 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ handleOk()

void DlgSettingsExportFormat::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 535 of file DlgSettingsExportFormat.cpp.

536 {
537  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk";
538 
540  cmdMediator ().document(),
541  *m_modelExportBefore,
542  *m_modelExportAfter);
543  cmdMediator ().push (cmd);
544 
545  hide ();
546 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
MainWindow & mainWindow()
Get method for MainWindow.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
Command for DlgSettingsExportFormat.

◆ load()

void DlgSettingsExportFormat::load ( CmdMediator cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 572 of file DlgSettingsExportFormat.cpp.

573 {
574  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::load";
575 
577 
578  // Flush old data
579  delete m_modelExportBefore;
580  delete m_modelExportAfter;
581 
582  // Save new data
583  m_modelExportBefore = new DocumentModelExportFormat (cmdMediator.document());
584  m_modelExportAfter = new DocumentModelExportFormat (cmdMediator.document());
585 
586  // Populate controls. First load excluded curves
587  m_listExcluded->clear();
588  QStringList curveNamesExcluded = m_modelExportAfter->curveNamesNotExported();
589  QStringList::const_iterator itr;
590  for (itr = curveNamesExcluded.begin (); itr != curveNamesExcluded.end(); ++itr) {
591  QString curveNameNotExported = *itr;
592  m_listExcluded->addItem (curveNameNotExported);
593  }
594 
595  // Include curves that are not excluded
596  m_listIncluded->clear();
597  QStringList curveNamesAll = cmdMediator.document().curvesGraphsNames();
598  for (itr = curveNamesAll.begin (); itr != curveNamesAll.end(); itr++) {
599  QString curveName = *itr;
600  if (!curveNamesExcluded.contains (curveName)) {
601  m_listIncluded->addItem (curveName);
602  }
603  }
604 
605  ExportPointsSelectionFunctions pointsSelectionFunctions = m_modelExportAfter->pointsSelectionFunctions();
606  m_btnFunctionsPointsAllCurves->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
607  m_btnFunctionsPointsFirstCurve->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
608  m_btnFunctionsPointsEvenlySpaced->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
609  m_btnFunctionsPointsGridLines->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES);
610  m_btnFunctionsPointsRaw->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
611 
612  ExportLayoutFunctions layoutFunctions = m_modelExportAfter->layoutFunctions ();
613  m_btnCurvesLayoutAllCurves->setChecked (layoutFunctions == EXPORT_LAYOUT_ALL_PER_LINE);
614  m_btnCurvesLayoutOneCurve->setChecked (layoutFunctions == EXPORT_LAYOUT_ONE_PER_LINE);
615 
616  ExportPointsSelectionRelations pointsSelectionRelations = m_modelExportAfter->pointsSelectionRelations();
617  m_btnRelationsPointsEvenlySpaced->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
618  m_btnRelationsPointsRaw->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_RAW);
619 
620  ExportDelimiter delimiter = m_modelExportAfter->delimiter ();
621  m_btnDelimitersCommas->setChecked (delimiter == EXPORT_DELIMITER_COMMA);
622  m_btnDelimitersSpaces->setChecked (delimiter == EXPORT_DELIMITER_SPACE);
623  m_btnDelimitersTabs->setChecked (delimiter == EXPORT_DELIMITER_TAB);
624  m_btnDelimitersSemicolons->setChecked (delimiter == EXPORT_DELIMITER_SEMICOLON);
625 
626  m_chkExtrapolateOutsideEndpoints->setChecked (m_modelExportAfter->extrapolateOutsideEndpoints ());
627 
628  m_chkOverrideCsvTsv->setChecked (m_modelExportAfter->overrideCsvTsv());
629 
630  ExportHeader header = m_modelExportAfter->header ();
631  m_btnHeaderNone->setChecked (header == EXPORT_HEADER_NONE);
632  m_btnHeaderSimple->setChecked (header == EXPORT_HEADER_SIMPLE);
633  m_btnHeaderGnuplot->setChecked (header == EXPORT_HEADER_GNUPLOT);
634 
635  m_editXLabel->setText (m_modelExportAfter->xLabel());
636 
637  m_editFunctionsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalFunctions()));
638  m_editRelationsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalRelations()));
639 
640  ExportPointsIntervalUnits pointsIntervalUnitsFunctions = m_modelExportAfter->pointsIntervalUnitsFunctions();
641  ExportPointsIntervalUnits pointsIntervalUnitsRelations = m_modelExportAfter->pointsIntervalUnitsRelations();
642  int indexFunctions = m_cmbFunctionsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsFunctions));
643  int indexRelations = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsRelations));
644  m_cmbFunctionsPointsEvenlySpacingUnits->setCurrentIndex (indexFunctions);
645  m_cmbRelationsPointsEvenlySpacingUnits->setCurrentIndex (indexRelations);
646 
647  initializeIntervalConstraints ();
648 
649  updateControlsUponLoad (); // Before updateControls so m_haveFunction and m_haveRelation are set
650  updateControls();
651  updateIntervalConstraints();
652  enableOk (false); // Disable Ok button since there not yet any changes
653  updatePreview();
654 }
bool overrideCsvTsv() const
Get method for csv/tsv format override.
QStringList curveNamesNotExported() const
Get method for curve names not exported.
bool extrapolateOutsideEndpoints() const
Get methods for extrapolation.
ExportDelimiter
Delimiter values that may or may not be overridden by DOCUMENT_SERIALIZE_EXPORT_DELIMITER_OVERRIDE_CS...
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
ExportPointsIntervalUnits
ExportLayoutFunctions
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
ExportPointsSelectionRelations pointsSelectionRelations() const
Get method for point selection for relations.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
double pointsIntervalFunctions() const
Get method for points interval for functions.
ExportHeader
Definition: ExportHeader.h:12
ExportPointsIntervalUnits pointsIntervalUnitsRelations() const
Get method for points interval units for relations.
ExportDelimiter delimiter() const
Get method for delimiter.
ExportPointsIntervalUnits pointsIntervalUnitsFunctions() const
Get method for points interval units for functions.
ExportHeader header() const
Get method for header.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
double pointsIntervalRelations() const
Get method for relations interval for relations.
ExportLayoutFunctions layoutFunctions() const
Get method for functions layout.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
QString xLabel() const
Get method for x label.
ExportPointsSelectionFunctions pointsSelectionFunctions() const
Get method for point selection for functions.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: Document.cpp:349
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ setSmallDialogs()

void DlgSettingsExportFormat::setSmallDialogs ( bool  smallDialogs)
virtual

If false then dialogs have a minimum size so all controls are visible.

Implements DlgSettingsAbstractBase.

Definition at line 656 of file DlgSettingsExportFormat.cpp.

657 {
658  if (!smallDialogs) {
659  setMinimumHeight (MINIMUM_HEIGHT);
660  }
661 }
const int MINIMUM_HEIGHT

The documentation for this class was generated from the following files: