Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsCurveProperties Class Reference

Dialog for editing curve properties settings. More...

#include <DlgSettingsCurveProperties.h>

Inheritance diagram for DlgSettingsCurveProperties:
Inheritance graph
Collaboration diagram for DlgSettingsCurveProperties:
Collaboration graph

Public Member Functions

 DlgSettingsCurveProperties (MainWindow &mainWindow)
 Single constructor.
virtual ~DlgSettingsCurveProperties ()
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.
void setCurveName (const QString &curveName)
 Load information for the specified curve name. When called externally, the load method must have been called first.
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 curve properties settings.

Definition at line 24 of file DlgSettingsCurveProperties.h.

Constructor & Destructor Documentation

◆ DlgSettingsCurveProperties()

DlgSettingsCurveProperties::DlgSettingsCurveProperties ( MainWindow & mainWindow)

Single constructor.

Definition at line 63 of file DlgSettingsCurveProperties.cpp.

63 :
64 DlgSettingsAbstractBase (tr ("Curve Properties"),
65 "DlgSettingsCurveProperties",
67 m_modelMainWindow (mainWindow.modelMainWindow()),
68 m_scenePreview (nullptr),
69 m_viewPreview (nullptr),
70 m_modelCurveStylesBefore (nullptr),
71 m_modelCurveStylesAfter (nullptr)
72{
73 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::DlgSettingsCurveProperties";
74
75 QWidget *subPanel = createSubPanel ();
76 finishPanel (subPanel);
77
78 setMinimumWidth (740); // Override finishPanel width for room for m_cmbLineType and preview to be completely visible
79}
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

◆ ~DlgSettingsCurveProperties()

DlgSettingsCurveProperties::~DlgSettingsCurveProperties ( )
virtual

Definition at line 81 of file DlgSettingsCurveProperties.cpp.

82{
83 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::~DlgSettingsCurveProperties";
84}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsCurveProperties::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 226 of file DlgSettingsCurveProperties.cpp.

227{
228 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::createOptionalSaveDefault";
229
230 m_btnSaveDefault = new QPushButton ("Save As Default");
231 m_btnSaveDefault->setWhatsThis (tr ("Save the visible curve settings for use as future defaults, according to the curve name selection.\n\n"
232 "If the visible settings are for the axes curve, then they will be used for future "
233 "axes curves, until new settings are saved as the defaults.\n\n"
234 "If the visible settings are for the Nth graph curve in the curve list, then they will be used for future "
235 "graph curves that are also the Nth graph curve in their curve list, until new settings are saved as the defaults."));
236 connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
237 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
238}

◆ createSubPanel()

QWidget * DlgSettingsCurveProperties::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 264 of file DlgSettingsCurveProperties.cpp.

265{
266 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::createSubPanel";
267
268 QWidget *subPanel = new QWidget ();
269 QGridLayout *layout = new QGridLayout (subPanel);
270 subPanel->setLayout (layout);
271
272 int row = 0;
273 createCurveName (layout, row);
274
275 int rowLeft = row, rowRight = row++;
276 createPoint (layout, rowLeft);
277 createLine (layout, rowRight);
278 createPreview (layout, row);
279
280 layout->setColumnStretch(0, 1); // Empty first column
281 layout->setColumnStretch(1, 0); // Point group
282 layout->setColumnStretch(2, 0); // Line group
283 layout->setColumnStretch(3, 1); // Empty last column
284
285 layout->setRowStretch (0, 1); // Expand empty first row
286
287 return subPanel;
288}

◆ handleOk()

void DlgSettingsCurveProperties::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 374 of file DlgSettingsCurveProperties.cpp.

375{
376 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::handleOk";
377
378 ENGAUGE_CHECK_PTR (m_modelCurveStylesBefore);
379 ENGAUGE_CHECK_PTR (m_modelCurveStylesAfter);
380
381 CmdSettingsCurveProperties *cmd = new CmdSettingsCurveProperties (mainWindow (),
382 cmdMediator ().document(),
383 *m_modelCurveStylesBefore,
384 *m_modelCurveStylesAfter);
385 cmdMediator ().push (cmd);
386
387 hide ();
388}
#define ENGAUGE_CHECK_PTR(ptr)
Drop in replacement for Q_CHECK_PTR.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsCurveProperties::load ( CmdMediator & cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 390 of file DlgSettingsCurveProperties.cpp.

391{
392 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::load";
393
395
396 // Flush old data
397 delete m_modelCurveStylesBefore;
398 delete m_modelCurveStylesAfter;
399
400 // Save new data
401 m_modelCurveStylesBefore = new CurveStyles (cmdMediator.coordSystem());
402 m_modelCurveStylesAfter = new CurveStyles (cmdMediator.coordSystem());
403
404 // Populate controls. First load curve name combobox. The curve-specific controls get loaded in slotCurveName
405 m_cmbCurveName->clear ();
406 m_cmbCurveName->addItem (AXIS_CURVE_NAME);
407 QStringList curveNames = cmdMediator.curvesGraphsNames();
408 QStringList::const_iterator itr;
409 for (itr = curveNames.begin (); itr != curveNames.end (); itr++) {
410
411 QString curveName = *itr;
412 m_cmbCurveName->addItem (curveName);
413 }
414
415 loadForCurveName (mainWindow().selectedGraphCurve());
416
417 m_isDirty = false;
418 enableOk (false); // Disable Ok button since there not yet any changes
419}
const QString AXIS_CURVE_NAME
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void enableOk(bool enable)
Let leaf subclass control the Ok button.

◆ setCurveName()

void DlgSettingsCurveProperties::setCurveName ( const QString & curveName)

Load information for the specified curve name. When called externally, the load method must have been called first.

Definition at line 473 of file DlgSettingsCurveProperties.cpp.

474{
475 m_cmbCurveName->setCurrentText (curveName);
476 loadForCurveName (curveName);
477}

◆ setSmallDialogs()

void DlgSettingsCurveProperties::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 479 of file DlgSettingsCurveProperties.cpp.

480{
481 if (!smallDialogs) {
482 setMinimumHeight (MINIMUM_HEIGHT);
483 }
484}
const int MINIMUM_HEIGHT

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