7 #include "BackgroundImage.h" 8 #include "BackgroundStateContext.h" 9 #include "img/bannerapp_16.xpm" 10 #include "img/bannerapp_32.xpm" 11 #include "img/bannerapp_64.xpm" 12 #include "img/bannerapp_128.xpm" 13 #include "img/bannerapp_256.xpm" 14 #include "ChecklistGuide.h" 15 #include "ChecklistGuideWizard.h" 18 #include "CmdDelete.h" 19 #include "CmdMediator.h" 20 #include "CmdSelectCoordSystem.h" 21 #include "CmdStackShadow.h" 22 #include "ColorFilter.h" 25 #include "DigitizeStateContext.h" 26 #include "DigitAxis.xpm" 27 #include "DigitColorPicker.xpm" 28 #include "DigitCurve.xpm" 29 #include "DigitPointMatch.xpm" 30 #include "DigitScale.xpm" 31 #include "DigitSegment.xpm" 32 #include "DigitSelect.xpm" 34 #include "DlgErrorReportLocal.h" 35 #include "DlgErrorReportNetworking.h" 36 #include "DlgImportAdvanced.h" 37 #include "DlgRequiresTransform.h" 38 #include "DlgSettingsAxesChecker.h" 39 #include "DlgSettingsColorFilter.h" 40 #include "DlgSettingsCoords.h" 41 #include "DlgSettingsCurveAddRemove.h" 42 #include "DlgSettingsCurveProperties.h" 43 #include "DlgSettingsDigitizeCurve.h" 44 #include "DlgSettingsExportFormat.h" 45 #include "DlgSettingsGeneral.h" 46 #include "DlgSettingsGridDisplay.h" 47 #include "DlgSettingsGridRemoval.h" 48 #include "DlgSettingsMainWindow.h" 49 #include "DlgSettingsPointMatch.h" 50 #include "DlgSettingsSegments.h" 51 #include "DocumentSerialize.h" 52 #include "EngaugeAssert.h" 53 #include "EnumsToQt.h" 54 #include "ExportImageForRegression.h" 55 #include "ExportToFile.h" 56 #include "FileCmdScript.h" 57 #include "FittingCurve.h" 58 #include "FittingWindow.h" 59 #include "GeometryWindow.h" 61 #include "GraphicsItemsExtractor.h" 62 #include "GraphicsItemType.h" 63 #include "GraphicsScene.h" 64 #include "GraphicsView.h" 65 #include "GridLineFactory.h" 66 #include "GridLineLimiter.h" 67 #include "HelpWindow.h" 68 #ifdef ENGAUGE_JPEG2000 70 #endif // ENGAUGE_JPEG2000 71 #include "LoadFileInfo.h" 73 #include "LoadImageFromUrl.h" 76 #include "MainTitleBarFormat.h" 77 #include "MainWindow.h" 79 #include "NetworkClient.h" 85 #include "PdfResolution.h" 87 #include <QApplication> 88 #include <QCloseEvent> 91 #include <QDesktopServices> 92 #include <QDockWidget> 93 #include <QDomDocument> 95 #include <QFileDialog> 97 #include <QGraphicsLineItem> 98 #include <QImageReader> 100 #include <QKeySequence> 104 #include <QMessageBox> 105 #include <QMouseEvent> 106 #include <QPrintDialog> 109 #include <QTextStream> 113 #include <QToolButton> 114 #include "QtToString.h" 115 #include <QVBoxLayout> 116 #include <QWhatsThis> 117 #include <QXmlStreamReader> 118 #include <QXmlStreamWriter> 119 #include "ScaleBarAxisPointsUnite.h" 120 #include "Settings.h" 121 #include "StatusBar.h" 122 #include "TransformationStateContext.h" 123 #include "TutorialDlg.h" 125 #include "ViewPointStyle.h" 126 #include "ViewSegmentFilter.h" 127 #include "ZoomFactor.h" 128 #include "ZoomFactorInitial.h" 130 const QString EMPTY_FILENAME (
"");
131 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
132 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
133 const int REGRESSION_INTERVAL = 400;
134 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
137 const QString &fileCmdScriptFile,
138 bool isRegressionTest,
141 QStringList loadStartupFiles,
144 m_isDocumentExported (false),
145 m_engaugeFile (EMPTY_FILENAME),
146 m_currentFile (EMPTY_FILENAME),
150 m_loadImageFromUrl (0),
152 m_digitizeStateContext (0),
153 m_transformationStateContext (0),
154 m_backgroundStateContext (0),
156 m_isGnuplot (isGnuplot),
158 m_timerRegressionErrorReport(0),
160 m_isErrorReportRegressionTest (isRegressionTest),
161 m_timerRegressionFileCmdScript(0),
164 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow" 165 <<
" curDir=" << QDir::currentPath().toLatin1().data();
167 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 168 qApp->setApplicationName (
"Engauge Digitizer");
169 qApp->setOrganizationDomain (
"Mark Mitchell");
174 m_startupDirectory = QDir::currentPath();
178 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
179 setWindowTitle (engaugeWindowTitle ());
181 createCentralWidget();
186 createDockableWidgets ();
191 createLoadImageFromUrl ();
192 createStateContextBackground ();
193 createStateContextDigitize ();
194 createStateContextTransformation ();
195 createSettingsDialogs ();
196 createCommandStackShadow ();
200 settingsRead (isReset);
202 setUnifiedTitleAndToolBarOnMac(
true);
204 installEventFilter(
this);
208 QString originalPath = QDir::currentPath();
209 QDir::setCurrent (m_startupDirectory);
210 if (!errorReportFile.isEmpty()) {
211 loadErrorReportFile(errorReportFile);
212 if (m_isErrorReportRegressionTest) {
213 startRegressionTestErrorReport(errorReportFile);
215 }
else if (!fileCmdScriptFile.isEmpty()) {
217 startRegressionTestFileCmdScript();
222 m_loadStartupFiles = loadStartupFiles;
224 QDir::setCurrent (originalPath);
227 MainWindow::~MainWindow()
231 void MainWindow::addDockWindow (QDockWidget *dockWidget,
233 const QString &settingsTokenArea,
234 const QString &settingsTokenGeometry,
235 Qt::DockWidgetArea dockWidgetArea)
240 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
241 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
242 Qt::NoDockWidgetArea).toInt();
244 if (area == Qt::NoDockWidgetArea) {
246 addDockWidget (dockWidgetArea,
248 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
249 if (settings.contains (settingsTokenGeometry)) {
250 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
261 void MainWindow::applyZoomFactorAfterLoad()
263 ZoomFactor zoomFactor;
266 if (m_zoomMap.contains (zoomFactorInitial)) {
267 zoomFactor = m_zoomMap [zoomFactorInitial];
268 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
269 zoomFactor = currentZoomFactor ();
271 ENGAUGE_ASSERT (
false);
272 zoomFactor = currentZoomFactor();
275 slotViewZoom (zoomFactor);
278 void MainWindow::closeEvent(QCloseEvent *event)
290 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
292 setWindowModified (
false);
298 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
307 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
309 m_regressionFile = exportFilenameFromInputFilename (fileName);
310 fileImport (fileName,
316 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
318 m_regressionFile = exportFilenameFromInputFilename (fileName);
319 loadDocumentFile(fileName);
325 return m_cmdMediator;
328 void MainWindow::createActions()
330 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
332 createActionsFile ();
333 createActionsEdit ();
334 createActionsDigitize ();
335 createActionsView ();
336 createActionsSettings ();
337 createActionsHelp ();
340 void MainWindow::createActionsDigitize ()
342 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
344 QPixmap pixmapAxis (DigitAxis_xpm);
345 QPixmap pixmapCurve (DigitCurve_xpm);
346 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
347 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
348 QPixmap pixmapScale (DigitScale_xpm);
349 QPixmap pixmapSegment (DigitSegment_xpm);
350 QPixmap pixmapSelect (DigitSelect_xpm);
352 QIcon iconAxis (pixmapAxis);
353 QIcon iconCurve (pixmapCurve);
354 QIcon iconColorPicker (pixmapColorPicker);
355 QIcon iconPointMatch (pixmapPointMatch);
356 QIcon iconScale (pixmapScale);
357 QIcon iconSegment (pixmapSegment);
358 QIcon iconSelect (pixmapSelect);
360 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
361 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
362 m_actionDigitizeSelect->setCheckable (
true);
363 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
364 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n" 365 "Select points on the screen."));
366 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
368 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
369 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
370 m_actionDigitizeAxis->setCheckable (
true);
371 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points for a graph."));
372 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n" 373 "Digitizes an axis point for a graph by placing a new point at the cursor " 374 "after a mouse click. The coordinates of the axis point are then " 375 "entered. In a graph, three axis points are required to define " 376 "the graph coordinates."));
377 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
379 m_actionDigitizeScale =
new QAction (iconScale, tr (
"Scale Bar Tool"),
this);
380 m_actionDigitizeScale->setShortcut (QKeySequence (tr (
"Shift+F8")));
381 m_actionDigitizeScale->setCheckable (
true);
382 m_actionDigitizeScale->setStatusTip (tr (
"Digitize scale bar for a map."));
383 m_actionDigitizeScale->setWhatsThis (tr (
"Digitize Scale Bar\n\n" 384 "Digitize a scale bar for a map by clicking and dragging. The length of the " 385 "scale bar is then entered. In a map, the two endpoints of the scale " 386 "bar define the distances in graph coordinates.\n\n" 387 "Maps must be imported using Import (Advanced)."));
388 connect (m_actionDigitizeScale, SIGNAL (triggered ()),
this, SLOT (slotDigitizeScale ()));
390 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
391 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
392 m_actionDigitizeCurve->setCheckable (
true);
393 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
394 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n" 395 "Digitizes a curve point by placing a new point at the cursor " 396 "after a mouse click. Use this mode to digitize points along curves " 398 "New points will be assigned to the currently selected curve."));
399 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
401 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
402 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
403 m_actionDigitizePointMatch->setCheckable (
true);
404 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
405 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n" 406 "Digitizes curve points in a point plot by finding points that match a sample point. The process " 407 "starts by selecting a representative sample point.\n\n" 408 "New points will be assigned to the currently selected curve."));
409 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
411 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
412 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
413 m_actionDigitizeColorPicker->setCheckable (
true);
414 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
415 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n" 416 "Select a pixel along the currently selected curve. That pixel and its neighbors will " 417 "define the filter settings (color, brightness, and so on) of the currently selected curve " 418 "while in Segment Fill mode."));
419 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
421 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
422 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
423 m_actionDigitizeSegment->setCheckable (
true);
424 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
425 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n" 426 "Digitizes curve points by placing new points along the highlighted " 427 "segment under the cursor. Use this mode to quickly digitize multiple points along a " 428 "curve with a single click.\n\n" 429 "New points will be assigned to the currently selected curve."));
430 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
432 m_groupDigitize =
new QActionGroup (
this);
433 m_groupDigitize->addAction (m_actionDigitizeSelect);
434 m_groupDigitize->addAction (m_actionDigitizeAxis);
435 m_groupDigitize->addAction (m_actionDigitizeScale);
436 m_groupDigitize->addAction (m_actionDigitizeCurve);
437 m_groupDigitize->addAction (m_actionDigitizePointMatch);
438 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
439 m_groupDigitize->addAction (m_actionDigitizeSegment);
442 void MainWindow::createActionsEdit ()
444 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
446 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
447 m_actionEditUndo->setShortcut (QKeySequence::Undo);
448 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
449 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n" 450 "Undo the last operation."));
453 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
454 m_actionEditRedo->setShortcut (QKeySequence::Redo);
455 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
456 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n" 457 "Redo the last operation."));
460 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
461 m_actionEditCut->setShortcut (QKeySequence::Cut);
462 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
463 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n" 464 "Cuts the selected points and copies them to the clipboard."));
465 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
467 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
468 m_actionEditCopy->setShortcut (QKeySequence::Copy);
469 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
470 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n" 471 "Copies the selected points to the clipboard."));
472 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
474 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
475 m_actionEditPaste->setShortcut (QKeySequence::Paste);
476 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
477 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n" 478 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
479 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
481 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
482 m_actionEditDelete->setShortcut (QKeySequence::Delete);
483 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
484 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n" 485 "Deletes the selected points, after copying them to the clipboard."));
486 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
488 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
489 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
490 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n" 491 "Creates a new document by pasting an image from the clipboard."));
492 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
494 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
495 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
496 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n" 497 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
498 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
501 void MainWindow::createActionsFile ()
503 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
505 m_actionImport =
new QAction(tr (
"&Import..."),
this);
506 m_actionImport->setShortcut (tr (
"Ctrl+I"));
507 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
508 m_actionImport->setWhatsThis (tr (
"Import Image\n\n" 509 "Creates a new document by importing an image with a single coordinate system, " 510 "and axes both coordinates known.\n\n" 511 "For more complicated images with multiple coordinate systems, " 512 "and/or floating axes, Import (Advanced) is used instead."));
513 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
515 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
516 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
517 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n" 518 "Creates a new document by importing an image with support for advanced feaures. In " 519 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
520 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
522 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
523 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
524 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n" 525 "Imports a new image into the current document. The existing image is replaced, " 526 "and all curves in the document are preserved. This operation is useful for applying " 527 "the axis points and other settings from an existing document to a different image."));
528 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
530 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
531 m_actionOpen->setShortcut (QKeySequence::Open);
532 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
533 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n" 534 "Opens an existing document."));
535 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
538 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
539 QAction *recentFileAction =
new QAction (
this);
540 recentFileAction->setVisible (
true);
541 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
542 m_actionRecentFiles.append (recentFileAction);
546 m_actionClose =
new QAction(tr (
"&Close"),
this);
547 m_actionClose->setShortcut (QKeySequence::Close);
548 m_actionClose->setStatusTip (tr (
"Closes the open document."));
549 m_actionClose->setWhatsThis (tr (
"Close Document\n\n" 550 "Closes the open document."));
551 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
553 m_actionSave =
new QAction(tr (
"&Save"),
this);
554 m_actionSave->setShortcut (QKeySequence::Save);
555 m_actionSave->setStatusTip (tr (
"Saves the current document."));
556 m_actionSave->setWhatsThis (tr (
"Save Document\n\n" 557 "Saves the current document."));
558 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
560 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
561 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
562 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
563 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n" 564 "Saves the current document under a new filename."));
565 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
567 m_actionExport =
new QAction (tr (
"Export..."),
this);
568 m_actionExport->setShortcut (tr (
"Ctrl+E"));
569 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
570 m_actionExport->setWhatsThis (tr (
"Export Document\n\n" 571 "Exports the current document into a text file."));
572 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
574 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
575 m_actionPrint->setShortcut (QKeySequence::Print);
576 m_actionPrint->setStatusTip (tr (
"Print the current document."));
577 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n" 578 "Print the current document to a printer or file."));
579 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
581 m_actionExit =
new QAction(tr (
"&Exit"),
this);
582 m_actionExit->setShortcut (QKeySequence::Quit);
583 m_actionExit->setStatusTip (tr (
"Quits the application."));
584 m_actionExit->setWhatsThis (tr (
"Exit\n\n" 585 "Quits the application."));
586 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
589 void MainWindow::createActionsHelp ()
591 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
593 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
594 m_actionHelpChecklistGuideWizard->setCheckable (
true);
595 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
596 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n" 597 "Use Checklist Guide Wizard during import to generate a checklist of steps " 598 "for the imported document"));
600 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
601 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
603 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
604 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
605 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n" 606 "Play tutorial showing steps for digitizing points from curves drawn with lines " 608 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
611 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
612 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
613 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
614 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n" 615 "Searchable help documentation"));
619 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
620 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
621 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
622 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
625 void MainWindow::createActionsSettings ()
627 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
629 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
630 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
631 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n" 632 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
633 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
635 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
636 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
637 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n" 638 "Add/Remove Curve settings control which curves are included in the current document"));
639 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
641 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
642 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
643 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n" 644 "Curves properties settings determine how each curve appears"));
645 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
647 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
648 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
649 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n" 650 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and " 651 "Digitize Graph Point modes"));
652 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
654 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
655 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
656 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n" 657 "Export format settings affect how exported files are formatted"));
658 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
660 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
661 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
662 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n" 663 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
664 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
666 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
667 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
668 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n" 669 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
670 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
672 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
673 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
674 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n" 675 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. " 676 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
677 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
679 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
680 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
681 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n" 682 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when " 683 "Color Filtering is not able to separate grid lines from curve lines."));
684 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
686 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
687 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
688 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n" 689 "Point match settings determine how points are matched while in Point Match mode"));
690 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
692 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
693 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
694 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n" 695 "Segment fill settings determine how points are generated in the Segment Fill mode"));
696 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
698 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
699 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
700 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n" 701 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects " 702 "both Color Picker and Point Match modes"));
703 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
705 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
706 m_actionSettingsMainWindow->setEnabled (
true);
707 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
708 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n" 709 "Main window settings affect the user interface and are not specific to any document"));
710 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
713 void MainWindow::createActionsView ()
715 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
717 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
718 m_actionViewBackground->setCheckable (
true);
719 m_actionViewBackground->setChecked (
true);
720 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
721 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n" 722 "Show or hide the background toolbar"));
723 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
725 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
726 m_actionViewChecklistGuide->setCheckable (
true);
727 m_actionViewChecklistGuide->setChecked (
false);
728 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
729 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n" 730 "Show or hide the checklist guide"));
731 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
733 m_actionViewFittingWindow =
new QAction (tr (
"Curve Fitting Window"),
this);
734 m_actionViewFittingWindow->setCheckable (
true);
735 m_actionViewFittingWindow->setChecked (
false);
736 m_actionViewFittingWindow->setStatusTip (tr (
"Show or hide the curve fitting window."));
737 m_actionViewFittingWindow->setWhatsThis (tr (
"View Curve Fitting Window\n\n" 738 "Show or hide the curve fitting window"));
739 connect (m_actionViewFittingWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarFittingWindow()));
741 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
742 m_actionViewGeometryWindow->setCheckable (
true);
743 m_actionViewGeometryWindow->setChecked (
false);
744 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
745 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n" 746 "Show or hide the geometry window"));
747 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
749 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
750 m_actionViewDigitize->setCheckable (
true);
751 m_actionViewDigitize->setChecked (
true);
752 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
753 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n" 754 "Show or hide the digitizing tools toolbar"));
755 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
757 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
758 m_actionViewSettingsViews->setCheckable (
true);
759 m_actionViewSettingsViews->setChecked (
true);
760 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
761 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n" 762 "Show or hide the settings views toolbar. These views graphically show the " 763 "most important settings."));
764 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
766 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
767 m_actionViewCoordSystem->setCheckable (
true);
768 m_actionViewCoordSystem->setChecked (
false);
769 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
770 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n" 771 "Show or hide the coordinate system selection toolbar. This toolbar is used " 772 "to select the current coordinate system when the document has multiple " 773 "coordinate systems. This toolbar is also used to view and print all coordinate " 775 "This toolbar is disabled when there is only one coordinate system."));
776 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
778 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
779 m_actionViewToolTips->setCheckable (
true);
780 m_actionViewToolTips->setChecked (
true);
781 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
782 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n" 783 "Show or hide the tool tips"));
784 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
786 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
787 m_actionViewGridLines->setCheckable (
true);
788 m_actionViewGridLines->setChecked (
false);
789 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
790 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n" 791 "Show or hide grid lines that are added for accurate adjustments of the axes points, " 792 "which can improve accuracy in distorted graphs"));
793 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
795 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
796 m_actionViewBackgroundNone->setCheckable (
true);
797 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
798 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n" 799 "No image is shown so points are easier to see"));
801 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
802 m_actionViewBackgroundOriginal->setCheckable (
true);
803 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
804 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n" 805 "Show the original image underneath the points"));
807 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
808 m_actionViewBackgroundFiltered->setCheckable (
true);
809 m_actionViewBackgroundFiltered->setChecked (
true);
810 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
811 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n" 812 "Show the filtered image underneath the points.\n\n" 813 "The filtered image is created from the original image according to the " 814 "Filter preferences so unimportant information is hidden and important " 815 "information is emphasized"));
817 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
818 m_actionViewCurvesNone->setCheckable (
true);
819 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
820 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n" 821 "No axis points or digitized graph curves are shown so the image is easier to see."));
823 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
824 m_actionViewCurvesSelected->setCheckable (
true);
825 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
826 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n" 827 "Show only the digitized points and line that belong to the currently selected curve."));
829 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
830 m_actionViewCurvesAll->setCheckable (
true);
831 m_actionViewCurvesAll->setChecked (
true);
832 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
833 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n" 834 "Show all digitized axis points and graph curves"));
836 m_groupBackground =
new QActionGroup(
this);
837 m_groupBackground->addAction (m_actionViewBackgroundNone);
838 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
839 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
840 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
842 m_groupCurves =
new QActionGroup(
this);
843 m_groupCurves->addAction (m_actionViewCurvesNone);
844 m_groupCurves->addAction (m_actionViewCurvesSelected);
845 m_groupCurves->addAction (m_actionViewCurvesAll);
846 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
848 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
849 m_actionStatusNever->setCheckable(
true);
850 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
851 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
853 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
854 m_actionStatusTemporary->setCheckable(
true);
855 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
856 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
858 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
859 m_actionStatusAlways->setCheckable(
true);
860 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
861 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, " 862 "the status bar also displays information about the cursor position."));
864 m_groupStatus =
new QActionGroup(
this);
865 m_groupStatus->addAction (m_actionStatusNever);
866 m_groupStatus->addAction (m_actionStatusTemporary);
867 m_groupStatus->addAction (m_actionStatusAlways);
868 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
870 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
871 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
873 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
875 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
876 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
878 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
880 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
881 m_actionZoom16To1->setCheckable (
true);
882 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
883 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
885 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
886 m_actionZoom8To1->setCheckable (
true);
887 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
888 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
890 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
891 m_actionZoom4To1->setCheckable (
true);
892 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
893 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
895 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
896 m_actionZoom2To1->setCheckable (
true);
897 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
898 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
900 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
901 m_actionZoom1To1->setCheckable (
true);
902 m_actionZoom1To1->setChecked (
true);
903 m_actionZoom1To1->setStatusTip (tr (
"Zoom 1:1"));
904 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
906 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
907 m_actionZoom1To2->setCheckable (
true);
908 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
909 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
911 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
912 m_actionZoom1To4->setCheckable (
true);
913 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
914 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
916 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
917 m_actionZoom1To8->setCheckable (
true);
918 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
919 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
921 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
922 m_actionZoom1To16->setCheckable (
true);
923 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
924 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
926 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
927 m_actionZoomFill->setCheckable (
true);
928 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
929 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
931 m_groupZoom =
new QActionGroup (
this);
932 m_groupZoom->addAction (m_actionZoom16To1);
933 m_groupZoom->addAction (m_actionZoom8To1);
934 m_groupZoom->addAction (m_actionZoom4To1);
935 m_groupZoom->addAction (m_actionZoom2To1);
936 m_groupZoom->addAction (m_actionZoom1To1);
937 m_groupZoom->addAction (m_actionZoom1To2);
938 m_groupZoom->addAction (m_actionZoom1To4);
939 m_groupZoom->addAction (m_actionZoom1To8);
940 m_groupZoom->addAction (m_actionZoom1To16);
941 m_groupZoom->addAction (m_actionZoomFill);
944 void MainWindow::createCentralWidget ()
946 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
948 QWidget *widget =
new QWidget;
949 setCentralWidget (widget);
950 m_layout =
new QVBoxLayout;
951 widget->setLayout (m_layout);
954 void MainWindow::createCommandStackShadow ()
956 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
961 void MainWindow::createDockableWidgets ()
963 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
967 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
971 connect (m_dockFittingWindow, SIGNAL (signalFittingWindowClosed()),
972 this, SLOT (slotFittingWindowClosed()));
973 connect (m_dockFittingWindow, SIGNAL (signalCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)),
974 this, SLOT (slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)));
978 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
979 this, SLOT (slotGeometryWindowClosed()));
983 void MainWindow::createHelpWindow ()
985 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
989 m_helpWindow->hide ();
990 addDockWidget (Qt::RightDockWidgetArea,
992 m_helpWindow->setFloating (
true);
994 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
998 void MainWindow::createIcons()
1000 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
1003 QPixmap icon16 (bannerapp_16);
1004 QPixmap icon32 (bannerapp_32);
1005 QPixmap icon64 (bannerapp_64);
1006 QPixmap icon128 (bannerapp_128);
1007 QPixmap icon256 (bannerapp_256);
1009 icon.addPixmap (icon16);
1010 icon.addPixmap (icon32);
1011 icon.addPixmap (icon64);
1012 icon.addPixmap (icon128);
1013 icon.addPixmap (icon256);
1015 setWindowIcon (icon);
1018 void MainWindow::createLoadImageFromUrl ()
1025 void MainWindow::createMenus()
1027 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
1029 m_menuFile = menuBar()->addMenu(tr(
"&File"));
1030 m_menuFile->addAction (m_actionImport);
1031 m_menuFile->addAction (m_actionImportAdvanced);
1032 m_menuFile->addAction (m_actionImportImageReplace);
1033 m_menuFile->addAction (m_actionOpen);
1035 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
1036 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
1037 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
1039 m_menuFile->addMenu (m_menuFileOpenRecent);
1041 m_menuFile->addAction (m_actionClose);
1042 m_menuFile->insertSeparator (m_actionSave);
1043 m_menuFile->addAction (m_actionSave);
1044 m_menuFile->addAction (m_actionSaveAs);
1045 m_menuFile->addAction (m_actionExport);
1046 m_menuFile->insertSeparator (m_actionPrint);
1047 m_menuFile->addAction (m_actionPrint);
1048 m_menuFile->insertSeparator (m_actionExit);
1049 m_menuFile->addAction (m_actionExit);
1051 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1052 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1053 m_menuEdit->addAction (m_actionEditUndo);
1054 m_menuEdit->addAction (m_actionEditRedo);
1055 m_menuEdit->insertSeparator (m_actionEditCut);
1056 m_menuEdit->addAction (m_actionEditCut);
1057 m_menuEdit->addAction (m_actionEditCopy);
1058 m_menuEdit->addAction (m_actionEditPaste);
1059 m_menuEdit->addAction (m_actionEditDelete);
1060 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1061 m_menuEdit->addAction (m_actionEditPasteAsNew);
1062 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1064 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1065 m_menuDigitize->addAction (m_actionDigitizeSelect);
1066 m_menuDigitize->addAction (m_actionDigitizeAxis);
1067 m_menuDigitize->addAction (m_actionDigitizeScale);
1068 m_menuDigitize->addAction (m_actionDigitizeCurve);
1069 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1070 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1071 m_menuDigitize->addAction (m_actionDigitizeSegment);
1073 m_menuView = menuBar()->addMenu(tr(
"View"));
1074 m_menuView->addAction (m_actionViewBackground);
1075 m_menuView->addAction (m_actionViewDigitize);
1076 m_menuView->addAction (m_actionViewChecklistGuide);
1077 m_menuView->addAction (m_actionViewFittingWindow);
1078 m_menuView->addAction (m_actionViewGeometryWindow);
1079 m_menuView->addAction (m_actionViewSettingsViews);
1080 m_menuView->addAction (m_actionViewCoordSystem);
1081 m_menuView->insertSeparator (m_actionViewToolTips);
1082 m_menuView->addAction (m_actionViewToolTips);
1083 m_menuView->addAction (m_actionViewGridLines);
1084 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1085 m_menuViewBackground =
new QMenu (tr (
"Background"));
1086 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1087 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1088 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1089 m_menuView->addMenu (m_menuViewBackground);
1090 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1091 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1092 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1093 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1094 m_menuView->addMenu (m_menuViewCurves);
1095 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1096 m_menuViewStatus->addAction (m_actionStatusNever);
1097 m_menuViewStatus->addAction (m_actionStatusTemporary);
1098 m_menuViewStatus->addAction (m_actionStatusAlways);
1099 m_menuView->addMenu (m_menuViewStatus);
1100 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1101 m_menuViewZoom->addAction (m_actionZoomOut);
1102 m_menuViewZoom->addAction (m_actionZoomIn);
1103 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1104 m_menuViewZoom->addAction (m_actionZoom16To1);
1105 m_menuViewZoom->addAction (m_actionZoom8To1);
1106 m_menuViewZoom->addAction (m_actionZoom4To1);
1107 m_menuViewZoom->addAction (m_actionZoom2To1);
1108 m_menuViewZoom->addAction (m_actionZoom1To1);
1109 m_menuViewZoom->addAction (m_actionZoom1To2);
1110 m_menuViewZoom->addAction (m_actionZoom1To4);
1111 m_menuViewZoom->addAction (m_actionZoom1To8);
1112 m_menuViewZoom->addAction (m_actionZoom1To16);
1113 m_menuViewZoom->addAction (m_actionZoomFill);
1114 m_menuView->addMenu (m_menuViewZoom);
1116 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1117 m_menuSettings->addAction (m_actionSettingsCoords);
1118 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1119 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1120 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1121 m_menuSettings->addAction (m_actionSettingsExport);
1122 m_menuSettings->addAction (m_actionSettingsColorFilter);
1123 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1124 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1125 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1126 m_menuSettings->addAction (m_actionSettingsPointMatch);
1127 m_menuSettings->addAction (m_actionSettingsSegments);
1128 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1129 m_menuSettings->addAction (m_actionSettingsGeneral);
1130 m_menuSettings->addAction (m_actionSettingsMainWindow);
1132 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1133 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1134 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1135 m_menuHelp->addAction (m_actionHelpWhatsThis);
1136 m_menuHelp->addAction (m_actionHelpTutorial);
1138 m_menuHelp->addAction (m_actionHelpHelp);
1140 m_menuHelp->addAction (m_actionHelpAbout);
1142 updateRecentFileList();
1145 void MainWindow::createNetwork ()
1147 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1154 void MainWindow::createSettingsDialogs ()
1156 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1172 m_dlgSettingsCoords->setVisible (
false);
1173 m_dlgSettingsCurveAddRemove->setVisible (
false);
1174 m_dlgSettingsCurveProperties->setVisible (
false);
1175 m_dlgSettingsDigitizeCurve->setVisible (
false);
1176 m_dlgSettingsExportFormat->setVisible (
false);
1177 m_dlgSettingsColorFilter->setVisible (
false);
1178 m_dlgSettingsAxesChecker->setVisible (
false);
1179 m_dlgSettingsGridDisplay->setVisible (
false);
1180 m_dlgSettingsGridRemoval->setVisible (
false);
1181 m_dlgSettingsPointMatch->setVisible (
false);
1182 m_dlgSettingsSegments->setVisible (
false);
1183 m_dlgSettingsGeneral->setVisible (
false);
1184 m_dlgSettingsMainWindow->setVisible (
false);
1187 void MainWindow::createScene ()
1189 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1193 m_layout->addWidget (m_view);
1196 void MainWindow::createStateContextBackground ()
1198 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1203 void MainWindow::createStateContextDigitize ()
1205 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1212 void MainWindow::createStateContextTransformation ()
1214 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1216 ENGAUGE_CHECK_PTR (m_scene);
1222 void MainWindow::createStatusBar ()
1224 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1226 m_statusBar =
new StatusBar (*statusBar ());
1227 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1228 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1231 void MainWindow::createToolBars ()
1233 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1235 const int VIEW_SIZE = 22;
1238 m_cmbBackground =
new QComboBox ();
1239 m_cmbBackground->setEnabled (
false);
1240 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1241 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n" 1242 "Select background image:\n" 1243 "1) No background which highlights points\n" 1244 "2) Original image which shows everything\n" 1245 "3) Filtered image which highlights important details"));
1246 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1247 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1248 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1250 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1253 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1254 m_toolBackground->addWidget (m_cmbBackground);
1255 addToolBar (m_toolBackground);
1258 m_cmbCurve =
new QComboBox ();
1259 m_cmbCurve->setEnabled (
false);
1260 m_cmbCurve->setMinimumWidth (180);
1261 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1262 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n" 1263 "Select curve for any new points. Every point belongs to one curve.\n\n" 1264 "This can be changed while in Curve Point, Point Match, Color Picker or Segment Fill mode."));
1265 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1268 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1269 m_toolDigitize->addAction (m_actionDigitizeSelect);
1270 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1271 m_toolDigitize->addAction (m_actionDigitizeAxis);
1272 m_toolDigitize->addAction (m_actionDigitizeScale);
1273 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1274 m_toolDigitize->addAction (m_actionDigitizeCurve);
1275 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1276 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1277 m_toolDigitize->addAction (m_actionDigitizeSegment);
1278 m_toolDigitize->addWidget (m_cmbCurve);
1279 addToolBar (m_toolDigitize);
1283 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1284 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1285 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1286 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n" 1287 "Points style for the currently selected curve. The points style is only " 1288 "displayed in this toolbar. To change the points style, " 1289 "use the Curve Properties dialog."));
1292 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1293 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1294 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1295 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n" 1296 "View of filter for the current curve in Segment Fill mode. The filter settings are only " 1297 "displayed in this toolbar. To changed the filter settings, " 1298 "use the Color Picker mode or the Filter Settings dialog."));
1301 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1302 m_toolSettingsViews->addWidget (m_viewPointStyle);
1303 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1304 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1305 addToolBar (m_toolSettingsViews);
1308 m_cmbCoordSystem =
new QComboBox;
1309 m_cmbCoordSystem->setEnabled (
false);
1310 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1311 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n" 1312 "Currently selected coordinate system. This is used to switch between coordinate systems " 1313 "in documents with multiple coordinate systems"));
1314 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1316 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1317 m_btnShowAll->setEnabled (
false);
1318 m_btnShowAll->setAcceptDrops(
false);
1319 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1320 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n" 1321 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1322 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1323 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1325 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1326 m_btnPrintAll->setEnabled (
false);
1327 m_btnPrintAll->setAcceptDrops(
false);
1328 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1329 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n" 1330 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1331 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1333 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1334 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1335 m_toolCoordSystem->addWidget (m_btnShowAll);
1336 m_toolCoordSystem->addWidget (m_btnPrintAll);
1337 addToolBar (m_toolCoordSystem);
1340 void MainWindow::createTutorial ()
1342 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1345 m_tutorialDlg->setModal (
true);
1346 m_tutorialDlg->setMinimumSize (500, 400);
1347 m_tutorialDlg->hide();
1350 void MainWindow::createZoomMap ()
1352 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1354 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1355 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1356 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1357 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1358 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1359 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1360 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1361 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1362 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1363 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1366 ZoomFactor MainWindow::currentZoomFactor ()
const 1368 if (m_actionZoom1To1->isChecked()) {
1370 }
else if (m_actionZoom1To2->isChecked()) {
1372 }
else if (m_actionZoom1To4->isChecked()) {
1374 }
else if (m_actionZoom1To8->isChecked()) {
1376 }
else if (m_actionZoom1To16->isChecked()) {
1377 return ZOOM_1_TO_16;
1378 }
else if (m_actionZoom2To1->isChecked()) {
1380 }
else if (m_actionZoom4To1->isChecked()) {
1382 }
else if (m_actionZoom8To1->isChecked()) {
1384 }
else if (m_actionZoom16To1->isChecked()) {
1385 return ZOOM_16_TO_1;
1386 }
else if (m_actionZoomFill->isChecked()) {
1389 ENGAUGE_ASSERT (
false);
1395 if (event->type () == QEvent::KeyPress) {
1397 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1400 if ((eventKeyPress->key() == Qt::Key_E) &&
1401 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1402 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1412 return QObject::eventFilter (target, event);
1416 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1418 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1425 QString regressionFile = QString (
"%1_%2")
1426 .arg (m_regressionFile)
1440 fileExport (regressionFile,
1447 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const 1449 QString outFileName = fileName;
1451 outFileName = outFileName.replace (
".xml",
".csv_actual");
1452 outFileName = outFileName.replace (
".dig",
".csv_actual");
1453 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1458 void MainWindow::fileExport(
const QString &fileName,
1461 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport" 1462 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1463 <<
" fileName=" << fileName.toLatin1().data();
1465 QFile file (fileName);
1466 if (file.open(QIODevice::WriteOnly)) {
1468 QTextStream str (&file);
1479 updateChecklistGuide ();
1484 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport" 1485 <<
" file=" << fileName.toLatin1().data()
1486 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1487 QMessageBox::critical (0,
1488 engaugeWindowTitle(),
1489 tr (
"Unable to export to file ") + fileName);
1493 void MainWindow::fileImport (
const QString &fileName,
1494 ImportType importType)
1496 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport" 1497 <<
" fileName=" << fileName.toLatin1 ().data ()
1498 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1499 <<
" importType=" << importType;
1501 QString originalFileOld = m_originalFile;
1502 bool originalFileWasImported = m_originalFileWasImported;
1504 m_originalFile = fileName;
1505 m_originalFileWasImported =
true;
1507 if (importType == IMPORT_TYPE_ADVANCED) {
1518 bool loaded =
false;
1520 #ifdef ENGAUGE_JPEG2000 1522 loaded = jpeg2000.
load (fileName,
1524 #endif // ENGAUGE_JPEG2000 1530 PdfReturn pdfReturn = pdf.
load (fileName,
1534 m_isErrorReportRegressionTest);
1535 if (pdfReturn == PDF_RETURN_CANCELED) {
1542 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1544 #endif // ENGAUGE_PDF 1548 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1551 m_isErrorReportRegressionTest);
1552 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1559 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1563 QString msg = QString(
"%1 %2 %3 %4.")
1564 .arg (tr (
"Cannot read file"))
1566 .arg (tr (
"from directory"))
1567 .arg (QDir::currentPath());
1568 QMessageBox::warning (
this,
1569 engaugeWindowTitle(),
1573 m_originalFile = originalFileOld;
1574 m_originalFileWasImported = originalFileWasImported;
1578 loaded = loadImage (fileName,
1585 if (importType == IMPORT_TYPE_ADVANCED) {
1595 m_originalFile = originalFileOld;
1596 m_originalFileWasImported = originalFileWasImported;
1602 void MainWindow::fileImportWithPrompts (ImportType importType)
1604 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts" 1605 <<
" importType=" << importType;
1609 bool okToContinue =
true;
1610 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1611 okToContinue = maybeSave ();
1617 QTextStream str (&filter);
1620 QList<QByteArray>::const_iterator itr;
1621 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1622 QStringList supportedImageFormatStrings;
1623 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1624 QByteArray arr = *itr;
1625 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1626 supportedImageFormatStrings << extensionAsWildcard;
1628 #ifdef ENGAUGE_JPEG2000 1631 #endif // ENGAUGE_JPEG2000 1634 supportedImageFormatStrings <<
"*.pdf";
1635 #endif // ENGAUGE_PDF 1637 supportedImageFormatStrings.sort();
1639 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1643 str <<
";; All Files (*.*)";
1645 QString fileName = QFileDialog::getOpenFileName (
this,
1647 QDir::currentPath (),
1649 if (!fileName.isEmpty ()) {
1652 fileImport (fileName,
1658 void MainWindow::filePaste (ImportType importType)
1660 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste" 1661 <<
" importType=" << importType;
1663 QString originalFileOld = m_originalFile;
1664 bool originalFileWasImported = m_originalFileWasImported;
1666 QString fileName (
"clipboard");
1667 m_originalFile = fileName;
1668 m_originalFileWasImported =
true;
1670 if (importType == IMPORT_TYPE_ADVANCED) {
1681 QImage image = QApplication::clipboard()->image();
1683 bool loaded =
false;
1685 loaded = !image.isNull();
1689 QMessageBox::warning (
this,
1690 engaugeWindowTitle(),
1691 QString(
"%1 %2 %3 %4.")
1692 .arg (tr (
"Cannot read file"))
1694 .arg (tr (
"from directory"))
1695 .arg (QDir::currentPath ()));
1698 m_originalFile = originalFileOld;
1699 m_originalFileWasImported = originalFileWasImported;
1703 loaded = loadImage (fileName,
1710 if (importType == IMPORT_TYPE_ADVANCED) {
1720 m_originalFile = originalFileOld;
1721 m_originalFileWasImported = originalFileWasImported;
1727 void MainWindow::ghostsCreate ()
1729 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1731 ENGAUGE_ASSERT (m_ghosts == 0);
1753 void MainWindow::ghostsDestroy ()
1755 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1757 ENGAUGE_CHECK_PTR (m_ghosts);
1775 void MainWindow::loadCoordSystemListFromCmdMediator ()
1777 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1779 m_cmbCoordSystem->clear();
1783 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1784 int index1Based = i + 1;
1785 m_cmbCoordSystem->addItem (QString::number (index1Based),
1790 m_cmbCoordSystem->setCurrentIndex (0);
1793 bool enable = (m_cmbCoordSystem->count() > 1);
1794 m_cmbCoordSystem->setEnabled (enable);
1795 m_btnShowAll->setEnabled (enable);
1796 m_btnPrintAll->setEnabled (enable);
1799 void MainWindow::loadCurveListFromCmdMediator ()
1801 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1803 m_cmbCurve->clear ();
1805 QStringList::iterator itr;
1806 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1808 QString curvesGraphName = *itr;
1809 m_cmbCurve->addItem (curvesGraphName);
1816 void MainWindow::loadDocumentFile (
const QString &fileName)
1818 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1820 QApplication::setOverrideCursor(Qt::WaitCursor);
1826 setCurrentPathFromFile (fileName);
1827 rebuildRecentFileListForCurrentFile(fileName);
1828 m_currentFile = fileName;
1830 if (m_cmdMediator != 0) {
1831 delete m_cmdMediator;
1836 setupAfterLoadNewDocument (fileName,
1838 IMPORT_TYPE_SIMPLE);
1841 m_actionDigitizeSelect->setChecked (
true);
1842 slotDigitizeSelect();
1844 m_engaugeFile = fileName;
1845 m_originalFile = fileName;
1846 m_originalFileWasImported =
false;
1851 QApplication::restoreOverrideCursor();
1855 QApplication::restoreOverrideCursor();
1857 QMessageBox::warning (
this,
1858 engaugeWindowTitle(),
1859 QString(
"%1 %2 %3 %4:\n%5.")
1860 .arg (tr (
"Cannot read file"))
1862 .arg (tr (
"from directory"))
1863 .arg (QDir::currentPath ())
1870 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1872 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile" 1873 <<
" file=" << errorReportFile.toLatin1().data();
1875 QFile file (errorReportFile);
1876 if (!file.exists()) {
1878 QFileInfo fileInfo (errorReportFile);
1880 QMessageBox::critical (
this,
1881 engaugeWindowTitle(),
1882 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1887 QXmlStreamReader reader (&file);
1888 file.open(QIODevice::ReadOnly | QIODevice::Text);
1898 setupAfterLoadNewDocument (errorReportFile,
1899 "Error report opened",
1900 IMPORT_TYPE_SIMPLE);
1903 m_actionDigitizeSelect->setChecked (
true);
1904 slotDigitizeSelect();
1909 bool MainWindow::loadImage (
const QString &fileName,
1910 const QImage &image,
1911 ImportType importType)
1913 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage" 1914 <<
" fileName=" << fileName.toLatin1 ().data ()
1915 <<
" importType=" << importType;
1918 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1919 success = loadImageReplacingImage (fileName,
1923 success = loadImageNewDocument (fileName,
1931 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1932 const QImage &image,
1933 ImportType importType)
1935 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument" 1936 <<
" fileName=" << fileName.toLatin1 ().data ()
1937 <<
" importType=" << importType;
1939 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1941 QApplication::setOverrideCursor(Qt::WaitCursor);
1944 QApplication::restoreOverrideCursor();
1946 setCurrentPathFromFile (fileName);
1948 m_engaugeFile = EMPTY_FILENAME;
1950 if (m_cmdMediator != 0) {
1951 delete m_cmdMediator;
1956 bool accepted = setupAfterLoadNewDocument (fileName,
1957 tr (
"File imported"),
1963 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1964 (m_fileCmdScript == 0)) {
1969 if (wizard->exec() == QDialog::Accepted) {
1971 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1985 m_actionViewChecklistGuide->setChecked (
true);
1988 loadCurveListFromCmdMediator();
1991 loadCoordSystemListFromCmdMediator();
1997 m_actionDigitizeAxis->setChecked (
true);
2001 slotDigitizeScale ();
2002 }
else if (modeGraph ()) {
2003 slotDigitizeAxis ();
2012 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
2013 const QImage &image,
2014 ImportType importType)
2016 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage" 2017 <<
" fileName=" << fileName.toLatin1 ().data ()
2018 <<
" importType=" << importType;
2020 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
2022 setCurrentPathFromFile (fileName);
2024 m_engaugeFile = EMPTY_FILENAME;
2026 ENGAUGE_ASSERT (m_cmdMediator != 0);
2030 bool accepted = setupAfterLoadReplacingImage (fileName,
2031 tr (
"File imported"),
2039 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const 2041 QFile file (m_originalFile);
2045 if (!file.open (QIODevice::ReadOnly)) {
2049 domInputFile.setContent (&file);
2053 void MainWindow::loadToolTips()
2055 if (m_actionViewToolTips->isChecked ()) {
2058 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2059 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2060 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
2061 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2062 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2063 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2064 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2065 m_cmbBackground->setToolTip (tr (
"Background image."));
2066 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2067 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2068 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2073 m_actionDigitizeSelect->setToolTip (
"");
2074 m_actionDigitizeAxis->setToolTip (
"");
2075 m_actionDigitizeScale->setToolTip (
"");
2076 m_actionDigitizeCurve->setToolTip (
"");
2077 m_actionDigitizePointMatch->setToolTip (
"");
2078 m_actionDigitizeColorPicker->setToolTip (
"");
2079 m_actionDigitizeSegment->setToolTip (
"");
2080 m_cmbBackground->setToolTip (
"");
2081 m_cmbCurve->setToolTip (
"");
2082 m_viewPointStyle->setToolTip (
"");
2083 m_viewSegmentFilter->setToolTip (
"");
2088 bool MainWindow::modeGraph ()
const 2090 bool success =
false;
2092 if (m_cmdMediator != 0) {
2099 bool MainWindow::modeMap ()
const 2101 bool success =
false;
2103 if (m_cmdMediator != 0) {
2110 bool MainWindow::maybeSave()
2112 if (m_cmdMediator != 0) {
2114 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2115 engaugeWindowTitle(),
2116 tr(
"The document has been modified.\n" 2117 "Do you want to save your changes?"),
2118 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2119 if (ret == QMessageBox::Save) {
2120 return slotFileSave();
2121 }
else if (ret == QMessageBox::Cancel) {
2132 const QString &fileName)
const 2140 QString csvExtension = QString (
".%1")
2142 QString tsvExtension = QString (
".%1")
2144 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2145 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2149 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2150 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2151 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2152 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2156 return modelExportFormatAfter;
2161 return m_modelMainWindow;
2164 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2166 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2168 setWindowFilePath (filePath);
2170 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2171 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2172 recentFilePaths.removeAll (filePath);
2173 recentFilePaths.prepend (filePath);
2174 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2175 recentFilePaths.removeLast ();
2177 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2179 updateRecentFileList();
2184 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2186 if (m_actionZoomFill->isChecked ()) {
2191 bool MainWindow::saveDocumentFile (
const QString &fileName)
2193 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2195 QFile file(fileName);
2196 if (!file.open(QFile::WriteOnly)) {
2197 QMessageBox::warning (
this,
2198 engaugeWindowTitle(),
2199 QString (
"%1 %2: \n%3.")
2200 .arg(tr (
"Cannot write file"))
2202 .arg(file.errorString()));
2206 rebuildRecentFileListForCurrentFile (fileName);
2208 QApplication::setOverrideCursor (Qt::WaitCursor);
2209 QXmlStreamWriter writer(&file);
2210 writer.setAutoFormatting(
true);
2211 writer.writeStartDocument();
2212 writer.writeDTD(
"<!DOCTYPE engauge>");
2214 writer.writeEndDocument();
2215 QApplication::restoreOverrideCursor ();
2219 m_cmdMediator->setClean ();
2221 setCurrentFile(fileName);
2222 m_engaugeFile = fileName;
2232 const char *comment)
const 2236 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2238 QString report = saveErrorReportFileAndExitXml (context,
2246 if (dlg.exec() == QDialog::Accepted) {
2259 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2262 const char *comment)
const 2264 const bool DEEP_COPY =
true;
2266 QString xmlErrorReport;
2267 QXmlStreamWriter writer (&xmlErrorReport);
2268 writer.setAutoFormatting(
true);
2271 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2274 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2275 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2276 writer.writeEndElement();
2280 QXmlStreamReader reader (m_startingDocumentSnapshot);
2281 while (!reader.atEnd ()) {
2283 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2284 reader.tokenType() != QXmlStreamReader::EndDocument) {
2285 writer.writeCurrentToken (reader);
2290 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2291 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2292 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2293 writer.writeEndElement();
2296 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2297 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2298 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2299 writer.writeEndElement();
2302 m_cmdMediator->
saveXml(writer);
2305 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2306 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2307 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2308 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2309 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2310 writer.writeEndElement();
2312 writer.writeEndElement();
2315 QDomDocument domErrorReport (
"ErrorReport");
2316 domErrorReport.setContent (xmlErrorReport);
2319 if (!m_originalFileWasImported) {
2323 QDomDocument domInputFile;
2324 loadInputFileForErrorReport (domInputFile);
2325 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2326 if (!domInputFile.isNull()) {
2327 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2329 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2330 if (nodesFileTo.count () > 0) {
2331 QDomNode nodeFileTo = nodesFileTo.at (0);
2332 nodeFileTo.appendChild (fragmentFileFrom);
2339 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2340 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2341 QDomNode nodeDocument = nodesDocument.at (i);
2342 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2343 if (!elemImage.isNull()) {
2346 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2347 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2349 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2350 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2352 QDomNode nodeReplacement;
2353 QDomElement elemReplacement = nodeReplacement.toElement();
2354 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2355 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2358 nodeDocument.insertBefore (nodeReplacement,
2360 nodeDocument.removeChild(elemImage);
2366 return domErrorReport.toString();
2369 void MainWindow::saveStartingDocumentSnapshot()
2371 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2373 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2374 writer.setAutoFormatting (
true);
2380 ENGAUGE_CHECK_PTR (m_scene);
2386 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2388 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2390 int index = m_cmbBackground->findData (backgroundImage);
2391 ENGAUGE_ASSERT (index >= 0);
2393 m_cmbBackground->setCurrentIndex(index);
2395 return previousBackground;
2400 return m_cmbCurve->currentText ();
2403 void MainWindow::setCurrentFile (
const QString &fileName)
2405 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2407 QString fileNameStripped;
2408 if (!fileName.isEmpty()) {
2411 QFileInfo fileInfo (fileName);
2412 fileNameStripped = fileInfo.baseName();
2415 m_currentFile = fileNameStripped;
2416 m_currentFileWithPathAndFileExtension = fileName;
2418 updateWindowTitle ();
2421 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2423 QDir dir = QFileInfo (fileName).absoluteDir();
2425 if (dir.exists ()) {
2427 bool success = QDir::setCurrent (dir.absolutePath ());
2428 ENGAUGE_ASSERT (success);
2436 void MainWindow::setPixmap (
const QString &curveSelected,
2437 const QPixmap &pixmap)
2439 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2446 m_backgroundStateContext->
setPixmap (m_transformation,
2453 void MainWindow::settingsRead (
bool isReset)
2455 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2462 settingsReadEnvironment (settings);
2463 settingsReadMainWindow (settings);
2466 void MainWindow::settingsReadEnvironment (QSettings &settings)
2468 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2469 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2470 QDir::currentPath ()).toString ());
2471 settings.endGroup ();
2474 void MainWindow::settingsReadMainWindow (QSettings &settings)
2476 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2479 resize (settings.value (SETTINGS_SIZE,
2480 QSize (600, 600)).toSize ());
2481 move (settings.value (SETTINGS_POS,
2482 QPoint (200, 200)).toPoint ());
2486 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2487 QSize (900, 600)).toSize();
2488 m_helpWindow->resize (helpSize);
2489 if (settings.contains (SETTINGS_HELP_POS)) {
2490 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2491 m_helpWindow->move (helpPos);
2496 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2500 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2502 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2503 m_toolBackground->setVisible (viewBackgroundToolBar);
2504 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2505 BACKGROUND_IMAGE_FILTERED).toInt ();
2506 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2507 m_cmbBackground->setCurrentIndex (indexBackground);
2510 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2512 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2513 m_toolDigitize->setVisible (viewDigitizeToolBar);
2516 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2518 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2519 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2522 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2524 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2525 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2528 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2530 m_actionViewToolTips->setChecked (viewToolTips);
2534 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2537 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2538 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2539 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2541 addDockWindow (m_dockChecklistGuide,
2543 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2544 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2545 Qt::RightDockWidgetArea);
2546 addDockWindow (m_dockFittingWindow,
2548 SETTINGS_FITTING_WINDOW_DOCK_AREA,
2549 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
2550 Qt::RightDockWidgetArea);
2551 addDockWindow (m_dockGeometryWindow,
2553 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2554 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2555 Qt::RightDockWidgetArea);
2560 QLocale localeDefault;
2561 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2562 QVariant (localeDefault.language())).toInt();
2563 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2564 QVariant (localeDefault.country())).toInt();
2565 QLocale locale (language,
2567 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2568 QVariant (ZOOM_1_TO_1)).toInt());
2570 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2571 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2572 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2573 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2574 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2575 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2576 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2577 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2578 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2579 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2581 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2583 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2584 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
2585 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
2587 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
2590 updateSmallDialogs();
2592 settings.endGroup();
2595 void MainWindow::settingsWrite ()
2597 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2599 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2600 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2601 settings.endGroup ();
2603 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2604 settings.setValue (SETTINGS_SIZE, size ());
2605 settings.setValue (SETTINGS_POS, pos ());
2607 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2608 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2610 if (m_dockChecklistGuide->isFloating()) {
2612 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2613 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2617 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2620 if (m_dockFittingWindow->isFloating()) {
2622 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2623 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
2626 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
2628 if (m_dockGeometryWindow->isFloating()) {
2630 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2631 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2635 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2638 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2639 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2640 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
2641 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2642 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2643 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2644 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2645 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2646 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2647 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2648 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
2649 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2650 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2651 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2652 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2653 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2654 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2655 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2656 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2657 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2658 settings.endGroup ();
2661 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2662 const QString &temporaryMessage ,
2663 ImportType importType)
2665 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument" 2666 <<
" file=" << fileName.toLatin1().data()
2667 <<
" message=" << temporaryMessage.toLatin1().data()
2668 <<
" importType=" << importType;
2673 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2677 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2681 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2683 m_cmdMediator->
pixmap ());
2687 if (importType == IMPORT_TYPE_ADVANCED) {
2689 applyZoomFactorAfterLoad();
2692 dlgImportAdvanced.exec();
2694 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2707 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2708 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2709 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2710 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2711 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2712 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2713 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2714 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2715 loadCurveListFromCmdMediator ();
2716 loadCoordSystemListFromCmdMediator ();
2719 m_isDocumentExported =
false;
2728 m_cmbCurve->currentText ());
2729 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2731 applyZoomFactorAfterLoad();
2733 setCurrentFile(fileName);
2737 saveStartingDocumentSnapshot();
2744 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2745 const QString &temporaryMessage ,
2746 ImportType importType)
2748 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage" 2749 <<
" file=" << fileName.toLatin1().data()
2750 <<
" message=" << temporaryMessage.toLatin1().data()
2751 <<
" importType=" << importType;
2756 m_cmdMediator->clear();
2759 m_cmdMediator->
pixmap ());
2761 m_isDocumentExported =
false;
2763 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2765 applyZoomFactorAfterLoad();
2767 setCurrentFile(fileName);
2771 saveStartingDocumentSnapshot();
2780 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent" 2781 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2783 QMainWindow::showEvent (event);
2785 if (m_loadStartupFiles.count() > 0) {
2787 m_timerLoadStartupFiles =
new QTimer;
2788 m_timerLoadStartupFiles->setSingleShot (
true);
2789 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2790 m_timerLoadStartupFiles->start (0);
2800 void MainWindow::slotBtnPrintAll ()
2802 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2806 QPrinter printer (QPrinter::HighResolution);
2807 QPrintDialog dlg (&printer,
this);
2808 if (dlg.exec() == QDialog::Accepted) {
2809 QPainter painter (&printer);
2810 m_view->render (&painter);
2817 void MainWindow::slotBtnShowAllPressed ()
2819 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2825 void MainWindow::slotBtnShowAllReleased ()
2827 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2833 void MainWindow::slotCanRedoChanged (
bool canRedo)
2835 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2837 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2840 void MainWindow::slotCanUndoChanged (
bool canUndo)
2842 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2844 m_actionEditUndo->setEnabled (canUndo);
2847 void MainWindow::slotChecklistClosed()
2849 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2851 m_actionViewChecklistGuide->setChecked (
false);
2854 void MainWindow::slotCleanChanged(
bool clean)
2856 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2858 setWindowModified (!clean);
2861 void MainWindow::slotCmbBackground(
int currentIndex)
2863 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2865 switch (currentIndex) {
2866 case BACKGROUND_IMAGE_NONE:
2867 if (!m_actionViewBackgroundNone->isChecked()) {
2868 m_actionViewBackgroundNone->toggle();
2872 case BACKGROUND_IMAGE_ORIGINAL:
2873 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2874 m_actionViewBackgroundOriginal->toggle();
2878 case BACKGROUND_IMAGE_FILTERED:
2879 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2880 m_actionViewBackgroundFiltered->toggle();
2888 void MainWindow::slotCmbCoordSystem(
int index)
2890 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2896 m_cmdMediator->push (cmd);
2899 void MainWindow::slotCmbCurve(
int )
2901 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2906 m_cmbCurve->currentText ());
2910 updateViewedCurves();
2912 updateFittingWindow();
2913 updateGeometryWindow();
2916 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2918 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2924 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2926 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2932 void MainWindow::slotDigitizeAxis ()
2934 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2937 DIGITIZE_STATE_AXIS);
2938 m_cmbCurve->setEnabled (
false);
2943 void MainWindow::slotDigitizeColorPicker ()
2945 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2948 DIGITIZE_STATE_COLOR_PICKER);
2949 m_cmbCurve->setEnabled (
true);
2954 void MainWindow::slotDigitizeCurve ()
2956 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2959 DIGITIZE_STATE_CURVE);
2960 m_cmbCurve->setEnabled (
true);
2965 void MainWindow::slotDigitizePointMatch ()
2967 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2970 DIGITIZE_STATE_POINT_MATCH);
2971 m_cmbCurve->setEnabled (
true);
2976 void MainWindow::slotDigitizeScale ()
2978 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeScale";
2981 DIGITIZE_STATE_SCALE);
2982 m_cmbCurve->setEnabled (
false);
2987 void MainWindow::slotDigitizeSegment ()
2989 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2992 DIGITIZE_STATE_SEGMENT);
2993 m_cmbCurve->setEnabled (
true);
2998 void MainWindow::slotDigitizeSelect ()
3000 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
3003 DIGITIZE_STATE_SELECT);
3004 m_cmbCurve->setEnabled (
false);
3009 void MainWindow::slotEditCopy ()
3011 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
3014 bool tableFittingIsActive, tableFittingIsCopyable;
3015 bool tableGeometryIsActive, tableGeometryIsCopyable;
3016 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3017 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3019 if (tableFittingIsActive) {
3022 m_dockFittingWindow->
doCopy ();
3024 }
else if (tableGeometryIsActive) {
3027 m_dockGeometryWindow->
doCopy ();
3033 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3044 void MainWindow::slotEditCut ()
3046 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
3049 bool tableFittingIsActive, tableFittingIsCopyable;
3050 bool tableGeometryIsActive, tableGeometryIsCopyable;
3051 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3052 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3054 if (tableFittingIsActive || tableGeometryIsActive) {
3062 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3073 void MainWindow::slotEditDelete ()
3075 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
3078 bool tableFittingIsActive, tableFittingIsCopyable;
3079 bool tableGeometryIsActive, tableGeometryIsCopyable;
3080 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3081 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3083 if (tableFittingIsActive || tableGeometryIsActive) {
3096 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3097 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
3108 void MainWindow::slotEditMenu ()
3110 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
3112 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
3113 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
3116 void MainWindow::slotEditPaste ()
3118 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
3121 void MainWindow::slotEditPasteAsNew ()
3123 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
3125 filePaste (IMPORT_TYPE_SIMPLE);
3128 void MainWindow::slotEditPasteAsNewAdvanced ()
3130 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
3132 filePaste (IMPORT_TYPE_ADVANCED);
3135 void MainWindow::slotFileClose()
3137 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
3151 DIGITIZE_STATE_EMPTY);
3154 if (m_fittingCurve != 0) {
3155 m_scene->removeItem (m_fittingCurve);
3163 m_backgroundStateContext->
close ();
3166 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
3169 m_dockFittingWindow->
clear ();
3172 m_dockGeometryWindow->
clear ();
3175 delete m_cmdMediator;
3181 setWindowTitle (engaugeWindowTitle ());
3183 m_gridLines.
clear();
3188 void MainWindow::slotFileExport ()
3190 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3195 QString filter = QString (
"%1;;%2;;All files (*.*)")
3200 QString defaultFileName = QString (
"%1/%2.%3")
3201 .arg (QDir::currentPath ())
3202 .arg (m_currentFile)
3205 QString filterCsv = exportStrategy.
filterCsv ();
3206 QString fileName = dlg.getSaveFileName (
this,
3211 if (!fileName.isEmpty ()) {
3213 fileExport(fileName,
3222 void MainWindow::slotFileImport ()
3224 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3226 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3229 void MainWindow::slotFileImportAdvanced ()
3231 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3233 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3236 void MainWindow::slotFileImportDraggedImage(QImage image)
3238 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3243 IMPORT_TYPE_SIMPLE);
3246 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3248 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3255 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3257 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3260 loadImage (fileName,
3262 IMPORT_TYPE_SIMPLE);
3265 void MainWindow::slotFileImportImageReplace ()
3267 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3269 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3272 void MainWindow::slotFileOpen()
3274 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3280 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3281 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3282 .arg (ENGAUGE_FILENAME_EXTENSION);
3284 QString fileName = QFileDialog::getOpenFileName (
this,
3285 tr(
"Open Document"),
3286 QDir::currentPath (),
3288 if (!fileName.isEmpty ()) {
3290 loadDocumentFile (fileName);
3296 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3298 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3300 loadDocumentFile (fileName);
3303 void MainWindow::slotFilePrint()
3305 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3307 QPrinter printer (QPrinter::HighResolution);
3308 QPrintDialog dlg (&printer,
this);
3309 if (dlg.exec() == QDialog::Accepted) {
3310 QPainter painter (&printer);
3311 m_view->render (&painter);
3316 bool MainWindow::slotFileSave()
3318 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3320 if (m_engaugeFile.isEmpty()) {
3321 return slotFileSaveAs();
3323 return saveDocumentFile (m_engaugeFile);
3327 bool MainWindow::slotFileSaveAs()
3329 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3332 QString filenameDefault = m_currentFile;
3333 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3334 filenameDefault = QString (
"%1.%2")
3335 .arg (m_currentFile)
3336 .arg (ENGAUGE_FILENAME_EXTENSION);
3339 if (!m_engaugeFile.isEmpty()) {
3340 filenameDefault = m_engaugeFile;
3343 QString filterDigitizer = QString (
"%1 (*.%2)")
3344 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3345 .arg (ENGAUGE_FILENAME_EXTENSION);
3346 QString filterAll (
"All files (*. *)");
3348 QStringList filters;
3349 filters << filterDigitizer;
3350 filters << filterAll;
3352 QFileDialog dlg(
this);
3353 dlg.setFileMode (QFileDialog::AnyFile);
3354 dlg.selectNameFilter (filterDigitizer);
3355 dlg.setNameFilters (filters);
3356 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 3359 dlg.setWindowModality(Qt::WindowModal);
3361 dlg.setAcceptMode(QFileDialog::AcceptSave);
3362 dlg.selectFile(filenameDefault);
3365 QStringList files = dlg.selectedFiles();
3366 return saveDocumentFile(files.at(0));
3372 void MainWindow::slotFittingWindowClosed()
3374 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
3376 m_actionViewFittingWindow->setChecked (
false);
3379 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
3386 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit" 3387 <<
" order=" << fittingCurveCoef.size() - 1;
3389 if (m_fittingCurve != 0) {
3390 m_scene->removeItem (m_fittingCurve);
3391 delete m_fittingCurve;
3401 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
3402 m_scene->addItem (m_fittingCurve);
3405 void MainWindow::slotGeometryWindowClosed()
3407 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3409 m_actionViewGeometryWindow->setChecked (
false);
3412 void MainWindow::slotHelpAbout()
3414 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3420 void MainWindow::slotHelpTutorial()
3422 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3424 m_tutorialDlg->show ();
3425 m_tutorialDlg->exec ();
3428 void MainWindow::slotKeyPress (Qt::Key key,
3429 bool atLeastOneSelectedItem)
3431 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress" 3432 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3433 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3437 atLeastOneSelectedItem);
3440 void MainWindow::slotLoadStartupFiles ()
3442 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3444 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3446 QString fileName = m_loadStartupFiles.front();
3447 m_loadStartupFiles.pop_front();
3453 loadDocumentFile (fileName);
3457 fileImport (fileName,
3458 IMPORT_TYPE_SIMPLE);
3462 if (m_loadStartupFiles.count() > 0) {
3466 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3467 m_loadStartupFiles);
3471 void MainWindow::slotMouseMove (QPointF pos)
3476 if (m_cmdMediator != 0) {
3478 QString needMoreText = (modeMap () ?
3479 QObject::tr (
"Need scale bar") :
3480 QObject::tr (
"Need more axis points"));
3483 QString coordsScreen, coordsGraph, resolutionGraph;
3503 void MainWindow::slotMousePress (QPointF pos)
3505 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3513 void MainWindow::slotMouseRelease (QPointF pos)
3515 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3517 if (pos.x() < 0 || pos.y() < 0) {
3531 void MainWindow::slotRecentFileAction ()
3533 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3535 QAction *action = qobject_cast<QAction*>(sender ());
3538 QString fileName = action->data().toString();
3539 loadDocumentFile (fileName);
3543 void MainWindow::slotRecentFileClear ()
3545 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3547 QStringList emptyList;
3549 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3550 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3553 updateRecentFileList();
3556 void MainWindow::slotRedoTextChanged (
const QString &text)
3558 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3560 QString completeText (
"Redo");
3561 if (!text.isEmpty ()) {
3562 completeText += QString (
" \"%1\"").arg (text);
3564 m_actionEditRedo->setText (completeText);
3567 void MainWindow::slotSettingsAxesChecker ()
3569 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3571 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3572 m_dlgSettingsAxesChecker->show ();
3575 void MainWindow::slotSettingsColorFilter ()
3577 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3579 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3580 m_dlgSettingsColorFilter->show ();
3583 void MainWindow::slotSettingsCoords ()
3585 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3587 m_dlgSettingsCoords->
load (*m_cmdMediator);
3588 m_dlgSettingsCoords->show ();
3591 void MainWindow::slotSettingsCurveAddRemove ()
3593 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3595 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3596 m_dlgSettingsCurveAddRemove->show ();
3599 void MainWindow::slotSettingsCurveProperties ()
3601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3603 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3605 m_dlgSettingsCurveProperties->show ();
3608 void MainWindow::slotSettingsDigitizeCurve ()
3610 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3612 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3613 m_dlgSettingsDigitizeCurve->show ();
3616 void MainWindow::slotSettingsExportFormat ()
3618 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3621 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3622 m_dlgSettingsExportFormat->show ();
3629 void MainWindow::slotSettingsGeneral ()
3631 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3633 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3634 m_dlgSettingsGeneral->show ();
3637 void MainWindow::slotSettingsGridDisplay()
3639 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3641 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3642 m_dlgSettingsGridDisplay->show ();
3645 void MainWindow::slotSettingsGridRemoval ()
3647 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3649 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3650 m_dlgSettingsGridRemoval->show ();
3653 void MainWindow::slotSettingsPointMatch ()
3655 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3657 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3658 m_dlgSettingsPointMatch->show ();
3661 void MainWindow::slotSettingsSegments ()
3663 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3665 m_dlgSettingsSegments->
load (*m_cmdMediator);
3666 m_dlgSettingsSegments->show ();
3669 void MainWindow::slotTableStatusChange ()
3671 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
3678 void MainWindow::slotSettingsMainWindow ()
3680 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3684 m_dlgSettingsMainWindow->show ();
3687 void MainWindow::slotTimeoutRegressionErrorReport ()
3689 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport" 3690 <<
" cmdStackIndex=" << m_cmdMediator->index()
3691 <<
" cmdStackCount=" << m_cmdMediator->count();
3693 if (m_cmdStackShadow->
canRedo()) {
3696 QDir::setCurrent (m_startupDirectory);
3701 QDir::setCurrent (m_startupDirectory);
3706 exportAllCoordinateSystemsAfterRegressionTests ();
3710 m_cmdMediator->setClean();
3716 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3718 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3720 if (m_fileCmdScript->
canRedo()) {
3723 QDir::setCurrent (m_startupDirectory);
3725 m_fileCmdScript->
redo(*
this);
3728 QDir::setCurrent (m_startupDirectory);
3733 if (m_cmdMediator != 0) {
3736 exportAllCoordinateSystemsAfterRegressionTests ();
3740 m_cmdMediator->setClean();
3750 void MainWindow::slotUndoTextChanged (
const QString &text)
3752 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3754 QString completeText (
"Undo");
3755 if (!text.isEmpty ()) {
3756 completeText += QString (
" \"%1\"").arg (text);
3758 m_actionEditUndo->setText (completeText);
3761 void MainWindow::slotViewGridLines ()
3763 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3768 void MainWindow::slotViewGroupBackground(QAction *action)
3770 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3773 BackgroundImage backgroundImage;
3774 int indexBackground;
3775 if (action == m_actionViewBackgroundNone) {
3776 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3777 backgroundImage = BACKGROUND_IMAGE_NONE;
3778 }
else if (action == m_actionViewBackgroundOriginal) {
3779 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3780 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3781 }
else if (action == m_actionViewBackgroundFiltered) {
3782 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3783 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3785 ENGAUGE_ASSERT (
false);
3788 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3789 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3792 m_cmbBackground->setCurrentIndex (indexBackground);
3796 void MainWindow::slotViewGroupCurves(QAction * )
3798 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3800 updateViewedCurves ();
3803 void MainWindow::slotViewGroupStatus(QAction *action)
3805 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3807 ENGAUGE_CHECK_PTR (m_statusBar);
3809 if (action == m_actionStatusNever) {
3811 }
else if (action == m_actionStatusTemporary) {
3818 void MainWindow::slotViewToolBarBackground ()
3820 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3822 if (m_actionViewBackground->isChecked ()) {
3823 m_toolBackground->show();
3825 m_toolBackground->hide();
3829 void MainWindow::slotViewToolBarChecklistGuide ()
3831 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3833 if (m_actionViewChecklistGuide->isChecked ()) {
3834 m_dockChecklistGuide->show();
3836 m_dockChecklistGuide->hide();
3840 void MainWindow::slotViewToolBarCoordSystem ()
3842 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3844 if (m_actionViewCoordSystem->isChecked ()) {
3845 m_toolCoordSystem->show();
3847 m_toolCoordSystem->hide();
3851 void MainWindow::slotViewToolBarDigitize ()
3853 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3855 if (m_actionViewDigitize->isChecked ()) {
3856 m_toolDigitize->show();
3858 m_toolDigitize->hide();
3862 void MainWindow::slotViewToolBarFittingWindow()
3864 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
3866 if (m_actionViewFittingWindow->isChecked()) {
3867 m_dockFittingWindow->show ();
3868 if (m_fittingCurve != 0) {
3869 m_fittingCurve->setVisible (
true);
3872 m_dockFittingWindow->hide ();
3873 if (m_fittingCurve != 0) {
3874 m_fittingCurve->setVisible (
false);
3879 void MainWindow::slotViewToolBarGeometryWindow ()
3881 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3883 if (m_actionViewGeometryWindow->isChecked ()) {
3884 m_dockGeometryWindow->show();
3886 m_dockGeometryWindow->hide();
3890 void MainWindow::slotViewToolBarSettingsViews ()
3892 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3894 if (m_actionViewSettingsViews->isChecked ()) {
3895 m_toolSettingsViews->show();
3897 m_toolSettingsViews->hide();
3901 void MainWindow::slotViewToolTips ()
3903 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3908 void MainWindow::slotViewZoom(
int zoom)
3910 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3913 switch ((ZoomFactor) zoom) {
3915 m_actionZoom16To1->setChecked(
true);
3916 slotViewZoom16To1 ();
3919 m_actionZoom8To1->setChecked(
true);
3920 slotViewZoom8To1 ();
3923 m_actionZoom4To1->setChecked(
true);
3924 slotViewZoom4To1 ();
3927 m_actionZoom2To1->setChecked(
true);
3928 slotViewZoom2To1 ();
3931 m_actionZoom1To1->setChecked(
true);
3932 slotViewZoom1To1 ();
3935 m_actionZoom1To2->setChecked(
true);
3936 slotViewZoom1To2 ();
3939 m_actionZoom1To4->setChecked(
true);
3940 slotViewZoom1To4 ();
3943 m_actionZoom1To8->setChecked(
true);
3944 slotViewZoom1To8 ();
3947 m_actionZoom1To16->setChecked(
true);
3948 slotViewZoom1To16 ();
3951 m_actionZoomFill->setChecked(
true);
3952 slotViewZoomFill ();
3957 void MainWindow::slotViewZoom16To1 ()
3959 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3961 QTransform transform;
3962 transform.scale (16.0, 16.0);
3963 m_view->setTransform (transform);
3967 void MainWindow::slotViewZoom8To1 ()
3969 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3971 QTransform transform;
3972 transform.scale (8.0, 8.0);
3973 m_view->setTransform (transform);
3977 void MainWindow::slotViewZoom4To1 ()
3979 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3981 QTransform transform;
3982 transform.scale (4.0, 4.0);
3983 m_view->setTransform (transform);
3987 void MainWindow::slotViewZoom2To1 ()
3989 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3991 QTransform transform;
3992 transform.scale (2.0, 2.0);
3993 m_view->setTransform (transform);
3997 void MainWindow::slotViewZoom1To1 ()
3999 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
4001 QTransform transform;
4002 transform.scale (1.0, 1.0);
4003 m_view->setTransform (transform);
4007 void MainWindow::slotViewZoom1To2 ()
4009 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
4011 QTransform transform;
4012 transform.scale (0.5, 0.5);
4013 m_view->setTransform (transform);
4017 void MainWindow::slotViewZoom1To4 ()
4019 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
4021 QTransform transform;
4022 transform.scale (0.25, 0.25);
4023 m_view->setTransform (transform);
4027 void MainWindow::slotViewZoom1To8 ()
4029 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
4031 QTransform transform;
4032 transform.scale (0.125, 0.125);
4033 m_view->setTransform (transform);
4037 void MainWindow::slotViewZoom1To16 ()
4039 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
4041 QTransform transform;
4042 transform.scale (0.0625, 0.0625);
4043 m_view->setTransform (transform);
4047 void MainWindow::slotViewZoomFill ()
4049 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
4051 m_backgroundStateContext->
fitInView (*m_view);
4056 void MainWindow::slotViewZoomIn ()
4058 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
4062 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4063 bool goto1To1 =
false;
4064 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4065 if (m_actionZoomFill->isChecked ()) {
4068 double xScale = m_view->transform().m11();
4069 double yScale = m_view->transform().m22();
4070 double scale = qMin(xScale, yScale);
4071 if (scale < 0.125) {
4073 }
else if (scale < 0.25) {
4075 }
else if (scale < 0.5) {
4077 }
else if (scale < 1) {
4079 }
else if (scale < 2) {
4081 }
else if (scale < 4) {
4083 }
else if (scale < 8) {
4089 goto16To1 = m_actionZoom8To1->isChecked ();
4090 goto8To1 = m_actionZoom4To1->isChecked ();
4091 goto4To1 = m_actionZoom2To1->isChecked ();
4092 goto2To1 = m_actionZoom1To1->isChecked ();
4093 goto1To1 = m_actionZoom1To2->isChecked ();
4094 goto1To2 = m_actionZoom1To4->isChecked ();
4095 goto1To4 = m_actionZoom1To8->isChecked ();
4096 goto1To8 = m_actionZoom1To16->isChecked ();
4101 m_actionZoom16To1->setChecked (
true);
4102 slotViewZoom16To1 ();
4103 }
else if (goto8To1) {
4104 m_actionZoom8To1->setChecked (
true);
4105 slotViewZoom8To1 ();
4106 }
else if (goto4To1) {
4107 m_actionZoom4To1->setChecked (
true);
4108 slotViewZoom4To1 ();
4109 }
else if (goto2To1) {
4110 m_actionZoom2To1->setChecked (
true);
4111 slotViewZoom2To1 ();
4112 }
else if (goto1To1) {
4113 m_actionZoom1To1->setChecked (
true);
4114 slotViewZoom1To1 ();
4115 }
else if (goto1To2) {
4116 m_actionZoom1To2->setChecked (
true);
4117 slotViewZoom1To2 ();
4118 }
else if (goto1To4) {
4119 m_actionZoom1To4->setChecked (
true);
4120 slotViewZoom1To4 ();
4121 }
else if (goto1To8) {
4122 m_actionZoom1To8->setChecked (
true);
4123 slotViewZoom1To8 ();
4124 }
else if (goto1To16) {
4125 m_actionZoom1To16->setChecked (
true);
4126 slotViewZoom1To16 ();
4130 void MainWindow::slotViewZoomInFromWheelEvent ()
4132 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
4134 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4135 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4138 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4143 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4147 void MainWindow::slotViewZoomOut ()
4149 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
4153 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4154 bool goto1To1 =
false;
4155 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4156 if (m_actionZoomFill->isChecked ()) {
4159 double xScale = m_view->transform().m11();
4160 double yScale = m_view->transform().m22();
4161 double scale = qMax(xScale, yScale);
4164 }
else if (scale > 4) {
4166 }
else if (scale > 2) {
4168 }
else if (scale > 1) {
4170 }
else if (scale > 0.5) {
4172 }
else if (scale > 0.25) {
4174 }
else if (scale > 0.125) {
4180 goto8To1 = m_actionZoom16To1->isChecked ();
4181 goto4To1 = m_actionZoom8To1->isChecked ();
4182 goto2To1 = m_actionZoom4To1->isChecked ();
4183 goto1To1 = m_actionZoom2To1->isChecked ();
4184 goto1To2 = m_actionZoom1To1->isChecked ();
4185 goto1To4 = m_actionZoom1To2->isChecked ();
4186 goto1To8 = m_actionZoom1To4->isChecked ();
4187 goto1To16 = m_actionZoom1To8->isChecked ();
4192 m_actionZoom1To16->setChecked (
true);
4193 slotViewZoom1To16 ();
4194 }
else if (goto1To8) {
4195 m_actionZoom1To8->setChecked (
true);
4196 slotViewZoom1To8 ();
4197 }
else if (goto1To4) {
4198 m_actionZoom1To4->setChecked (
true);
4199 slotViewZoom1To4 ();
4200 }
else if (goto1To2) {
4201 m_actionZoom1To2->setChecked (
true);
4202 slotViewZoom1To2 ();
4203 }
else if (goto1To1) {
4204 m_actionZoom1To1->setChecked (
true);
4205 slotViewZoom1To1 ();
4206 }
else if (goto2To1) {
4207 m_actionZoom2To1->setChecked (
true);
4208 slotViewZoom2To1 ();
4209 }
else if (goto4To1) {
4210 m_actionZoom4To1->setChecked (
true);
4211 slotViewZoom4To1 ();
4212 }
else if (goto8To1) {
4213 m_actionZoom8To1->setChecked (
true);
4214 slotViewZoom8To1 ();
4215 }
else if (goto16To1) {
4216 m_actionZoom16To1->setChecked (
true);
4217 slotViewZoom16To1 ();
4221 void MainWindow::slotViewZoomOutFromWheelEvent ()
4223 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
4225 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4226 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4229 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4234 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4238 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
4240 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4249 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4251 m_timerRegressionErrorReport =
new QTimer();
4252 m_timerRegressionErrorReport->setSingleShot(
false);
4253 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4255 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4258 void MainWindow::startRegressionTestFileCmdScript()
4260 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4262 m_timerRegressionFileCmdScript =
new QTimer();
4263 m_timerRegressionFileCmdScript->setSingleShot(
false);
4264 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4266 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4271 return m_transformation;
4281 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4283 ENGAUGE_CHECK_PTR (m_cmdMediator);
4287 updateAfterCommandStatusBarCoords ();
4289 updateHighlightOpacity ();
4295 updateChecklistGuide ();
4296 updateFittingWindow ();
4297 updateGeometryWindow();
4301 writeCheckpointToLogFile ();
4305 m_view->setFocus ();
4308 void MainWindow::updateAfterCommandStatusBarCoords ()
4310 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4315 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4319 updateTransformationAndItsDependencies();
4338 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4347 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4348 QPointF posScreen = m_view->mapToScene (posLocal);
4350 slotMouseMove (posScreen);
4355 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4360 void MainWindow::updateChecklistGuide ()
4362 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4364 m_isDocumentExported =
true;
4365 m_dockChecklistGuide->
update (*m_cmdMediator,
4366 m_isDocumentExported);
4369 void MainWindow::updateControls ()
4371 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls" 4372 <<
" selectedItems=" << m_scene->selectedItems().count();
4374 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4376 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4378 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4379 (m_actionRecentFiles.at(0)->isVisible ()));
4381 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4382 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4383 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4384 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4385 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4387 if (m_cmdMediator == 0) {
4388 m_actionEditUndo->setEnabled (
false);
4389 m_actionEditRedo->setEnabled (
false);
4391 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4392 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4394 bool tableFittingIsActive, tableFittingIsCopyable;
4395 bool tableGeometryIsActive, tableGeometryIsCopyable;
4396 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
4397 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
4398 m_actionEditCut->setEnabled (!tableFittingIsActive &&
4399 !tableGeometryIsActive &&
4400 m_scene->selectedItems().count () > 0);
4401 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
4402 (tableFittingIsActive && tableFittingIsCopyable) ||
4403 (tableGeometryIsActive && tableGeometryIsCopyable));
4404 m_actionEditPaste->setEnabled (
false);
4405 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
4406 !tableGeometryIsActive &&
4407 m_scene->selectedItems().count () > 0);
4410 m_actionDigitizeAxis->setEnabled (modeGraph ());
4411 m_actionDigitizeScale->setEnabled (modeMap ());
4412 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4413 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4414 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4415 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4416 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4418 m_actionViewGridLines->setEnabled (
true);
4420 m_actionViewGridLines->setEnabled (
false);
4421 m_actionViewGridLines->setChecked (
false);
4423 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4424 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4425 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4426 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4428 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4429 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4430 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4431 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4432 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4433 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4434 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4435 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4436 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4437 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4438 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4439 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4441 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4442 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4443 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4445 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4446 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4451 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4456 loadCurveListFromCmdMediator ();
4458 updateTransformationAndItsDependencies();
4470 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4472 switch (digitizeState) {
4473 case DIGITIZE_STATE_AXIS:
4474 m_actionDigitizeAxis->setChecked(
true);
4478 case DIGITIZE_STATE_COLOR_PICKER:
4479 m_actionDigitizeColorPicker->setChecked(
true);
4480 slotDigitizeColorPicker();
4483 case DIGITIZE_STATE_CURVE:
4484 m_actionDigitizeCurve->setChecked(
true);
4485 slotDigitizeCurve();
4488 case DIGITIZE_STATE_EMPTY:
4491 case DIGITIZE_STATE_POINT_MATCH:
4492 m_actionDigitizePointMatch->setChecked(
true);
4493 slotDigitizePointMatch();
4496 case DIGITIZE_STATE_SCALE:
4497 m_actionDigitizeScale->setChecked(
true);
4498 slotDigitizeScale();
4501 case DIGITIZE_STATE_SEGMENT:
4502 m_actionDigitizeSegment->setChecked(
true);
4503 slotDigitizeSegment();
4506 case DIGITIZE_STATE_SELECT:
4507 m_actionDigitizeSelect->setChecked(
true);
4508 slotDigitizeSelect();
4512 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4517 void MainWindow::updateFittingWindow ()
4519 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
4521 if (m_cmdMediator != 0 &&
4525 m_dockFittingWindow->
update (*m_cmdMediator,
4527 m_cmbCurve->currentText (),
4532 void MainWindow::updateGeometryWindow ()
4534 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4536 if (m_cmdMediator != 0 &&
4540 m_dockGeometryWindow->
update (*m_cmdMediator,
4542 m_cmbCurve->currentText (),
4549 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4555 void MainWindow::updateGridLines ()
4557 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4560 m_gridLines.
clear ();
4571 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4574 void MainWindow::updateHighlightOpacity ()
4576 if (m_cmdMediator != 0) {
4582 m_dockGeometryWindow);
4586 void MainWindow::updateRecentFileList()
4588 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4591 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4592 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4595 unsigned int count = recentFilePaths.size();
4596 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4597 count = MAX_RECENT_FILE_LIST_SIZE;
4602 for (i = 0; i < count; i++) {
4603 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4604 m_actionRecentFiles.at (i)->setText (strippedName);
4605 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4606 m_actionRecentFiles.at (i)->setVisible (
true);
4610 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4611 m_actionRecentFiles.at (i)->setVisible (
false);
4618 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4625 m_cmbCurve->currentText());
4630 m_cmbCurve->currentText());
4636 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4642 m_cmbCurve->currentText());
4649 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4656 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4659 loadCurveListFromCmdMediator();
4665 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4674 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4678 modelDigitizeCurve);
4683 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4690 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4697 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4704 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4711 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4713 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4714 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4716 m_actionZoomIn->setShortcut (tr (
""));
4717 m_actionZoomOut->setShortcut (tr (
""));
4721 m_actionZoomIn->setShortcut (tr (
"+"));
4722 m_actionZoomOut->setShortcut (tr (
"-"));
4726 if ((m_scene != 0) &&
4727 (m_cmdMediator != 0)) {
4731 updateHighlightOpacity();
4732 updateWindowTitle();
4733 updateFittingWindow();
4734 updateGeometryWindow();
4739 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4747 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4754 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4760 void MainWindow::updateSmallDialogs ()
4777 void MainWindow::updateTransformationAndItsDependencies()
4779 m_transformation.
update (!m_currentFile.isEmpty (),
4787 m_cmbCurve->currentText ());
4794 void MainWindow::updateViewedCurves ()
4796 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4798 if (m_actionViewCurvesAll->isChecked ()) {
4802 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4806 }
else if (m_actionViewCurvesNone->isChecked ()) {
4811 ENGAUGE_ASSERT (
false);
4817 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4819 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4826 if (activeCurve.isEmpty ()) {
4839 m_cmdMediator->
pixmap ());
4844 void MainWindow::updateWindowTitle ()
4846 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4848 const QString PLACEHOLDER (
"[*]");
4850 QString title = QString (tr (
"Engauge Digitizer %1")
4851 .arg (VERSION_NUMBER));
4853 QString fileNameMaybeStripped;
4854 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4856 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4860 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4861 fileNameMaybeStripped = fileInfo.baseName();
4864 case MAIN_TITLE_BAR_FORMAT_PATH:
4865 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4869 title += QString (
": %1")
4870 .arg (fileNameMaybeStripped);
4875 title += PLACEHOLDER;
4877 setWindowTitle (title);
4882 ENGAUGE_CHECK_PTR (m_view);
4888 ENGAUGE_CHECK_PTR (m_view);
4892 void MainWindow::writeCheckpointToLogFile ()
4895 QString checkpointDoc;
4896 QTextStream strDoc (&checkpointDoc);
4901 QString checkpointScene;
4902 QTextStream strScene (&checkpointScene);
4907 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4909 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n" 4910 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n" 4911 << checkpointDoc.toLatin1().data()
4912 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n" 4913 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n" 4914 << checkpointScene.toLatin1().data()
4915 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine...
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
void unsetPointStyle()
Apply no PointStyle.
Given a set of point identifiers, if a map is in effect (with its two axis endpoints) then both axis ...
void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Dialog for sending error report with networking.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings, const QPixmap &pixmap)
Apply the color filter of the currently selected curve. The pixmap is included so the background colo...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
unsigned int coordSystemCount() const
Number of CoordSystem.
void setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
void createGhosts(QGraphicsScene &scene)
Create ghosts from the path/rect/polygon lists.
void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Returns information about files.
void updateAfterPointAddition()
Update the graphics attributes.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Command for cutting all selected Points.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
Dialog for saving error report to local hard drive.
void clear()
Deallocate and remove all grid lines.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
Wrapper around the Poppler library.
Class that displays the current Segment Filter in a MainWindow toolbar.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points selected by user.
Dialog for editing point match settings, for DigitizeStatePointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
Context class for transformation state machine.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
Wrapper around the QImage class for read and importing non-PDF files.
void updateSettingsCurveAddRemove(const CurvesGraphs &curvesGraphs)
Update with new curves.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
bool canRedo() const
Returns true if there is at least one command on the stack.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isRegressionTest, bool isGnuplot, bool isReset, QStringList loadStartupFiles, QWidget *parent=0)
Single constructor.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void setCoordinates(const QString &coordsScreen, const QString &coordsGraph, const QString &resolutionGraph)
Populate the coordinates fields. Unavailable values are empty. Html-encoding to highlight with colors...
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void cmdFileClose()
Close file. This is called from a file script command.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow)
Update the Points and their Curves after executing a command.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
PointStyle pointStyle() const
Get method for PointStyle.
void triggerStateTransition(TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
Window that displays the geometry information, as a table, for the current curve. ...
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
NonPdfReturn load(const QString &fileName, QImage &image, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void wakeUp()
Enable all widgets in the status bar. This is called just after a Document becomes active...
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
static void bindToMainWindow(const MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
Dialog for editing grid removal settings.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void uploadErrorReport(const QString &report)
Upload the error report asynchronously.
unsigned int numberCoordSystem() const
Number of coordinate systems selected by user.
void setPixmap(const QImage &image)
Set method for the background pixmap.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Dialog for editing curve names settings.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
int maximumGridLines() const
Maximum number of grid lines.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool dragDropExport() const
Get method for drag and drop export.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
bool smallDialogs() const
Get method for small dialogs flag.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Dockable text window containing checklist guide.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Dialog for editing filtering settings.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
ZoomControl zoomControl() const
Get method for zoom control.
QString fileExtensionTsv() const
File extension for tsv export files.
Details for a specific Point.
Class for exporting during regression, when the Transformation has not yet been defined.
Container for all graph curves. The axes point curve is external to this class.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Wrapper around QStatusBar to manage permanent widgets.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
Client for interacting with Engauge server.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Context class that manages the background image state machine.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
virtual void doCopy()
Copy the current selection to the clipboard.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsMainWindow.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
bool canRedo() const
Return true if there is a command available.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Dialog for editing grid display settings.
void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Command for deleting all selected Points.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
Dialog for editing DigitizeStateCurve settings.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
Class that displays a view of the current Curve's point style.
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
double highlightOpacity() const
Get method for highlight opacity.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
const ColorFilterSettings colorFilterSettings(const QString &curveName) const
Get method for copying one color filter. Cannot return just a reference or else there is a warning ab...
Dialog for editing main window settings, which are entirely independent of all documents.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
bool isGnuplot() const
Get method for gnuplot flag.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Dialog for editing curve properties settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.
void resizeEvent(QResizeEvent *event)
Intercept resize event so graphics scene can be appropriately resized when in Fill mode...
QStringList supportedImageWildcards() const
List the supported jpeg2000 file extensions, for filtering import files.
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
File that manages a command stack for regression testing of file import/open/export/close.
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
PdfReturn load(const QString &fileName, QImage &image, int resolution, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
QString filterCsv() const
QFileDialog filter for CSV files.
ImportCropping importCropping() const
Get method for import cropping.
Command for moving all selected Points by a specified translation.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
Window that displays curve fitting as applied to the currently selected curve.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
QLocale locale() const
Get method for locale.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
Command for changing the currently selected CoordSystem.
void showCurves(bool show, bool showAll=false, const QString &curveName="")
Show or hide all Curves (if showAll is true) or just the selected Curve (if showAll is false);...
Dialog for editing axes checker settings.
void setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
void updateGraphicsLinesToMatchGraphicsPoints()
Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
MainWindowModel modelMainWindow() const
Get method for main window model.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
virtual void clear()
Clear stale information.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
virtual void clear()
Clear stale information.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.