7 #include "CmdMediator.h" 8 #include "CmdSettingsGeneral.h" 9 #include "DlgSettingsGeneral.h" 10 #include "EngaugeAssert.h" 12 #include "MainWindow.h" 14 #include <QGraphicsScene> 15 #include <QGridLayout> 19 #include <QPushButton> 28 m_modelGeneralBefore (0),
29 m_modelGeneralAfter (0)
31 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::DlgSettingsGeneral";
37 DlgSettingsGeneral::~DlgSettingsGeneral()
39 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::~DlgSettingsGeneral";
42 void DlgSettingsGeneral::createControls (QGridLayout *layout,
45 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::createControls";
47 QLabel *labelCursorSize =
new QLabel (tr (
"Effective cursor size (pixels):"));
48 layout->addWidget (labelCursorSize, row, 1);
50 m_spinCursorSize =
new QSpinBox;
51 m_spinCursorSize->setMinimum (1);
52 m_spinCursorSize->setWhatsThis (tr (
"Effective Cursor Size\n\n" 53 "This is the effective width and height of the cursor when clicking on a pixel that is " 54 "not part of the background.\n\n" 55 "This parameter is used in the Color Picker and Point Match modes"));
56 connect (m_spinCursorSize, SIGNAL (valueChanged (
int)),
this, SLOT (slotCursorSize (
int)));
57 layout->addWidget (m_spinCursorSize, row++, 2);
59 QLabel *labelExtraPrecision =
new QLabel (tr (
"Extra precision (digits):"));
60 layout->addWidget (labelExtraPrecision, row, 1);
62 m_spinExtraPrecision =
new QSpinBox;
63 m_spinExtraPrecision->setMinimum (0);
64 m_spinExtraPrecision->setWhatsThis (tr (
"Extra Digits of Precision\n\n" 65 "This is the number of additional digits of precision appended after the significant " 66 "digits determined by the digitization accuracy at that point. The digitization accuracy " 67 "at any point equals the change in graph coordinates from moving one pixel in each direction. " 68 "Appending extra digits does not improve the accuracy of the numbers. More information can " 69 "be found in discussions of accuracy versus precision.\n\n" 70 "This parameter is used on the coordinates in the Status Bar and during Export"));
71 connect (m_spinExtraPrecision, SIGNAL (valueChanged (
int)),
this, SLOT (slotExtraPrecision (
int)));
72 layout->addWidget (m_spinExtraPrecision, row++, 2);
77 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::createOptionalSaveDefault";
79 m_btnSaveDefault =
new QPushButton (tr (
"Save As Default"));
80 m_btnSaveDefault->setWhatsThis (tr (
"Save the settings for use as future defaults, according to the curve name selection."));
81 connect (m_btnSaveDefault, SIGNAL (released ()),
this, SLOT (slotSaveDefault ()));
82 layout->addWidget (m_btnSaveDefault, 0, Qt::AlignLeft);
87 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::createSubPanel";
89 QWidget *subPanel =
new QWidget ();
90 QGridLayout *layout =
new QGridLayout (subPanel);
91 subPanel->setLayout (layout);
93 layout->setColumnStretch(0, 1);
94 layout->setColumnStretch(1, 0);
95 layout->setColumnStretch(2, 0);
96 layout->setColumnStretch(3, 1);
99 createControls (layout, row);
106 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::handleOk";
110 *m_modelGeneralBefore,
111 *m_modelGeneralAfter);
119 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::load";
124 if (m_modelGeneralBefore != 0) {
125 delete m_modelGeneralBefore;
127 if (m_modelGeneralAfter != 0) {
128 delete m_modelGeneralAfter;
136 m_spinCursorSize->setValue (m_modelGeneralAfter->
cursorSize());
137 m_spinExtraPrecision->setValue (m_modelGeneralAfter->
extraPrecision());
147 void DlgSettingsGeneral::slotCursorSize (
int cursorSize)
149 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::slotCursorSize";
155 void DlgSettingsGeneral::slotExtraPrecision (
int extraPrecision)
157 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::slotExtraPrecision";
163 void DlgSettingsGeneral::slotSaveDefault()
165 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGeneral::slotSaveDefault";
167 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
168 settings.beginGroup (SETTINGS_GROUP_GENERAL);
170 settings.setValue (SETTINGS_GENERAL_CURSOR_SIZE,
172 settings.setValue (SETTINGS_GENERAL_EXTRA_PRECISION,
174 settings.endGroup ();
177 void DlgSettingsGeneral::updateControls ()
Model for DlgSettingsGeneral and CmdSettingsGeneral.
void setCursorSize(int cursorSize)
Set method for effective cursor size.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void handleOk()
Process slotOk.
DlgSettingsGeneral(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.
Command for DlgSettingsGeneral.
int cursorSize() const
Get method for effective cursor size.
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 enableOk(bool enable)
Let leaf subclass control the Ok button.
Abstract base class for all Settings dialogs.
void setExtraPrecision(int extraPrecision)
Set method for extra digits of precision.
int extraPrecision() const
Get method for extra digits of precsion.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
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.