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 "DigitSegment.xpm" 31 #include "DigitSelect.xpm" 33 #include "DlgErrorReport.h" 34 #include "DlgImportAdvanced.h" 35 #include "DlgRequiresTransform.h" 36 #include "DlgSettingsAxesChecker.h" 37 #include "DlgSettingsColorFilter.h" 38 #include "DlgSettingsCoords.h" 39 #include "DlgSettingsCurveAddRemove.h" 40 #include "DlgSettingsCurveProperties.h" 41 #include "DlgSettingsDigitizeCurve.h" 42 #include "DlgSettingsExportFormat.h" 43 #include "DlgSettingsGeneral.h" 44 #include "DlgSettingsGridDisplay.h" 45 #include "DlgSettingsGridRemoval.h" 46 #include "DlgSettingsMainWindow.h" 47 #include "DlgSettingsPointMatch.h" 48 #include "DlgSettingsSegments.h" 49 #include "DocumentSerialize.h" 50 #include "EngaugeAssert.h" 51 #include "EnumsToQt.h" 52 #include "ExportImageForRegression.h" 53 #include "ExportToFile.h" 54 #include "FileCmdScript.h" 55 #include "GeometryWindow.h" 57 #include "GraphicsItemsExtractor.h" 58 #include "GraphicsItemType.h" 59 #include "GraphicsScene.h" 60 #include "GraphicsView.h" 61 #include "GridLineFactory.h" 62 #include "GridLineLimiter.h" 63 #include "HelpWindow.h" 64 #ifdef ENGAUGE_JPEG2000 66 #endif // ENGAUGE_JPEG2000 67 #include "LoadFileInfo.h" 68 #include "LoadImageFromUrl.h" 70 #include "MainTitleBarFormat.h" 71 #include "MainWindow.h" 72 #include "NetworkClient.h" 77 #include "PdfResolution.h" 79 #include <QApplication> 80 #include <QCloseEvent> 83 #include <QDesktopServices> 84 #include <QDockWidget> 85 #include <QDomDocument> 87 #include <QFileDialog> 89 #include <QGraphicsLineItem> 90 #include <QImageReader> 92 #include <QKeySequence> 96 #include <QMessageBox> 97 #include <QMouseEvent> 98 #include <QPrintDialog> 101 #include <QTextStream> 105 #include <QToolButton> 106 #include "QtToString.h" 107 #include <QVBoxLayout> 108 #include <QWhatsThis> 109 #include <QXmlStreamReader> 110 #include <QXmlStreamWriter> 111 #include "Settings.h" 112 #include "StatusBar.h" 113 #include "TransformationStateContext.h" 114 #include "TutorialDlg.h" 116 #include "ViewPointStyle.h" 117 #include "ViewSegmentFilter.h" 118 #include "ZoomFactor.h" 119 #include "ZoomFactorInitial.h" 121 const QString EMPTY_FILENAME (
"");
122 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
123 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
124 const int REGRESSION_INTERVAL = 400;
125 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
128 const QString &fileCmdScriptFile,
129 bool isRegressionTest,
132 QStringList loadStartupFiles,
135 m_isDocumentExported (false),
136 m_engaugeFile (EMPTY_FILENAME),
137 m_currentFile (EMPTY_FILENAME),
142 m_digitizeStateContext (0),
143 m_transformationStateContext (0),
144 m_backgroundStateContext (0),
145 m_isGnuplot (isGnuplot),
147 m_timerRegressionErrorReport(0),
149 m_isErrorReportRegressionTest (isRegressionTest),
150 m_timerRegressionFileCmdScript(0)
152 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow" 153 <<
" curDir=" << QDir::currentPath().toLatin1().data();
155 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 156 qApp->setApplicationName (
"Engauge Digitizer");
157 qApp->setOrganizationDomain (
"Mark Mitchell");
162 m_startupDirectory = QDir::currentPath();
166 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
167 setWindowTitle (engaugeWindowTitle ());
169 createCentralWidget();
174 createDockableWidgets ();
179 createLoadImageFromUrl ();
180 createStateContextBackground ();
181 createStateContextDigitize ();
182 createStateContextTransformation ();
183 createSettingsDialogs ();
184 createCommandStackShadow ();
188 settingsRead (isReset);
190 setUnifiedTitleAndToolBarOnMac(
true);
192 installEventFilter(
this);
196 QString originalPath = QDir::currentPath();
197 QDir::setCurrent (m_startupDirectory);
198 if (!errorReportFile.isEmpty()) {
199 loadErrorReportFile(errorReportFile);
200 if (m_isErrorReportRegressionTest) {
201 startRegressionTestErrorReport(errorReportFile);
203 }
else if (!fileCmdScriptFile.isEmpty()) {
205 startRegressionTestFileCmdScript();
210 m_loadStartupFiles = loadStartupFiles;
212 QDir::setCurrent (originalPath);
215 MainWindow::~MainWindow()
219 void MainWindow::addDockWindow (QDockWidget *dockWidget,
221 const QString &settingsTokenArea,
222 const QString &settingsTokenGeometry,
223 Qt::DockWidgetArea dockWidgetArea)
228 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
229 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
230 Qt::NoDockWidgetArea).toInt();
232 if (area == Qt::NoDockWidgetArea) {
234 addDockWidget (dockWidgetArea,
236 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
237 if (settings.contains (settingsTokenGeometry)) {
238 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
249 void MainWindow::applyZoomFactorAfterLoad()
251 ZoomFactor zoomFactor;
254 if (m_zoomMap.contains (zoomFactorInitial)) {
255 zoomFactor = m_zoomMap [zoomFactorInitial];
256 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
257 zoomFactor = currentZoomFactor ();
259 ENGAUGE_ASSERT (
false);
260 zoomFactor = currentZoomFactor();
263 slotViewZoom (zoomFactor);
266 void MainWindow::closeEvent(QCloseEvent *event)
278 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
280 setWindowModified (
false);
286 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
295 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
297 m_regressionFile = exportFilenameFromInputFilename (fileName);
298 fileImport (fileName,
304 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
306 m_regressionFile = exportFilenameFromInputFilename (fileName);
307 loadDocumentFile(fileName);
313 return m_cmdMediator;
316 void MainWindow::createActions()
318 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
320 createActionsFile ();
321 createActionsEdit ();
322 createActionsDigitize ();
323 createActionsView ();
324 createActionsSettings ();
325 createActionsHelp ();
328 void MainWindow::createActionsDigitize ()
330 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
332 QPixmap pixmapAxis (DigitAxis_xpm);
333 QPixmap pixmapCurve (DigitCurve_xpm);
334 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
335 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
336 QPixmap pixmapSegment (DigitSegment_xpm);
337 QPixmap pixmapSelect (DigitSelect_xpm);
339 QIcon iconAxis (pixmapAxis);
340 QIcon iconCurve (pixmapCurve);
341 QIcon iconColorPicker (pixmapColorPicker);
342 QIcon iconPointMatch (pixmapPointMatch);
343 QIcon iconSegment (pixmapSegment);
344 QIcon iconSelect (pixmapSelect);
346 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
347 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
348 m_actionDigitizeSelect->setCheckable (
true);
349 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
350 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n" 351 "Select points on the screen."));
352 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
354 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
355 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
356 m_actionDigitizeAxis->setCheckable (
true);
357 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points."));
358 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n" 359 "Digitizes an axis point by placing a new point at the cursor " 360 "after a mouse click. The coordinates of the axis point are then " 361 "entered. In a graph, three axis points are required to define " 362 "the graph coordinates."));
363 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
365 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
366 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
367 m_actionDigitizeCurve->setCheckable (
true);
368 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
369 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n" 370 "Digitizes a curve point by placing a new point at the cursor " 371 "after a mouse click. Use this mode to digitize points along curves " 373 "New points will be assigned to the currently selected curve."));
374 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
376 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
377 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
378 m_actionDigitizePointMatch->setCheckable (
true);
379 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
380 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n" 381 "Digitizes curve points in a point plot by finding points that match a sample point. The process " 382 "starts by selecting a representative sample point.\n\n" 383 "New points will be assigned to the currently selected curve."));
384 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
386 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
387 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
388 m_actionDigitizeColorPicker->setCheckable (
true);
389 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
390 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n" 391 "Select a pixel along the currently selected curve. That pixel and its neighbors will " 392 "define the filter settings (color, brightness, and so on) of the currently selected curve " 393 "while in Segment Fill mode."));
394 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
396 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
397 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
398 m_actionDigitizeSegment->setCheckable (
true);
399 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
400 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n" 401 "Digitizes curve points by placing new points along the highlighted " 402 "segment under the cursor. Use this mode to quickly digitize multiple points along a " 403 "curve with a single click.\n\n" 404 "New points will be assigned to the currently selected curve."));
405 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
407 m_groupDigitize =
new QActionGroup (
this);
408 m_groupDigitize->addAction (m_actionDigitizeSelect);
409 m_groupDigitize->addAction (m_actionDigitizeAxis);
410 m_groupDigitize->addAction (m_actionDigitizeCurve);
411 m_groupDigitize->addAction (m_actionDigitizePointMatch);
412 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
413 m_groupDigitize->addAction (m_actionDigitizeSegment);
416 void MainWindow::createActionsEdit ()
418 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
420 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
421 m_actionEditUndo->setShortcut (QKeySequence::Undo);
422 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
423 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n" 424 "Undo the last operation."));
427 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
428 m_actionEditRedo->setShortcut (QKeySequence::Redo);
429 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
430 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n" 431 "Redo the last operation."));
434 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
435 m_actionEditCut->setShortcut (QKeySequence::Cut);
436 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
437 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n" 438 "Cuts the selected points and copies them to the clipboard."));
439 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
441 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
442 m_actionEditCopy->setShortcut (QKeySequence::Copy);
443 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
444 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n" 445 "Copies the selected points to the clipboard."));
446 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
448 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
449 m_actionEditPaste->setShortcut (QKeySequence::Paste);
450 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
451 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n" 452 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
453 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
455 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
456 m_actionEditDelete->setShortcut (QKeySequence::Delete);
457 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
458 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n" 459 "Deletes the selected points, after copying them to the clipboard."));
460 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
462 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
463 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
464 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n" 465 "Creates a new document by pasting an image from the clipboard."));
466 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
468 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
469 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
470 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n" 471 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
472 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
475 void MainWindow::createActionsFile ()
477 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
479 m_actionImport =
new QAction(tr (
"&Import..."),
this);
480 m_actionImport->setShortcut (tr (
"Ctrl+I"));
481 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
482 m_actionImport->setWhatsThis (tr (
"Import Image\n\n" 483 "Creates a new document by importing an image with a single coordinate system, " 484 "and axes both coordinates known.\n\n" 485 "For more complicated images with multiple coordinate systems, " 486 "and/or floating axes, Import (Advanced) is used instead."));
487 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
489 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
490 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
491 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n" 492 "Creates a new document by importing an image with support for advanced feaures. In " 493 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
494 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
496 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
497 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
498 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n" 499 "Imports a new image into the current document. The existing image is replaced, " 500 "and all curves in the document are preserved. This operation is useful for applying " 501 "the axis points and other settings from an existing document to a different image."));
502 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
504 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
505 m_actionOpen->setShortcut (QKeySequence::Open);
506 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
507 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n" 508 "Opens an existing document."));
509 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
512 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
513 QAction *recentFileAction =
new QAction (
this);
514 recentFileAction->setVisible (
true);
515 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
516 m_actionRecentFiles.append (recentFileAction);
520 m_actionClose =
new QAction(tr (
"&Close"),
this);
521 m_actionClose->setShortcut (QKeySequence::Close);
522 m_actionClose->setStatusTip (tr (
"Closes the open document."));
523 m_actionClose->setWhatsThis (tr (
"Close Document\n\n" 524 "Closes the open document."));
525 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
527 m_actionSave =
new QAction(tr (
"&Save"),
this);
528 m_actionSave->setShortcut (QKeySequence::Save);
529 m_actionSave->setStatusTip (tr (
"Saves the current document."));
530 m_actionSave->setWhatsThis (tr (
"Save Document\n\n" 531 "Saves the current document."));
532 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
534 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
535 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
536 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
537 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n" 538 "Saves the current document under a new filename."));
539 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
541 m_actionExport =
new QAction (tr (
"Export..."),
this);
542 m_actionExport->setShortcut (tr (
"Ctrl+E"));
543 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
544 m_actionExport->setWhatsThis (tr (
"Export Document\n\n" 545 "Exports the current document into a text file."));
546 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
548 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
549 m_actionPrint->setShortcut (QKeySequence::Print);
550 m_actionPrint->setStatusTip (tr (
"Print the current document."));
551 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n" 552 "Print the current document to a printer or file."));
553 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
555 m_actionExit =
new QAction(tr (
"&Exit"),
this);
556 m_actionExit->setShortcut (QKeySequence::Quit);
557 m_actionExit->setStatusTip (tr (
"Quits the application."));
558 m_actionExit->setWhatsThis (tr (
"Exit\n\n" 559 "Quits the application."));
560 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
563 void MainWindow::createActionsHelp ()
565 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
567 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
568 m_actionHelpChecklistGuideWizard->setCheckable (
true);
569 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
570 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n" 571 "Use Checklist Guide Wizard during import to generate a checklist of steps " 572 "for the imported document"));
574 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
575 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
577 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
578 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
579 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n" 580 "Play tutorial showing steps for digitizing points from curves drawn with lines " 582 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
585 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
586 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
587 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
588 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n" 589 "Searchable help documentation"));
593 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
594 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
595 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
596 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
599 void MainWindow::createActionsSettings ()
601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
603 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
604 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
605 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n" 606 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
607 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
609 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
610 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
611 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n" 612 "Add/Remove Curve settings control which curves are included in the current document"));
613 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
615 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
616 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
617 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n" 618 "Curves properties settings determine how each curve appears"));
619 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
621 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
622 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
623 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n" 624 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and " 625 "Digitize Graph Point modes"));
626 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
628 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
629 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
630 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n" 631 "Export format settings affect how exported files are formatted"));
632 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
634 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
635 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
636 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n" 637 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
638 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
640 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
641 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
642 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n" 643 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
644 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
646 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
647 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
648 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n" 649 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. " 650 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
651 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
653 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
654 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
655 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n" 656 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when " 657 "Color Filtering is not able to separate grid lines from curve lines."));
658 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
660 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
661 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
662 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n" 663 "Point match settings determine how points are matched while in Point Match mode"));
664 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
666 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
667 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
668 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n" 669 "Segment fill settings determine how points are generated in the Segment Fill mode"));
670 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
672 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
673 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
674 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n" 675 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects " 676 "both Color Picker and Point Match modes"));
677 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
679 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
680 m_actionSettingsMainWindow->setEnabled (
true);
681 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
682 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n" 683 "Main window settings affect the user interface and are not specific to any document"));
684 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
687 void MainWindow::createActionsView ()
689 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
691 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
692 m_actionViewBackground->setCheckable (
true);
693 m_actionViewBackground->setChecked (
true);
694 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
695 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n" 696 "Show or hide the background toolbar"));
697 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
699 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
700 m_actionViewChecklistGuide->setCheckable (
true);
701 m_actionViewChecklistGuide->setChecked (
false);
702 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
703 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n" 704 "Show or hide the checklist guide"));
705 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
707 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
708 m_actionViewGeometryWindow->setCheckable (
true);
709 m_actionViewGeometryWindow->setChecked (
false);
710 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
711 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n" 712 "Show or hide the geometry window"));
713 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
715 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
716 m_actionViewDigitize->setCheckable (
true);
717 m_actionViewDigitize->setChecked (
true);
718 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
719 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n" 720 "Show or hide the digitizing tools toolbar"));
721 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
723 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
724 m_actionViewSettingsViews->setCheckable (
true);
725 m_actionViewSettingsViews->setChecked (
true);
726 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
727 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n" 728 "Show or hide the settings views toolbar. These views graphically show the " 729 "most important settings."));
730 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
732 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
733 m_actionViewCoordSystem->setCheckable (
true);
734 m_actionViewCoordSystem->setChecked (
false);
735 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
736 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n" 737 "Show or hide the coordinate system selection toolbar. This toolbar is used " 738 "to select the current coordinate system when the document has multiple " 739 "coordinate systems. This toolbar is also used to view and print all coordinate " 741 "This toolbar is disabled when there is only one coordinate system."));
742 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
744 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
745 m_actionViewToolTips->setCheckable (
true);
746 m_actionViewToolTips->setChecked (
true);
747 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
748 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n" 749 "Show or hide the tool tips"));
750 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
752 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
753 m_actionViewGridLines->setCheckable (
true);
754 m_actionViewGridLines->setChecked (
false);
755 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
756 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n" 757 "Show or hide grid lines that are added for accurate adjustments of the axes points, " 758 "which can improve accuracy in distorted graphs"));
759 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
761 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
762 m_actionViewBackgroundNone->setCheckable (
true);
763 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
764 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n" 765 "No image is shown so points are easier to see"));
767 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
768 m_actionViewBackgroundOriginal->setCheckable (
true);
769 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
770 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n" 771 "Show the original image underneath the points"));
773 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
774 m_actionViewBackgroundFiltered->setCheckable (
true);
775 m_actionViewBackgroundFiltered->setChecked (
true);
776 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
777 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n" 778 "Show the filtered image underneath the points.\n\n" 779 "The filtered image is created from the original image according to the " 780 "Filter preferences so unimportant information is hidden and important " 781 "information is emphasized"));
783 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
784 m_actionViewCurvesNone->setCheckable (
true);
785 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
786 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n" 787 "No axis points or digitized graph curves are shown so the image is easier to see."));
789 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
790 m_actionViewCurvesSelected->setCheckable (
true);
791 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
792 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n" 793 "Show only the digitized points and line that belong to the currently selected curve."));
795 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
796 m_actionViewCurvesAll->setCheckable (
true);
797 m_actionViewCurvesAll->setChecked (
true);
798 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
799 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n" 800 "Show all digitized axis points and graph curves"));
802 m_groupBackground =
new QActionGroup(
this);
803 m_groupBackground->addAction (m_actionViewBackgroundNone);
804 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
805 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
806 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
808 m_groupCurves =
new QActionGroup(
this);
809 m_groupCurves->addAction (m_actionViewCurvesNone);
810 m_groupCurves->addAction (m_actionViewCurvesSelected);
811 m_groupCurves->addAction (m_actionViewCurvesAll);
812 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
814 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
815 m_actionStatusNever->setCheckable(
true);
816 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
817 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
819 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
820 m_actionStatusTemporary->setCheckable(
true);
821 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
822 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
824 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
825 m_actionStatusAlways->setCheckable(
true);
826 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
827 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, " 828 "the status bar also displays information about the cursor position."));
830 m_groupStatus =
new QActionGroup(
this);
831 m_groupStatus->addAction (m_actionStatusNever);
832 m_groupStatus->addAction (m_actionStatusTemporary);
833 m_groupStatus->addAction (m_actionStatusAlways);
834 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
836 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
837 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
839 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
841 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
842 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
844 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
846 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
847 m_actionZoom16To1->setCheckable (
true);
848 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
849 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
851 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
852 m_actionZoom8To1->setCheckable (
true);
853 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
854 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
856 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
857 m_actionZoom4To1->setCheckable (
true);
858 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
859 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
861 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
862 m_actionZoom2To1->setCheckable (
true);
863 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
864 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
866 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
867 m_actionZoom1To1->setCheckable (
true);
868 m_actionZoom1To1->setChecked (
true);
869 m_actionZoom1To1->setStatusTip (tr (
"Zoom 1:1"));
870 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
872 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
873 m_actionZoom1To2->setCheckable (
true);
874 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
875 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
877 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
878 m_actionZoom1To4->setCheckable (
true);
879 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
880 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
882 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
883 m_actionZoom1To8->setCheckable (
true);
884 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
885 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
887 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
888 m_actionZoom1To16->setCheckable (
true);
889 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
890 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
892 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
893 m_actionZoomFill->setCheckable (
true);
894 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
895 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
897 m_groupZoom =
new QActionGroup (
this);
898 m_groupZoom->addAction (m_actionZoom16To1);
899 m_groupZoom->addAction (m_actionZoom8To1);
900 m_groupZoom->addAction (m_actionZoom4To1);
901 m_groupZoom->addAction (m_actionZoom2To1);
902 m_groupZoom->addAction (m_actionZoom1To1);
903 m_groupZoom->addAction (m_actionZoom1To2);
904 m_groupZoom->addAction (m_actionZoom1To4);
905 m_groupZoom->addAction (m_actionZoom1To8);
906 m_groupZoom->addAction (m_actionZoom1To16);
907 m_groupZoom->addAction (m_actionZoomFill);
910 void MainWindow::createCentralWidget ()
912 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
914 QWidget *widget =
new QWidget;
915 setCentralWidget (widget);
916 m_layout =
new QVBoxLayout;
917 widget->setLayout (m_layout);
920 void MainWindow::createCommandStackShadow ()
922 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
927 void MainWindow::createDockableWidgets ()
929 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
933 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
937 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
this, SLOT (slotGeometryWindowClosed()));
940 void MainWindow::createHelpWindow ()
942 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
946 m_helpWindow->hide ();
947 addDockWidget (Qt::RightDockWidgetArea,
949 m_helpWindow->setFloating (
true);
951 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
955 void MainWindow::createIcons()
957 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
960 QPixmap icon16 (bannerapp_16);
961 QPixmap icon32 (bannerapp_32);
962 QPixmap icon64 (bannerapp_64);
963 QPixmap icon128 (bannerapp_128);
964 QPixmap icon256 (bannerapp_256);
966 icon.addPixmap (icon16);
967 icon.addPixmap (icon32);
968 icon.addPixmap (icon64);
969 icon.addPixmap (icon128);
970 icon.addPixmap (icon256);
972 setWindowIcon (icon);
975 void MainWindow::createLoadImageFromUrl ()
980 void MainWindow::createMenus()
982 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
984 m_menuFile = menuBar()->addMenu(tr(
"&File"));
985 m_menuFile->addAction (m_actionImport);
986 m_menuFile->addAction (m_actionImportAdvanced);
987 m_menuFile->addAction (m_actionImportImageReplace);
988 m_menuFile->addAction (m_actionOpen);
990 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
991 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
992 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
994 m_menuFile->addMenu (m_menuFileOpenRecent);
996 m_menuFile->addAction (m_actionClose);
997 m_menuFile->insertSeparator (m_actionSave);
998 m_menuFile->addAction (m_actionSave);
999 m_menuFile->addAction (m_actionSaveAs);
1000 m_menuFile->addAction (m_actionExport);
1001 m_menuFile->insertSeparator (m_actionPrint);
1002 m_menuFile->addAction (m_actionPrint);
1003 m_menuFile->insertSeparator (m_actionExit);
1004 m_menuFile->addAction (m_actionExit);
1006 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1007 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1008 m_menuEdit->addAction (m_actionEditUndo);
1009 m_menuEdit->addAction (m_actionEditRedo);
1010 m_menuEdit->insertSeparator (m_actionEditCut);
1011 m_menuEdit->addAction (m_actionEditCut);
1012 m_menuEdit->addAction (m_actionEditCopy);
1013 m_menuEdit->addAction (m_actionEditPaste);
1014 m_menuEdit->addAction (m_actionEditDelete);
1015 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1016 m_menuEdit->addAction (m_actionEditPasteAsNew);
1017 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1019 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1020 m_menuDigitize->addAction (m_actionDigitizeSelect);
1021 m_menuDigitize->addAction (m_actionDigitizeAxis);
1022 m_menuDigitize->addAction (m_actionDigitizeCurve);
1023 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1024 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1025 m_menuDigitize->addAction (m_actionDigitizeSegment);
1027 m_menuView = menuBar()->addMenu(tr(
"View"));
1028 m_menuView->addAction (m_actionViewBackground);
1029 m_menuView->addAction (m_actionViewDigitize);
1030 m_menuView->addAction (m_actionViewChecklistGuide);
1031 m_menuView->addAction (m_actionViewGeometryWindow);
1032 m_menuView->addAction (m_actionViewSettingsViews);
1033 m_menuView->addAction (m_actionViewCoordSystem);
1034 m_menuView->insertSeparator (m_actionViewToolTips);
1035 m_menuView->addAction (m_actionViewToolTips);
1036 m_menuView->addAction (m_actionViewGridLines);
1037 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1038 m_menuViewBackground =
new QMenu (tr (
"Background"));
1039 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1040 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1041 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1042 m_menuView->addMenu (m_menuViewBackground);
1043 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1044 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1045 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1046 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1047 m_menuView->addMenu (m_menuViewCurves);
1048 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1049 m_menuViewStatus->addAction (m_actionStatusNever);
1050 m_menuViewStatus->addAction (m_actionStatusTemporary);
1051 m_menuViewStatus->addAction (m_actionStatusAlways);
1052 m_menuView->addMenu (m_menuViewStatus);
1053 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1054 m_menuViewZoom->addAction (m_actionZoomOut);
1055 m_menuViewZoom->addAction (m_actionZoomIn);
1056 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1057 m_menuViewZoom->addAction (m_actionZoom16To1);
1058 m_menuViewZoom->addAction (m_actionZoom8To1);
1059 m_menuViewZoom->addAction (m_actionZoom4To1);
1060 m_menuViewZoom->addAction (m_actionZoom2To1);
1061 m_menuViewZoom->addAction (m_actionZoom1To1);
1062 m_menuViewZoom->addAction (m_actionZoom1To2);
1063 m_menuViewZoom->addAction (m_actionZoom1To4);
1064 m_menuViewZoom->addAction (m_actionZoom1To8);
1065 m_menuViewZoom->addAction (m_actionZoom1To16);
1066 m_menuViewZoom->addAction (m_actionZoomFill);
1067 m_menuView->addMenu (m_menuViewZoom);
1069 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1070 m_menuSettings->addAction (m_actionSettingsCoords);
1071 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1072 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1073 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1074 m_menuSettings->addAction (m_actionSettingsExport);
1075 m_menuSettings->addAction (m_actionSettingsColorFilter);
1076 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1077 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1078 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1079 m_menuSettings->addAction (m_actionSettingsPointMatch);
1080 m_menuSettings->addAction (m_actionSettingsSegments);
1081 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1082 m_menuSettings->addAction (m_actionSettingsGeneral);
1083 m_menuSettings->addAction (m_actionSettingsMainWindow);
1085 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1086 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1087 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1088 m_menuHelp->addAction (m_actionHelpWhatsThis);
1089 m_menuHelp->addAction (m_actionHelpTutorial);
1091 m_menuHelp->addAction (m_actionHelpHelp);
1093 m_menuHelp->addAction (m_actionHelpAbout);
1095 updateRecentFileList();
1098 void MainWindow::createNetwork ()
1100 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1105 void MainWindow::createSettingsDialogs ()
1107 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1123 m_dlgSettingsCoords->setVisible (
false);
1124 m_dlgSettingsCurveAddRemove->setVisible (
false);
1125 m_dlgSettingsCurveProperties->setVisible (
false);
1126 m_dlgSettingsDigitizeCurve->setVisible (
false);
1127 m_dlgSettingsExportFormat->setVisible (
false);
1128 m_dlgSettingsColorFilter->setVisible (
false);
1129 m_dlgSettingsAxesChecker->setVisible (
false);
1130 m_dlgSettingsGridDisplay->setVisible (
false);
1131 m_dlgSettingsGridRemoval->setVisible (
false);
1132 m_dlgSettingsPointMatch->setVisible (
false);
1133 m_dlgSettingsSegments->setVisible (
false);
1134 m_dlgSettingsGeneral->setVisible (
false);
1135 m_dlgSettingsMainWindow->setVisible (
false);
1138 void MainWindow::createScene ()
1140 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1144 m_layout->addWidget (m_view);
1147 void MainWindow::createStateContextBackground ()
1149 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1154 void MainWindow::createStateContextDigitize ()
1156 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1163 void MainWindow::createStateContextTransformation ()
1165 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1167 ENGAUGE_CHECK_PTR (m_scene);
1173 void MainWindow::createStatusBar ()
1175 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1177 m_statusBar =
new StatusBar (*statusBar ());
1178 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1179 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1182 void MainWindow::createToolBars ()
1184 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1186 const int VIEW_SIZE = 22;
1189 m_cmbBackground =
new QComboBox ();
1190 m_cmbBackground->setEnabled (
false);
1191 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1192 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n" 1193 "Select background image:\n" 1194 "1) No background which highlights points\n" 1195 "2) Original image which shows everything\n" 1196 "3) Filtered image which highlights important details"));
1197 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1198 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1199 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1201 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1204 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1205 m_toolBackground->addWidget (m_cmbBackground);
1206 addToolBar (m_toolBackground);
1209 m_cmbCurve =
new QComboBox ();
1210 m_cmbCurve->setEnabled (
false);
1211 m_cmbCurve->setMinimumWidth (180);
1212 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1213 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n" 1214 "Select curve for any new points. Every point belongs to one curve."));
1215 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1218 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1219 m_toolDigitize->addAction (m_actionDigitizeSelect);
1220 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1221 m_toolDigitize->addAction (m_actionDigitizeAxis);
1222 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1223 m_toolDigitize->addAction (m_actionDigitizeCurve);
1224 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1225 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1226 m_toolDigitize->addAction (m_actionDigitizeSegment);
1227 m_toolDigitize->addWidget (m_cmbCurve);
1228 addToolBar (m_toolDigitize);
1232 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1233 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1234 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1235 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n" 1236 "Points style for the currently selected curve. The points style is only " 1237 "displayed in this toolbar. To change the points style, " 1238 "use the Curve Properties dialog."));
1241 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1242 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1243 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1244 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n" 1245 "View of filter for the current curve in Segment Fill mode. The filter settings are only " 1246 "displayed in this toolbar. To changed the filter settings, " 1247 "use the Color Picker mode or the Filter Settings dialog."));
1250 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1251 m_toolSettingsViews->addWidget (m_viewPointStyle);
1252 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1253 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1254 addToolBar (m_toolSettingsViews);
1257 m_cmbCoordSystem =
new QComboBox;
1258 m_cmbCoordSystem->setEnabled (
false);
1259 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1260 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n" 1261 "Currently selected coordinate system. This is used to switch between coordinate systems " 1262 "in documents with multiple coordinate systems"));
1263 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1265 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1266 m_btnShowAll->setEnabled (
false);
1267 m_btnShowAll->setAcceptDrops(
false);
1268 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1269 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n" 1270 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1271 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1272 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1274 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1275 m_btnPrintAll->setEnabled (
false);
1276 m_btnPrintAll->setAcceptDrops(
false);
1277 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1278 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n" 1279 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1280 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1282 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1283 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1284 m_toolCoordSystem->addWidget (m_btnShowAll);
1285 m_toolCoordSystem->addWidget (m_btnPrintAll);
1286 addToolBar (m_toolCoordSystem);
1289 void MainWindow::createTutorial ()
1291 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1294 m_tutorialDlg->setModal (
true);
1295 m_tutorialDlg->setMinimumSize (500, 400);
1296 m_tutorialDlg->hide();
1299 void MainWindow::createZoomMap ()
1301 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1303 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1304 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1305 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1306 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1307 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1308 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1309 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1310 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1311 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1312 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1315 ZoomFactor MainWindow::currentZoomFactor ()
const 1317 if (m_actionZoom1To1->isChecked()) {
1319 }
else if (m_actionZoom1To2->isChecked()) {
1321 }
else if (m_actionZoom1To4->isChecked()) {
1323 }
else if (m_actionZoom1To8->isChecked()) {
1325 }
else if (m_actionZoom1To16->isChecked()) {
1326 return ZOOM_1_TO_16;
1327 }
else if (m_actionZoom2To1->isChecked()) {
1329 }
else if (m_actionZoom4To1->isChecked()) {
1331 }
else if (m_actionZoom8To1->isChecked()) {
1333 }
else if (m_actionZoom16To1->isChecked()) {
1334 return ZOOM_16_TO_1;
1335 }
else if (m_actionZoomFill->isChecked()) {
1338 ENGAUGE_ASSERT (
false);
1344 if (event->type () == QEvent::KeyPress) {
1346 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1349 if ((eventKeyPress->key() == Qt::Key_E) &&
1350 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1351 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1361 return QObject::eventFilter (target, event);
1365 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1367 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1374 QString regressionFile = QString (
"%1_%2")
1375 .arg (m_regressionFile)
1389 fileExport (regressionFile,
1396 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const 1398 QString outFileName = fileName;
1400 outFileName = outFileName.replace (
".xml",
".csv_actual");
1401 outFileName = outFileName.replace (
".dig",
".csv_actual");
1402 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1407 void MainWindow::fileExport(
const QString &fileName,
1410 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport" 1411 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1412 <<
" fileName=" << fileName.toLatin1().data();
1414 QFile file (fileName);
1415 if (file.open(QIODevice::WriteOnly)) {
1417 QTextStream str (&file);
1428 updateChecklistGuide ();
1432 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport" 1433 <<
" file=" << fileName.toLatin1().data()
1434 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1435 QMessageBox::critical (0,
1436 engaugeWindowTitle(),
1437 tr (
"Unable to export to file ") + fileName);
1441 void MainWindow::fileImport (
const QString &fileName,
1442 ImportType importType)
1444 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport" 1445 <<
" fileName=" << fileName.toLatin1 ().data ()
1446 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1447 <<
" importType=" << importType;
1449 QString originalFileOld = m_originalFile;
1450 bool originalFileWasImported = m_originalFileWasImported;
1452 m_originalFile = fileName;
1453 m_originalFileWasImported =
true;
1455 if (importType == IMPORT_TYPE_ADVANCED) {
1466 bool loaded =
false;
1468 #ifdef ENGAUGE_JPEG2000 1470 loaded = jpeg2000.
load (fileName,
1472 #endif // ENGAUGE_JPEG2000 1478 PdfReturn pdfReturn = pdf.
load (fileName,
1482 m_isErrorReportRegressionTest);
1483 if (pdfReturn == PDF_RETURN_CANCELED) {
1490 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1492 #endif // ENGAUGE_PDF 1496 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1499 m_isErrorReportRegressionTest);
1500 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1507 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1511 QString msg = QString(
"%1 %2 %3 %4.")
1512 .arg (tr (
"Cannot read file"))
1514 .arg (tr (
"from directory"))
1515 .arg (QDir::currentPath());
1516 QMessageBox::warning (
this,
1517 engaugeWindowTitle(),
1521 m_originalFile = originalFileOld;
1522 m_originalFileWasImported = originalFileWasImported;
1526 loaded = loadImage (fileName,
1533 if (importType == IMPORT_TYPE_ADVANCED) {
1543 m_originalFile = originalFileOld;
1544 m_originalFileWasImported = originalFileWasImported;
1550 void MainWindow::fileImportWithPrompts (ImportType importType)
1552 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts" 1553 <<
" importType=" << importType;
1557 bool okToContinue =
true;
1558 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1559 okToContinue = maybeSave ();
1565 QTextStream str (&filter);
1568 QList<QByteArray>::const_iterator itr;
1569 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1570 QStringList supportedImageFormatStrings;
1571 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1572 QByteArray arr = *itr;
1573 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1574 supportedImageFormatStrings << extensionAsWildcard;
1576 #ifdef ENGAUGE_JPEG2000 1579 #endif // ENGAUGE_JPEG2000 1582 supportedImageFormatStrings <<
"*.pdf";
1583 #endif // ENGAUGE_PDF 1585 supportedImageFormatStrings.sort();
1587 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1591 str <<
";; All Files (*.*)";
1593 QString fileName = QFileDialog::getOpenFileName (
this,
1595 QDir::currentPath (),
1597 if (!fileName.isEmpty ()) {
1600 fileImport (fileName,
1606 void MainWindow::filePaste (ImportType importType)
1608 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste" 1609 <<
" importType=" << importType;
1611 QString originalFileOld = m_originalFile;
1612 bool originalFileWasImported = m_originalFileWasImported;
1614 QString fileName (
"clipboard");
1615 m_originalFile = fileName;
1616 m_originalFileWasImported =
true;
1618 if (importType == IMPORT_TYPE_ADVANCED) {
1629 QImage image = QApplication::clipboard()->image();
1631 bool loaded =
false;
1633 loaded = !image.isNull();
1637 QMessageBox::warning (
this,
1638 engaugeWindowTitle(),
1639 QString(
"%1 %2 %3 %4.")
1640 .arg (tr (
"Cannot read file"))
1642 .arg (tr (
"from directory"))
1643 .arg (QDir::currentPath ()));
1646 m_originalFile = originalFileOld;
1647 m_originalFileWasImported = originalFileWasImported;
1651 loaded = loadImage (fileName,
1658 if (importType == IMPORT_TYPE_ADVANCED) {
1668 m_originalFile = originalFileOld;
1669 m_originalFileWasImported = originalFileWasImported;
1675 void MainWindow::ghostsCreate ()
1677 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1679 ENGAUGE_ASSERT (m_ghosts == 0);
1701 void MainWindow::ghostsDestroy ()
1703 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1705 ENGAUGE_CHECK_PTR (m_ghosts);
1723 void MainWindow::loadCoordSystemListFromCmdMediator ()
1725 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1727 m_cmbCoordSystem->clear();
1731 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1732 int index1Based = i + 1;
1733 m_cmbCoordSystem->addItem (QString::number (index1Based),
1738 m_cmbCoordSystem->setCurrentIndex (0);
1741 bool enable = (m_cmbCoordSystem->count() > 1);
1742 m_cmbCoordSystem->setEnabled (enable);
1743 m_btnShowAll->setEnabled (enable);
1744 m_btnPrintAll->setEnabled (enable);
1747 void MainWindow::loadCurveListFromCmdMediator ()
1749 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1751 m_cmbCurve->clear ();
1753 QStringList::iterator itr;
1754 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1756 QString curvesGraphName = *itr;
1757 m_cmbCurve->addItem (curvesGraphName);
1764 void MainWindow::loadDocumentFile (
const QString &fileName)
1766 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1768 QApplication::setOverrideCursor(Qt::WaitCursor);
1774 setCurrentPathFromFile (fileName);
1775 rebuildRecentFileListForCurrentFile(fileName);
1776 m_currentFile = fileName;
1778 if (m_cmdMediator != 0) {
1779 delete m_cmdMediator;
1784 setupAfterLoadNewDocument (fileName,
1786 IMPORT_TYPE_SIMPLE);
1789 m_actionDigitizeSelect->setChecked (
true);
1790 slotDigitizeSelect();
1792 m_engaugeFile = fileName;
1793 m_originalFile = fileName;
1794 m_originalFileWasImported =
false;
1799 QApplication::restoreOverrideCursor();
1803 QApplication::restoreOverrideCursor();
1805 QMessageBox::warning (
this,
1806 engaugeWindowTitle(),
1807 QString(
"%1 %2 %3 %4:\n%5.")
1808 .arg (tr (
"Cannot read file"))
1810 .arg (tr (
"from directory"))
1811 .arg (QDir::currentPath ())
1818 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1820 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile" 1821 <<
" file=" << errorReportFile.toLatin1().data();
1823 QFile file (errorReportFile);
1824 if (!file.exists()) {
1826 QFileInfo fileInfo (errorReportFile);
1828 QMessageBox::critical (
this,
1829 engaugeWindowTitle(),
1830 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1835 QXmlStreamReader reader (&file);
1836 file.open(QIODevice::ReadOnly | QIODevice::Text);
1846 setupAfterLoadNewDocument (errorReportFile,
1847 "Error report opened",
1848 IMPORT_TYPE_SIMPLE);
1851 m_actionDigitizeSelect->setChecked (
true);
1852 slotDigitizeSelect();
1857 bool MainWindow::loadImage (
const QString &fileName,
1858 const QImage &image,
1859 ImportType importType)
1861 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage" 1862 <<
" fileName=" << fileName.toLatin1 ().data ()
1863 <<
" importType=" << importType;
1866 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1867 success = loadImageReplacingImage (fileName,
1871 success = loadImageNewDocument (fileName,
1879 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1880 const QImage &image,
1881 ImportType importType)
1883 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument" 1884 <<
" fileName=" << fileName.toLatin1 ().data ()
1885 <<
" importType=" << importType;
1887 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1889 QApplication::setOverrideCursor(Qt::WaitCursor);
1892 QApplication::restoreOverrideCursor();
1894 setCurrentPathFromFile (fileName);
1896 m_engaugeFile = EMPTY_FILENAME;
1898 if (m_cmdMediator != 0) {
1899 delete m_cmdMediator;
1904 bool accepted = setupAfterLoadNewDocument (fileName,
1905 tr (
"File imported"),
1911 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1912 (m_fileCmdScript == 0)) {
1917 if (wizard->exec() == QDialog::Accepted) {
1919 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1933 m_actionViewChecklistGuide->setChecked (
true);
1936 loadCurveListFromCmdMediator();
1939 loadCoordSystemListFromCmdMediator();
1945 m_actionDigitizeAxis->setChecked (
true);
1946 slotDigitizeAxis ();
1954 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1955 const QImage &image,
1956 ImportType importType)
1958 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage" 1959 <<
" fileName=" << fileName.toLatin1 ().data ()
1960 <<
" importType=" << importType;
1962 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1964 setCurrentPathFromFile (fileName);
1966 m_engaugeFile = EMPTY_FILENAME;
1968 ENGAUGE_ASSERT (m_cmdMediator != 0);
1972 bool accepted = setupAfterLoadReplacingImage (fileName,
1973 tr (
"File imported"),
1981 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const 1983 QFile file (m_originalFile);
1987 if (!file.open (QIODevice::ReadOnly)) {
1991 domInputFile.setContent (&file);
1995 void MainWindow::loadToolTips()
1997 if (m_actionViewToolTips->isChecked ()) {
2000 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2001 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2002 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2003 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2004 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2005 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2006 m_cmbBackground->setToolTip (tr (
"Background image."));
2007 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2008 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2009 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2014 m_actionDigitizeSelect->setToolTip (
"");
2015 m_actionDigitizeAxis->setToolTip (
"");
2016 m_actionDigitizeCurve->setToolTip (
"");
2017 m_actionDigitizePointMatch->setToolTip (
"");
2018 m_actionDigitizeColorPicker->setToolTip (
"");
2019 m_actionDigitizeSegment->setToolTip (
"");
2020 m_cmbBackground->setToolTip (
"");
2021 m_cmbCurve->setToolTip (
"");
2022 m_viewPointStyle->setToolTip (
"");
2023 m_viewSegmentFilter->setToolTip (
"");
2028 bool MainWindow::maybeSave()
2030 if (m_cmdMediator != 0) {
2032 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2033 engaugeWindowTitle(),
2034 tr(
"The document has been modified.\n" 2035 "Do you want to save your changes?"),
2036 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2037 if (ret == QMessageBox::Save) {
2038 return slotFileSave();
2039 }
else if (ret == QMessageBox::Cancel) {
2050 const QString &fileName)
const 2058 QString csvExtension = QString (
".%1")
2060 QString tsvExtension = QString (
".%1")
2062 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2063 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2067 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2068 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2069 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2070 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2074 return modelExportFormatAfter;
2079 return m_modelMainWindow;
2082 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2084 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2086 setWindowFilePath (filePath);
2088 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2089 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2090 recentFilePaths.removeAll (filePath);
2091 recentFilePaths.prepend (filePath);
2092 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2093 recentFilePaths.removeLast ();
2095 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2097 updateRecentFileList();
2102 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2104 if (m_actionZoomFill->isChecked ()) {
2109 bool MainWindow::saveDocumentFile (
const QString &fileName)
2111 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2113 QFile file(fileName);
2114 if (!file.open(QFile::WriteOnly)) {
2115 QMessageBox::warning (
this,
2116 engaugeWindowTitle(),
2117 QString (
"%1 %2: \n%3.")
2118 .arg(tr (
"Cannot write file"))
2120 .arg(file.errorString()));
2124 rebuildRecentFileListForCurrentFile (fileName);
2126 QApplication::setOverrideCursor (Qt::WaitCursor);
2127 QXmlStreamWriter writer(&file);
2128 writer.setAutoFormatting(
true);
2129 writer.writeStartDocument();
2130 writer.writeDTD(
"<!DOCTYPE engauge>");
2132 writer.writeEndDocument();
2133 QApplication::restoreOverrideCursor ();
2137 m_cmdMediator->setClean ();
2139 setCurrentFile(fileName);
2140 m_engaugeFile = fileName;
2150 const char *comment)
const 2154 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2156 QString report = saveErrorReportFileAndExitXml (context,
2163 if (dlg.exec() == QDialog::Accepted) {
2171 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2174 const char *comment)
const 2176 const bool DEEP_COPY =
true;
2178 QString xmlErrorReport;
2179 QXmlStreamWriter writer (&xmlErrorReport);
2180 writer.setAutoFormatting(
true);
2183 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2186 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2187 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2188 writer.writeEndElement();
2192 QXmlStreamReader reader (m_startingDocumentSnapshot);
2193 while (!reader.atEnd ()) {
2195 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2196 reader.tokenType() != QXmlStreamReader::EndDocument) {
2197 writer.writeCurrentToken (reader);
2202 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2203 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2204 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2205 writer.writeEndElement();
2208 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2209 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2210 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2211 writer.writeEndElement();
2214 m_cmdMediator->
saveXml(writer);
2217 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2218 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2219 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2220 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2221 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2222 writer.writeEndElement();
2224 writer.writeEndElement();
2227 QDomDocument domErrorReport (
"ErrorReport");
2228 domErrorReport.setContent (xmlErrorReport);
2231 if (!m_originalFileWasImported) {
2235 QDomDocument domInputFile;
2236 loadInputFileForErrorReport (domInputFile);
2237 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2238 if (!domInputFile.isNull()) {
2239 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2241 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2242 if (nodesFileTo.count () > 0) {
2243 QDomNode nodeFileTo = nodesFileTo.at (0);
2244 nodeFileTo.appendChild (fragmentFileFrom);
2251 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2252 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2253 QDomNode nodeDocument = nodesDocument.at (i);
2254 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2255 if (!elemImage.isNull()) {
2258 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2259 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2261 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2262 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2264 QDomNode nodeReplacement;
2265 QDomElement elemReplacement = nodeReplacement.toElement();
2266 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2267 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2270 nodeDocument.insertBefore (nodeReplacement,
2272 nodeDocument.removeChild(elemImage);
2278 return domErrorReport.toString();
2281 void MainWindow::saveStartingDocumentSnapshot()
2283 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2285 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2286 writer.setAutoFormatting (
true);
2292 ENGAUGE_CHECK_PTR (m_scene);
2298 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2300 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2302 int index = m_cmbBackground->findData (backgroundImage);
2303 ENGAUGE_ASSERT (index >= 0);
2305 m_cmbBackground->setCurrentIndex(index);
2307 return previousBackground;
2312 return m_cmbCurve->currentText ();
2315 void MainWindow::setCurrentFile (
const QString &fileName)
2317 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2319 QString fileNameStripped;
2320 if (!fileName.isEmpty()) {
2323 QFileInfo fileInfo (fileName);
2324 fileNameStripped = fileInfo.baseName();
2327 m_currentFile = fileNameStripped;
2328 m_currentFileWithPathAndFileExtension = fileName;
2330 updateWindowTitle ();
2333 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2335 QDir dir = QFileInfo (fileName).absoluteDir();
2337 if (dir.exists ()) {
2339 bool success = QDir::setCurrent (dir.absolutePath ());
2340 ENGAUGE_ASSERT (success);
2348 void MainWindow::setPixmap (
const QString &curveSelected,
2349 const QPixmap &pixmap)
2351 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2358 m_backgroundStateContext->
setPixmap (m_transformation,
2365 void MainWindow::settingsRead (
bool isReset)
2367 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2374 settingsReadEnvironment (settings);
2375 settingsReadMainWindow (settings);
2378 void MainWindow::settingsReadEnvironment (QSettings &settings)
2380 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2381 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2382 QDir::currentPath ()).toString ());
2383 settings.endGroup ();
2386 void MainWindow::settingsReadMainWindow (QSettings &settings)
2388 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2391 resize (settings.value (SETTINGS_SIZE,
2392 QSize (600, 600)).toSize ());
2393 move (settings.value (SETTINGS_POS,
2394 QPoint (200, 200)).toPoint ());
2398 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2399 QSize (900, 600)).toSize();
2400 m_helpWindow->resize (helpSize);
2401 if (settings.contains (SETTINGS_HELP_POS)) {
2402 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2403 m_helpWindow->move (helpPos);
2408 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2412 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2414 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2415 m_toolBackground->setVisible (viewBackgroundToolBar);
2416 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2417 BACKGROUND_IMAGE_FILTERED).toInt ();
2418 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2419 m_cmbBackground->setCurrentIndex (indexBackground);
2422 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2424 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2425 m_toolDigitize->setVisible (viewDigitizeToolBar);
2428 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2430 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2431 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2434 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2436 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2437 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2440 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2442 m_actionViewToolTips->setChecked (viewToolTips);
2446 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2449 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2450 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2451 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2453 addDockWindow (m_dockChecklistGuide,
2455 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2456 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2457 Qt::RightDockWidgetArea);
2458 addDockWindow (m_dockGeometryWindow,
2460 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2461 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2462 Qt::RightDockWidgetArea);
2467 QLocale localeDefault;
2468 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2469 QVariant (localeDefault.language())).toInt();
2470 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2471 QVariant (localeDefault.country())).toInt();
2472 QLocale locale (language,
2474 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2475 QVariant (ZOOM_1_TO_1)).toInt());
2477 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2478 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2479 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2480 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2481 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2482 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2483 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2484 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2485 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2486 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2488 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2490 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2491 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
2492 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
2495 updateSmallDialogs();
2497 settings.endGroup();
2500 void MainWindow::settingsWrite ()
2502 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2504 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2505 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2506 settings.endGroup ();
2508 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2509 settings.setValue (SETTINGS_SIZE, size ());
2510 settings.setValue (SETTINGS_POS, pos ());
2512 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2513 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2515 if (m_dockChecklistGuide->isFloating()) {
2517 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2518 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2522 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2525 if (m_dockGeometryWindow->isFloating()) {
2527 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2528 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2532 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2535 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2536 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2537 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2538 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2539 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2540 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2541 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2542 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2543 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2544 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
2545 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2546 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2547 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2548 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2549 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2550 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2551 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2552 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2553 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2554 settings.endGroup ();
2557 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2558 const QString &temporaryMessage ,
2559 ImportType importType)
2561 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument" 2562 <<
" file=" << fileName.toLatin1().data()
2563 <<
" message=" << temporaryMessage.toLatin1().data()
2564 <<
" importType=" << importType;
2569 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2573 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2577 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2579 m_cmdMediator->
pixmap ());
2583 if (importType == IMPORT_TYPE_ADVANCED) {
2585 applyZoomFactorAfterLoad();
2588 dlgImportAdvanced.exec();
2590 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2603 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2604 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2605 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2606 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2607 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2608 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2609 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2610 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2611 loadCurveListFromCmdMediator ();
2612 loadCoordSystemListFromCmdMediator ();
2615 m_isDocumentExported =
false;
2624 m_cmbCurve->currentText ());
2625 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2627 applyZoomFactorAfterLoad();
2629 setCurrentFile(fileName);
2633 saveStartingDocumentSnapshot();
2640 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2641 const QString &temporaryMessage ,
2642 ImportType importType)
2644 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage" 2645 <<
" file=" << fileName.toLatin1().data()
2646 <<
" message=" << temporaryMessage.toLatin1().data()
2647 <<
" importType=" << importType;
2652 m_cmdMediator->clear();
2655 m_cmdMediator->
pixmap ());
2657 m_isDocumentExported =
false;
2659 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2661 applyZoomFactorAfterLoad();
2663 setCurrentFile(fileName);
2667 saveStartingDocumentSnapshot();
2676 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent" 2677 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2679 QMainWindow::showEvent (event);
2681 if (m_loadStartupFiles.count() > 0) {
2683 m_timerLoadStartupFiles =
new QTimer;
2684 m_timerLoadStartupFiles->setSingleShot (
true);
2685 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2686 m_timerLoadStartupFiles->start (0);
2696 void MainWindow::slotBtnPrintAll ()
2698 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2702 QPrinter printer (QPrinter::HighResolution);
2703 QPrintDialog dlg (&printer,
this);
2704 if (dlg.exec() == QDialog::Accepted) {
2705 QPainter painter (&printer);
2706 m_view->render (&painter);
2713 void MainWindow::slotBtnShowAllPressed ()
2715 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2721 void MainWindow::slotBtnShowAllReleased ()
2723 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2729 void MainWindow::slotCanRedoChanged (
bool canRedo)
2731 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2733 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2736 void MainWindow::slotCanUndoChanged (
bool canUndo)
2738 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2740 m_actionEditUndo->setEnabled (canUndo);
2743 void MainWindow::slotChecklistClosed()
2745 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2747 m_actionViewChecklistGuide->setChecked (
false);
2750 void MainWindow::slotCleanChanged(
bool clean)
2752 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2754 setWindowModified (!clean);
2757 void MainWindow::slotCmbBackground(
int currentIndex)
2759 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2761 switch (currentIndex) {
2762 case BACKGROUND_IMAGE_NONE:
2763 if (!m_actionViewBackgroundNone->isChecked()) {
2764 m_actionViewBackgroundNone->toggle();
2768 case BACKGROUND_IMAGE_ORIGINAL:
2769 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2770 m_actionViewBackgroundOriginal->toggle();
2774 case BACKGROUND_IMAGE_FILTERED:
2775 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2776 m_actionViewBackgroundFiltered->toggle();
2784 void MainWindow::slotCmbCoordSystem(
int index)
2786 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2792 m_cmdMediator->push (cmd);
2795 void MainWindow::slotCmbCurve(
int )
2797 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2802 m_cmbCurve->currentText ());
2806 updateViewedCurves();
2808 updateGeometryWindow();
2811 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2813 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2819 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2821 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2827 void MainWindow::slotDigitizeAxis ()
2829 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2832 DIGITIZE_STATE_AXIS);
2833 m_cmbCurve->setEnabled (
false);
2838 void MainWindow::slotDigitizeColorPicker ()
2840 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2843 DIGITIZE_STATE_COLOR_PICKER);
2844 m_cmbCurve->setEnabled (
true);
2849 void MainWindow::slotDigitizeCurve ()
2851 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2854 DIGITIZE_STATE_CURVE);
2855 m_cmbCurve->setEnabled (
true);
2860 void MainWindow::slotDigitizePointMatch ()
2862 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2865 DIGITIZE_STATE_POINT_MATCH);
2866 m_cmbCurve->setEnabled (
true);
2871 void MainWindow::slotDigitizeSegment ()
2873 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2876 DIGITIZE_STATE_SEGMENT);
2877 m_cmbCurve->setEnabled (
true);
2882 void MainWindow::slotDigitizeSelect ()
2884 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2887 DIGITIZE_STATE_SELECT);
2888 m_cmbCurve->setEnabled (
false);
2893 void MainWindow::slotEditCopy ()
2895 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2898 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2908 void MainWindow::slotEditCut ()
2910 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2913 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2923 void MainWindow::slotEditDelete ()
2925 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
2928 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2938 void MainWindow::slotEditMenu ()
2940 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
2942 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2943 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2946 void MainWindow::slotEditPaste ()
2948 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
2951 void MainWindow::slotEditPasteAsNew ()
2953 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
2955 filePaste (IMPORT_TYPE_SIMPLE);
2958 void MainWindow::slotEditPasteAsNewAdvanced ()
2960 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
2962 filePaste (IMPORT_TYPE_ADVANCED);
2965 void MainWindow::slotFileClose()
2967 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
2981 DIGITIZE_STATE_EMPTY);
2987 m_backgroundStateContext->
close ();
2990 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2993 m_dockGeometryWindow->
clear ();
2996 delete m_cmdMediator;
3002 setWindowTitle (engaugeWindowTitle ());
3004 m_gridLines.
clear();
3009 void MainWindow::slotFileExport ()
3011 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3016 QString filter = QString (
"%1;;%2;;All files (*.*)")
3021 QString defaultFileName = QString (
"%1/%2.%3")
3022 .arg (QDir::currentPath ())
3023 .arg (m_currentFile)
3026 QString filterCsv = exportStrategy.
filterCsv ();
3027 QString fileName = dlg.getSaveFileName (
this,
3032 if (!fileName.isEmpty ()) {
3034 fileExport(fileName,
3043 void MainWindow::slotFileImport ()
3045 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3047 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3050 void MainWindow::slotFileImportAdvanced ()
3052 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3054 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3057 void MainWindow::slotFileImportDraggedImage(QImage image)
3059 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3064 IMPORT_TYPE_SIMPLE);
3067 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3069 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3074 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3076 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3079 loadImage (fileName,
3081 IMPORT_TYPE_SIMPLE);
3084 void MainWindow::slotFileImportImageReplace ()
3086 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3088 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3091 void MainWindow::slotFileOpen()
3093 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3099 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3100 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3101 .arg (ENGAUGE_FILENAME_EXTENSION);
3103 QString fileName = QFileDialog::getOpenFileName (
this,
3104 tr(
"Open Document"),
3105 QDir::currentPath (),
3107 if (!fileName.isEmpty ()) {
3109 loadDocumentFile (fileName);
3115 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3117 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3119 loadDocumentFile (fileName);
3122 void MainWindow::slotFilePrint()
3124 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3126 QPrinter printer (QPrinter::HighResolution);
3127 QPrintDialog dlg (&printer,
this);
3128 if (dlg.exec() == QDialog::Accepted) {
3129 QPainter painter (&printer);
3130 m_view->render (&painter);
3135 bool MainWindow::slotFileSave()
3137 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3139 if (m_engaugeFile.isEmpty()) {
3140 return slotFileSaveAs();
3142 return saveDocumentFile (m_engaugeFile);
3146 bool MainWindow::slotFileSaveAs()
3148 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3151 QString filenameDefault = m_currentFile;
3152 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3153 filenameDefault = QString (
"%1.%2")
3154 .arg (m_currentFile)
3155 .arg (ENGAUGE_FILENAME_EXTENSION);
3158 if (!m_engaugeFile.isEmpty()) {
3159 filenameDefault = m_engaugeFile;
3162 QString filterDigitizer = QString (
"%1 (*.%2)")
3163 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3164 .arg (ENGAUGE_FILENAME_EXTENSION);
3165 QString filterAll (
"All files (*. *)");
3167 QStringList filters;
3168 filters << filterDigitizer;
3169 filters << filterAll;
3171 QFileDialog dlg(
this);
3172 dlg.setFileMode (QFileDialog::AnyFile);
3173 dlg.selectNameFilter (filterDigitizer);
3174 dlg.setNameFilters (filters);
3175 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 3178 dlg.setWindowModality(Qt::WindowModal);
3180 dlg.setAcceptMode(QFileDialog::AcceptSave);
3181 dlg.selectFile(filenameDefault);
3184 QStringList files = dlg.selectedFiles();
3185 return saveDocumentFile(files.at(0));
3191 void MainWindow::slotGeometryWindowClosed()
3193 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3195 m_actionViewGeometryWindow->setChecked (
false);
3198 void MainWindow::slotHelpAbout()
3200 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3206 void MainWindow::slotHelpTutorial()
3208 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3210 m_tutorialDlg->show ();
3211 m_tutorialDlg->exec ();
3214 void MainWindow::slotKeyPress (Qt::Key key,
3215 bool atLeastOneSelectedItem)
3217 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress" 3218 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3219 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3223 atLeastOneSelectedItem);
3226 void MainWindow::slotLoadStartupFiles ()
3228 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3230 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3232 QString fileName = m_loadStartupFiles.front();
3233 m_loadStartupFiles.pop_front();
3239 loadDocumentFile (fileName);
3243 fileImport (fileName,
3244 IMPORT_TYPE_SIMPLE);
3248 if (m_loadStartupFiles.count() > 0) {
3252 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3253 m_loadStartupFiles);
3257 void MainWindow::slotMouseMove (QPointF pos)
3262 if (m_cmdMediator != 0) {
3265 QString coordsScreen, coordsGraph, resolutionGraph;
3284 void MainWindow::slotMousePress (QPointF pos)
3286 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3294 void MainWindow::slotMouseRelease (QPointF pos)
3296 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3298 if (pos.x() < 0 || pos.y() < 0) {
3312 void MainWindow::slotRecentFileAction ()
3314 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3316 QAction *action = qobject_cast<QAction*>(sender ());
3319 QString fileName = action->data().toString();
3320 loadDocumentFile (fileName);
3324 void MainWindow::slotRecentFileClear ()
3326 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3328 QStringList emptyList;
3330 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3331 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3334 updateRecentFileList();
3337 void MainWindow::slotRedoTextChanged (
const QString &text)
3339 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3341 QString completeText (
"Redo");
3342 if (!text.isEmpty ()) {
3343 completeText += QString (
" \"%1\"").arg (text);
3345 m_actionEditRedo->setText (completeText);
3348 void MainWindow::slotSettingsAxesChecker ()
3350 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3352 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3353 m_dlgSettingsAxesChecker->show ();
3356 void MainWindow::slotSettingsColorFilter ()
3358 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3360 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3361 m_dlgSettingsColorFilter->show ();
3364 void MainWindow::slotSettingsCoords ()
3366 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3368 m_dlgSettingsCoords->
load (*m_cmdMediator);
3369 m_dlgSettingsCoords->show ();
3372 void MainWindow::slotSettingsCurveAddRemove ()
3374 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3376 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3377 m_dlgSettingsCurveAddRemove->show ();
3380 void MainWindow::slotSettingsCurveProperties ()
3382 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3384 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3386 m_dlgSettingsCurveProperties->show ();
3389 void MainWindow::slotSettingsDigitizeCurve ()
3391 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3393 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3394 m_dlgSettingsDigitizeCurve->show ();
3397 void MainWindow::slotSettingsExportFormat ()
3399 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3402 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3403 m_dlgSettingsExportFormat->show ();
3410 void MainWindow::slotSettingsGeneral ()
3412 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3414 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3415 m_dlgSettingsGeneral->show ();
3418 void MainWindow::slotSettingsGridDisplay()
3420 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3422 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3423 m_dlgSettingsGridDisplay->show ();
3426 void MainWindow::slotSettingsGridRemoval ()
3428 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3430 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3431 m_dlgSettingsGridRemoval->show ();
3434 void MainWindow::slotSettingsPointMatch ()
3436 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3438 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3439 m_dlgSettingsPointMatch->show ();
3442 void MainWindow::slotSettingsSegments ()
3444 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3446 m_dlgSettingsSegments->
load (*m_cmdMediator);
3447 m_dlgSettingsSegments->show ();
3450 void MainWindow::slotSettingsMainWindow ()
3452 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3456 m_dlgSettingsMainWindow->show ();
3459 void MainWindow::slotTimeoutRegressionErrorReport ()
3461 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport" 3462 <<
" cmdStackIndex=" << m_cmdMediator->index()
3463 <<
" cmdStackCount=" << m_cmdMediator->count();
3465 if (m_cmdStackShadow->
canRedo()) {
3468 QDir::setCurrent (m_startupDirectory);
3473 QDir::setCurrent (m_startupDirectory);
3478 exportAllCoordinateSystemsAfterRegressionTests ();
3482 m_cmdMediator->setClean();
3488 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3490 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3492 if (m_fileCmdScript->
canRedo()) {
3495 QDir::setCurrent (m_startupDirectory);
3497 m_fileCmdScript->
redo(*
this);
3500 QDir::setCurrent (m_startupDirectory);
3505 if (m_cmdMediator != 0) {
3508 exportAllCoordinateSystemsAfterRegressionTests ();
3512 m_cmdMediator->setClean();
3522 void MainWindow::slotUndoTextChanged (
const QString &text)
3524 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3526 QString completeText (
"Undo");
3527 if (!text.isEmpty ()) {
3528 completeText += QString (
" \"%1\"").arg (text);
3530 m_actionEditUndo->setText (completeText);
3533 void MainWindow::slotViewGridLines ()
3535 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3540 void MainWindow::slotViewGroupBackground(QAction *action)
3542 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3545 BackgroundImage backgroundImage;
3546 int indexBackground;
3547 if (action == m_actionViewBackgroundNone) {
3548 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3549 backgroundImage = BACKGROUND_IMAGE_NONE;
3550 }
else if (action == m_actionViewBackgroundOriginal) {
3551 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3552 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3553 }
else if (action == m_actionViewBackgroundFiltered) {
3554 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3555 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3557 ENGAUGE_ASSERT (
false);
3560 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3561 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3564 m_cmbBackground->setCurrentIndex (indexBackground);
3568 void MainWindow::slotViewGroupCurves(QAction * )
3570 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3572 updateViewedCurves ();
3575 void MainWindow::slotViewGroupStatus(QAction *action)
3577 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3579 ENGAUGE_CHECK_PTR (m_statusBar);
3581 if (action == m_actionStatusNever) {
3583 }
else if (action == m_actionStatusTemporary) {
3590 void MainWindow::slotViewToolBarBackground ()
3592 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3594 if (m_actionViewBackground->isChecked ()) {
3595 m_toolBackground->show();
3597 m_toolBackground->hide();
3601 void MainWindow::slotViewToolBarChecklistGuide ()
3603 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3605 if (m_actionViewChecklistGuide->isChecked ()) {
3606 m_dockChecklistGuide->show();
3608 m_dockChecklistGuide->hide();
3612 void MainWindow::slotViewToolBarCoordSystem ()
3614 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3616 if (m_actionViewCoordSystem->isChecked ()) {
3617 m_toolCoordSystem->show();
3619 m_toolCoordSystem->hide();
3623 void MainWindow::slotViewToolBarDigitize ()
3625 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3627 if (m_actionViewDigitize->isChecked ()) {
3628 m_toolDigitize->show();
3630 m_toolDigitize->hide();
3634 void MainWindow::slotViewToolBarGeometryWindow ()
3636 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3638 if (m_actionViewGeometryWindow->isChecked ()) {
3639 m_dockGeometryWindow->show();
3641 m_dockGeometryWindow->hide();
3645 void MainWindow::slotViewToolBarSettingsViews ()
3647 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3649 if (m_actionViewSettingsViews->isChecked ()) {
3650 m_toolSettingsViews->show();
3652 m_toolSettingsViews->hide();
3656 void MainWindow::slotViewToolTips ()
3658 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3663 void MainWindow::slotViewZoom(
int zoom)
3665 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3668 switch ((ZoomFactor) zoom) {
3670 m_actionZoom16To1->setChecked(
true);
3671 slotViewZoom16To1 ();
3674 m_actionZoom8To1->setChecked(
true);
3675 slotViewZoom8To1 ();
3678 m_actionZoom4To1->setChecked(
true);
3679 slotViewZoom4To1 ();
3682 m_actionZoom2To1->setChecked(
true);
3683 slotViewZoom2To1 ();
3686 m_actionZoom1To1->setChecked(
true);
3687 slotViewZoom1To1 ();
3690 m_actionZoom1To2->setChecked(
true);
3691 slotViewZoom1To2 ();
3694 m_actionZoom1To4->setChecked(
true);
3695 slotViewZoom1To4 ();
3698 m_actionZoom1To8->setChecked(
true);
3699 slotViewZoom1To8 ();
3702 m_actionZoom1To16->setChecked(
true);
3703 slotViewZoom1To16 ();
3706 m_actionZoomFill->setChecked(
true);
3707 slotViewZoomFill ();
3712 void MainWindow::slotViewZoom16To1 ()
3714 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3716 QTransform transform;
3717 transform.scale (16.0, 16.0);
3718 m_view->setTransform (transform);
3722 void MainWindow::slotViewZoom8To1 ()
3724 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3726 QTransform transform;
3727 transform.scale (8.0, 8.0);
3728 m_view->setTransform (transform);
3732 void MainWindow::slotViewZoom4To1 ()
3734 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3736 QTransform transform;
3737 transform.scale (4.0, 4.0);
3738 m_view->setTransform (transform);
3742 void MainWindow::slotViewZoom2To1 ()
3744 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3746 QTransform transform;
3747 transform.scale (2.0, 2.0);
3748 m_view->setTransform (transform);
3752 void MainWindow::slotViewZoom1To1 ()
3754 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
3756 QTransform transform;
3757 transform.scale (1.0, 1.0);
3758 m_view->setTransform (transform);
3762 void MainWindow::slotViewZoom1To2 ()
3764 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
3766 QTransform transform;
3767 transform.scale (0.5, 0.5);
3768 m_view->setTransform (transform);
3772 void MainWindow::slotViewZoom1To4 ()
3774 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
3776 QTransform transform;
3777 transform.scale (0.25, 0.25);
3778 m_view->setTransform (transform);
3782 void MainWindow::slotViewZoom1To8 ()
3784 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
3786 QTransform transform;
3787 transform.scale (0.125, 0.125);
3788 m_view->setTransform (transform);
3792 void MainWindow::slotViewZoom1To16 ()
3794 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
3796 QTransform transform;
3797 transform.scale (0.0625, 0.0625);
3798 m_view->setTransform (transform);
3802 void MainWindow::slotViewZoomFill ()
3804 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
3806 m_backgroundStateContext->
fitInView (*m_view);
3811 void MainWindow::slotViewZoomIn ()
3813 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3817 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3818 bool goto1To1 =
false;
3819 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3820 if (m_actionZoomFill->isChecked ()) {
3823 double xScale = m_view->transform().m11();
3824 double yScale = m_view->transform().m22();
3825 double scale = qMin(xScale, yScale);
3826 if (scale < 0.125) {
3828 }
else if (scale < 0.25) {
3830 }
else if (scale < 0.5) {
3832 }
else if (scale < 1) {
3834 }
else if (scale < 2) {
3836 }
else if (scale < 4) {
3838 }
else if (scale < 8) {
3844 goto16To1 = m_actionZoom8To1->isChecked ();
3845 goto8To1 = m_actionZoom4To1->isChecked ();
3846 goto4To1 = m_actionZoom2To1->isChecked ();
3847 goto2To1 = m_actionZoom1To1->isChecked ();
3848 goto1To1 = m_actionZoom1To2->isChecked ();
3849 goto1To2 = m_actionZoom1To4->isChecked ();
3850 goto1To4 = m_actionZoom1To8->isChecked ();
3851 goto1To8 = m_actionZoom1To16->isChecked ();
3856 m_actionZoom16To1->setChecked (
true);
3857 slotViewZoom16To1 ();
3858 }
else if (goto8To1) {
3859 m_actionZoom8To1->setChecked (
true);
3860 slotViewZoom8To1 ();
3861 }
else if (goto4To1) {
3862 m_actionZoom4To1->setChecked (
true);
3863 slotViewZoom4To1 ();
3864 }
else if (goto2To1) {
3865 m_actionZoom2To1->setChecked (
true);
3866 slotViewZoom2To1 ();
3867 }
else if (goto1To1) {
3868 m_actionZoom1To1->setChecked (
true);
3869 slotViewZoom1To1 ();
3870 }
else if (goto1To2) {
3871 m_actionZoom1To2->setChecked (
true);
3872 slotViewZoom1To2 ();
3873 }
else if (goto1To4) {
3874 m_actionZoom1To4->setChecked (
true);
3875 slotViewZoom1To4 ();
3876 }
else if (goto1To8) {
3877 m_actionZoom1To8->setChecked (
true);
3878 slotViewZoom1To8 ();
3879 }
else if (goto1To16) {
3880 m_actionZoom1To16->setChecked (
true);
3881 slotViewZoom1To16 ();
3885 void MainWindow::slotViewZoomInFromWheelEvent ()
3887 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
3889 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3890 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3893 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3898 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3902 void MainWindow::slotViewZoomOut ()
3904 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
3908 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3909 bool goto1To1 =
false;
3910 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3911 if (m_actionZoomFill->isChecked ()) {
3914 double xScale = m_view->transform().m11();
3915 double yScale = m_view->transform().m22();
3916 double scale = qMax(xScale, yScale);
3919 }
else if (scale > 4) {
3921 }
else if (scale > 2) {
3923 }
else if (scale > 1) {
3925 }
else if (scale > 0.5) {
3927 }
else if (scale > 0.25) {
3929 }
else if (scale > 0.125) {
3935 goto8To1 = m_actionZoom16To1->isChecked ();
3936 goto4To1 = m_actionZoom8To1->isChecked ();
3937 goto2To1 = m_actionZoom4To1->isChecked ();
3938 goto1To1 = m_actionZoom2To1->isChecked ();
3939 goto1To2 = m_actionZoom1To1->isChecked ();
3940 goto1To4 = m_actionZoom1To2->isChecked ();
3941 goto1To8 = m_actionZoom1To4->isChecked ();
3942 goto1To16 = m_actionZoom1To8->isChecked ();
3947 m_actionZoom1To16->setChecked (
true);
3948 slotViewZoom1To16 ();
3949 }
else if (goto1To8) {
3950 m_actionZoom1To8->setChecked (
true);
3951 slotViewZoom1To8 ();
3952 }
else if (goto1To4) {
3953 m_actionZoom1To4->setChecked (
true);
3954 slotViewZoom1To4 ();
3955 }
else if (goto1To2) {
3956 m_actionZoom1To2->setChecked (
true);
3957 slotViewZoom1To2 ();
3958 }
else if (goto1To1) {
3959 m_actionZoom1To1->setChecked (
true);
3960 slotViewZoom1To1 ();
3961 }
else if (goto2To1) {
3962 m_actionZoom2To1->setChecked (
true);
3963 slotViewZoom2To1 ();
3964 }
else if (goto4To1) {
3965 m_actionZoom4To1->setChecked (
true);
3966 slotViewZoom4To1 ();
3967 }
else if (goto8To1) {
3968 m_actionZoom8To1->setChecked (
true);
3969 slotViewZoom8To1 ();
3970 }
else if (goto16To1) {
3971 m_actionZoom16To1->setChecked (
true);
3972 slotViewZoom16To1 ();
3976 void MainWindow::slotViewZoomOutFromWheelEvent ()
3978 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
3980 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3981 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3984 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3989 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3993 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3995 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4004 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4006 m_timerRegressionErrorReport =
new QTimer();
4007 m_timerRegressionErrorReport->setSingleShot(
false);
4008 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4010 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4013 void MainWindow::startRegressionTestFileCmdScript()
4015 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4017 m_timerRegressionFileCmdScript =
new QTimer();
4018 m_timerRegressionFileCmdScript->setSingleShot(
false);
4019 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4021 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4026 return m_transformation;
4036 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4038 ENGAUGE_CHECK_PTR (m_cmdMediator);
4042 updateAfterCommandStatusBarCoords ();
4044 updateHighlightOpacity ();
4050 updateChecklistGuide ();
4051 updateGeometryWindow();
4055 writeCheckpointToLogFile ();
4059 m_view->setFocus ();
4062 void MainWindow::updateAfterCommandStatusBarCoords ()
4064 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4069 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4073 updateTransformationAndItsDependencies();
4092 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4101 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4102 QPointF posScreen = m_view->mapToScene (posLocal);
4104 slotMouseMove (posScreen);
4109 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4114 void MainWindow::updateChecklistGuide ()
4116 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4118 m_isDocumentExported =
true;
4119 m_dockChecklistGuide->
update (*m_cmdMediator,
4120 m_isDocumentExported);
4123 void MainWindow::updateControls ()
4125 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls" 4126 <<
" selectedItems=" << m_scene->selectedItems().count();
4128 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4130 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4132 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4133 (m_actionRecentFiles.at(0)->isVisible ()));
4135 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4136 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4137 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4138 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4139 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4141 if (m_cmdMediator == 0) {
4142 m_actionEditUndo->setEnabled (
false);
4143 m_actionEditRedo->setEnabled (
false);
4145 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4146 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4148 m_actionEditCut->setEnabled (m_scene->selectedItems().count () > 0);
4149 m_actionEditCopy->setEnabled (m_scene->selectedItems().count () > 0);
4150 m_actionEditPaste->setEnabled (
false);
4151 m_actionEditDelete->setEnabled (m_scene->selectedItems().count () > 0);
4154 m_actionDigitizeAxis->setEnabled (!m_currentFile.isEmpty ());
4155 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4156 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4157 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4158 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4159 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4161 m_actionViewGridLines->setEnabled (
true);
4163 m_actionViewGridLines->setEnabled (
false);
4164 m_actionViewGridLines->setChecked (
false);
4166 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4167 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4168 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4169 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4171 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4172 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4173 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4174 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4175 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4176 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4177 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4178 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4179 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4180 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4181 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4182 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4184 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4185 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4186 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4188 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4189 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4194 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4199 loadCurveListFromCmdMediator ();
4201 updateTransformationAndItsDependencies();
4213 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4215 switch (digitizeState) {
4216 case DIGITIZE_STATE_AXIS:
4217 m_actionDigitizeAxis->setChecked(
true);
4221 case DIGITIZE_STATE_COLOR_PICKER:
4222 m_actionDigitizeColorPicker->setChecked(
true);
4223 slotDigitizeColorPicker();
4226 case DIGITIZE_STATE_CURVE:
4227 m_actionDigitizeCurve->setChecked(
true);
4228 slotDigitizeCurve();
4231 case DIGITIZE_STATE_EMPTY:
4234 case DIGITIZE_STATE_POINT_MATCH:
4235 m_actionDigitizePointMatch->setChecked(
true);
4236 slotDigitizePointMatch();
4239 case DIGITIZE_STATE_SEGMENT:
4240 m_actionDigitizeSegment->setChecked(
true);
4241 slotDigitizeSegment();
4244 case DIGITIZE_STATE_SELECT:
4245 m_actionDigitizeSelect->setChecked(
true);
4246 slotDigitizeSelect();
4250 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4255 void MainWindow::updateGeometryWindow ()
4257 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4260 m_dockGeometryWindow->
update (*m_cmdMediator,
4262 m_cmbCurve->currentText (),
4268 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4274 void MainWindow::updateGridLines ()
4276 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4279 m_gridLines.
clear ();
4290 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4293 void MainWindow::updateHighlightOpacity ()
4295 if (m_cmdMediator != 0) {
4301 m_dockGeometryWindow);
4305 void MainWindow::updateRecentFileList()
4307 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4310 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4311 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4314 unsigned int count = recentFilePaths.size();
4315 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4316 count = MAX_RECENT_FILE_LIST_SIZE;
4321 for (i = 0; i < count; i++) {
4322 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4323 m_actionRecentFiles.at (i)->setText (strippedName);
4324 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4325 m_actionRecentFiles.at (i)->setVisible (
true);
4329 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4330 m_actionRecentFiles.at (i)->setVisible (
false);
4337 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4344 m_cmbCurve->currentText());
4349 m_cmbCurve->currentText());
4355 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4361 m_cmbCurve->currentText());
4368 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4375 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4378 loadCurveListFromCmdMediator();
4384 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4393 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4397 modelDigitizeCurve);
4402 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4409 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4416 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4423 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4430 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4432 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4433 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4435 m_actionZoomIn->setShortcut (tr (
""));
4436 m_actionZoomOut->setShortcut (tr (
""));
4440 m_actionZoomIn->setShortcut (tr (
"+"));
4441 m_actionZoomOut->setShortcut (tr (
"-"));
4445 if ((m_scene != 0) &&
4446 (m_cmdMediator != 0)) {
4450 updateHighlightOpacity();
4451 updateWindowTitle();
4456 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4464 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4471 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4477 void MainWindow::updateSmallDialogs ()
4494 void MainWindow::updateTransformationAndItsDependencies()
4496 m_transformation.
update (!m_currentFile.isEmpty (),
4504 m_cmbCurve->currentText ());
4511 void MainWindow::updateViewedCurves ()
4513 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4515 if (m_actionViewCurvesAll->isChecked ()) {
4519 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4523 }
else if (m_actionViewCurvesNone->isChecked ()) {
4528 ENGAUGE_ASSERT (
false);
4534 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4536 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4543 if (activeCurve.isEmpty ()) {
4556 m_cmdMediator->
pixmap ());
4561 void MainWindow::updateWindowTitle ()
4563 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4565 const QString PLACEHOLDER (
"[*]");
4567 QString title = QString (tr (
"Engauge Digitizer %1")
4568 .arg (VERSION_NUMBER));
4570 QString fileNameMaybeStripped;
4571 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4573 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4577 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4578 fileNameMaybeStripped = fileInfo.baseName();
4581 case MAIN_TITLE_BAR_FORMAT_PATH:
4582 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4586 title += QString (
": %1")
4587 .arg (fileNameMaybeStripped);
4592 title += PLACEHOLDER;
4594 setWindowTitle (title);
4599 ENGAUGE_CHECK_PTR (m_view);
4605 ENGAUGE_CHECK_PTR (m_view);
4609 void MainWindow::writeCheckpointToLogFile ()
4612 QString checkpointDoc;
4613 QTextStream strDoc (&checkpointDoc);
4618 QString checkpointScene;
4619 QTextStream strScene (&checkpointScene);
4624 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4626 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n" 4627 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n" 4628 << checkpointDoc.toLatin1().data()
4629 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n" 4630 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n" 4631 << checkpointScene.toLatin1().data()
4632 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
bool canRedo() const
Return true if there is a command available.
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.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
void unsetPointStyle()
Apply no PointStyle.
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.
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 setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
bool canRedo() const
Returns true if there is at least one command on the stack.
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.
Command for cutting all selected Points.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
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...
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.
Dialog for editing point match settings, for DigitizeStatePointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
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.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
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 loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
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 exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
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.
PointStyle pointStyle() const
Get method for PointStyle.
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...
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...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
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.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
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.
void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
double highlightOpacity() const
Get method for highlight opacity.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
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...
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.
QStringList supportedImageWildcards() const
List the supported jpeg2000 file extensions, for filtering import files.
static void bindToMainWindow(const MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
Dialog for editing grid removal settings.
QString filterCsv() const
QFileDialog filter for CSV files.
unsigned int numberCoordSystem() const
Number of coordinate systems selected by user.
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.
void setPixmap(const QImage &image)
Set method for the background pixmap.
bool smallDialogs() const
Get method for small dialogs flag.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Dialog for editing curve names settings.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
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.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
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.
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.
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.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
Dialog for editing filtering settings.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points selected by user.
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...
ZoomControl zoomControl() const
Get method for zoom control.
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.
ImportCropping importCropping() const
Get method for import cropping.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
bool transformIsDefined() const
Return true if all three axis points have been defined.
Context class that manages the background image state machine.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
bool isGnuplot() const
Get method for gnuplot flag.
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...
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
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.
int maximumGridLines() const
Maximum number of grid lines.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Dialog for editing grid display settings.
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 setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
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.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
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 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.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
Dialog for editing main window settings, which are entirely independent of all documents.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
MainWindowModel modelMainWindow() const
Get method for main window model.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
QLocale locale() const
Get method for locale.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
unsigned int coordSystemCount() const
Number of CoordSystem.
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.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
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.
QString fileExtensionTsv() const
File extension for tsv export files.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
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.
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.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
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...
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
File that manages a command stack for regression testing of file import/open/export/close.
QString fileExtensionCsv() const
File extension for csv export files.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Command for moving all selected Points by a specified translation.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Dialog for sending error report.
QString filterTsv() const
QFileDialog filter for TSV files.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
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.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void clear()
Clear stale information.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
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 requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.