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 addPixmap (QGraphicsScene &scene, const QPixmap &pixmap)
 Adds pixmap to the scene.
void createWhatsThis (QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
 Create a WhatsThis button in a grid layout.
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 29 of file DlgSettingsExportFormat.h.

Constructor & Destructor Documentation

◆ DlgSettingsExportFormat()

DlgSettingsExportFormat::DlgSettingsExportFormat ( MainWindow & mainWindow)

Single constructor.

Definition at line 59 of file DlgSettingsExportFormat.cpp.

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

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

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsExportFormat::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 311 of file DlgSettingsExportFormat.cpp.

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

◆ createSubPanel()

QWidget * DlgSettingsExportFormat::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 434 of file DlgSettingsExportFormat.cpp.

435{
436 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createSubPanel";
437
438 QWidget *subPanel = new QWidget ();
439 QGridLayout *layout = new QGridLayout (subPanel);
440 subPanel->setLayout (layout);
441
442 int row = 0;
443
444 createWhatsThis (layout,
445 m_btnWhatsThis,
446 row++,
447 3);
448
449 createCurveSelection (layout, row);
450
451 createTabWidget (layout,
452 row);
453
454 QWidget *widgetMisc = new QWidget;
455 layout->addWidget (widgetMisc, row++, 0, 1, 3);
456 QHBoxLayout *layoutMisc = new QHBoxLayout;
457 widgetMisc->setLayout (layoutMisc);
458
459 createDelimiters (layoutMisc); // One row of radio buttons
460 createHeader (layoutMisc); // Two rows with radio buttons and then header label
461 createFileLayout (layoutMisc); // One row of radio buttons
462
463 createPreview (layout, row);
464
465 return subPanel;
466}
void createWhatsThis(QGridLayout *layout, ButtonWhatsThis *button, int row, int column)
Create a WhatsThis button in a grid layout.

◆ handleOk()

void DlgSettingsExportFormat::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 571 of file DlgSettingsExportFormat.cpp.

572{
573 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk";
574
575 CmdSettingsExportFormat *cmd = new CmdSettingsExportFormat (mainWindow (),
576 cmdMediator ().document(),
577 *m_modelExportBefore,
578 *m_modelExportAfter);
579 cmdMediator ().push (cmd);
580
581 hide ();
582}
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 608 of file DlgSettingsExportFormat.cpp.

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

695{
696 if (!smallDialogs) {
697 setMinimumHeight (MINIMUM_HEIGHT);
698 }
699}
const int MINIMUM_HEIGHT

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