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