Engauge Digitizer 2
Loading...
Searching...
No Matches
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.
 
virtual ~DlgSettingsExportFormat ()
 
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.
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document.
 
virtual void setSmallDialogs (bool smallDialogs)
 If false then dialogs have a minimum size so all controls are visible.
 
- Public Member Functions inherited from DlgSettingsAbstractBase
 DlgSettingsAbstractBase (const QString &title, const QString &dialogName, MainWindow &mainWindow)
 Single constructor.
 
virtual ~DlgSettingsAbstractBase ()
 

Protected Member Functions

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

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.
 
static int MINIMUM_PREVIEW_HEIGHT = 100
 Dialog layout constant that guarantees preview has sufficent room.
 

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",
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
log4cpp::Category * mainCat
Definition Logger.cpp:14
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
MainWindow & mainWindow()
Get method for MainWindow.
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

◆ ~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}

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}

◆ 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}

◆ 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
539 CmdSettingsExportFormat *cmd = new CmdSettingsExportFormat (mainWindow (),
540 cmdMediator ().document(),
541 *m_modelExportBefore,
542 *m_modelExportAfter);
543 cmdMediator ().push (cmd);
544
545 hide ();
546}
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ 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}
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
ExportHeader
@ EXPORT_HEADER_SIMPLE
@ EXPORT_HEADER_NONE
@ EXPORT_HEADER_GNUPLOT
ExportLayoutFunctions
@ EXPORT_LAYOUT_ALL_PER_LINE
@ EXPORT_LAYOUT_ONE_PER_LINE
@ 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
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void enableOk(bool enable)
Let leaf subclass control the Ok button.

◆ 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: