Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
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 QWidgetcreateSubPanel ()
 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 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 23 of file DlgSettingsCurveProperties.h.

Constructor & Destructor Documentation

◆ DlgSettingsCurveProperties()

DlgSettingsCurveProperties::DlgSettingsCurveProperties ( MainWindow & mainWindow)

Single constructor.

Definition at line 61 of file DlgSettingsCurveProperties.cpp.

61 :
62 DlgSettingsAbstractBase (tr ("Curve Properties"),
63 "DlgSettingsCurveProperties",
65 m_modelMainWindow (mainWindow.modelMainWindow()),
66 m_scenePreview (nullptr),
67 m_viewPreview (nullptr),
68 m_modelCurveStylesBefore (nullptr),
69 m_modelCurveStylesAfter (nullptr)
70{
71 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::DlgSettingsCurveProperties";
72
75
76 setMinimumWidth (740); // Override finishPanel width for room for m_cmbLineType and preview to be completely visible
77}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
Abstract base class for all Settings dialogs.
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.
MainWindowModel modelMainWindow() const
Get method for main window model.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ ~DlgSettingsCurveProperties()

DlgSettingsCurveProperties::~DlgSettingsCurveProperties ( )
virtual

Definition at line 79 of file DlgSettingsCurveProperties.cpp.

80{
81 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::~DlgSettingsCurveProperties";
82}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsCurveProperties::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 219 of file DlgSettingsCurveProperties.cpp.

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

◆ createSubPanel()

QWidget * DlgSettingsCurveProperties::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 257 of file DlgSettingsCurveProperties.cpp.

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

◆ handleOk()

void DlgSettingsCurveProperties::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 367 of file DlgSettingsCurveProperties.cpp.

368{
369 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::handleOk";
370
371 ENGAUGE_CHECK_PTR (m_modelCurveStylesBefore);
372 ENGAUGE_CHECK_PTR (m_modelCurveStylesAfter);
373
375 cmdMediator ().document(),
376 *m_modelCurveStylesBefore,
377 *m_modelCurveStylesAfter);
378 cmdMediator ().push (cmd);
379
380 hide ();
381}
#define ENGAUGE_CHECK_PTR(ptr)
#endif
Command for DlgSettingsCurveProperties.
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 383 of file DlgSettingsCurveProperties.cpp.

384{
385 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::load";
386
388
389 // Flush old data
390 delete m_modelCurveStylesBefore;
391 delete m_modelCurveStylesAfter;
392
393 // Save new data
394 m_modelCurveStylesBefore = new CurveStyles (cmdMediator.coordSystem());
395 m_modelCurveStylesAfter = new CurveStyles (cmdMediator.coordSystem());
396
397 // Populate controls. First load curve name combobox. The curve-specific controls get loaded in slotCurveName
398 m_cmbCurveName->clear ();
399 m_cmbCurveName->addItem (AXIS_CURVE_NAME);
401 QStringList::const_iterator itr;
402 for (itr = curveNames.begin (); itr != curveNames.end (); itr++) {
403
404 QString curveName = *itr;
405 m_cmbCurveName->addItem (curveName);
406 }
407
408 loadForCurveName (mainWindow().selectedGraphCurve());
409
410 m_isDirty = false;
411 enableOk (false); // Disable Ok button since there not yet any changes
412}
const QString AXIS_CURVE_NAME
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
const CoordSystem & coordSystem() const
Provide the current CoordSystem to commands with read-only access, primarily for undo/redo processing...
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition CurveStyles.h:23
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 466 of file DlgSettingsCurveProperties.cpp.

467{
468 m_cmbCurveName->setCurrentText (curveName);
469 loadForCurveName (curveName);
470}

◆ 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 472 of file DlgSettingsCurveProperties.cpp.

473{
474 if (!smallDialogs) {
476 }
477}
const int MINIMUM_HEIGHT

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