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