Engauge Digitizer  2
Public Slots | Public Member Functions | Protected Member Functions | List of all members
DlgSettingsCurveList Class Reference

Dialog for editing curve names settings. More...

#include <DlgSettingsCurveList.h>

Inheritance diagram for DlgSettingsCurveList:
Inheritance graph
Collaboration diagram for DlgSettingsCurveList:
Collaboration graph

Public Slots

void slotRowsAboutToBeRemoved (const QModelIndex &parent, int rowFirst, int rowLast)
 Cleanup after rows have been removed in the model. We remove the corresponding rows in the QListView. More...
 

Public Member Functions

 DlgSettingsCurveList (MainWindow &mainWindow)
 Single constructor. More...
 
virtual ~DlgSettingsCurveList ()
 
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...
 
void load (CmdMediator &cmdMediator)
 Load settings from Document. 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
CmdMediator & cmdMediator ()
 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...
 
MainWindow & mainWindow ()
 Get method for MainWindow. More...
 
const MainWindow & mainWindow () 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 names settings.

Definition at line 24 of file DlgSettingsCurveList.h.

Constructor & Destructor Documentation

◆ DlgSettingsCurveList()

DlgSettingsCurveList::DlgSettingsCurveList ( MainWindow &  mainWindow)

Single constructor.

Definition at line 31 of file DlgSettingsCurveList.cpp.

31  :
32  DlgSettingsAbstractBase (tr ("Curve List"),
33  "DlgSettingsCurveList",
34  mainWindow),
35  m_curveNameList (nullptr)
36 {
37  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::DlgSettingsCurveList";
38 
39  QWidget *subPanel = createSubPanel ();
40  finishPanel (subPanel);
41 }
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
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Abstract base class for all Settings dialogs.
MainWindow & mainWindow()
Get method for MainWindow.

◆ ~DlgSettingsCurveList()

DlgSettingsCurveList::~DlgSettingsCurveList ( )
virtual

Definition at line 43 of file DlgSettingsCurveList.cpp.

44 {
45  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::~DlgSettingsCurveList";
46 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsCurveList::createOptionalSaveDefault ( QHBoxLayout *  layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 117 of file DlgSettingsCurveList.cpp.

118 {
119  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::createOptionalSaveDefault";
120 
121  m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
122  m_btnSaveDefault->setWhatsThis (tr ("Save the curve names for use as defaults for future graph curves."));
123  connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
124  layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
125 
126  m_btnResetDefault = new QPushButton (tr ("Reset Default"));
127  m_btnResetDefault->setWhatsThis (tr ("Reset the defaults for future graph curves to the original settings."));
128  connect (m_btnResetDefault, SIGNAL (released ()), this, SLOT (slotResetDefault()));
129  layout->addWidget (m_btnResetDefault, 0, Qt::AlignRight);
130 
131  QSpacerItem *spacer = new QSpacerItem (40, 2);
132  layout->addItem (spacer);
133 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ createSubPanel()

QWidget * DlgSettingsCurveList::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 135 of file DlgSettingsCurveList.cpp.

136 {
137  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::createSubPanel";
138 
139  const int EMPTY_COLUMN_WIDTH = 30;
140 
141  QWidget *subPanel = new QWidget ();
142  QGridLayout *layout = new QGridLayout (subPanel);
143  subPanel->setLayout (layout);
144 
145  int row = 1;
146  createListCurves (layout, row);
147  createButtons (layout, row);
148 
149  layout->setColumnStretch (0, 0); // Empty first column
150  layout->setColumnMinimumWidth (0, EMPTY_COLUMN_WIDTH);
151  layout->setColumnStretch (1, 1); // New
152  layout->setColumnStretch (2, 1); // Remove
153  layout->setColumnStretch (3, 0); // Empty last column
154  layout->setColumnMinimumWidth (3, EMPTY_COLUMN_WIDTH);
155 
156  return subPanel;
157 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ handleOk()

void DlgSettingsCurveList::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 171 of file DlgSettingsCurveList.cpp.

172 {
173  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::handleOk";
174 
176  cmdMediator ().document(),
177  *m_curveNameList);
178  cmdMediator ().push (cmd);
179 
180  hide ();
181 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Command for DlgSettingsCurveList.
MainWindow & mainWindow()
Get method for MainWindow.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.

◆ load()

void DlgSettingsCurveList::load ( CmdMediator &  cmdMediator)
virtual

Load settings from Document.

Implements DlgSettingsAbstractBase.

Definition at line 195 of file DlgSettingsCurveList.cpp.

196 {
197  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::load";
198 
200 
201  // Perform comprehensive clearing
202  m_listCurves->reset ();
203  m_curveNameList->reset ();
204 
205  QStringList curveNames = cmdMediator.curvesGraphsNames ();
206  QStringList::const_iterator itr;
207  for (itr = curveNames.begin (); itr != curveNames.end (); itr++) {
208  QString curveName = *itr;
209  appendCurveName (curveName,
210  curveName,
211  cmdMediator.curvesGraphsNumPoints (curveName));
212  }
213 
214  selectCurveName (curveNames.first());
215 
216  updateControls (); // Make especially sure Remove is disabled if there is just one curve, or none are selected
217  enableOk (false); // Disable Ok button since there not yet any changes
218 }
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void enableOk(bool enable)
Let leaf subclass control the Ok button.
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
Definition: CmdMediator.cpp:67
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition: CmdMediator.cpp:62
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void reset()
Clear all information.

◆ setSmallDialogs()

void DlgSettingsCurveList::setSmallDialogs ( bool  smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 433 of file DlgSettingsCurveList.cpp.

434 {
435  if (!smallDialogs) {
436  setMinimumHeight (MINIMUM_HEIGHT);
437  }
438 }
const int MINIMUM_HEIGHT

◆ slotRowsAboutToBeRemoved

void DlgSettingsCurveList::slotRowsAboutToBeRemoved ( const QModelIndex &  parent,
int  rowFirst,
int  rowLast 
)
slot

Cleanup after rows have been removed in the model. We remove the corresponding rows in the QListView.

Definition at line 461 of file DlgSettingsCurveList.cpp.

464 {
465  LOG4CPP_DEBUG_S ((*mainCat)) << "DlgSettingsCurveList::slotRowsAboutToBeRemoved"
466  << " parentValid=" << (parent.isValid() ? "yes" : "no")
467  << " rowFirst=" << rowFirst
468  << " rowLast=" << rowLast;
469 
470  updateControls ();
471 }
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

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