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 57 of file DlgSettingsExportFormat.cpp.

57 :
58 DlgSettingsAbstractBase (tr ("Export Format"),
59 "DlgSettingsExportFormat",
61 m_validatorFunctionsPointsEvenlySpacing (nullptr),
62 m_validatorRelationsPointsEvenlySpacing (nullptr),
63 m_modelExportBefore (nullptr),
64 m_modelExportAfter (nullptr),
65 m_haveFunction (false),
66 m_haveRelation (false)
67{
68 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::DlgSettingsExportFormat";
69
70 QWidget *subPanel = createSubPanel ();
71 finishPanel (subPanel,
73}
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 75 of file DlgSettingsExportFormat.cpp.

76{
77 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::~DlgSettingsExportFormat";
78
79 delete m_validatorFunctionsPointsEvenlySpacing;
80 delete m_validatorRelationsPointsEvenlySpacing;
81}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsExportFormat::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 309 of file DlgSettingsExportFormat.cpp.

310{
311 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createOptionalSaveDefault";
312
313 m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
314 m_btnSaveDefault->setWhatsThis (tr ("Save the settings for use as future defaults."));
315 connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
316 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
317
318 m_btnLoadDefault = new QPushButton (tr ("Load Default"));
319 m_btnLoadDefault->setWhatsThis (tr ("Load the default settings."));
320 connect (m_btnLoadDefault, SIGNAL (released ()), this, SLOT (slotLoadDefault ()));
321 layout->addWidget (m_btnLoadDefault, 0, Qt::AlignLeft);
322}

◆ createSubPanel()

QWidget * DlgSettingsExportFormat::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 432 of file DlgSettingsExportFormat.cpp.

433{
434 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";
435
436 QWidget *subPanel = new QWidget ();
437 QGridLayout *layout = new QGridLayout (subPanel);
438 subPanel->setLayout (layout);
439
440 int row = 0;
441 createCurveSelection (layout, row);
442
443 createTabWidget (layout,
444 row);
445
446 QWidget *widgetMisc = new QWidget;
447 layout->addWidget (widgetMisc, row++, 0, 1, 3);
448 QHBoxLayout *layoutMisc = new QHBoxLayout;
449 widgetMisc->setLayout (layoutMisc);
450
451 createDelimiters (layoutMisc); // One row of radio buttons
452 createHeader (layoutMisc); // Two rows with radio buttons and then header label
453 createFileLayout (layoutMisc); // One row of radio buttons
454
455 createPreview (layout, row);
456
457 return subPanel;
458}

◆ handleOk()

void DlgSettingsExportFormat::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 563 of file DlgSettingsExportFormat.cpp.

564{
565 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk";
566
567 CmdSettingsExportFormat *cmd = new CmdSettingsExportFormat (mainWindow (),
568 cmdMediator ().document(),
569 *m_modelExportBefore,
570 *m_modelExportAfter);
571 cmdMediator ().push (cmd);
572
573 hide ();
574}
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 600 of file DlgSettingsExportFormat.cpp.

601{
602 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::load";
603
605
606 // Flush old data
607 delete m_modelExportBefore;
608 delete m_modelExportAfter;
609
610 // Save new data
611 m_modelExportBefore = new DocumentModelExportFormat (cmdMediator.document());
612 m_modelExportAfter = new DocumentModelExportFormat (cmdMediator.document());
613
614 // Populate controls. First load excluded curves
615 m_listExcluded->clear();
616 QStringList curveNamesExcluded = m_modelExportAfter->curveNamesNotExported();
617 QStringList::const_iterator itr;
618 for (itr = curveNamesExcluded.begin (); itr != curveNamesExcluded.end(); ++itr) {
619 QString curveNameNotExported = *itr;
620 m_listExcluded->addItem (curveNameNotExported);
621 }
622
623 // Include curves that are not excluded
624 m_listIncluded->clear();
625 QStringList curveNamesAll = cmdMediator.document().curvesGraphsNames();
626 for (itr = curveNamesAll.begin (); itr != curveNamesAll.end(); itr++) {
627 QString curveName = *itr;
628 if (!curveNamesExcluded.contains (curveName)) {
629 m_listIncluded->addItem (curveName);
630 }
631 }
632
633 ExportPointsSelectionFunctions pointsSelectionFunctions = m_modelExportAfter->pointsSelectionFunctions();
634 m_btnFunctionsPointsAllCurves->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_ALL_CURVES);
635 m_btnFunctionsPointsFirstCurve->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
636 m_btnFunctionsPointsEvenlySpaced->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC);
637 m_btnFunctionsPointsGridLines->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_GRID_LINES);
638 m_btnFunctionsPointsRaw->setChecked (pointsSelectionFunctions == EXPORT_POINTS_SELECTION_FUNCTIONS_RAW);
639
640 ExportLayoutFunctions layoutFunctions = m_modelExportAfter->layoutFunctions ();
641 m_btnCurvesLayoutAllCurves->setChecked (layoutFunctions == EXPORT_LAYOUT_ALL_PER_LINE);
642 m_btnCurvesLayoutOneCurve->setChecked (layoutFunctions == EXPORT_LAYOUT_ONE_PER_LINE);
643
644 ExportPointsSelectionRelations pointsSelectionRelations = m_modelExportAfter->pointsSelectionRelations();
645 m_btnRelationsPointsEvenlySpaced->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_INTERPOLATE);
646 m_btnRelationsPointsRaw->setChecked (pointsSelectionRelations == EXPORT_POINTS_SELECTION_RELATIONS_RAW);
647
648 ExportDelimiter delimiter = m_modelExportAfter->delimiter ();
649 m_btnDelimitersCommas->setChecked (delimiter == EXPORT_DELIMITER_COMMA);
650 m_btnDelimitersSpaces->setChecked (delimiter == EXPORT_DELIMITER_SPACE);
651 m_btnDelimitersTabs->setChecked (delimiter == EXPORT_DELIMITER_TAB);
652 m_btnDelimitersSemicolons->setChecked (delimiter == EXPORT_DELIMITER_SEMICOLON);
653
654 m_chkExtrapolateOutsideEndpoints->setChecked (m_modelExportAfter->extrapolateOutsideEndpoints ());
655
656 m_chkOverrideCsvTsv->setChecked (m_modelExportAfter->overrideCsvTsv());
657
658 ExportHeader header = m_modelExportAfter->header ();
659 m_btnHeaderNone->setChecked (header == EXPORT_HEADER_NONE);
660 m_btnHeaderSimple->setChecked (header == EXPORT_HEADER_SIMPLE);
661 m_btnHeaderGnuplot->setChecked (header == EXPORT_HEADER_GNUPLOT);
662
663 m_editXLabel->setText (m_modelExportAfter->xLabel());
664
665 m_editFunctionsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalFunctions()));
666 m_editRelationsPointsEvenlySpacing->setText (QString::number (m_modelExportAfter->pointsIntervalRelations()));
667
668 ExportPointsIntervalUnits pointsIntervalUnitsFunctions = m_modelExportAfter->pointsIntervalUnitsFunctions();
669 ExportPointsIntervalUnits pointsIntervalUnitsRelations = m_modelExportAfter->pointsIntervalUnitsRelations();
670 int indexFunctions = m_cmbFunctionsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsFunctions));
671 int indexRelations = m_cmbRelationsPointsEvenlySpacingUnits->findData (QVariant (pointsIntervalUnitsRelations));
672 m_cmbFunctionsPointsEvenlySpacingUnits->setCurrentIndex (indexFunctions);
673 m_cmbRelationsPointsEvenlySpacingUnits->setCurrentIndex (indexRelations);
674
675 m_cmbFileExtension->setCurrentText (exportFileExtensionToPreviewString (EXPORT_FILE_EXTENSION_CSV));
676
677 initializeIntervalConstraints ();
678
679 updateControlsUponLoad (); // Before updateControls so m_haveFunction and m_haveRelation are set
680 updateControls();
681 updateIntervalConstraints();
682 enableOk (false); // Disable Ok button since there not yet any changes
683 updatePreview();
684}
ExportDelimiter
Delimiter values that may or may not be overridden by DOCUMENT_SERIALIZE_EXPORT_DELIMITER_OVERRIDE_CS...
@ EXPORT_DELIMITER_SPACE
@ EXPORT_DELIMITER_COMMA
@ EXPORT_DELIMITER_TAB
@ EXPORT_DELIMITER_SEMICOLON
QString exportFileExtensionToPreviewString(ExportFileExtension exportFileExtension)
Displayed text for each ExportFileExtension value.
@ EXPORT_FILE_EXTENSION_CSV
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 686 of file DlgSettingsExportFormat.cpp.

687{
688 if (!smallDialogs) {
689 setMinimumHeight (MINIMUM_HEIGHT);
690 }
691}
const int MINIMUM_HEIGHT

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