Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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. More...
 
virtual ~DlgSettingsCurveProperties ()
 
virtual void createOptionalSaveDefault (QHBoxLayout *layout)
 Let subclass define an optional Save As Default button. More...
 
virtual QWidget * createSubPanel ()
 Create dialog-specific panel to which base class will add Ok and Cancel buttons. More...
 
virtual void load (CmdMediator &cmdMediator)
 Load settings from Document. More...
 
void setCurveName (const QString &curveName)
 Load information for the specified curve name. When called externally, the load method must have been called first. More...
 
virtual void setSmallDialogs (bool smallDialogs)
 If false then dialogs have a minimum size so all controls are visible. More...
 
- Public Member Functions inherited from DlgSettingsAbstractBase
 DlgSettingsAbstractBase (const QString &title, const QString &dialogName, MainWindow &mainWindow)
 Single constructor. More...
 
virtual ~DlgSettingsAbstractBase ()
 

Protected Member Functions

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

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

Detailed Description

Dialog for editing curve properties settings.

Definition at line 23 of file DlgSettingsCurveProperties.h.

Constructor & Destructor Documentation

DlgSettingsCurveProperties::DlgSettingsCurveProperties ( MainWindow mainWindow)

Single constructor.

Definition at line 61 of file DlgSettingsCurveProperties.cpp.

61  :
62  DlgSettingsAbstractBase (tr ("Curve Properties"),
63  "DlgSettingsCurveProperties",
64  mainWindow),
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 
73  QWidget *subPanel = createSubPanel ();
74  finishPanel (subPanel);
75 
76  setMinimumWidth (740); // Override finishPanel width for room for m_cmbLineType and preview to be completely visible
77 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Abstract base class for all Settings dialogs.
MainWindowModel modelMainWindow() const
Get method for main window model.
DlgSettingsCurveProperties::~DlgSettingsCurveProperties ( )
virtual

Definition at line 79 of file DlgSettingsCurveProperties.cpp.

80 {
81  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveProperties::~DlgSettingsCurveProperties";
82 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 ();
262  QGridLayout *layout = new QGridLayout (subPanel);
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
Command for DlgSettingsCurveProperties.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
#define ENGAUGE_CHECK_PTR(ptr)
#endif
Definition: EngaugeAssert.h:27
log4cpp::Category * mainCat
Definition: Logger.cpp:14
MainWindow & mainWindow()
Get method for MainWindow.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
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 
387  setCmdMediator (cmdMediator);
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);
400  QStringList curveNames = cmdMediator.curvesGraphsNames();
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 }
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition: CurveStyles.h:22
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const CoordSystem & coordSystem() const
Provide the current CoordSystem to commands with read-only access, primarily for undo/redo processing...
Definition: CmdMediator.cpp:52
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void enableOk(bool enable)
Let leaf subclass control the Ok button.
MainWindow & mainWindow()
Get method for MainWindow.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: CmdMediator.cpp:62
const QString AXIS_CURVE_NAME
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 }
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) {
475  setMinimumHeight (MINIMUM_HEIGHT);
476  }
477 }
const int MINIMUM_HEIGHT

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