1 #include "CmdMediator.h"
2 #include "CmdSettingsCommon.h"
3 #include "DlgSettingsCommon.h"
4 #include "EngaugeAssert.h"
6 #include "MainWindow.h"
7 #include <QGraphicsScene>
11 #include <QRadioButton>
18 m_modelCommonBefore (0),
19 m_modelCommonAfter (0)
21 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::DlgSettingsCommon";
27 DlgSettingsCommon::~DlgSettingsCommon()
29 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::~DlgSettingsCommon";
32 void DlgSettingsCommon::createControls (QGridLayout *layout,
35 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::createControls";
37 QLabel *labelCursorSize =
new QLabel (
"Cursor size (pixels):");
38 layout->addWidget (labelCursorSize, row, 1);
40 m_spinCursorSize =
new QSpinBox;
41 m_spinCursorSize->setMinimum (1);
42 m_spinCursorSize->setWhatsThis (tr (
"Effective Cursor Size\n\n"
43 "This is the effective width and height of the cursor when clicking on a pixel that is "
44 "not part of the background.\n\n"
45 "This parameter is used in the Color Picker and Point Match modes"));
46 connect (m_spinCursorSize, SIGNAL (valueChanged (
int)),
this, SLOT (slotCursorSize (
int)));
47 layout->addWidget (m_spinCursorSize, row++, 2);
49 QLabel *labelExtraPrecision =
new QLabel (
"Extra precision (digits):");
50 layout->addWidget (labelExtraPrecision, row, 1);
52 m_spinExtraPrecision =
new QSpinBox;
53 m_spinExtraPrecision->setMinimum (0);
54 m_spinExtraPrecision->setWhatsThis (tr (
"Extra Digits of Precision\n\n"
55 "This is the number of additional digits of precision appended after the significant "
56 "digits determined by the digitization accuracy at that point. The digitization accuracy "
57 "at any point equals the change in graph coordinates from moving one pixel in each direction. "
58 "Appending extra digits does not improve the accuracy of the numbers. More information can "
59 "be found in discussions of accuracy versus precision.\n\n"
60 "This parameter is used on the coordinates in the Status Bar and during Export"));
61 connect (m_spinExtraPrecision, SIGNAL (valueChanged (
int)),
this, SLOT (slotExtraPrecision (
int)));
62 layout->addWidget (m_spinExtraPrecision, row++, 2);
67 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::createSubPanel";
69 QWidget *subPanel =
new QWidget ();
70 QGridLayout *layout =
new QGridLayout (subPanel);
71 subPanel->setLayout (layout);
73 layout->setColumnStretch(0, 1);
74 layout->setColumnStretch(1, 0);
75 layout->setColumnStretch(2, 0);
76 layout->setColumnStretch(3, 1);
79 createControls (layout, row);
86 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::handleOk";
99 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::load";
104 if (m_modelCommonBefore != 0) {
105 delete m_modelCommonBefore;
107 if (m_modelCommonAfter != 0) {
108 delete m_modelCommonAfter;
116 m_spinCursorSize->setValue (m_modelCommonAfter->
cursorSize());
117 m_spinExtraPrecision->setValue (m_modelCommonAfter->
extraPrecision());
123 void DlgSettingsCommon::slotCursorSize (
int cursorSize)
125 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::slotCursorSize";
131 void DlgSettingsCommon::slotExtraPrecision (
int extraPrecision)
133 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsCommon::slotExtraPrecision";
139 void DlgSettingsCommon::updateControls ()
int extraPrecision() const
Get method for extra digits of precsion.
DlgSettingsCommon(MainWindow &mainWindow)
Single constructor.
Model for DlgSettingsCommon and CmdSettingsCommon.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
virtual void handleOk()
Process slotOk.
int cursorSize() const
Get method for effective cursor size.
void setExtraPrecision(int extraPrecision)
Set method for extra digits of precision.
void setCursorSize(int cursorSize)
Set method for effective cursor size.
void finishPanel(QWidget *subPanel)
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.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
Abstract base class for all Settings dialogs.
Command for DlgSettingsCommon.
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.