Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgSettingsMainWindow.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "ButtonWhatsThis.h"
9#include "EngaugeAssert.h"
10#include "ImportCropping.h"
12#include "Logger.h"
13#include "MainWindow.h"
14#include "MainWindowModel.h"
15#include <QApplication>
16#include <QCheckBox>
17#include <QComboBox>
18#include <QDir>
19#include <QDoubleSpinBox>
20#include <QGraphicsScene>
21#include <QGridLayout>
22#include <QGroupBox>
23#include <QLabel>
24#include <qmath.h>
25#include <QPushButton>
26#include <QSpinBox>
27#include <QString>
28#include <QLocale>
29#include "QtToString.h"
30#include <QWhatsThis>
31#include "TranslatorContainer.h"
32#include "ZoomControl.h"
33#include "ZoomFactorInitial.h"
34#include "ZoomLabels.h"
35
36// Curve fitting number of significant figures should be much greater than 1 to prevent
37// gratuitous triggering of 'matrix is inconsistent' errors, but not too much greater than
38// the precision of floating point values which is about 7
41
42const int MAX_GRID_LINES_MIN = 2;
43const int MAX_GRID_LINES_MAX = 1000;
45
46// The limits for exported points must include DEFAULT_MAXIMUM_EXPORTED_POINTS_PER_CURVE. The max
47// is not very large since that would correspond to more points than pixels in the picture
48const int STEP_MAX_EXPORTED_POINTS_PER_CURVE = 100; // Min and max should probably both be a multiple of this step size
51
53 DlgSettingsAbstractBase (tr ("Main Window"),
54 "DlgSettingsMainWindow",
56 m_modelMainWindowBefore (nullptr),
57 m_modelMainWindowAfter (nullptr)
58{
59 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::DlgSettingsMainWindow";
60
61 QWidget *subPanel = createSubPanel ();
62 finishPanel (subPanel,
64}
65
67{
68 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::~DlgSettingsMainWindow";
69}
70
71void DlgSettingsMainWindow::createControls (QGridLayout *layout,
72 int &row)
73{
74 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createControls";
75
76 const int COLUMN0 = 0;
77
78 QLabel *labelZoomFactor = new QLabel (QString ("%1:").arg (tr ("Initial zoom after load")));
79 layout->addWidget (labelZoomFactor, row, 1);
80
81 m_cmbZoomFactor = new QComboBox;
82 m_cmbZoomFactor->addItem (*LABEL_ZOOM_16_TO_1 , QVariant (ZOOM_INITIAL_16_TO_1));
83 m_cmbZoomFactor->addItem (*LABEL_ZOOM_8_TO_1 , QVariant (ZOOM_INITIAL_8_TO_1));
84 m_cmbZoomFactor->addItem (*LABEL_ZOOM_4_TO_1 , QVariant (ZOOM_INITIAL_4_TO_1));
85 m_cmbZoomFactor->addItem (*LABEL_ZOOM_2_TO_1 , QVariant (ZOOM_INITIAL_2_TO_1));
86 m_cmbZoomFactor->addItem (*LABEL_ZOOM_1_TO_1 , QVariant (ZOOM_INITIAL_1_TO_1));
87 m_cmbZoomFactor->addItem (*LABEL_ZOOM_1_TO_2 , QVariant (ZOOM_INITIAL_1_TO_2));
88 m_cmbZoomFactor->addItem (*LABEL_ZOOM_1_TO_4 , QVariant (ZOOM_INITIAL_1_TO_4));
89 m_cmbZoomFactor->addItem (*LABEL_ZOOM_1_TO_8 , QVariant (ZOOM_INITIAL_1_TO_8));
90 m_cmbZoomFactor->addItem (*LABEL_ZOOM_1_TO_16 , QVariant (ZOOM_INITIAL_1_TO_16));
91 m_cmbZoomFactor->addItem (*LABEL_ZOOM_FILL , QVariant (ZOOM_INITIAL_FILL));
92 m_cmbZoomFactor->addItem (*LABEL_ZOOM_PREVIOUS , QVariant (ZOOM_INITIAL_PREVIOUS));
93 m_cmbZoomFactor->setWhatsThis(tr ("Initial Zoom\n\n"
94 "Select the initial zoom factor when a new document is loaded. Either the previous "
95 "zoom can be kept, or the specified zoom can be applied."));
96 connect (m_cmbZoomFactor, SIGNAL (currentTextChanged (const QString)), this, SLOT (slotZoomFactor(const QString)));
97 layout->addWidget (m_cmbZoomFactor, row++, 2);
98
99 QLabel *labelLoadViews = new QLabel (QString ("%1:").arg (tr ("Initial views after load")));
100 layout->addWidget (labelLoadViews, row, 1);
101
102 m_cmbLoadViews = new QComboBox;
103 m_cmbLoadViews->setWhatsThis (tr ("Views After Load\n\n"
104 "Selects the set of views to be shown after loading a document. Either the existing views "
105 "can be kept, or the views last used for the loaded document can be restored."));
106 m_cmbLoadViews->addItem (tr ("Keep previous views"), LOAD_VIEWS_KEEP_CURRENT);
107 m_cmbLoadViews->addItem (tr ("Use document views"), LOAD_VIEWS_USE_DOCUMENT);
108 connect (m_cmbLoadViews, SIGNAL (currentIndexChanged (int)), this, SLOT (slotLoadViews (int)));
109 layout->addWidget (m_cmbLoadViews, row++, 2);
110
111 QLabel *labelZoomControl = new QLabel (QString ("%1:").arg (tr ("Zoom control")));
112 layout->addWidget (labelZoomControl, row, 1);
113
114 m_cmbZoomControl = new QComboBox;
115 m_cmbZoomControl->addItem (tr ("Menu only" ), QVariant (ZOOM_CONTROL_MENU_ONLY));
116 m_cmbZoomControl->addItem (tr ("Menu and mouse wheel" ), QVariant (ZOOM_CONTROL_MENU_WHEEL));
117 m_cmbZoomControl->addItem (tr ("Menu and +/- keys" ), QVariant (ZOOM_CONTROL_MENU_PLUSMINUS));
118 m_cmbZoomControl->addItem (tr ("Menu, mouse wheel and +/- keys"), QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS));
119 m_cmbZoomControl->setWhatsThis (tr ("Zoom Control\n\n"
120 "Select which inputs are used to zoom in and out."));
121 connect (m_cmbZoomControl, SIGNAL (currentTextChanged (const QString)), this, SLOT (slotZoomControl(const QString)));
122 layout->addWidget (m_cmbZoomControl, row++, 2);
123
124 QLabel *labelLocale = new QLabel (QString ("%1:").arg (tr ("Locale (requires restart)")));
125 layout->addWidget (labelLocale, row, 1);
126
127 // Initialization of combobox is liberated from Qt Calendar example
128 m_cmbLocale = new QComboBox;
129 m_cmbLocale->setWhatsThis(tr ("Locale\n\n"
130 "Select the locale that will be used in numbers (immediately), and the language in the user "
131 "interface (after restart).\n\n"
132 "The locale determines how numbers are formatted. Specifically, either commas or "
133 "periods will be used as group delimiters in each number entered "
134 "by the user, displayed in the user interface, or exported to a file."));
135 QStringList qmFilenames;
136 qmFilenames << gatherQmFilenames ();
137 for (int i = 0; i < qmFilenames.size(); i++) {
138 QString localeSelector = qmFilenames [i]; // "engauge_de.qm"
139 localeSelector.truncate (localeSelector.lastIndexOf ('.')); // "engauge_de"
140 localeSelector.remove (0, localeSelector.indexOf ('_') + 1); // "de"
141 QLocale locale (localeSelector);
142 QString label = QLocaleToString (locale);
143 m_cmbLocale->addItem (label, locale);
144 }
145 m_cmbLocale->model()->sort(COLUMN0); // Sort the new entries
146 connect (m_cmbLocale, SIGNAL (currentIndexChanged (int)), this, SLOT (slotLocale (int)));
147 layout->addWidget (m_cmbLocale, row++, 2);
148
149 QLabel *labelImportCropping = new QLabel (QString ("%1:").arg (tr ("Import cropping")));
150 layout->addWidget (labelImportCropping, row, 1);
151
152 m_cmbImportCropping = new QComboBox;
153 m_cmbImportCropping->setWhatsThis (tr ("Import Cropping\n\n"
154 "Enables or disables cropping of the imported image when importing. Cropping the image is useful "
155 "for removing unimportant information around a graph, but less useful when the graph already fills "
156 "the entire image.\n\n"
157 "This setting only has an effect when Engauge has been built with support for pdf files."));
158 ImportCroppingUtilBase importCroppingUtil;
159 m_cmbImportCropping->addItem (importCroppingUtil.importCroppingToString (IMPORT_CROPPING_NEVER), IMPORT_CROPPING_NEVER);
160 m_cmbImportCropping->addItem (importCroppingUtil.importCroppingToString (IMPORT_CROPPING_MULTIPAGE_PDFS), IMPORT_CROPPING_MULTIPAGE_PDFS);
161 m_cmbImportCropping->addItem (importCroppingUtil.importCroppingToString (IMPORT_CROPPING_ALWAYS), IMPORT_CROPPING_ALWAYS);
162 connect (m_cmbImportCropping, SIGNAL (currentIndexChanged (int)), this, SLOT (slotImportCropping (int)));
163 layout->addWidget (m_cmbImportCropping, row++, 2);
164
165#ifdef ENGAUGE_PDF
166 QLabel *labelPdfResolution = new QLabel (QString ("%1:").arg (tr ("Import PDF resolution (dots per inch)")));
167 layout->addWidget (labelPdfResolution, row, 1);
168
169 m_cmbPdfResolution = new QComboBox;
170 m_cmbPdfResolution->setWhatsThis (tr ("Import PDF Resolution\n\n"
171 "Imported Portable Document Format (PDF) files will be converted to this pixel resolution "
172 "in dots per inch (DPI), where each pixel is one dot. A higher value increases the picture resolution "
173 "and may also improve numeric digitizing accuracy. However, a very high value can make the image so "
174 "large that Engauge will slow down."));
175 m_cmbPdfResolution->addItem ("75", 75);
176 m_cmbPdfResolution->addItem ("100", 100);
177 m_cmbPdfResolution->addItem ("150", 150);
178 m_cmbPdfResolution->addItem ("200", 200);
179 m_cmbPdfResolution->addItem ("250", 250);
180 m_cmbPdfResolution->addItem ("300", 300);
181 connect (m_cmbPdfResolution, SIGNAL (currentTextChanged (QString)), this, SLOT (slotPdfResolution (QString)));
182 layout->addWidget (m_cmbPdfResolution, row++, 2);
183#endif
184
185 QLabel *labelMaximumGridLines = new QLabel (QString ("%1:").arg (tr ("Maximum grid lines")));
186 layout->addWidget (labelMaximumGridLines, row, 1);
187
188 m_spinMaximumGridLines = new QSpinBox;
189 m_spinMaximumGridLines->setRange (MAX_GRID_LINES_MIN, MAX_GRID_LINES_MAX);
190 m_spinMaximumGridLines->setWhatsThis (tr ("Maximum Grid Lines\n\n"
191 "Maximum number of grid lines to be processed. This limit is applied when the step value is too "
192 "small for the start and stop values, which would result in too many grid lines visually and "
193 "possibly extremely long processing time (since each grid line would have to be processed)"));
194 connect (m_spinMaximumGridLines, SIGNAL (valueChanged (int)), this, (SLOT (slotMaximumGridLines (int))));
195 layout->addWidget (m_spinMaximumGridLines, row++, 2);
196
197 QLabel *labelExportedPoints = new QLabel (QString ("%1:").arg (tr ("Maximum exported points per curve")));
198 layout->addWidget (labelExportedPoints, row, 1);
199
200 m_spinMaximumExportedPointsPerCurve = new QSpinBox;
201 m_spinMaximumExportedPointsPerCurve->setRange (MIN_MAX_EXPORTED_POINTS_PER_CURVE, MAX_MAX_EXPORTED_POINTS_PER_CURVE);
202 m_spinMaximumExportedPointsPerCurve->setSingleStep (STEP_MAX_EXPORTED_POINTS_PER_CURVE);
203 m_spinMaximumExportedPointsPerCurve->setWhatsThis (tr ("Maximum Exported Points per Curve\n\n"
204 "This is the maximum number of points allowed in each exported curve. No points are "
205 "exported when this is exceeded. This limit prevents delays and overly large file sizes due "
206 "to curves that have too many points."));
207 connect (m_spinMaximumExportedPointsPerCurve, SIGNAL (valueChanged (int)), this, SLOT (slotMaximumExportedPointsPerCurve (int)));
208 layout->addWidget (m_spinMaximumExportedPointsPerCurve, row++, 2);
209
210 QLabel *labelHighlightOpacity = new QLabel (QString ("%1:").arg (tr ("Highlight opacity")));
211 layout->addWidget (labelHighlightOpacity, row, 1);
212
213 m_spinHighlightOpacity = new QDoubleSpinBox;
214 m_spinHighlightOpacity->setRange (0, 1);
215 m_spinHighlightOpacity->setSingleStep (0.1);
216 m_spinHighlightOpacity->setWhatsThis (tr ("Highlight Opacity\n\n"
217 "Opacity to be applied when the cursor is over a curve or axis point in Select mode. The change in "
218 "appearance shows when the point can be selected."));
219 connect (m_spinHighlightOpacity, SIGNAL (valueChanged (double)), this, SLOT (slotHighlightOpacity(double)));
220 layout->addWidget (m_spinHighlightOpacity, row++, 2);
221
222 QLabel *labelRecent = new QLabel (QString ("%1:").arg (tr ("Recent file list")));
223 layout->addWidget (labelRecent, row, 1);
224
225 m_btnRecentClear = new QPushButton (tr ("Clear"));
226 m_btnRecentClear->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
227 m_btnRecentClear->setWhatsThis (tr ("Recent File List Clear\n\n"
228 "Clear the recent file list in the File menu."));
229 connect (m_btnRecentClear, SIGNAL (pressed ()), &mainWindow(), SLOT (slotRecentFileClear ()));
230 connect (m_btnRecentClear, SIGNAL (pressed ()), this, SLOT (slotRecentFileClear()));
231 layout->addWidget (m_btnRecentClear, row++, 2);
232
233 QLabel *labelTitleBarFormat = new QLabel (QString ("%1:").arg (tr ("Include title bar path")));
234 layout->addWidget (labelTitleBarFormat, row, 1);
235
236 m_chkTitleBarFormat = new QCheckBox;
237 m_chkTitleBarFormat->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
238 m_chkTitleBarFormat->setWhatsThis (tr ("Title Bar Filename\n\n"
239 "Includes or excludes the path and file extension from the filename in the title bar."));
240 connect (m_chkTitleBarFormat, SIGNAL (toggled (bool)), this, SLOT (slotTitleBarFormat(bool)));
241 layout->addWidget (m_chkTitleBarFormat, row++, 2);
242
243 QLabel *labelSmallDialogs = new QLabel (QString ("%1:").arg (tr ("Allow small dialogs")));
244 layout->addWidget (labelSmallDialogs, row, 1);
245
246 m_chkSmallDialogs = new QCheckBox;
247 m_chkSmallDialogs->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
248 m_chkSmallDialogs->setWhatsThis (tr ("Allow Small Dialogs\n\n"
249 "Allows settings dialogs to be made very small so they fit on small computer screens."));
250 connect (m_chkSmallDialogs, SIGNAL (toggled (bool)), this, SLOT (slotSmallDialogs (bool)));
251 layout->addWidget (m_chkSmallDialogs, row++, 2);
252
253 QLabel *labelDragDropExport = new QLabel (QString ("%1:").arg (tr ("Allow drag and drop export")));
254 layout->addWidget (labelDragDropExport, row, 1);
255
256 m_chkDragDropExport = new QCheckBox;
257 m_chkDragDropExport->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
258 m_chkDragDropExport->setWhatsThis (tr ("Allow Drag and Drop Export\n\n"
259 "Allows drag and drop export from the Curve Fitting Window and Geometry Window tables.\n\n"
260 "When drag and drop is disabled, a rectangular set of table cells can be selected using click and "
261 "drag. When drag and drop is enabled, a rectangular set of table cells can be selected using Click "
262 "then Shift+Click, since click and drag starts the drag operation."));
263 connect (m_chkDragDropExport, SIGNAL (toggled (bool)), this, SLOT (slotDragDropExport (bool)));
264 layout->addWidget (m_chkDragDropExport, row++, 2);
265
266 QLabel *labelImageReplaceRenamesDocument = new QLabel (QString ("%1:").arg (tr ("Image replace renames document")));
267 layout->addWidget (labelImageReplaceRenamesDocument, row, 1);
268
269 m_chkImageReplaceRenamesDocument = new QCheckBox;
270 m_chkImageReplaceRenamesDocument->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
271 m_chkImageReplaceRenamesDocument->setWhatsThis (tr ("Image Replace Renames Document\n\n"
272 "When an image is imported to replace the current image, the document "
273 "will be renamed if this is true, otherwise the name will stay the same."));
274 connect (m_chkImageReplaceRenamesDocument, SIGNAL (toggled (bool)), this, SLOT (slotImageReplaceRenamesDocument (bool)));
275 layout->addWidget (m_chkImageReplaceRenamesDocument, row++, 2);
276
277 QLabel *labelSignificantDigits = new QLabel (QString ("%1:").arg (tr ("Significant digits")));
278 layout->addWidget (labelSignificantDigits, row, 1);
279
280 m_spinSignificantDigits = new QSpinBox;
281 m_spinSignificantDigits->setRange (MIN_SIGNIFICANT_DIGITS, MAX_SIGNIFICANT_DIGITS);
282 m_spinSignificantDigits->setWhatsThis (tr ("Significant Digits\n\n"
283 "Number of digits of precision in floating point numbers. This value affects "
284 "calculations for curve fits, since intermediate results smaller than a "
285 "threshold T indicate that a polynomial curve with a specific order cannot be "
286 "fitted to the data. The threshold T is computed from the maximum matrix "
287 "element M and significant digits S as T = M / 10^S."));
288 connect (m_spinSignificantDigits, SIGNAL (valueChanged (int)), this, SLOT (slotSignificantDigits (int)));
289 layout->addWidget (m_spinSignificantDigits, row++, 2);
290}
291
293{
294 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createOptionalSaveDefault";
295}
296
298{
299 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::createSubPanel";
300
301 QWidget *subPanel = new QWidget ();
302 QGridLayout *layout = new QGridLayout (subPanel);
303 subPanel->setLayout (layout);
304
305 layout->setColumnStretch(0, 1); // Empty first column
306 layout->setColumnStretch(1, 0); // Labels
307 layout->setColumnStretch(2, 0); // Values
308 layout->setColumnStretch(3, 1); // Empty first column
309
310 int row = 0;
311
312 createWhatsThis (layout,
313 m_btnWhatsThis,
314 row++,
315 3);
316 createControls (layout, row);
317
318 return subPanel;
319}
320
321QStringList DlgSettingsMainWindow::gatherQmFilenames () const
322{
323 // Get available locales. The static QLocale::matchingLocales gives the few available translations
324 // but also the many unavailable translations. We use a list of translation files to see what is available
325 QDir translationPath (TranslatorContainer::qmDirectory ());
326 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::gatherQmFilenames directory="
327 << translationPath.path().toLatin1().data();
328 QStringList filenames = translationPath.entryList (QStringList ("engauge_*.qm"));
329
330 return filenames;
331}
332
334{
335 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::handleOk";
336
337 mainWindow().updateSettingsMainWindow (*m_modelMainWindowAfter);
338
339 hide ();
340}
341
342void DlgSettingsMainWindow::load (CmdMediator & /* cmdMediator */)
343{
344 LOG4CPP_ERROR_S ((*mainCat)) << "DlgSettingsMainWindow::load";
345
346 ENGAUGE_ASSERT (false);
347}
348
350 const MainWindowModel &modelMainWindow)
351{
352 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::loadMainWindowModel";
353
355
356 // Flush old data
357 delete m_modelMainWindowBefore;
358 delete m_modelMainWindowAfter;
359
360 // Save new data
361 m_modelMainWindowBefore = new MainWindowModel (modelMainWindow);
362 m_modelMainWindowAfter = new MainWindowModel (modelMainWindow);
363
364 // Populate controls
365 int index = m_cmbZoomFactor->findData (m_modelMainWindowAfter->zoomFactorInitial());
366 m_cmbZoomFactor->setCurrentIndex (index);
367 index = m_cmbZoomControl->findData (m_modelMainWindowAfter->zoomControl());
368 m_cmbZoomControl->setCurrentIndex (index);
369 QString locLabel = QLocaleToString (m_modelMainWindowAfter->locale());
370 index = m_cmbLocale->findText (locLabel);
371 if (index < 0) {
372 // Somehow an invalid locale is selected. Fix it by setting to default
373 locLabel = QLocale::system().name();
374 index = m_cmbLocale->findText (locLabel);
375 }
376 m_cmbLocale->setCurrentIndex(index);
377 index = m_cmbImportCropping->findData (m_modelMainWindowAfter->importCropping());
378 m_cmbImportCropping->setCurrentIndex (index);
379 index = m_cmbLoadViews->findData (m_modelMainWindowAfter->loadViews());
380 m_cmbLoadViews->setCurrentIndex (index);
381 m_chkTitleBarFormat->setChecked (m_modelMainWindowAfter->mainTitleBarFormat() == MAIN_TITLE_BAR_FORMAT_PATH);
382#ifdef ENGAUGE_PDF
383 index = m_cmbPdfResolution->findData (m_modelMainWindowAfter->pdfResolution());
384 m_cmbPdfResolution->setCurrentIndex(index);
385#endif
386 m_spinMaximumGridLines->setValue (m_modelMainWindowAfter->maximumGridLines());
387 m_spinHighlightOpacity->setValue (m_modelMainWindowAfter->highlightOpacity());
388 m_chkSmallDialogs->setChecked (m_modelMainWindowAfter->smallDialogs());
389 m_chkDragDropExport->setChecked (m_modelMainWindowAfter->dragDropExport());
390 m_spinSignificantDigits->setValue (m_modelMainWindowAfter->significantDigits ());
391 m_chkImageReplaceRenamesDocument->setChecked (m_modelMainWindowAfter->imageReplaceRenamesDocument());
392 m_spinMaximumExportedPointsPerCurve->setValue (m_modelMainWindowAfter->maximumExportedPointsPerCurve());
393
394 updateControls ();
395 enableOk (false); // Disable Ok button since there not yet any changes
396}
397
398void DlgSettingsMainWindow::setSmallDialogs(bool /* smallDialogs */)
399{
400}
401
402void DlgSettingsMainWindow::slotDragDropExport (bool)
403{
404 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotDragDropExport";
405
406 m_modelMainWindowAfter->setDragDropExport (m_chkDragDropExport->isChecked());
407 updateControls ();
408}
409
410void DlgSettingsMainWindow::slotHighlightOpacity(double)
411{
412 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotHighlightOpacity";
413
414 m_modelMainWindowAfter->setHighlightOpacity (m_spinHighlightOpacity->value());
415 updateControls();
416}
417
418void DlgSettingsMainWindow::slotImageReplaceRenamesDocument (bool)
419{
420 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotImageReplaceRenamesDocument";
421
422 m_modelMainWindowAfter->setImageReplaceRenamesDocument (m_chkImageReplaceRenamesDocument->isChecked());
423 updateControls ();
424}
425
426void DlgSettingsMainWindow::slotImportCropping (int index)
427{
428 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotImportCropping";
429
430 m_modelMainWindowAfter->setImportCropping (static_cast<ImportCropping> (m_cmbImportCropping->itemData (index).toInt ()));
431 updateControls();
432}
433
434void DlgSettingsMainWindow::slotLoadViews (int index)
435{
436 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotLoadViews";
437
438 m_modelMainWindowAfter->setLoadViews (static_cast<LoadViews> (m_cmbLoadViews->itemData (index).toInt ()));
439 updateControls();
440}
441void DlgSettingsMainWindow::slotLocale (int index)
442{
443 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotLocale";
444
445 QLocale locale = m_cmbLocale->itemData (index).toLocale();
446
447 m_modelMainWindowAfter->setLocale (locale);
448 updateControls();
449}
450
451void DlgSettingsMainWindow::slotMaximumExportedPointsPerCurve (int limit)
452{
453 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotMaximumExportedPointsPerCurve";
454
455 m_modelMainWindowAfter->setMaximumExportedPointsPerCurve (limit);
456 updateControls ();
457}
458
459void DlgSettingsMainWindow::slotMaximumGridLines (int limit)
460{
461 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotMaximumGridLines";
462
463 m_modelMainWindowAfter->setMaximumGridLines (limit);
464 updateControls ();
465}
466
467void DlgSettingsMainWindow::slotPdfResolution(const QString)
468{
469 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWIndow::slotPdfResolution";
470
471#ifdef ENGAUGE_PDF
472 m_modelMainWindowAfter->setPdfResolution(m_cmbPdfResolution->currentData().toInt());
473 updateControls();
474#endif
475}
476
477void DlgSettingsMainWindow::slotRecentFileClear()
478{
479 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotRecentFileClear";
480
481 // The signal that triggered the call to this method was also sent to MainWindow to clear the list there
482 updateControls();
483}
484
485void DlgSettingsMainWindow::slotSignificantDigits(int)
486{
487 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotSignificantDigits";
488
489 m_modelMainWindowAfter->setSignificantDigits(m_spinSignificantDigits->value ());
490 updateControls ();
491}
492
493void DlgSettingsMainWindow::slotSmallDialogs (bool)
494{
495 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotSmallDialogs";
496
497 m_modelMainWindowAfter->setSmallDialogs (m_chkSmallDialogs->isChecked());
498 updateControls ();
499}
500
501void DlgSettingsMainWindow::slotTitleBarFormat(bool)
502{
503 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotTitleBarFormat";
504
505 m_modelMainWindowAfter->setMainTitleBarFormat(m_chkTitleBarFormat->isChecked() ?
508 updateControls();
509}
510
511void DlgSettingsMainWindow::slotWhatsThis ()
512{
513 QWhatsThis::enterWhatsThisMode();
514}
515
516void DlgSettingsMainWindow::slotZoomControl(const QString)
517{
518 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::slotZoomControl";
519
520 m_modelMainWindowAfter->setZoomControl (static_cast<ZoomControl> (m_cmbZoomControl->currentData().toInt()));
521 updateControls();
522}
523
524void DlgSettingsMainWindow::slotZoomFactor(const QString)
525{
526 LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWIndow::slotZoomFactor";
527
528 m_modelMainWindowAfter->setZoomFactorInitial(static_cast<ZoomFactorInitial> (m_cmbZoomFactor->currentData().toInt()));
529 updateControls();
530}
531
532void DlgSettingsMainWindow::updateControls ()
533{
534 enableOk (true);
535}
const int MAX_GRID_LINES_MIN
const int MAX_MAX_EXPORTED_POINTS_PER_CURVE
const int MINIMUM_DIALOG_WIDTH_MAIN_WINDOW
const int MIN_MAX_EXPORTED_POINTS_PER_CURVE
const int MAX_GRID_LINES_MAX
const int STEP_MAX_EXPORTED_POINTS_PER_CURVE
const int MAX_SIGNIFICANT_DIGITS
const int MIN_SIGNIFICANT_DIGITS
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
ImportCropping
@ IMPORT_CROPPING_NEVER
@ IMPORT_CROPPING_MULTIPAGE_PDFS
@ IMPORT_CROPPING_ALWAYS
LoadViews
Options for loading view states.
Definition LoadViews.h:13
@ LOAD_VIEWS_USE_DOCUMENT
Definition LoadViews.h:15
@ LOAD_VIEWS_KEEP_CURRENT
Definition LoadViews.h:14
log4cpp::Category * mainCat
Definition Logger.cpp:14
@ MAIN_TITLE_BAR_FORMAT_NO_PATH
@ MAIN_TITLE_BAR_FORMAT_PATH
Filename without path.
QString QLocaleToString(const QLocale &locale)
ZoomControl
Definition ZoomControl.h:10
@ ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS
Definition ZoomControl.h:14
@ ZOOM_CONTROL_MENU_WHEEL
Definition ZoomControl.h:12
@ ZOOM_CONTROL_MENU_PLUSMINUS
Definition ZoomControl.h:13
@ ZOOM_CONTROL_MENU_ONLY
Definition ZoomControl.h:11
ZoomFactorInitial
@ ZOOM_INITIAL_4_TO_1
@ ZOOM_INITIAL_1_TO_2
@ ZOOM_INITIAL_2_TO_1
@ ZOOM_INITIAL_1_TO_1
@ ZOOM_INITIAL_16_TO_1
@ ZOOM_INITIAL_PREVIOUS
@ ZOOM_INITIAL_FILL
@ ZOOM_INITIAL_1_TO_4
@ ZOOM_INITIAL_8_TO_1
@ ZOOM_INITIAL_1_TO_8
@ ZOOM_INITIAL_1_TO_16
const QString * LABEL_ZOOM_1_TO_4
const QString * LABEL_ZOOM_16_TO_1
const QString * LABEL_ZOOM_1_TO_2
const QString * LABEL_ZOOM_1_TO_8
const QString * LABEL_ZOOM_1_TO_1
const QString * LABEL_ZOOM_2_TO_1
const QString * LABEL_ZOOM_8_TO_1
const QString * LABEL_ZOOM_4_TO_1
const QString * LABEL_ZOOM_PREVIOUS
const QString * LABEL_ZOOM_FILL
const QString * LABEL_ZOOM_1_TO_16
Command queue stack.
Definition CmdMediator.h:24
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
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.
MainWindow & mainWindow()
Get method for MainWindow.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
DlgSettingsMainWindow(MainWindow &mainWindow)
Single constructor.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void handleOk()
Process slotOk.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
static QString importCroppingToString(ImportCropping importCropping)
Option as string for display to user.
Model for DlgSettingsMainWindow.
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
static QString qmDirectory()
Platform dependent directory containing qm translation files.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12