Engauge Digitizer 2
Loading...
Searching...
No Matches
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.
void slotWhatsThis ()

Public Member Functions

 DlgSettingsCurveList (MainWindow &mainWindow)
 Single constructor.
virtual ~DlgSettingsCurveList ()
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.
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 curve names settings.

Definition at line 25 of file DlgSettingsCurveList.h.

Constructor & Destructor Documentation

◆ DlgSettingsCurveList()

DlgSettingsCurveList::DlgSettingsCurveList ( MainWindow & mainWindow)

Single constructor.

Definition at line 33 of file DlgSettingsCurveList.cpp.

33 :
34 DlgSettingsAbstractBase (tr ("Curve List"),
35 "DlgSettingsCurveList",
37 m_curveNameList (nullptr)
38{
39 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::DlgSettingsCurveList";
40
41 QWidget *subPanel = createSubPanel ();
42 finishPanel (subPanel);
43}
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

◆ ~DlgSettingsCurveList()

DlgSettingsCurveList::~DlgSettingsCurveList ( )
virtual

Definition at line 45 of file DlgSettingsCurveList.cpp.

46{
47 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::~DlgSettingsCurveList";
48}

Member Function Documentation

◆ createOptionalSaveDefault()

void DlgSettingsCurveList::createOptionalSaveDefault ( QHBoxLayout * layout)
virtual

Let subclass define an optional Save As Default button.

Implements DlgSettingsAbstractBase.

Definition at line 124 of file DlgSettingsCurveList.cpp.

125{
126 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::createOptionalSaveDefault";
127
128 m_btnSaveDefault = new QPushButton (tr ("Save As Default"));
129 m_btnSaveDefault->setWhatsThis (tr ("Save the curve names for use as defaults for future graph curves."));
130 connect (m_btnSaveDefault, SIGNAL (released ()), this, SLOT (slotSaveDefault ()));
131 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
132
133 m_btnResetDefault = new QPushButton (tr ("Reset Default"));
134 m_btnResetDefault->setWhatsThis (tr ("Reset the defaults for future graph curves to the original settings."));
135 connect (m_btnResetDefault, SIGNAL (released ()), this, SLOT (slotResetDefault()));
136 layout->addWidget (m_btnResetDefault, 0, Qt::AlignRight);
137
138 QSpacerItem *spacer = new QSpacerItem (40, 2);
139 layout->addItem (spacer);
140}

◆ createSubPanel()

QWidget * DlgSettingsCurveList::createSubPanel ( )
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 142 of file DlgSettingsCurveList.cpp.

143{
144 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::createSubPanel";
145
146 const int EMPTY_COLUMN_WIDTH = 30;
147
148 QWidget *subPanel = new QWidget ();
149 QGridLayout *layout = new QGridLayout (subPanel);
150 subPanel->setLayout (layout);
151
152 int row = 0;
153 createListCurves (layout, row);
154 createButtons (layout, row);
155
156 layout->setColumnStretch (0, 0); // Empty first column
157 layout->setColumnMinimumWidth (0, EMPTY_COLUMN_WIDTH);
158 layout->setColumnStretch (1, 1); // New
159 layout->setColumnStretch (2, 1); // Remove
160 layout->setColumnStretch (3, 0); // Empty last column
161 layout->setColumnMinimumWidth (3, EMPTY_COLUMN_WIDTH);
162
163 return subPanel;
164}

◆ handleOk()

void DlgSettingsCurveList::handleOk ( )
protectedvirtual

Process slotOk.

Implements DlgSettingsAbstractBase.

Definition at line 178 of file DlgSettingsCurveList.cpp.

179{
180 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::handleOk";
181
182 CmdSettingsCurveList *cmd = new CmdSettingsCurveList (mainWindow (),
183 cmdMediator ().document(),
184 *m_curveNameList);
185 cmdMediator ().push (cmd);
186
187 hide ();
188}
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 202 of file DlgSettingsCurveList.cpp.

203{
204 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsCurveList::load";
205
207
208 // Perform comprehensive clearing
209 m_listCurves->reset ();
210 m_curveNameList->reset ();
211
212 QStringList curveNames = cmdMediator.curvesGraphsNames ();
213 QStringList::const_iterator itr;
214 for (itr = curveNames.begin (); itr != curveNames.end (); itr++) {
215 QString curveName = *itr;
216 appendCurveName (curveName,
217 curveName,
218 cmdMediator.curvesGraphsNumPoints (curveName));
219 }
220
221 selectCurveName (curveNames.first());
222
223 updateControls (); // Make especially sure Remove is disabled if there is just one curve, or none are selected
224 enableOk (false); // Disable Ok button since there not yet any changes
225}
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 DlgSettingsCurveList::setSmallDialogs ( bool smallDialogs)
virtual

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

Implements DlgSettingsAbstractBase.

Definition at line 440 of file DlgSettingsCurveList.cpp.

441{
442 if (!smallDialogs) {
443 setMinimumHeight (MINIMUM_HEIGHT);
444 }
445}
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 549 of file DlgSettingsCurveList.cpp.

552{
553 LOG4CPP_DEBUG_S ((*mainCat)) << "DlgSettingsCurveList::slotRowsAboutToBeRemoved"
554 << " parentValid=" << (parent.isValid() ? "yes" : "no")
555 << " rowFirst=" << rowFirst
556 << " rowLast=" << rowLast;
557
558 updateControls ();
559}
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ slotWhatsThis

void DlgSettingsCurveList::slotWhatsThis ( )
slot

Definition at line 585 of file DlgSettingsCurveList.cpp.

586{
587 QWhatsThis::enterWhatsThisMode();
588}

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