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 "DlgErrorReportLocal.h" 34 #include "DlgErrorReportNetworking.h" 35 #include "DlgImportAdvanced.h" 36 #include "DlgRequiresTransform.h" 37 #include "DlgSettingsAxesChecker.h" 38 #include "DlgSettingsColorFilter.h" 39 #include "DlgSettingsCoords.h" 40 #include "DlgSettingsCurveAddRemove.h" 41 #include "DlgSettingsCurveProperties.h" 42 #include "DlgSettingsDigitizeCurve.h" 43 #include "DlgSettingsExportFormat.h" 44 #include "DlgSettingsGeneral.h" 45 #include "DlgSettingsGridDisplay.h" 46 #include "DlgSettingsGridRemoval.h" 47 #include "DlgSettingsMainWindow.h" 48 #include "DlgSettingsPointMatch.h" 49 #include "DlgSettingsSegments.h" 50 #include "DocumentSerialize.h" 51 #include "EngaugeAssert.h" 52 #include "EnumsToQt.h" 53 #include "ExportImageForRegression.h" 54 #include "ExportToFile.h" 55 #include "FileCmdScript.h" 56 #include "FittingCurve.h" 57 #include "FittingWindow.h" 58 #include "GeometryWindow.h" 60 #include "GraphicsItemsExtractor.h" 61 #include "GraphicsItemType.h" 62 #include "GraphicsScene.h" 63 #include "GraphicsView.h" 64 #include "GridLineFactory.h" 65 #include "GridLineLimiter.h" 66 #include "HelpWindow.h" 67 #ifdef ENGAUGE_JPEG2000 69 #endif // ENGAUGE_JPEG2000 70 #include "LoadFileInfo.h" 72 #include "LoadImageFromUrl.h" 75 #include "MainTitleBarFormat.h" 76 #include "MainWindow.h" 78 #include "NetworkClient.h" 84 #include "PdfResolution.h" 86 #include <QApplication> 87 #include <QCloseEvent> 90 #include <QDesktopServices> 91 #include <QDockWidget> 92 #include <QDomDocument> 94 #include <QFileDialog> 96 #include <QGraphicsLineItem> 97 #include <QImageReader> 99 #include <QKeySequence> 103 #include <QMessageBox> 104 #include <QMouseEvent> 105 #include <QPrintDialog> 108 #include <QTextStream> 112 #include <QToolButton> 113 #include "QtToString.h" 114 #include <QVBoxLayout> 115 #include <QWhatsThis> 116 #include <QXmlStreamReader> 117 #include <QXmlStreamWriter> 118 #include "Settings.h" 119 #include "StatusBar.h" 120 #include "TransformationStateContext.h" 121 #include "TutorialDlg.h" 123 #include "ViewPointStyle.h" 124 #include "ViewSegmentFilter.h" 125 #include "ZoomFactor.h" 126 #include "ZoomFactorInitial.h" 128 const QString EMPTY_FILENAME (
"");
129 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
130 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
131 const int REGRESSION_INTERVAL = 400;
132 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
135 const QString &fileCmdScriptFile,
136 bool isRegressionTest,
139 QStringList loadStartupFiles,
142 m_isDocumentExported (false),
143 m_engaugeFile (EMPTY_FILENAME),
144 m_currentFile (EMPTY_FILENAME),
148 m_loadImageFromUrl (0),
150 m_digitizeStateContext (0),
151 m_transformationStateContext (0),
152 m_backgroundStateContext (0),
154 m_isGnuplot (isGnuplot),
156 m_timerRegressionErrorReport(0),
158 m_isErrorReportRegressionTest (isRegressionTest),
159 m_timerRegressionFileCmdScript(0),
162 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow" 163 <<
" curDir=" << QDir::currentPath().toLatin1().data();
165 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 166 qApp->setApplicationName (
"Engauge Digitizer");
167 qApp->setOrganizationDomain (
"Mark Mitchell");
172 m_startupDirectory = QDir::currentPath();
176 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
177 setWindowTitle (engaugeWindowTitle ());
179 createCentralWidget();
184 createDockableWidgets ();
189 createLoadImageFromUrl ();
190 createStateContextBackground ();
191 createStateContextDigitize ();
192 createStateContextTransformation ();
193 createSettingsDialogs ();
194 createCommandStackShadow ();
198 settingsRead (isReset);
200 setUnifiedTitleAndToolBarOnMac(
true);
202 installEventFilter(
this);
206 QString originalPath = QDir::currentPath();
207 QDir::setCurrent (m_startupDirectory);
208 if (!errorReportFile.isEmpty()) {
209 loadErrorReportFile(errorReportFile);
210 if (m_isErrorReportRegressionTest) {
211 startRegressionTestErrorReport(errorReportFile);
213 }
else if (!fileCmdScriptFile.isEmpty()) {
215 startRegressionTestFileCmdScript();
220 m_loadStartupFiles = loadStartupFiles;
222 QDir::setCurrent (originalPath);
225 MainWindow::~MainWindow()
229 void MainWindow::addDockWindow (QDockWidget *dockWidget,
231 const QString &settingsTokenArea,
232 const QString &settingsTokenGeometry,
233 Qt::DockWidgetArea dockWidgetArea)
238 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
239 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
240 Qt::NoDockWidgetArea).toInt();
242 if (area == Qt::NoDockWidgetArea) {
244 addDockWidget (dockWidgetArea,
246 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
247 if (settings.contains (settingsTokenGeometry)) {
248 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
259 void MainWindow::applyZoomFactorAfterLoad()
261 ZoomFactor zoomFactor;
264 if (m_zoomMap.contains (zoomFactorInitial)) {
265 zoomFactor = m_zoomMap [zoomFactorInitial];
266 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
267 zoomFactor = currentZoomFactor ();
269 ENGAUGE_ASSERT (
false);
270 zoomFactor = currentZoomFactor();
273 slotViewZoom (zoomFactor);
276 void MainWindow::closeEvent(QCloseEvent *event)
288 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
290 setWindowModified (
false);
296 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
305 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
307 m_regressionFile = exportFilenameFromInputFilename (fileName);
308 fileImport (fileName,
314 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
316 m_regressionFile = exportFilenameFromInputFilename (fileName);
317 loadDocumentFile(fileName);
323 return m_cmdMediator;
326 void MainWindow::createActions()
328 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
330 createActionsFile ();
331 createActionsEdit ();
332 createActionsDigitize ();
333 createActionsView ();
334 createActionsSettings ();
335 createActionsHelp ();
338 void MainWindow::createActionsDigitize ()
340 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
342 QPixmap pixmapAxis (DigitAxis_xpm);
343 QPixmap pixmapCurve (DigitCurve_xpm);
344 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
345 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
346 QPixmap pixmapSegment (DigitSegment_xpm);
347 QPixmap pixmapSelect (DigitSelect_xpm);
349 QIcon iconAxis (pixmapAxis);
350 QIcon iconCurve (pixmapCurve);
351 QIcon iconColorPicker (pixmapColorPicker);
352 QIcon iconPointMatch (pixmapPointMatch);
353 QIcon iconSegment (pixmapSegment);
354 QIcon iconSelect (pixmapSelect);
356 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
357 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
358 m_actionDigitizeSelect->setCheckable (
true);
359 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
360 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n" 361 "Select points on the screen."));
362 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
364 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
365 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
366 m_actionDigitizeAxis->setCheckable (
true);
367 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points."));
368 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n" 369 "Digitizes an axis point by placing a new point at the cursor " 370 "after a mouse click. The coordinates of the axis point are then " 371 "entered. In a graph, three axis points are required to define " 372 "the graph coordinates."));
373 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
375 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
376 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
377 m_actionDigitizeCurve->setCheckable (
true);
378 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
379 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n" 380 "Digitizes a curve point by placing a new point at the cursor " 381 "after a mouse click. Use this mode to digitize points along curves " 383 "New points will be assigned to the currently selected curve."));
384 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
386 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
387 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
388 m_actionDigitizePointMatch->setCheckable (
true);
389 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
390 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n" 391 "Digitizes curve points in a point plot by finding points that match a sample point. The process " 392 "starts by selecting a representative sample point.\n\n" 393 "New points will be assigned to the currently selected curve."));
394 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
396 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
397 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
398 m_actionDigitizeColorPicker->setCheckable (
true);
399 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
400 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n" 401 "Select a pixel along the currently selected curve. That pixel and its neighbors will " 402 "define the filter settings (color, brightness, and so on) of the currently selected curve " 403 "while in Segment Fill mode."));
404 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
406 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
407 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
408 m_actionDigitizeSegment->setCheckable (
true);
409 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
410 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n" 411 "Digitizes curve points by placing new points along the highlighted " 412 "segment under the cursor. Use this mode to quickly digitize multiple points along a " 413 "curve with a single click.\n\n" 414 "New points will be assigned to the currently selected curve."));
415 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
417 m_groupDigitize =
new QActionGroup (
this);
418 m_groupDigitize->addAction (m_actionDigitizeSelect);
419 m_groupDigitize->addAction (m_actionDigitizeAxis);
420 m_groupDigitize->addAction (m_actionDigitizeCurve);
421 m_groupDigitize->addAction (m_actionDigitizePointMatch);
422 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
423 m_groupDigitize->addAction (m_actionDigitizeSegment);
426 void MainWindow::createActionsEdit ()
428 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
430 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
431 m_actionEditUndo->setShortcut (QKeySequence::Undo);
432 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
433 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n" 434 "Undo the last operation."));
437 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
438 m_actionEditRedo->setShortcut (QKeySequence::Redo);
439 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
440 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n" 441 "Redo the last operation."));
444 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
445 m_actionEditCut->setShortcut (QKeySequence::Cut);
446 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
447 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n" 448 "Cuts the selected points and copies them to the clipboard."));
449 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
451 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
452 m_actionEditCopy->setShortcut (QKeySequence::Copy);
453 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
454 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n" 455 "Copies the selected points to the clipboard."));
456 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
458 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
459 m_actionEditPaste->setShortcut (QKeySequence::Paste);
460 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
461 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n" 462 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
463 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
465 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
466 m_actionEditDelete->setShortcut (QKeySequence::Delete);
467 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
468 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n" 469 "Deletes the selected points, after copying them to the clipboard."));
470 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
472 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
473 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
474 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n" 475 "Creates a new document by pasting an image from the clipboard."));
476 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
478 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
479 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
480 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n" 481 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
482 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
485 void MainWindow::createActionsFile ()
487 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
489 m_actionImport =
new QAction(tr (
"&Import..."),
this);
490 m_actionImport->setShortcut (tr (
"Ctrl+I"));
491 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
492 m_actionImport->setWhatsThis (tr (
"Import Image\n\n" 493 "Creates a new document by importing an image with a single coordinate system, " 494 "and axes both coordinates known.\n\n" 495 "For more complicated images with multiple coordinate systems, " 496 "and/or floating axes, Import (Advanced) is used instead."));
497 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
499 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
500 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
501 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n" 502 "Creates a new document by importing an image with support for advanced feaures. In " 503 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
504 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
506 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
507 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
508 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n" 509 "Imports a new image into the current document. The existing image is replaced, " 510 "and all curves in the document are preserved. This operation is useful for applying " 511 "the axis points and other settings from an existing document to a different image."));
512 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
514 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
515 m_actionOpen->setShortcut (QKeySequence::Open);
516 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
517 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n" 518 "Opens an existing document."));
519 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
522 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
523 QAction *recentFileAction =
new QAction (
this);
524 recentFileAction->setVisible (
true);
525 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
526 m_actionRecentFiles.append (recentFileAction);
530 m_actionClose =
new QAction(tr (
"&Close"),
this);
531 m_actionClose->setShortcut (QKeySequence::Close);
532 m_actionClose->setStatusTip (tr (
"Closes the open document."));
533 m_actionClose->setWhatsThis (tr (
"Close Document\n\n" 534 "Closes the open document."));
535 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
537 m_actionSave =
new QAction(tr (
"&Save"),
this);
538 m_actionSave->setShortcut (QKeySequence::Save);
539 m_actionSave->setStatusTip (tr (
"Saves the current document."));
540 m_actionSave->setWhatsThis (tr (
"Save Document\n\n" 541 "Saves the current document."));
542 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
544 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
545 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
546 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
547 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n" 548 "Saves the current document under a new filename."));
549 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
551 m_actionExport =
new QAction (tr (
"Export..."),
this);
552 m_actionExport->setShortcut (tr (
"Ctrl+E"));
553 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
554 m_actionExport->setWhatsThis (tr (
"Export Document\n\n" 555 "Exports the current document into a text file."));
556 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
558 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
559 m_actionPrint->setShortcut (QKeySequence::Print);
560 m_actionPrint->setStatusTip (tr (
"Print the current document."));
561 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n" 562 "Print the current document to a printer or file."));
563 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
565 m_actionExit =
new QAction(tr (
"&Exit"),
this);
566 m_actionExit->setShortcut (QKeySequence::Quit);
567 m_actionExit->setStatusTip (tr (
"Quits the application."));
568 m_actionExit->setWhatsThis (tr (
"Exit\n\n" 569 "Quits the application."));
570 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
573 void MainWindow::createActionsHelp ()
575 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
577 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
578 m_actionHelpChecklistGuideWizard->setCheckable (
true);
579 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
580 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n" 581 "Use Checklist Guide Wizard during import to generate a checklist of steps " 582 "for the imported document"));
584 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
585 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
587 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
588 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
589 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n" 590 "Play tutorial showing steps for digitizing points from curves drawn with lines " 592 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
595 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
596 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
597 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
598 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n" 599 "Searchable help documentation"));
603 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
604 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
605 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
606 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
609 void MainWindow::createActionsSettings ()
611 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
613 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
614 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
615 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n" 616 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
617 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
619 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
620 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
621 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n" 622 "Add/Remove Curve settings control which curves are included in the current document"));
623 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
625 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
626 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
627 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n" 628 "Curves properties settings determine how each curve appears"));
629 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
631 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
632 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
633 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n" 634 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and " 635 "Digitize Graph Point modes"));
636 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
638 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
639 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
640 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n" 641 "Export format settings affect how exported files are formatted"));
642 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
644 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
645 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
646 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n" 647 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
648 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
650 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
651 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
652 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n" 653 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
654 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
656 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
657 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
658 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n" 659 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. " 660 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
661 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
663 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
664 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
665 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n" 666 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when " 667 "Color Filtering is not able to separate grid lines from curve lines."));
668 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
670 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
671 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
672 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n" 673 "Point match settings determine how points are matched while in Point Match mode"));
674 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
676 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
677 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
678 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n" 679 "Segment fill settings determine how points are generated in the Segment Fill mode"));
680 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
682 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
683 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
684 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n" 685 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects " 686 "both Color Picker and Point Match modes"));
687 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
689 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
690 m_actionSettingsMainWindow->setEnabled (
true);
691 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
692 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n" 693 "Main window settings affect the user interface and are not specific to any document"));
694 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
697 void MainWindow::createActionsView ()
699 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
701 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
702 m_actionViewBackground->setCheckable (
true);
703 m_actionViewBackground->setChecked (
true);
704 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
705 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n" 706 "Show or hide the background toolbar"));
707 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
709 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
710 m_actionViewChecklistGuide->setCheckable (
true);
711 m_actionViewChecklistGuide->setChecked (
false);
712 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
713 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n" 714 "Show or hide the checklist guide"));
715 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
717 m_actionViewFittingWindow =
new QAction (tr (
"Curve Fitting Window"),
this);
718 m_actionViewFittingWindow->setCheckable (
true);
719 m_actionViewFittingWindow->setChecked (
false);
720 m_actionViewFittingWindow->setStatusTip (tr (
"Show or hide the curve fitting window."));
721 m_actionViewFittingWindow->setWhatsThis (tr (
"View Curve Fitting Window\n\n" 722 "Show or hide the curve fitting window"));
723 connect (m_actionViewFittingWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarFittingWindow()));
725 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
726 m_actionViewGeometryWindow->setCheckable (
true);
727 m_actionViewGeometryWindow->setChecked (
false);
728 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
729 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n" 730 "Show or hide the geometry window"));
731 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
733 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
734 m_actionViewDigitize->setCheckable (
true);
735 m_actionViewDigitize->setChecked (
true);
736 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
737 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n" 738 "Show or hide the digitizing tools toolbar"));
739 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
741 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
742 m_actionViewSettingsViews->setCheckable (
true);
743 m_actionViewSettingsViews->setChecked (
true);
744 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
745 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n" 746 "Show or hide the settings views toolbar. These views graphically show the " 747 "most important settings."));
748 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
750 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
751 m_actionViewCoordSystem->setCheckable (
true);
752 m_actionViewCoordSystem->setChecked (
false);
753 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
754 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n" 755 "Show or hide the coordinate system selection toolbar. This toolbar is used " 756 "to select the current coordinate system when the document has multiple " 757 "coordinate systems. This toolbar is also used to view and print all coordinate " 759 "This toolbar is disabled when there is only one coordinate system."));
760 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
762 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
763 m_actionViewToolTips->setCheckable (
true);
764 m_actionViewToolTips->setChecked (
true);
765 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
766 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n" 767 "Show or hide the tool tips"));
768 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
770 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
771 m_actionViewGridLines->setCheckable (
true);
772 m_actionViewGridLines->setChecked (
false);
773 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
774 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n" 775 "Show or hide grid lines that are added for accurate adjustments of the axes points, " 776 "which can improve accuracy in distorted graphs"));
777 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
779 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
780 m_actionViewBackgroundNone->setCheckable (
true);
781 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
782 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n" 783 "No image is shown so points are easier to see"));
785 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
786 m_actionViewBackgroundOriginal->setCheckable (
true);
787 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
788 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n" 789 "Show the original image underneath the points"));
791 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
792 m_actionViewBackgroundFiltered->setCheckable (
true);
793 m_actionViewBackgroundFiltered->setChecked (
true);
794 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
795 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n" 796 "Show the filtered image underneath the points.\n\n" 797 "The filtered image is created from the original image according to the " 798 "Filter preferences so unimportant information is hidden and important " 799 "information is emphasized"));
801 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
802 m_actionViewCurvesNone->setCheckable (
true);
803 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
804 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n" 805 "No axis points or digitized graph curves are shown so the image is easier to see."));
807 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
808 m_actionViewCurvesSelected->setCheckable (
true);
809 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
810 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n" 811 "Show only the digitized points and line that belong to the currently selected curve."));
813 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
814 m_actionViewCurvesAll->setCheckable (
true);
815 m_actionViewCurvesAll->setChecked (
true);
816 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
817 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n" 818 "Show all digitized axis points and graph curves"));
820 m_groupBackground =
new QActionGroup(
this);
821 m_groupBackground->addAction (m_actionViewBackgroundNone);
822 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
823 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
824 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
826 m_groupCurves =
new QActionGroup(
this);
827 m_groupCurves->addAction (m_actionViewCurvesNone);
828 m_groupCurves->addAction (m_actionViewCurvesSelected);
829 m_groupCurves->addAction (m_actionViewCurvesAll);
830 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
832 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
833 m_actionStatusNever->setCheckable(
true);
834 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
835 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
837 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
838 m_actionStatusTemporary->setCheckable(
true);
839 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
840 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
842 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
843 m_actionStatusAlways->setCheckable(
true);
844 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
845 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, " 846 "the status bar also displays information about the cursor position."));
848 m_groupStatus =
new QActionGroup(
this);
849 m_groupStatus->addAction (m_actionStatusNever);
850 m_groupStatus->addAction (m_actionStatusTemporary);
851 m_groupStatus->addAction (m_actionStatusAlways);
852 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
854 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
855 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
857 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
859 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
860 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
862 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
864 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
865 m_actionZoom16To1->setCheckable (
true);
866 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
867 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
869 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
870 m_actionZoom8To1->setCheckable (
true);
871 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
872 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
874 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
875 m_actionZoom4To1->setCheckable (
true);
876 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
877 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
879 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
880 m_actionZoom2To1->setCheckable (
true);
881 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
882 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
884 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
885 m_actionZoom1To1->setCheckable (
true);
886 m_actionZoom1To1->setChecked (
true);
887 m_actionZoom1To1->setStatusTip (tr (
"Zoom 1:1"));
888 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
890 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
891 m_actionZoom1To2->setCheckable (
true);
892 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
893 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
895 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
896 m_actionZoom1To4->setCheckable (
true);
897 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
898 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
900 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
901 m_actionZoom1To8->setCheckable (
true);
902 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
903 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
905 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
906 m_actionZoom1To16->setCheckable (
true);
907 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
908 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
910 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
911 m_actionZoomFill->setCheckable (
true);
912 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
913 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
915 m_groupZoom =
new QActionGroup (
this);
916 m_groupZoom->addAction (m_actionZoom16To1);
917 m_groupZoom->addAction (m_actionZoom8To1);
918 m_groupZoom->addAction (m_actionZoom4To1);
919 m_groupZoom->addAction (m_actionZoom2To1);
920 m_groupZoom->addAction (m_actionZoom1To1);
921 m_groupZoom->addAction (m_actionZoom1To2);
922 m_groupZoom->addAction (m_actionZoom1To4);
923 m_groupZoom->addAction (m_actionZoom1To8);
924 m_groupZoom->addAction (m_actionZoom1To16);
925 m_groupZoom->addAction (m_actionZoomFill);
928 void MainWindow::createCentralWidget ()
930 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
932 QWidget *widget =
new QWidget;
933 setCentralWidget (widget);
934 m_layout =
new QVBoxLayout;
935 widget->setLayout (m_layout);
938 void MainWindow::createCommandStackShadow ()
940 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
945 void MainWindow::createDockableWidgets ()
947 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
951 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
955 connect (m_dockFittingWindow, SIGNAL (signalFittingWindowClosed()),
956 this, SLOT (slotFittingWindowClosed()));
957 connect (m_dockFittingWindow, SIGNAL (signalCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)),
958 this, SLOT (slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)));
962 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
963 this, SLOT (slotGeometryWindowClosed()));
967 void MainWindow::createHelpWindow ()
969 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
973 m_helpWindow->hide ();
974 addDockWidget (Qt::RightDockWidgetArea,
976 m_helpWindow->setFloating (
true);
978 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
982 void MainWindow::createIcons()
984 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
987 QPixmap icon16 (bannerapp_16);
988 QPixmap icon32 (bannerapp_32);
989 QPixmap icon64 (bannerapp_64);
990 QPixmap icon128 (bannerapp_128);
991 QPixmap icon256 (bannerapp_256);
993 icon.addPixmap (icon16);
994 icon.addPixmap (icon32);
995 icon.addPixmap (icon64);
996 icon.addPixmap (icon128);
997 icon.addPixmap (icon256);
999 setWindowIcon (icon);
1002 void MainWindow::createLoadImageFromUrl ()
1009 void MainWindow::createMenus()
1011 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
1013 m_menuFile = menuBar()->addMenu(tr(
"&File"));
1014 m_menuFile->addAction (m_actionImport);
1015 m_menuFile->addAction (m_actionImportAdvanced);
1016 m_menuFile->addAction (m_actionImportImageReplace);
1017 m_menuFile->addAction (m_actionOpen);
1019 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
1020 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
1021 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
1023 m_menuFile->addMenu (m_menuFileOpenRecent);
1025 m_menuFile->addAction (m_actionClose);
1026 m_menuFile->insertSeparator (m_actionSave);
1027 m_menuFile->addAction (m_actionSave);
1028 m_menuFile->addAction (m_actionSaveAs);
1029 m_menuFile->addAction (m_actionExport);
1030 m_menuFile->insertSeparator (m_actionPrint);
1031 m_menuFile->addAction (m_actionPrint);
1032 m_menuFile->insertSeparator (m_actionExit);
1033 m_menuFile->addAction (m_actionExit);
1035 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1036 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1037 m_menuEdit->addAction (m_actionEditUndo);
1038 m_menuEdit->addAction (m_actionEditRedo);
1039 m_menuEdit->insertSeparator (m_actionEditCut);
1040 m_menuEdit->addAction (m_actionEditCut);
1041 m_menuEdit->addAction (m_actionEditCopy);
1042 m_menuEdit->addAction (m_actionEditPaste);
1043 m_menuEdit->addAction (m_actionEditDelete);
1044 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1045 m_menuEdit->addAction (m_actionEditPasteAsNew);
1046 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1048 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1049 m_menuDigitize->addAction (m_actionDigitizeSelect);
1050 m_menuDigitize->addAction (m_actionDigitizeAxis);
1051 m_menuDigitize->addAction (m_actionDigitizeCurve);
1052 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1053 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1054 m_menuDigitize->addAction (m_actionDigitizeSegment);
1056 m_menuView = menuBar()->addMenu(tr(
"View"));
1057 m_menuView->addAction (m_actionViewBackground);
1058 m_menuView->addAction (m_actionViewDigitize);
1059 m_menuView->addAction (m_actionViewChecklistGuide);
1060 m_menuView->addAction (m_actionViewFittingWindow);
1061 m_menuView->addAction (m_actionViewGeometryWindow);
1062 m_menuView->addAction (m_actionViewSettingsViews);
1063 m_menuView->addAction (m_actionViewCoordSystem);
1064 m_menuView->insertSeparator (m_actionViewToolTips);
1065 m_menuView->addAction (m_actionViewToolTips);
1066 m_menuView->addAction (m_actionViewGridLines);
1067 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1068 m_menuViewBackground =
new QMenu (tr (
"Background"));
1069 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1070 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1071 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1072 m_menuView->addMenu (m_menuViewBackground);
1073 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1074 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1075 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1076 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1077 m_menuView->addMenu (m_menuViewCurves);
1078 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1079 m_menuViewStatus->addAction (m_actionStatusNever);
1080 m_menuViewStatus->addAction (m_actionStatusTemporary);
1081 m_menuViewStatus->addAction (m_actionStatusAlways);
1082 m_menuView->addMenu (m_menuViewStatus);
1083 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1084 m_menuViewZoom->addAction (m_actionZoomOut);
1085 m_menuViewZoom->addAction (m_actionZoomIn);
1086 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1087 m_menuViewZoom->addAction (m_actionZoom16To1);
1088 m_menuViewZoom->addAction (m_actionZoom8To1);
1089 m_menuViewZoom->addAction (m_actionZoom4To1);
1090 m_menuViewZoom->addAction (m_actionZoom2To1);
1091 m_menuViewZoom->addAction (m_actionZoom1To1);
1092 m_menuViewZoom->addAction (m_actionZoom1To2);
1093 m_menuViewZoom->addAction (m_actionZoom1To4);
1094 m_menuViewZoom->addAction (m_actionZoom1To8);
1095 m_menuViewZoom->addAction (m_actionZoom1To16);
1096 m_menuViewZoom->addAction (m_actionZoomFill);
1097 m_menuView->addMenu (m_menuViewZoom);
1099 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1100 m_menuSettings->addAction (m_actionSettingsCoords);
1101 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1102 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1103 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1104 m_menuSettings->addAction (m_actionSettingsExport);
1105 m_menuSettings->addAction (m_actionSettingsColorFilter);
1106 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1107 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1108 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1109 m_menuSettings->addAction (m_actionSettingsPointMatch);
1110 m_menuSettings->addAction (m_actionSettingsSegments);
1111 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1112 m_menuSettings->addAction (m_actionSettingsGeneral);
1113 m_menuSettings->addAction (m_actionSettingsMainWindow);
1115 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1116 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1117 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1118 m_menuHelp->addAction (m_actionHelpWhatsThis);
1119 m_menuHelp->addAction (m_actionHelpTutorial);
1121 m_menuHelp->addAction (m_actionHelpHelp);
1123 m_menuHelp->addAction (m_actionHelpAbout);
1125 updateRecentFileList();
1128 void MainWindow::createNetwork ()
1130 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1137 void MainWindow::createSettingsDialogs ()
1139 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1155 m_dlgSettingsCoords->setVisible (
false);
1156 m_dlgSettingsCurveAddRemove->setVisible (
false);
1157 m_dlgSettingsCurveProperties->setVisible (
false);
1158 m_dlgSettingsDigitizeCurve->setVisible (
false);
1159 m_dlgSettingsExportFormat->setVisible (
false);
1160 m_dlgSettingsColorFilter->setVisible (
false);
1161 m_dlgSettingsAxesChecker->setVisible (
false);
1162 m_dlgSettingsGridDisplay->setVisible (
false);
1163 m_dlgSettingsGridRemoval->setVisible (
false);
1164 m_dlgSettingsPointMatch->setVisible (
false);
1165 m_dlgSettingsSegments->setVisible (
false);
1166 m_dlgSettingsGeneral->setVisible (
false);
1167 m_dlgSettingsMainWindow->setVisible (
false);
1170 void MainWindow::createScene ()
1172 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1176 m_layout->addWidget (m_view);
1179 void MainWindow::createStateContextBackground ()
1181 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1186 void MainWindow::createStateContextDigitize ()
1188 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1195 void MainWindow::createStateContextTransformation ()
1197 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1199 ENGAUGE_CHECK_PTR (m_scene);
1205 void MainWindow::createStatusBar ()
1207 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1209 m_statusBar =
new StatusBar (*statusBar ());
1210 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1211 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1214 void MainWindow::createToolBars ()
1216 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1218 const int VIEW_SIZE = 22;
1221 m_cmbBackground =
new QComboBox ();
1222 m_cmbBackground->setEnabled (
false);
1223 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1224 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n" 1225 "Select background image:\n" 1226 "1) No background which highlights points\n" 1227 "2) Original image which shows everything\n" 1228 "3) Filtered image which highlights important details"));
1229 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1230 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1231 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1233 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1236 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1237 m_toolBackground->addWidget (m_cmbBackground);
1238 addToolBar (m_toolBackground);
1241 m_cmbCurve =
new QComboBox ();
1242 m_cmbCurve->setEnabled (
false);
1243 m_cmbCurve->setMinimumWidth (180);
1244 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1245 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n" 1246 "Select curve for any new points. Every point belongs to one curve.\n\n" 1247 "This can be changed while in Curve Point, Point Match, Color Picker or Segment Fill mode."));
1248 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1251 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1252 m_toolDigitize->addAction (m_actionDigitizeSelect);
1253 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1254 m_toolDigitize->addAction (m_actionDigitizeAxis);
1255 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1256 m_toolDigitize->addAction (m_actionDigitizeCurve);
1257 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1258 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1259 m_toolDigitize->addAction (m_actionDigitizeSegment);
1260 m_toolDigitize->addWidget (m_cmbCurve);
1261 addToolBar (m_toolDigitize);
1265 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1266 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1267 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1268 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n" 1269 "Points style for the currently selected curve. The points style is only " 1270 "displayed in this toolbar. To change the points style, " 1271 "use the Curve Properties dialog."));
1274 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1275 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1276 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1277 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n" 1278 "View of filter for the current curve in Segment Fill mode. The filter settings are only " 1279 "displayed in this toolbar. To changed the filter settings, " 1280 "use the Color Picker mode or the Filter Settings dialog."));
1283 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1284 m_toolSettingsViews->addWidget (m_viewPointStyle);
1285 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1286 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1287 addToolBar (m_toolSettingsViews);
1290 m_cmbCoordSystem =
new QComboBox;
1291 m_cmbCoordSystem->setEnabled (
false);
1292 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1293 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n" 1294 "Currently selected coordinate system. This is used to switch between coordinate systems " 1295 "in documents with multiple coordinate systems"));
1296 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1298 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1299 m_btnShowAll->setEnabled (
false);
1300 m_btnShowAll->setAcceptDrops(
false);
1301 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1302 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n" 1303 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1304 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1305 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1307 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1308 m_btnPrintAll->setEnabled (
false);
1309 m_btnPrintAll->setAcceptDrops(
false);
1310 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1311 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n" 1312 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1313 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1315 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1316 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1317 m_toolCoordSystem->addWidget (m_btnShowAll);
1318 m_toolCoordSystem->addWidget (m_btnPrintAll);
1319 addToolBar (m_toolCoordSystem);
1322 void MainWindow::createTutorial ()
1324 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1327 m_tutorialDlg->setModal (
true);
1328 m_tutorialDlg->setMinimumSize (500, 400);
1329 m_tutorialDlg->hide();
1332 void MainWindow::createZoomMap ()
1334 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1336 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1337 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1338 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1339 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1340 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1341 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1342 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1343 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1344 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1345 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1348 ZoomFactor MainWindow::currentZoomFactor ()
const 1350 if (m_actionZoom1To1->isChecked()) {
1352 }
else if (m_actionZoom1To2->isChecked()) {
1354 }
else if (m_actionZoom1To4->isChecked()) {
1356 }
else if (m_actionZoom1To8->isChecked()) {
1358 }
else if (m_actionZoom1To16->isChecked()) {
1359 return ZOOM_1_TO_16;
1360 }
else if (m_actionZoom2To1->isChecked()) {
1362 }
else if (m_actionZoom4To1->isChecked()) {
1364 }
else if (m_actionZoom8To1->isChecked()) {
1366 }
else if (m_actionZoom16To1->isChecked()) {
1367 return ZOOM_16_TO_1;
1368 }
else if (m_actionZoomFill->isChecked()) {
1371 ENGAUGE_ASSERT (
false);
1377 if (event->type () == QEvent::KeyPress) {
1379 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1382 if ((eventKeyPress->key() == Qt::Key_E) &&
1383 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1384 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1394 return QObject::eventFilter (target, event);
1398 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1400 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1407 QString regressionFile = QString (
"%1_%2")
1408 .arg (m_regressionFile)
1422 fileExport (regressionFile,
1429 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const 1431 QString outFileName = fileName;
1433 outFileName = outFileName.replace (
".xml",
".csv_actual");
1434 outFileName = outFileName.replace (
".dig",
".csv_actual");
1435 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1440 void MainWindow::fileExport(
const QString &fileName,
1443 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport" 1444 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1445 <<
" fileName=" << fileName.toLatin1().data();
1447 QFile file (fileName);
1448 if (file.open(QIODevice::WriteOnly)) {
1450 QTextStream str (&file);
1461 updateChecklistGuide ();
1465 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport" 1466 <<
" file=" << fileName.toLatin1().data()
1467 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1468 QMessageBox::critical (0,
1469 engaugeWindowTitle(),
1470 tr (
"Unable to export to file ") + fileName);
1474 void MainWindow::fileImport (
const QString &fileName,
1475 ImportType importType)
1477 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport" 1478 <<
" fileName=" << fileName.toLatin1 ().data ()
1479 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1480 <<
" importType=" << importType;
1482 QString originalFileOld = m_originalFile;
1483 bool originalFileWasImported = m_originalFileWasImported;
1485 m_originalFile = fileName;
1486 m_originalFileWasImported =
true;
1488 if (importType == IMPORT_TYPE_ADVANCED) {
1499 bool loaded =
false;
1501 #ifdef ENGAUGE_JPEG2000 1503 loaded = jpeg2000.
load (fileName,
1505 #endif // ENGAUGE_JPEG2000 1511 PdfReturn pdfReturn = pdf.
load (fileName,
1515 m_isErrorReportRegressionTest);
1516 if (pdfReturn == PDF_RETURN_CANCELED) {
1523 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1525 #endif // ENGAUGE_PDF 1529 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1532 m_isErrorReportRegressionTest);
1533 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1540 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1544 QString msg = QString(
"%1 %2 %3 %4.")
1545 .arg (tr (
"Cannot read file"))
1547 .arg (tr (
"from directory"))
1548 .arg (QDir::currentPath());
1549 QMessageBox::warning (
this,
1550 engaugeWindowTitle(),
1554 m_originalFile = originalFileOld;
1555 m_originalFileWasImported = originalFileWasImported;
1559 loaded = loadImage (fileName,
1566 if (importType == IMPORT_TYPE_ADVANCED) {
1576 m_originalFile = originalFileOld;
1577 m_originalFileWasImported = originalFileWasImported;
1583 void MainWindow::fileImportWithPrompts (ImportType importType)
1585 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts" 1586 <<
" importType=" << importType;
1590 bool okToContinue =
true;
1591 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1592 okToContinue = maybeSave ();
1598 QTextStream str (&filter);
1601 QList<QByteArray>::const_iterator itr;
1602 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1603 QStringList supportedImageFormatStrings;
1604 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1605 QByteArray arr = *itr;
1606 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1607 supportedImageFormatStrings << extensionAsWildcard;
1609 #ifdef ENGAUGE_JPEG2000 1612 #endif // ENGAUGE_JPEG2000 1615 supportedImageFormatStrings <<
"*.pdf";
1616 #endif // ENGAUGE_PDF 1618 supportedImageFormatStrings.sort();
1620 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1624 str <<
";; All Files (*.*)";
1626 QString fileName = QFileDialog::getOpenFileName (
this,
1628 QDir::currentPath (),
1630 if (!fileName.isEmpty ()) {
1633 fileImport (fileName,
1639 void MainWindow::filePaste (ImportType importType)
1641 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste" 1642 <<
" importType=" << importType;
1644 QString originalFileOld = m_originalFile;
1645 bool originalFileWasImported = m_originalFileWasImported;
1647 QString fileName (
"clipboard");
1648 m_originalFile = fileName;
1649 m_originalFileWasImported =
true;
1651 if (importType == IMPORT_TYPE_ADVANCED) {
1662 QImage image = QApplication::clipboard()->image();
1664 bool loaded =
false;
1666 loaded = !image.isNull();
1670 QMessageBox::warning (
this,
1671 engaugeWindowTitle(),
1672 QString(
"%1 %2 %3 %4.")
1673 .arg (tr (
"Cannot read file"))
1675 .arg (tr (
"from directory"))
1676 .arg (QDir::currentPath ()));
1679 m_originalFile = originalFileOld;
1680 m_originalFileWasImported = originalFileWasImported;
1684 loaded = loadImage (fileName,
1691 if (importType == IMPORT_TYPE_ADVANCED) {
1701 m_originalFile = originalFileOld;
1702 m_originalFileWasImported = originalFileWasImported;
1708 void MainWindow::ghostsCreate ()
1710 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1712 ENGAUGE_ASSERT (m_ghosts == 0);
1734 void MainWindow::ghostsDestroy ()
1736 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1738 ENGAUGE_CHECK_PTR (m_ghosts);
1756 void MainWindow::loadCoordSystemListFromCmdMediator ()
1758 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1760 m_cmbCoordSystem->clear();
1764 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1765 int index1Based = i + 1;
1766 m_cmbCoordSystem->addItem (QString::number (index1Based),
1771 m_cmbCoordSystem->setCurrentIndex (0);
1774 bool enable = (m_cmbCoordSystem->count() > 1);
1775 m_cmbCoordSystem->setEnabled (enable);
1776 m_btnShowAll->setEnabled (enable);
1777 m_btnPrintAll->setEnabled (enable);
1780 void MainWindow::loadCurveListFromCmdMediator ()
1782 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1784 m_cmbCurve->clear ();
1786 QStringList::iterator itr;
1787 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1789 QString curvesGraphName = *itr;
1790 m_cmbCurve->addItem (curvesGraphName);
1797 void MainWindow::loadDocumentFile (
const QString &fileName)
1799 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1801 QApplication::setOverrideCursor(Qt::WaitCursor);
1807 setCurrentPathFromFile (fileName);
1808 rebuildRecentFileListForCurrentFile(fileName);
1809 m_currentFile = fileName;
1811 if (m_cmdMediator != 0) {
1812 delete m_cmdMediator;
1817 setupAfterLoadNewDocument (fileName,
1819 IMPORT_TYPE_SIMPLE);
1822 m_actionDigitizeSelect->setChecked (
true);
1823 slotDigitizeSelect();
1825 m_engaugeFile = fileName;
1826 m_originalFile = fileName;
1827 m_originalFileWasImported =
false;
1832 QApplication::restoreOverrideCursor();
1836 QApplication::restoreOverrideCursor();
1838 QMessageBox::warning (
this,
1839 engaugeWindowTitle(),
1840 QString(
"%1 %2 %3 %4:\n%5.")
1841 .arg (tr (
"Cannot read file"))
1843 .arg (tr (
"from directory"))
1844 .arg (QDir::currentPath ())
1851 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1853 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile" 1854 <<
" file=" << errorReportFile.toLatin1().data();
1856 QFile file (errorReportFile);
1857 if (!file.exists()) {
1859 QFileInfo fileInfo (errorReportFile);
1861 QMessageBox::critical (
this,
1862 engaugeWindowTitle(),
1863 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1868 QXmlStreamReader reader (&file);
1869 file.open(QIODevice::ReadOnly | QIODevice::Text);
1879 setupAfterLoadNewDocument (errorReportFile,
1880 "Error report opened",
1881 IMPORT_TYPE_SIMPLE);
1884 m_actionDigitizeSelect->setChecked (
true);
1885 slotDigitizeSelect();
1890 bool MainWindow::loadImage (
const QString &fileName,
1891 const QImage &image,
1892 ImportType importType)
1894 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage" 1895 <<
" fileName=" << fileName.toLatin1 ().data ()
1896 <<
" importType=" << importType;
1899 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1900 success = loadImageReplacingImage (fileName,
1904 success = loadImageNewDocument (fileName,
1912 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1913 const QImage &image,
1914 ImportType importType)
1916 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument" 1917 <<
" fileName=" << fileName.toLatin1 ().data ()
1918 <<
" importType=" << importType;
1920 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1922 QApplication::setOverrideCursor(Qt::WaitCursor);
1925 QApplication::restoreOverrideCursor();
1927 setCurrentPathFromFile (fileName);
1929 m_engaugeFile = EMPTY_FILENAME;
1931 if (m_cmdMediator != 0) {
1932 delete m_cmdMediator;
1937 bool accepted = setupAfterLoadNewDocument (fileName,
1938 tr (
"File imported"),
1944 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1945 (m_fileCmdScript == 0)) {
1950 if (wizard->exec() == QDialog::Accepted) {
1952 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1966 m_actionViewChecklistGuide->setChecked (
true);
1969 loadCurveListFromCmdMediator();
1972 loadCoordSystemListFromCmdMediator();
1978 m_actionDigitizeAxis->setChecked (
true);
1979 slotDigitizeAxis ();
1987 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1988 const QImage &image,
1989 ImportType importType)
1991 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage" 1992 <<
" fileName=" << fileName.toLatin1 ().data ()
1993 <<
" importType=" << importType;
1995 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1997 setCurrentPathFromFile (fileName);
1999 m_engaugeFile = EMPTY_FILENAME;
2001 ENGAUGE_ASSERT (m_cmdMediator != 0);
2005 bool accepted = setupAfterLoadReplacingImage (fileName,
2006 tr (
"File imported"),
2014 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const 2016 QFile file (m_originalFile);
2020 if (!file.open (QIODevice::ReadOnly)) {
2024 domInputFile.setContent (&file);
2028 void MainWindow::loadToolTips()
2030 if (m_actionViewToolTips->isChecked ()) {
2033 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2034 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2035 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2036 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2037 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2038 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2039 m_cmbBackground->setToolTip (tr (
"Background image."));
2040 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2041 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2042 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2047 m_actionDigitizeSelect->setToolTip (
"");
2048 m_actionDigitizeAxis->setToolTip (
"");
2049 m_actionDigitizeCurve->setToolTip (
"");
2050 m_actionDigitizePointMatch->setToolTip (
"");
2051 m_actionDigitizeColorPicker->setToolTip (
"");
2052 m_actionDigitizeSegment->setToolTip (
"");
2053 m_cmbBackground->setToolTip (
"");
2054 m_cmbCurve->setToolTip (
"");
2055 m_viewPointStyle->setToolTip (
"");
2056 m_viewSegmentFilter->setToolTip (
"");
2061 bool MainWindow::maybeSave()
2063 if (m_cmdMediator != 0) {
2065 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2066 engaugeWindowTitle(),
2067 tr(
"The document has been modified.\n" 2068 "Do you want to save your changes?"),
2069 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2070 if (ret == QMessageBox::Save) {
2071 return slotFileSave();
2072 }
else if (ret == QMessageBox::Cancel) {
2083 const QString &fileName)
const 2091 QString csvExtension = QString (
".%1")
2093 QString tsvExtension = QString (
".%1")
2095 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2096 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2100 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2101 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2102 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2103 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2107 return modelExportFormatAfter;
2112 return m_modelMainWindow;
2115 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2117 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2119 setWindowFilePath (filePath);
2121 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2122 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2123 recentFilePaths.removeAll (filePath);
2124 recentFilePaths.prepend (filePath);
2125 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2126 recentFilePaths.removeLast ();
2128 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2130 updateRecentFileList();
2135 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2137 if (m_actionZoomFill->isChecked ()) {
2142 bool MainWindow::saveDocumentFile (
const QString &fileName)
2144 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2146 QFile file(fileName);
2147 if (!file.open(QFile::WriteOnly)) {
2148 QMessageBox::warning (
this,
2149 engaugeWindowTitle(),
2150 QString (
"%1 %2: \n%3.")
2151 .arg(tr (
"Cannot write file"))
2153 .arg(file.errorString()));
2157 rebuildRecentFileListForCurrentFile (fileName);
2159 QApplication::setOverrideCursor (Qt::WaitCursor);
2160 QXmlStreamWriter writer(&file);
2161 writer.setAutoFormatting(
true);
2162 writer.writeStartDocument();
2163 writer.writeDTD(
"<!DOCTYPE engauge>");
2165 writer.writeEndDocument();
2166 QApplication::restoreOverrideCursor ();
2170 m_cmdMediator->setClean ();
2172 setCurrentFile(fileName);
2173 m_engaugeFile = fileName;
2183 const char *comment)
const 2187 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2189 QString report = saveErrorReportFileAndExitXml (context,
2197 if (dlg.exec() == QDialog::Accepted) {
2210 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2213 const char *comment)
const 2215 const bool DEEP_COPY =
true;
2217 QString xmlErrorReport;
2218 QXmlStreamWriter writer (&xmlErrorReport);
2219 writer.setAutoFormatting(
true);
2222 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2225 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2226 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2227 writer.writeEndElement();
2231 QXmlStreamReader reader (m_startingDocumentSnapshot);
2232 while (!reader.atEnd ()) {
2234 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2235 reader.tokenType() != QXmlStreamReader::EndDocument) {
2236 writer.writeCurrentToken (reader);
2241 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2242 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2243 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2244 writer.writeEndElement();
2247 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2248 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2249 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2250 writer.writeEndElement();
2253 m_cmdMediator->
saveXml(writer);
2256 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2257 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2258 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2259 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2260 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2261 writer.writeEndElement();
2263 writer.writeEndElement();
2266 QDomDocument domErrorReport (
"ErrorReport");
2267 domErrorReport.setContent (xmlErrorReport);
2270 if (!m_originalFileWasImported) {
2274 QDomDocument domInputFile;
2275 loadInputFileForErrorReport (domInputFile);
2276 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2277 if (!domInputFile.isNull()) {
2278 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2280 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2281 if (nodesFileTo.count () > 0) {
2282 QDomNode nodeFileTo = nodesFileTo.at (0);
2283 nodeFileTo.appendChild (fragmentFileFrom);
2290 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2291 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2292 QDomNode nodeDocument = nodesDocument.at (i);
2293 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2294 if (!elemImage.isNull()) {
2297 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2298 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2300 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2301 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2303 QDomNode nodeReplacement;
2304 QDomElement elemReplacement = nodeReplacement.toElement();
2305 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2306 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2309 nodeDocument.insertBefore (nodeReplacement,
2311 nodeDocument.removeChild(elemImage);
2317 return domErrorReport.toString();
2320 void MainWindow::saveStartingDocumentSnapshot()
2322 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2324 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2325 writer.setAutoFormatting (
true);
2331 ENGAUGE_CHECK_PTR (m_scene);
2337 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2339 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2341 int index = m_cmbBackground->findData (backgroundImage);
2342 ENGAUGE_ASSERT (index >= 0);
2344 m_cmbBackground->setCurrentIndex(index);
2346 return previousBackground;
2351 return m_cmbCurve->currentText ();
2354 void MainWindow::setCurrentFile (
const QString &fileName)
2356 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2358 QString fileNameStripped;
2359 if (!fileName.isEmpty()) {
2362 QFileInfo fileInfo (fileName);
2363 fileNameStripped = fileInfo.baseName();
2366 m_currentFile = fileNameStripped;
2367 m_currentFileWithPathAndFileExtension = fileName;
2369 updateWindowTitle ();
2372 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2374 QDir dir = QFileInfo (fileName).absoluteDir();
2376 if (dir.exists ()) {
2378 bool success = QDir::setCurrent (dir.absolutePath ());
2379 ENGAUGE_ASSERT (success);
2387 void MainWindow::setPixmap (
const QString &curveSelected,
2388 const QPixmap &pixmap)
2390 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2397 m_backgroundStateContext->
setPixmap (m_transformation,
2404 void MainWindow::settingsRead (
bool isReset)
2406 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2413 settingsReadEnvironment (settings);
2414 settingsReadMainWindow (settings);
2417 void MainWindow::settingsReadEnvironment (QSettings &settings)
2419 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2420 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2421 QDir::currentPath ()).toString ());
2422 settings.endGroup ();
2425 void MainWindow::settingsReadMainWindow (QSettings &settings)
2427 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2430 resize (settings.value (SETTINGS_SIZE,
2431 QSize (600, 600)).toSize ());
2432 move (settings.value (SETTINGS_POS,
2433 QPoint (200, 200)).toPoint ());
2437 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2438 QSize (900, 600)).toSize();
2439 m_helpWindow->resize (helpSize);
2440 if (settings.contains (SETTINGS_HELP_POS)) {
2441 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2442 m_helpWindow->move (helpPos);
2447 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2451 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2453 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2454 m_toolBackground->setVisible (viewBackgroundToolBar);
2455 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2456 BACKGROUND_IMAGE_FILTERED).toInt ();
2457 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2458 m_cmbBackground->setCurrentIndex (indexBackground);
2461 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2463 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2464 m_toolDigitize->setVisible (viewDigitizeToolBar);
2467 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2469 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2470 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2473 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2475 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2476 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2479 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2481 m_actionViewToolTips->setChecked (viewToolTips);
2485 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2488 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2489 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2490 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2492 addDockWindow (m_dockChecklistGuide,
2494 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2495 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2496 Qt::RightDockWidgetArea);
2497 addDockWindow (m_dockFittingWindow,
2499 SETTINGS_FITTING_WINDOW_DOCK_AREA,
2500 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
2501 Qt::RightDockWidgetArea);
2502 addDockWindow (m_dockGeometryWindow,
2504 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2505 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2506 Qt::RightDockWidgetArea);
2511 QLocale localeDefault;
2512 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2513 QVariant (localeDefault.language())).toInt();
2514 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2515 QVariant (localeDefault.country())).toInt();
2516 QLocale locale (language,
2518 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2519 QVariant (ZOOM_1_TO_1)).toInt());
2521 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2522 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2523 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2524 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2525 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2526 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2527 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2528 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2529 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2530 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2532 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2534 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2535 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
2536 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
2538 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
2541 updateSmallDialogs();
2543 settings.endGroup();
2546 void MainWindow::settingsWrite ()
2548 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2550 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2551 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2552 settings.endGroup ();
2554 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2555 settings.setValue (SETTINGS_SIZE, size ());
2556 settings.setValue (SETTINGS_POS, pos ());
2558 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2559 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2561 if (m_dockChecklistGuide->isFloating()) {
2563 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2564 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2568 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2571 if (m_dockFittingWindow->isFloating()) {
2573 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2574 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
2577 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
2579 if (m_dockGeometryWindow->isFloating()) {
2581 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2582 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2586 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2589 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2590 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2591 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
2592 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2593 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2594 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2595 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2596 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2597 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2598 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2599 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
2600 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2601 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2602 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2603 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2604 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2605 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2606 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2607 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2608 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2609 settings.endGroup ();
2612 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2613 const QString &temporaryMessage ,
2614 ImportType importType)
2616 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument" 2617 <<
" file=" << fileName.toLatin1().data()
2618 <<
" message=" << temporaryMessage.toLatin1().data()
2619 <<
" importType=" << importType;
2624 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2628 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2632 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2634 m_cmdMediator->
pixmap ());
2638 if (importType == IMPORT_TYPE_ADVANCED) {
2640 applyZoomFactorAfterLoad();
2643 dlgImportAdvanced.exec();
2645 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2658 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2659 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2660 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2661 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2662 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2663 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2664 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2665 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2666 loadCurveListFromCmdMediator ();
2667 loadCoordSystemListFromCmdMediator ();
2670 m_isDocumentExported =
false;
2679 m_cmbCurve->currentText ());
2680 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2682 applyZoomFactorAfterLoad();
2684 setCurrentFile(fileName);
2688 saveStartingDocumentSnapshot();
2695 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2696 const QString &temporaryMessage ,
2697 ImportType importType)
2699 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage" 2700 <<
" file=" << fileName.toLatin1().data()
2701 <<
" message=" << temporaryMessage.toLatin1().data()
2702 <<
" importType=" << importType;
2707 m_cmdMediator->clear();
2710 m_cmdMediator->
pixmap ());
2712 m_isDocumentExported =
false;
2714 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2716 applyZoomFactorAfterLoad();
2718 setCurrentFile(fileName);
2722 saveStartingDocumentSnapshot();
2731 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent" 2732 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2734 QMainWindow::showEvent (event);
2736 if (m_loadStartupFiles.count() > 0) {
2738 m_timerLoadStartupFiles =
new QTimer;
2739 m_timerLoadStartupFiles->setSingleShot (
true);
2740 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2741 m_timerLoadStartupFiles->start (0);
2751 void MainWindow::slotBtnPrintAll ()
2753 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2757 QPrinter printer (QPrinter::HighResolution);
2758 QPrintDialog dlg (&printer,
this);
2759 if (dlg.exec() == QDialog::Accepted) {
2760 QPainter painter (&printer);
2761 m_view->render (&painter);
2768 void MainWindow::slotBtnShowAllPressed ()
2770 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2776 void MainWindow::slotBtnShowAllReleased ()
2778 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2784 void MainWindow::slotCanRedoChanged (
bool canRedo)
2786 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2788 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2791 void MainWindow::slotCanUndoChanged (
bool canUndo)
2793 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2795 m_actionEditUndo->setEnabled (canUndo);
2798 void MainWindow::slotChecklistClosed()
2800 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2802 m_actionViewChecklistGuide->setChecked (
false);
2805 void MainWindow::slotCleanChanged(
bool clean)
2807 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2809 setWindowModified (!clean);
2812 void MainWindow::slotCmbBackground(
int currentIndex)
2814 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2816 switch (currentIndex) {
2817 case BACKGROUND_IMAGE_NONE:
2818 if (!m_actionViewBackgroundNone->isChecked()) {
2819 m_actionViewBackgroundNone->toggle();
2823 case BACKGROUND_IMAGE_ORIGINAL:
2824 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2825 m_actionViewBackgroundOriginal->toggle();
2829 case BACKGROUND_IMAGE_FILTERED:
2830 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2831 m_actionViewBackgroundFiltered->toggle();
2839 void MainWindow::slotCmbCoordSystem(
int index)
2841 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2847 m_cmdMediator->push (cmd);
2850 void MainWindow::slotCmbCurve(
int )
2852 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2857 m_cmbCurve->currentText ());
2861 updateViewedCurves();
2863 updateFittingWindow();
2864 updateGeometryWindow();
2867 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2869 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2875 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2877 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2883 void MainWindow::slotDigitizeAxis ()
2885 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2888 DIGITIZE_STATE_AXIS);
2889 m_cmbCurve->setEnabled (
false);
2894 void MainWindow::slotDigitizeColorPicker ()
2896 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2899 DIGITIZE_STATE_COLOR_PICKER);
2900 m_cmbCurve->setEnabled (
true);
2905 void MainWindow::slotDigitizeCurve ()
2907 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2910 DIGITIZE_STATE_CURVE);
2911 m_cmbCurve->setEnabled (
true);
2916 void MainWindow::slotDigitizePointMatch ()
2918 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2921 DIGITIZE_STATE_POINT_MATCH);
2922 m_cmbCurve->setEnabled (
true);
2927 void MainWindow::slotDigitizeSegment ()
2929 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2932 DIGITIZE_STATE_SEGMENT);
2933 m_cmbCurve->setEnabled (
true);
2938 void MainWindow::slotDigitizeSelect ()
2940 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2943 DIGITIZE_STATE_SELECT);
2944 m_cmbCurve->setEnabled (
false);
2949 void MainWindow::slotEditCopy ()
2951 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2954 bool tableFittingIsActive, tableFittingIsCopyable;
2955 bool tableGeometryIsActive, tableGeometryIsCopyable;
2956 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2957 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2959 if (tableFittingIsActive) {
2962 m_dockFittingWindow->
doCopy ();
2964 }
else if (tableGeometryIsActive) {
2967 m_dockGeometryWindow->
doCopy ();
2973 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2984 void MainWindow::slotEditCut ()
2986 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2989 bool tableFittingIsActive, tableFittingIsCopyable;
2990 bool tableGeometryIsActive, tableGeometryIsCopyable;
2991 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2992 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2994 if (tableFittingIsActive || tableGeometryIsActive) {
3002 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3013 void MainWindow::slotEditDelete ()
3015 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
3018 bool tableFittingIsActive, tableFittingIsCopyable;
3019 bool tableGeometryIsActive, tableGeometryIsCopyable;
3020 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3021 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3023 if (tableFittingIsActive || tableGeometryIsActive) {
3031 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3042 void MainWindow::slotEditMenu ()
3044 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
3046 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
3047 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
3050 void MainWindow::slotEditPaste ()
3052 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
3055 void MainWindow::slotEditPasteAsNew ()
3057 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
3059 filePaste (IMPORT_TYPE_SIMPLE);
3062 void MainWindow::slotEditPasteAsNewAdvanced ()
3064 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
3066 filePaste (IMPORT_TYPE_ADVANCED);
3069 void MainWindow::slotFileClose()
3071 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
3085 DIGITIZE_STATE_EMPTY);
3088 if (m_fittingCurve != 0) {
3089 m_scene->removeItem (m_fittingCurve);
3097 m_backgroundStateContext->
close ();
3100 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
3103 m_dockFittingWindow->
clear ();
3106 m_dockGeometryWindow->
clear ();
3109 delete m_cmdMediator;
3115 setWindowTitle (engaugeWindowTitle ());
3117 m_gridLines.
clear();
3122 void MainWindow::slotFileExport ()
3124 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3129 QString filter = QString (
"%1;;%2;;All files (*.*)")
3134 QString defaultFileName = QString (
"%1/%2.%3")
3135 .arg (QDir::currentPath ())
3136 .arg (m_currentFile)
3139 QString filterCsv = exportStrategy.
filterCsv ();
3140 QString fileName = dlg.getSaveFileName (
this,
3145 if (!fileName.isEmpty ()) {
3147 fileExport(fileName,
3156 void MainWindow::slotFileImport ()
3158 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3160 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3163 void MainWindow::slotFileImportAdvanced ()
3165 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3167 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3170 void MainWindow::slotFileImportDraggedImage(QImage image)
3172 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3177 IMPORT_TYPE_SIMPLE);
3180 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3182 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3189 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3191 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3194 loadImage (fileName,
3196 IMPORT_TYPE_SIMPLE);
3199 void MainWindow::slotFileImportImageReplace ()
3201 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3203 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3206 void MainWindow::slotFileOpen()
3208 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3214 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3215 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3216 .arg (ENGAUGE_FILENAME_EXTENSION);
3218 QString fileName = QFileDialog::getOpenFileName (
this,
3219 tr(
"Open Document"),
3220 QDir::currentPath (),
3222 if (!fileName.isEmpty ()) {
3224 loadDocumentFile (fileName);
3230 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3232 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3234 loadDocumentFile (fileName);
3237 void MainWindow::slotFilePrint()
3239 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3241 QPrinter printer (QPrinter::HighResolution);
3242 QPrintDialog dlg (&printer,
this);
3243 if (dlg.exec() == QDialog::Accepted) {
3244 QPainter painter (&printer);
3245 m_view->render (&painter);
3250 bool MainWindow::slotFileSave()
3252 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3254 if (m_engaugeFile.isEmpty()) {
3255 return slotFileSaveAs();
3257 return saveDocumentFile (m_engaugeFile);
3261 bool MainWindow::slotFileSaveAs()
3263 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3266 QString filenameDefault = m_currentFile;
3267 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3268 filenameDefault = QString (
"%1.%2")
3269 .arg (m_currentFile)
3270 .arg (ENGAUGE_FILENAME_EXTENSION);
3273 if (!m_engaugeFile.isEmpty()) {
3274 filenameDefault = m_engaugeFile;
3277 QString filterDigitizer = QString (
"%1 (*.%2)")
3278 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3279 .arg (ENGAUGE_FILENAME_EXTENSION);
3280 QString filterAll (
"All files (*. *)");
3282 QStringList filters;
3283 filters << filterDigitizer;
3284 filters << filterAll;
3286 QFileDialog dlg(
this);
3287 dlg.setFileMode (QFileDialog::AnyFile);
3288 dlg.selectNameFilter (filterDigitizer);
3289 dlg.setNameFilters (filters);
3290 #if defined(OSX_DEBUG) || defined(OSX_RELEASE) 3293 dlg.setWindowModality(Qt::WindowModal);
3295 dlg.setAcceptMode(QFileDialog::AcceptSave);
3296 dlg.selectFile(filenameDefault);
3299 QStringList files = dlg.selectedFiles();
3300 return saveDocumentFile(files.at(0));
3306 void MainWindow::slotFittingWindowClosed()
3308 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
3310 m_actionViewFittingWindow->setChecked (
false);
3313 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
3320 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit" 3321 <<
" order=" << fittingCurveCoef.size() - 1;
3323 if (m_fittingCurve != 0) {
3324 m_scene->removeItem (m_fittingCurve);
3325 delete m_fittingCurve;
3335 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
3336 m_scene->addItem (m_fittingCurve);
3339 void MainWindow::slotGeometryWindowClosed()
3341 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3343 m_actionViewGeometryWindow->setChecked (
false);
3346 void MainWindow::slotHelpAbout()
3348 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3354 void MainWindow::slotHelpTutorial()
3356 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3358 m_tutorialDlg->show ();
3359 m_tutorialDlg->exec ();
3362 void MainWindow::slotKeyPress (Qt::Key key,
3363 bool atLeastOneSelectedItem)
3365 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress" 3366 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3367 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3371 atLeastOneSelectedItem);
3374 void MainWindow::slotLoadStartupFiles ()
3376 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3378 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3380 QString fileName = m_loadStartupFiles.front();
3381 m_loadStartupFiles.pop_front();
3387 loadDocumentFile (fileName);
3391 fileImport (fileName,
3392 IMPORT_TYPE_SIMPLE);
3396 if (m_loadStartupFiles.count() > 0) {
3400 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3401 m_loadStartupFiles);
3405 void MainWindow::slotMouseMove (QPointF pos)
3410 if (m_cmdMediator != 0) {
3413 QString coordsScreen, coordsGraph, resolutionGraph;
3432 void MainWindow::slotMousePress (QPointF pos)
3434 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3442 void MainWindow::slotMouseRelease (QPointF pos)
3444 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3446 if (pos.x() < 0 || pos.y() < 0) {
3460 void MainWindow::slotRecentFileAction ()
3462 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3464 QAction *action = qobject_cast<QAction*>(sender ());
3467 QString fileName = action->data().toString();
3468 loadDocumentFile (fileName);
3472 void MainWindow::slotRecentFileClear ()
3474 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3476 QStringList emptyList;
3478 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3479 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3482 updateRecentFileList();
3485 void MainWindow::slotRedoTextChanged (
const QString &text)
3487 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3489 QString completeText (
"Redo");
3490 if (!text.isEmpty ()) {
3491 completeText += QString (
" \"%1\"").arg (text);
3493 m_actionEditRedo->setText (completeText);
3496 void MainWindow::slotSettingsAxesChecker ()
3498 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3500 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3501 m_dlgSettingsAxesChecker->show ();
3504 void MainWindow::slotSettingsColorFilter ()
3506 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3508 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3509 m_dlgSettingsColorFilter->show ();
3512 void MainWindow::slotSettingsCoords ()
3514 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3516 m_dlgSettingsCoords->
load (*m_cmdMediator);
3517 m_dlgSettingsCoords->show ();
3520 void MainWindow::slotSettingsCurveAddRemove ()
3522 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3524 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3525 m_dlgSettingsCurveAddRemove->show ();
3528 void MainWindow::slotSettingsCurveProperties ()
3530 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3532 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3534 m_dlgSettingsCurveProperties->show ();
3537 void MainWindow::slotSettingsDigitizeCurve ()
3539 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3541 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3542 m_dlgSettingsDigitizeCurve->show ();
3545 void MainWindow::slotSettingsExportFormat ()
3547 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3550 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3551 m_dlgSettingsExportFormat->show ();
3558 void MainWindow::slotSettingsGeneral ()
3560 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3562 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3563 m_dlgSettingsGeneral->show ();
3566 void MainWindow::slotSettingsGridDisplay()
3568 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3570 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3571 m_dlgSettingsGridDisplay->show ();
3574 void MainWindow::slotSettingsGridRemoval ()
3576 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3578 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3579 m_dlgSettingsGridRemoval->show ();
3582 void MainWindow::slotSettingsPointMatch ()
3584 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3586 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3587 m_dlgSettingsPointMatch->show ();
3590 void MainWindow::slotSettingsSegments ()
3592 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3594 m_dlgSettingsSegments->
load (*m_cmdMediator);
3595 m_dlgSettingsSegments->show ();
3598 void MainWindow::slotTableStatusChange ()
3600 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
3607 void MainWindow::slotSettingsMainWindow ()
3609 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3613 m_dlgSettingsMainWindow->show ();
3616 void MainWindow::slotTimeoutRegressionErrorReport ()
3618 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport" 3619 <<
" cmdStackIndex=" << m_cmdMediator->index()
3620 <<
" cmdStackCount=" << m_cmdMediator->count();
3622 if (m_cmdStackShadow->
canRedo()) {
3625 QDir::setCurrent (m_startupDirectory);
3630 QDir::setCurrent (m_startupDirectory);
3635 exportAllCoordinateSystemsAfterRegressionTests ();
3639 m_cmdMediator->setClean();
3645 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3647 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3649 if (m_fileCmdScript->
canRedo()) {
3652 QDir::setCurrent (m_startupDirectory);
3654 m_fileCmdScript->
redo(*
this);
3657 QDir::setCurrent (m_startupDirectory);
3662 if (m_cmdMediator != 0) {
3665 exportAllCoordinateSystemsAfterRegressionTests ();
3669 m_cmdMediator->setClean();
3679 void MainWindow::slotUndoTextChanged (
const QString &text)
3681 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3683 QString completeText (
"Undo");
3684 if (!text.isEmpty ()) {
3685 completeText += QString (
" \"%1\"").arg (text);
3687 m_actionEditUndo->setText (completeText);
3690 void MainWindow::slotViewGridLines ()
3692 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3697 void MainWindow::slotViewGroupBackground(QAction *action)
3699 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3702 BackgroundImage backgroundImage;
3703 int indexBackground;
3704 if (action == m_actionViewBackgroundNone) {
3705 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3706 backgroundImage = BACKGROUND_IMAGE_NONE;
3707 }
else if (action == m_actionViewBackgroundOriginal) {
3708 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3709 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3710 }
else if (action == m_actionViewBackgroundFiltered) {
3711 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3712 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3714 ENGAUGE_ASSERT (
false);
3717 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3718 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3721 m_cmbBackground->setCurrentIndex (indexBackground);
3725 void MainWindow::slotViewGroupCurves(QAction * )
3727 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3729 updateViewedCurves ();
3732 void MainWindow::slotViewGroupStatus(QAction *action)
3734 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3736 ENGAUGE_CHECK_PTR (m_statusBar);
3738 if (action == m_actionStatusNever) {
3740 }
else if (action == m_actionStatusTemporary) {
3747 void MainWindow::slotViewToolBarBackground ()
3749 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3751 if (m_actionViewBackground->isChecked ()) {
3752 m_toolBackground->show();
3754 m_toolBackground->hide();
3758 void MainWindow::slotViewToolBarChecklistGuide ()
3760 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3762 if (m_actionViewChecklistGuide->isChecked ()) {
3763 m_dockChecklistGuide->show();
3765 m_dockChecklistGuide->hide();
3769 void MainWindow::slotViewToolBarCoordSystem ()
3771 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3773 if (m_actionViewCoordSystem->isChecked ()) {
3774 m_toolCoordSystem->show();
3776 m_toolCoordSystem->hide();
3780 void MainWindow::slotViewToolBarDigitize ()
3782 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3784 if (m_actionViewDigitize->isChecked ()) {
3785 m_toolDigitize->show();
3787 m_toolDigitize->hide();
3791 void MainWindow::slotViewToolBarFittingWindow()
3793 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
3795 if (m_actionViewFittingWindow->isChecked()) {
3796 m_dockFittingWindow->show ();
3797 if (m_fittingCurve != 0) {
3798 m_fittingCurve->setVisible (
true);
3801 m_dockFittingWindow->hide ();
3802 if (m_fittingCurve != 0) {
3803 m_fittingCurve->setVisible (
false);
3808 void MainWindow::slotViewToolBarGeometryWindow ()
3810 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3812 if (m_actionViewGeometryWindow->isChecked ()) {
3813 m_dockGeometryWindow->show();
3815 m_dockGeometryWindow->hide();
3819 void MainWindow::slotViewToolBarSettingsViews ()
3821 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3823 if (m_actionViewSettingsViews->isChecked ()) {
3824 m_toolSettingsViews->show();
3826 m_toolSettingsViews->hide();
3830 void MainWindow::slotViewToolTips ()
3832 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3837 void MainWindow::slotViewZoom(
int zoom)
3839 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3842 switch ((ZoomFactor) zoom) {
3844 m_actionZoom16To1->setChecked(
true);
3845 slotViewZoom16To1 ();
3848 m_actionZoom8To1->setChecked(
true);
3849 slotViewZoom8To1 ();
3852 m_actionZoom4To1->setChecked(
true);
3853 slotViewZoom4To1 ();
3856 m_actionZoom2To1->setChecked(
true);
3857 slotViewZoom2To1 ();
3860 m_actionZoom1To1->setChecked(
true);
3861 slotViewZoom1To1 ();
3864 m_actionZoom1To2->setChecked(
true);
3865 slotViewZoom1To2 ();
3868 m_actionZoom1To4->setChecked(
true);
3869 slotViewZoom1To4 ();
3872 m_actionZoom1To8->setChecked(
true);
3873 slotViewZoom1To8 ();
3876 m_actionZoom1To16->setChecked(
true);
3877 slotViewZoom1To16 ();
3880 m_actionZoomFill->setChecked(
true);
3881 slotViewZoomFill ();
3886 void MainWindow::slotViewZoom16To1 ()
3888 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3890 QTransform transform;
3891 transform.scale (16.0, 16.0);
3892 m_view->setTransform (transform);
3896 void MainWindow::slotViewZoom8To1 ()
3898 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3900 QTransform transform;
3901 transform.scale (8.0, 8.0);
3902 m_view->setTransform (transform);
3906 void MainWindow::slotViewZoom4To1 ()
3908 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3910 QTransform transform;
3911 transform.scale (4.0, 4.0);
3912 m_view->setTransform (transform);
3916 void MainWindow::slotViewZoom2To1 ()
3918 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3920 QTransform transform;
3921 transform.scale (2.0, 2.0);
3922 m_view->setTransform (transform);
3926 void MainWindow::slotViewZoom1To1 ()
3928 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
3930 QTransform transform;
3931 transform.scale (1.0, 1.0);
3932 m_view->setTransform (transform);
3936 void MainWindow::slotViewZoom1To2 ()
3938 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
3940 QTransform transform;
3941 transform.scale (0.5, 0.5);
3942 m_view->setTransform (transform);
3946 void MainWindow::slotViewZoom1To4 ()
3948 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
3950 QTransform transform;
3951 transform.scale (0.25, 0.25);
3952 m_view->setTransform (transform);
3956 void MainWindow::slotViewZoom1To8 ()
3958 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
3960 QTransform transform;
3961 transform.scale (0.125, 0.125);
3962 m_view->setTransform (transform);
3966 void MainWindow::slotViewZoom1To16 ()
3968 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
3970 QTransform transform;
3971 transform.scale (0.0625, 0.0625);
3972 m_view->setTransform (transform);
3976 void MainWindow::slotViewZoomFill ()
3978 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
3980 m_backgroundStateContext->
fitInView (*m_view);
3985 void MainWindow::slotViewZoomIn ()
3987 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3991 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3992 bool goto1To1 =
false;
3993 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3994 if (m_actionZoomFill->isChecked ()) {
3997 double xScale = m_view->transform().m11();
3998 double yScale = m_view->transform().m22();
3999 double scale = qMin(xScale, yScale);
4000 if (scale < 0.125) {
4002 }
else if (scale < 0.25) {
4004 }
else if (scale < 0.5) {
4006 }
else if (scale < 1) {
4008 }
else if (scale < 2) {
4010 }
else if (scale < 4) {
4012 }
else if (scale < 8) {
4018 goto16To1 = m_actionZoom8To1->isChecked ();
4019 goto8To1 = m_actionZoom4To1->isChecked ();
4020 goto4To1 = m_actionZoom2To1->isChecked ();
4021 goto2To1 = m_actionZoom1To1->isChecked ();
4022 goto1To1 = m_actionZoom1To2->isChecked ();
4023 goto1To2 = m_actionZoom1To4->isChecked ();
4024 goto1To4 = m_actionZoom1To8->isChecked ();
4025 goto1To8 = m_actionZoom1To16->isChecked ();
4030 m_actionZoom16To1->setChecked (
true);
4031 slotViewZoom16To1 ();
4032 }
else if (goto8To1) {
4033 m_actionZoom8To1->setChecked (
true);
4034 slotViewZoom8To1 ();
4035 }
else if (goto4To1) {
4036 m_actionZoom4To1->setChecked (
true);
4037 slotViewZoom4To1 ();
4038 }
else if (goto2To1) {
4039 m_actionZoom2To1->setChecked (
true);
4040 slotViewZoom2To1 ();
4041 }
else if (goto1To1) {
4042 m_actionZoom1To1->setChecked (
true);
4043 slotViewZoom1To1 ();
4044 }
else if (goto1To2) {
4045 m_actionZoom1To2->setChecked (
true);
4046 slotViewZoom1To2 ();
4047 }
else if (goto1To4) {
4048 m_actionZoom1To4->setChecked (
true);
4049 slotViewZoom1To4 ();
4050 }
else if (goto1To8) {
4051 m_actionZoom1To8->setChecked (
true);
4052 slotViewZoom1To8 ();
4053 }
else if (goto1To16) {
4054 m_actionZoom1To16->setChecked (
true);
4055 slotViewZoom1To16 ();
4059 void MainWindow::slotViewZoomInFromWheelEvent ()
4061 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
4063 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4064 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4067 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4072 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4076 void MainWindow::slotViewZoomOut ()
4078 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
4082 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4083 bool goto1To1 =
false;
4084 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4085 if (m_actionZoomFill->isChecked ()) {
4088 double xScale = m_view->transform().m11();
4089 double yScale = m_view->transform().m22();
4090 double scale = qMax(xScale, yScale);
4093 }
else if (scale > 4) {
4095 }
else if (scale > 2) {
4097 }
else if (scale > 1) {
4099 }
else if (scale > 0.5) {
4101 }
else if (scale > 0.25) {
4103 }
else if (scale > 0.125) {
4109 goto8To1 = m_actionZoom16To1->isChecked ();
4110 goto4To1 = m_actionZoom8To1->isChecked ();
4111 goto2To1 = m_actionZoom4To1->isChecked ();
4112 goto1To1 = m_actionZoom2To1->isChecked ();
4113 goto1To2 = m_actionZoom1To1->isChecked ();
4114 goto1To4 = m_actionZoom1To2->isChecked ();
4115 goto1To8 = m_actionZoom1To4->isChecked ();
4116 goto1To16 = m_actionZoom1To8->isChecked ();
4121 m_actionZoom1To16->setChecked (
true);
4122 slotViewZoom1To16 ();
4123 }
else if (goto1To8) {
4124 m_actionZoom1To8->setChecked (
true);
4125 slotViewZoom1To8 ();
4126 }
else if (goto1To4) {
4127 m_actionZoom1To4->setChecked (
true);
4128 slotViewZoom1To4 ();
4129 }
else if (goto1To2) {
4130 m_actionZoom1To2->setChecked (
true);
4131 slotViewZoom1To2 ();
4132 }
else if (goto1To1) {
4133 m_actionZoom1To1->setChecked (
true);
4134 slotViewZoom1To1 ();
4135 }
else if (goto2To1) {
4136 m_actionZoom2To1->setChecked (
true);
4137 slotViewZoom2To1 ();
4138 }
else if (goto4To1) {
4139 m_actionZoom4To1->setChecked (
true);
4140 slotViewZoom4To1 ();
4141 }
else if (goto8To1) {
4142 m_actionZoom8To1->setChecked (
true);
4143 slotViewZoom8To1 ();
4144 }
else if (goto16To1) {
4145 m_actionZoom16To1->setChecked (
true);
4146 slotViewZoom16To1 ();
4150 void MainWindow::slotViewZoomOutFromWheelEvent ()
4152 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
4154 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4155 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4158 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4163 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4167 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
4169 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4178 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4180 m_timerRegressionErrorReport =
new QTimer();
4181 m_timerRegressionErrorReport->setSingleShot(
false);
4182 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4184 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4187 void MainWindow::startRegressionTestFileCmdScript()
4189 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4191 m_timerRegressionFileCmdScript =
new QTimer();
4192 m_timerRegressionFileCmdScript->setSingleShot(
false);
4193 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4195 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4200 return m_transformation;
4210 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4212 ENGAUGE_CHECK_PTR (m_cmdMediator);
4216 updateAfterCommandStatusBarCoords ();
4218 updateHighlightOpacity ();
4224 updateChecklistGuide ();
4225 updateFittingWindow ();
4226 updateGeometryWindow();
4230 writeCheckpointToLogFile ();
4234 m_view->setFocus ();
4237 void MainWindow::updateAfterCommandStatusBarCoords ()
4239 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4244 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4248 updateTransformationAndItsDependencies();
4267 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4276 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4277 QPointF posScreen = m_view->mapToScene (posLocal);
4279 slotMouseMove (posScreen);
4284 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4289 void MainWindow::updateChecklistGuide ()
4291 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4293 m_isDocumentExported =
true;
4294 m_dockChecklistGuide->
update (*m_cmdMediator,
4295 m_isDocumentExported);
4298 void MainWindow::updateControls ()
4300 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls" 4301 <<
" selectedItems=" << m_scene->selectedItems().count();
4303 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4305 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4307 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4308 (m_actionRecentFiles.at(0)->isVisible ()));
4310 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4311 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4312 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4313 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4314 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4316 if (m_cmdMediator == 0) {
4317 m_actionEditUndo->setEnabled (
false);
4318 m_actionEditRedo->setEnabled (
false);
4320 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4321 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4323 bool tableFittingIsActive, tableFittingIsCopyable;
4324 bool tableGeometryIsActive, tableGeometryIsCopyable;
4325 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
4326 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
4327 m_actionEditCut->setEnabled (!tableFittingIsActive &&
4328 !tableGeometryIsActive &&
4329 m_scene->selectedItems().count () > 0);
4330 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
4331 (tableFittingIsActive && tableFittingIsCopyable) ||
4332 (tableGeometryIsActive && tableGeometryIsCopyable));
4333 m_actionEditPaste->setEnabled (
false);
4334 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
4335 !tableGeometryIsActive &&
4336 m_scene->selectedItems().count () > 0);
4339 m_actionDigitizeAxis->setEnabled (!m_currentFile.isEmpty ());
4340 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4341 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4342 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4343 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4344 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4346 m_actionViewGridLines->setEnabled (
true);
4348 m_actionViewGridLines->setEnabled (
false);
4349 m_actionViewGridLines->setChecked (
false);
4351 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4352 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4353 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4354 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4356 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4357 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4358 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4359 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4360 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4361 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4362 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4363 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4364 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4365 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4366 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4367 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4369 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4370 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4371 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4373 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4374 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4379 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4384 loadCurveListFromCmdMediator ();
4386 updateTransformationAndItsDependencies();
4398 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4400 switch (digitizeState) {
4401 case DIGITIZE_STATE_AXIS:
4402 m_actionDigitizeAxis->setChecked(
true);
4406 case DIGITIZE_STATE_COLOR_PICKER:
4407 m_actionDigitizeColorPicker->setChecked(
true);
4408 slotDigitizeColorPicker();
4411 case DIGITIZE_STATE_CURVE:
4412 m_actionDigitizeCurve->setChecked(
true);
4413 slotDigitizeCurve();
4416 case DIGITIZE_STATE_EMPTY:
4419 case DIGITIZE_STATE_POINT_MATCH:
4420 m_actionDigitizePointMatch->setChecked(
true);
4421 slotDigitizePointMatch();
4424 case DIGITIZE_STATE_SEGMENT:
4425 m_actionDigitizeSegment->setChecked(
true);
4426 slotDigitizeSegment();
4429 case DIGITIZE_STATE_SELECT:
4430 m_actionDigitizeSelect->setChecked(
true);
4431 slotDigitizeSelect();
4435 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4440 void MainWindow::updateFittingWindow ()
4442 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
4444 if (m_cmdMediator != 0 &&
4448 m_dockFittingWindow->
update (*m_cmdMediator,
4450 m_cmbCurve->currentText (),
4455 void MainWindow::updateGeometryWindow ()
4457 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4459 if (m_cmdMediator != 0 &&
4463 m_dockGeometryWindow->
update (*m_cmdMediator,
4465 m_cmbCurve->currentText (),
4472 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4478 void MainWindow::updateGridLines ()
4480 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4483 m_gridLines.
clear ();
4494 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4497 void MainWindow::updateHighlightOpacity ()
4499 if (m_cmdMediator != 0) {
4505 m_dockGeometryWindow);
4509 void MainWindow::updateRecentFileList()
4511 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4514 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4515 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4518 unsigned int count = recentFilePaths.size();
4519 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4520 count = MAX_RECENT_FILE_LIST_SIZE;
4525 for (i = 0; i < count; i++) {
4526 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4527 m_actionRecentFiles.at (i)->setText (strippedName);
4528 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4529 m_actionRecentFiles.at (i)->setVisible (
true);
4533 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4534 m_actionRecentFiles.at (i)->setVisible (
false);
4541 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4548 m_cmbCurve->currentText());
4553 m_cmbCurve->currentText());
4559 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4565 m_cmbCurve->currentText());
4572 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4579 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4582 loadCurveListFromCmdMediator();
4588 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4597 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4601 modelDigitizeCurve);
4606 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4613 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4620 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4627 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4634 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4636 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4637 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4639 m_actionZoomIn->setShortcut (tr (
""));
4640 m_actionZoomOut->setShortcut (tr (
""));
4644 m_actionZoomIn->setShortcut (tr (
"+"));
4645 m_actionZoomOut->setShortcut (tr (
"-"));
4649 if ((m_scene != 0) &&
4650 (m_cmdMediator != 0)) {
4654 updateHighlightOpacity();
4655 updateWindowTitle();
4656 updateFittingWindow();
4657 updateGeometryWindow();
4662 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4670 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4677 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4683 void MainWindow::updateSmallDialogs ()
4700 void MainWindow::updateTransformationAndItsDependencies()
4702 m_transformation.
update (!m_currentFile.isEmpty (),
4710 m_cmbCurve->currentText ());
4717 void MainWindow::updateViewedCurves ()
4719 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4721 if (m_actionViewCurvesAll->isChecked ()) {
4725 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4729 }
else if (m_actionViewCurvesNone->isChecked ()) {
4734 ENGAUGE_ASSERT (
false);
4740 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4742 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4749 if (activeCurve.isEmpty ()) {
4762 m_cmdMediator->
pixmap ());
4767 void MainWindow::updateWindowTitle ()
4769 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4771 const QString PLACEHOLDER (
"[*]");
4773 QString title = QString (tr (
"Engauge Digitizer %1")
4774 .arg (VERSION_NUMBER));
4776 QString fileNameMaybeStripped;
4777 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4779 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4783 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4784 fileNameMaybeStripped = fileInfo.baseName();
4787 case MAIN_TITLE_BAR_FORMAT_PATH:
4788 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4792 title += QString (
": %1")
4793 .arg (fileNameMaybeStripped);
4798 title += PLACEHOLDER;
4800 setWindowTitle (title);
4805 ENGAUGE_CHECK_PTR (m_view);
4811 ENGAUGE_CHECK_PTR (m_view);
4815 void MainWindow::writeCheckpointToLogFile ()
4818 QString checkpointDoc;
4819 QTextStream strDoc (&checkpointDoc);
4824 QString checkpointScene;
4825 QTextStream strScene (&checkpointScene);
4830 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4832 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n" 4833 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n" 4834 << checkpointDoc.toLatin1().data()
4835 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n" 4836 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n" 4837 << checkpointScene.toLatin1().data()
4838 <<
"-----------------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.
Dialog for sending error report with networking.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings, const QPixmap &pixmap)
Apply the color filter of the currently selected curve. The pixmap is included so the background colo...
void 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.
Dialog for saving error report to local hard drive.
void clear()
Deallocate and remove all grid lines.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
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.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
void triggerStateTransition(TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
Window that displays the geometry information, as a table, for the current curve. ...
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
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...
virtual void doCopy()
Copy the current selection to the clipboard.
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...
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.
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Dialog for editing grid display settings.
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.
bool dragDropExport() const
Get method for drag and drop export.
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.
Window that displays curve fitting as applied to the currently selected curve.
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...
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 clear()
Clear stale information.
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.
virtual 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 doCopy()
Copy the current selection to the clipboard.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.