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"
16 #include "CmdAddPointsGraph.h"
19 #include "CmdDelete.h"
20 #include "CmdMediator.h"
21 #include "CmdSelectCoordSystem.h"
22 #include "CmdStackShadow.h"
23 #include "ColorFilter.h"
26 #include "DigitizeStateContext.h"
27 #include "DigitAxis.xpm"
28 #include "DigitColorPicker.xpm"
29 #include "DigitCurve.xpm"
30 #include "DigitPointMatch.xpm"
31 #include "DigitScale.xpm"
32 #include "DigitSegment.xpm"
33 #include "DigitSelect.xpm"
35 #include "DlgErrorReportLocal.h"
36 #include "DlgErrorReportNetworking.h"
37 #include "DlgImportAdvanced.h"
38 #include "DlgRequiresTransform.h"
39 #include "DlgSettingsAxesChecker.h"
40 #include "DlgSettingsColorFilter.h"
41 #include "DlgSettingsCoords.h"
42 #include "DlgSettingsCurveAddRemove.h"
43 #include "DlgSettingsCurveProperties.h"
44 #include "DlgSettingsDigitizeCurve.h"
45 #include "DlgSettingsExportFormat.h"
46 #include "DlgSettingsGeneral.h"
47 #include "DlgSettingsGridDisplay.h"
48 #include "DlgSettingsGridRemoval.h"
49 #include "DlgSettingsMainWindow.h"
50 #include "DlgSettingsPointMatch.h"
51 #include "DlgSettingsSegments.h"
52 #include "DocumentSerialize.h"
53 #include "EngaugeAssert.h"
54 #include "EnumsToQt.h"
55 #include "ExportImageForRegression.h"
56 #include "ExportToFile.h"
57 #include "FileCmdScript.h"
58 #include "FittingCurve.h"
59 #include "FittingWindow.h"
60 #include "GeometryWindow.h"
62 #include "GraphicsItemsExtractor.h"
63 #include "GraphicsItemType.h"
64 #include "GraphicsScene.h"
65 #include "GraphicsView.h"
66 #include "GridLineFactory.h"
67 #include "GridLineLimiter.h"
68 #include "HelpWindow.h"
69 #ifdef ENGAUGE_JPEG2000
71 #endif // ENGAUGE_JPEG2000
72 #include "LoadFileInfo.h"
74 #include "LoadImageFromUrl.h"
77 #include "MainTitleBarFormat.h"
78 #include "MainWindow.h"
79 #include "MimePointsImport.h"
81 #include "NetworkClient.h"
87 #include "PdfResolution.h"
89 #include <QApplication>
90 #include <QCloseEvent>
93 #include <QDesktopServices>
94 #include <QDockWidget>
95 #include <QDomDocument>
97 #include <QFileDialog>
99 #include <QGraphicsLineItem>
100 #include <QImageReader>
102 #include <QKeySequence>
106 #include <QMessageBox>
107 #include <QMouseEvent>
108 #include <QPrintDialog>
111 #include <QTextStream>
115 #include <QToolButton>
116 #include "QtToString.h"
117 #include <QVBoxLayout>
118 #include <QWhatsThis>
119 #include <QXmlStreamReader>
120 #include <QXmlStreamWriter>
121 #include "ScaleBarAxisPointsUnite.h"
122 #include "Settings.h"
123 #include "StatusBar.h"
124 #include "TransformationStateContext.h"
125 #include "TutorialDlg.h"
127 #include "ViewPointStyle.h"
128 #include "ViewSegmentFilter.h"
129 #include "ZoomFactor.h"
130 #include "ZoomFactorInitial.h"
132 const QString EMPTY_FILENAME (
"");
133 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
134 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
135 const int REGRESSION_INTERVAL = 400;
136 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
139 const QString &fileCmdScriptFile,
140 bool isRegressionTest,
143 QStringList loadStartupFiles,
146 m_isDocumentExported (false),
147 m_engaugeFile (EMPTY_FILENAME),
148 m_currentFile (EMPTY_FILENAME),
152 m_loadImageFromUrl (0),
154 m_digitizeStateContext (0),
155 m_transformationStateContext (0),
156 m_backgroundStateContext (0),
158 m_isGnuplot (isGnuplot),
160 m_timerRegressionErrorReport(0),
162 m_isErrorReportRegressionTest (isRegressionTest),
163 m_timerRegressionFileCmdScript(0),
166 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow"
167 <<
" curDir=" << QDir::currentPath().toLatin1().data();
169 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
170 qApp->setApplicationName (
"Engauge Digitizer");
171 qApp->setOrganizationDomain (
"Mark Mitchell");
176 m_startupDirectory = QDir::currentPath();
180 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
181 setWindowTitle (engaugeWindowTitle ());
183 createCentralWidget();
188 createDockableWidgets ();
193 createLoadImageFromUrl ();
194 createStateContextBackground ();
195 createStateContextDigitize ();
196 createStateContextTransformation ();
197 createSettingsDialogs ();
198 createCommandStackShadow ();
202 settingsRead (isReset);
204 setUnifiedTitleAndToolBarOnMac(
true);
206 installEventFilter(
this);
210 QString originalPath = QDir::currentPath();
211 QDir::setCurrent (m_startupDirectory);
212 if (!errorReportFile.isEmpty()) {
213 loadErrorReportFile(errorReportFile);
214 if (m_isErrorReportRegressionTest) {
215 startRegressionTestErrorReport(errorReportFile);
217 }
else if (!fileCmdScriptFile.isEmpty()) {
219 startRegressionTestFileCmdScript();
224 m_loadStartupFiles = loadStartupFiles;
226 QDir::setCurrent (originalPath);
229 MainWindow::~MainWindow()
233 void MainWindow::addDockWindow (QDockWidget *dockWidget,
235 const QString &settingsTokenArea,
236 const QString &settingsTokenGeometry,
237 Qt::DockWidgetArea dockWidgetArea)
242 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
243 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
244 Qt::NoDockWidgetArea).toInt();
246 if (area == Qt::NoDockWidgetArea) {
248 addDockWidget (dockWidgetArea,
250 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
251 if (settings.contains (settingsTokenGeometry)) {
252 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
263 void MainWindow::applyZoomFactorAfterLoad()
265 ZoomFactor zoomFactor;
268 if (m_zoomMap.contains (zoomFactorInitial)) {
269 zoomFactor = m_zoomMap [zoomFactorInitial];
270 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
271 zoomFactor = currentZoomFactor ();
273 ENGAUGE_ASSERT (
false);
274 zoomFactor = currentZoomFactor();
277 slotViewZoom (zoomFactor);
280 void MainWindow::closeEvent(QCloseEvent *event)
292 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
294 setWindowModified (
false);
300 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
309 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
311 m_regressionFile = exportFilenameFromInputFilename (fileName);
312 fileImport (fileName,
318 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
320 m_regressionFile = exportFilenameFromInputFilename (fileName);
321 loadDocumentFile(fileName);
327 return m_cmdMediator;
330 void MainWindow::createActions()
332 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
334 createActionsFile ();
335 createActionsEdit ();
336 createActionsDigitize ();
337 createActionsView ();
338 createActionsSettings ();
339 createActionsHelp ();
342 void MainWindow::createActionsDigitize ()
344 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
346 QPixmap pixmapAxis (DigitAxis_xpm);
347 QPixmap pixmapCurve (DigitCurve_xpm);
348 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
349 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
350 QPixmap pixmapScale (DigitScale_xpm);
351 QPixmap pixmapSegment (DigitSegment_xpm);
352 QPixmap pixmapSelect (DigitSelect_xpm);
354 QIcon iconAxis (pixmapAxis);
355 QIcon iconCurve (pixmapCurve);
356 QIcon iconColorPicker (pixmapColorPicker);
357 QIcon iconPointMatch (pixmapPointMatch);
358 QIcon iconScale (pixmapScale);
359 QIcon iconSegment (pixmapSegment);
360 QIcon iconSelect (pixmapSelect);
362 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
363 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
364 m_actionDigitizeSelect->setCheckable (
true);
365 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
366 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n"
367 "Select points on the screen."));
368 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
370 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
371 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
372 m_actionDigitizeAxis->setCheckable (
true);
373 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points for a graph."));
374 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n"
375 "Digitizes an axis point for a graph by placing a new point at the cursor "
376 "after a mouse click. The coordinates of the axis point are then "
377 "entered. In a graph, three axis points are required to define "
378 "the graph coordinates."));
379 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
381 m_actionDigitizeScale =
new QAction (iconScale, tr (
"Scale Bar Tool"),
this);
382 m_actionDigitizeScale->setShortcut (QKeySequence (tr (
"Shift+F8")));
383 m_actionDigitizeScale->setCheckable (
true);
384 m_actionDigitizeScale->setStatusTip (tr (
"Digitize scale bar for a map."));
385 m_actionDigitizeScale->setWhatsThis (tr (
"Digitize Scale Bar\n\n"
386 "Digitize a scale bar for a map by clicking and dragging. The length of the "
387 "scale bar is then entered. In a map, the two endpoints of the scale "
388 "bar define the distances in graph coordinates.\n\n"
389 "Maps must be imported using Import (Advanced)."));
390 connect (m_actionDigitizeScale, SIGNAL (triggered ()),
this, SLOT (slotDigitizeScale ()));
392 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
393 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
394 m_actionDigitizeCurve->setCheckable (
true);
395 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
396 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n"
397 "Digitizes a curve point by placing a new point at the cursor "
398 "after a mouse click. Use this mode to digitize points along curves "
400 "New points will be assigned to the currently selected curve."));
401 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
403 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
404 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
405 m_actionDigitizePointMatch->setCheckable (
true);
406 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
407 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n"
408 "Digitizes curve points in a point plot by finding points that match a sample point. The process "
409 "starts by selecting a representative sample point.\n\n"
410 "New points will be assigned to the currently selected curve."));
411 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
413 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
414 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
415 m_actionDigitizeColorPicker->setCheckable (
true);
416 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
417 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n"
418 "Select a pixel along the currently selected curve. That pixel and its neighbors will "
419 "define the filter settings (color, brightness, and so on) of the currently selected curve "
420 "while in Segment Fill mode."));
421 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
423 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
424 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
425 m_actionDigitizeSegment->setCheckable (
true);
426 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
427 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n"
428 "Digitizes curve points by placing new points along the highlighted "
429 "segment under the cursor. Use this mode to quickly digitize multiple points along a "
430 "curve with a single click.\n\n"
431 "New points will be assigned to the currently selected curve."));
432 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
434 m_groupDigitize =
new QActionGroup (
this);
435 m_groupDigitize->addAction (m_actionDigitizeSelect);
436 m_groupDigitize->addAction (m_actionDigitizeAxis);
437 m_groupDigitize->addAction (m_actionDigitizeScale);
438 m_groupDigitize->addAction (m_actionDigitizeCurve);
439 m_groupDigitize->addAction (m_actionDigitizePointMatch);
440 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
441 m_groupDigitize->addAction (m_actionDigitizeSegment);
444 void MainWindow::createActionsEdit ()
446 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
448 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
449 m_actionEditUndo->setShortcut (QKeySequence::Undo);
450 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
451 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n"
452 "Undo the last operation."));
455 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
456 m_actionEditRedo->setShortcut (QKeySequence::Redo);
457 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
458 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n"
459 "Redo the last operation."));
462 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
463 m_actionEditCut->setShortcut (QKeySequence::Cut);
464 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
465 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n"
466 "Cuts the selected points and copies them to the clipboard."));
467 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
469 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
470 m_actionEditCopy->setShortcut (QKeySequence::Copy);
471 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
472 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n"
473 "Copies the selected points to the clipboard."));
474 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
476 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
477 m_actionEditPaste->setShortcut (QKeySequence::Paste);
478 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
479 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n"
480 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
481 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
483 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
484 m_actionEditDelete->setShortcut (QKeySequence::Delete);
485 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
486 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n"
487 "Deletes the selected points, after copying them to the clipboard."));
488 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
490 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
491 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
492 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n"
493 "Creates a new document by pasting an image from the clipboard."));
494 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
496 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
497 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
498 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n"
499 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
500 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
503 void MainWindow::createActionsFile ()
505 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
507 m_actionImport =
new QAction(tr (
"&Import..."),
this);
508 m_actionImport->setShortcut (tr (
"Ctrl+I"));
509 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
510 m_actionImport->setWhatsThis (tr (
"Import Image\n\n"
511 "Creates a new document by importing an image with a single coordinate system, "
512 "and axes both coordinates known.\n\n"
513 "For more complicated images with multiple coordinate systems, "
514 "and/or floating axes, Import (Advanced) is used instead."));
515 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
517 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
518 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
519 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n"
520 "Creates a new document by importing an image with support for advanced feaures. In "
521 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
522 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
524 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
525 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
526 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n"
527 "Imports a new image into the current document. The existing image is replaced, "
528 "and all curves in the document are preserved. This operation is useful for applying "
529 "the axis points and other settings from an existing document to a different image."));
530 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
532 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
533 m_actionOpen->setShortcut (QKeySequence::Open);
534 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
535 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n"
536 "Opens an existing document."));
537 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
540 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
541 QAction *recentFileAction =
new QAction (
this);
542 recentFileAction->setVisible (
true);
543 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
544 m_actionRecentFiles.append (recentFileAction);
548 m_actionClose =
new QAction(tr (
"&Close"),
this);
549 m_actionClose->setShortcut (QKeySequence::Close);
550 m_actionClose->setStatusTip (tr (
"Closes the open document."));
551 m_actionClose->setWhatsThis (tr (
"Close Document\n\n"
552 "Closes the open document."));
553 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
555 m_actionSave =
new QAction(tr (
"&Save"),
this);
556 m_actionSave->setShortcut (QKeySequence::Save);
557 m_actionSave->setStatusTip (tr (
"Saves the current document."));
558 m_actionSave->setWhatsThis (tr (
"Save Document\n\n"
559 "Saves the current document."));
560 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
562 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
563 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
564 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
565 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n"
566 "Saves the current document under a new filename."));
567 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
569 m_actionExport =
new QAction (tr (
"Export..."),
this);
570 m_actionExport->setShortcut (tr (
"Ctrl+E"));
571 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
572 m_actionExport->setWhatsThis (tr (
"Export Document\n\n"
573 "Exports the current document into a text file."));
574 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
576 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
577 m_actionPrint->setShortcut (QKeySequence::Print);
578 m_actionPrint->setStatusTip (tr (
"Print the current document."));
579 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n"
580 "Print the current document to a printer or file."));
581 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
583 m_actionExit =
new QAction(tr (
"&Exit"),
this);
584 m_actionExit->setShortcut (QKeySequence::Quit);
585 m_actionExit->setStatusTip (tr (
"Quits the application."));
586 m_actionExit->setWhatsThis (tr (
"Exit\n\n"
587 "Quits the application."));
588 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
591 void MainWindow::createActionsHelp ()
593 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
595 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
596 m_actionHelpChecklistGuideWizard->setCheckable (
true);
597 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
598 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n"
599 "Use Checklist Guide Wizard during import to generate a checklist of steps "
600 "for the imported document"));
602 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
603 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
605 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
606 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
607 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n"
608 "Play tutorial showing steps for digitizing points from curves drawn with lines "
610 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
613 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
614 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
615 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
616 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n"
617 "Searchable help documentation"));
621 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
622 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
623 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
624 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
627 void MainWindow::createActionsSettings ()
629 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
631 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
632 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
633 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n"
634 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
635 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
637 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
638 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
639 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n"
640 "Add/Remove Curve settings control which curves are included in the current document"));
641 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
643 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
644 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
645 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n"
646 "Curves properties settings determine how each curve appears"));
647 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
649 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
650 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
651 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n"
652 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and "
653 "Digitize Graph Point modes"));
654 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
656 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
657 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
658 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n"
659 "Export format settings affect how exported files are formatted"));
660 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
662 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
663 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
664 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n"
665 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
666 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
668 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
669 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
670 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n"
671 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
672 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
674 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
675 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
676 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n"
677 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. "
678 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
679 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
681 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
682 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
683 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n"
684 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when "
685 "Color Filtering is not able to separate grid lines from curve lines."));
686 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
688 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
689 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
690 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n"
691 "Point match settings determine how points are matched while in Point Match mode"));
692 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
694 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
695 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
696 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n"
697 "Segment fill settings determine how points are generated in the Segment Fill mode"));
698 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
700 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
701 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
702 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n"
703 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects "
704 "both Color Picker and Point Match modes"));
705 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
707 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
708 m_actionSettingsMainWindow->setEnabled (
true);
709 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
710 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n"
711 "Main window settings affect the user interface and are not specific to any document"));
712 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
715 void MainWindow::createActionsView ()
717 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
719 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
720 m_actionViewBackground->setCheckable (
true);
721 m_actionViewBackground->setChecked (
true);
722 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
723 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n"
724 "Show or hide the background toolbar"));
725 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
727 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
728 m_actionViewChecklistGuide->setCheckable (
true);
729 m_actionViewChecklistGuide->setChecked (
false);
730 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
731 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n"
732 "Show or hide the checklist guide"));
733 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
735 m_actionViewFittingWindow =
new QAction (tr (
"Curve Fitting Window"),
this);
736 m_actionViewFittingWindow->setCheckable (
true);
737 m_actionViewFittingWindow->setChecked (
false);
738 m_actionViewFittingWindow->setStatusTip (tr (
"Show or hide the curve fitting window."));
739 m_actionViewFittingWindow->setWhatsThis (tr (
"View Curve Fitting Window\n\n"
740 "Show or hide the curve fitting window"));
741 connect (m_actionViewFittingWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarFittingWindow()));
743 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
744 m_actionViewGeometryWindow->setCheckable (
true);
745 m_actionViewGeometryWindow->setChecked (
false);
746 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
747 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n"
748 "Show or hide the geometry window"));
749 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
751 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
752 m_actionViewDigitize->setCheckable (
true);
753 m_actionViewDigitize->setChecked (
true);
754 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
755 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n"
756 "Show or hide the digitizing tools toolbar"));
757 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
759 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
760 m_actionViewSettingsViews->setCheckable (
true);
761 m_actionViewSettingsViews->setChecked (
true);
762 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
763 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n"
764 "Show or hide the settings views toolbar. These views graphically show the "
765 "most important settings."));
766 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
768 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
769 m_actionViewCoordSystem->setCheckable (
true);
770 m_actionViewCoordSystem->setChecked (
false);
771 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
772 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n"
773 "Show or hide the coordinate system selection toolbar. This toolbar is used "
774 "to select the current coordinate system when the document has multiple "
775 "coordinate systems. This toolbar is also used to view and print all coordinate "
777 "This toolbar is disabled when there is only one coordinate system."));
778 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
780 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
781 m_actionViewToolTips->setCheckable (
true);
782 m_actionViewToolTips->setChecked (
true);
783 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
784 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n"
785 "Show or hide the tool tips"));
786 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
788 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
789 m_actionViewGridLines->setCheckable (
true);
790 m_actionViewGridLines->setChecked (
false);
791 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
792 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n"
793 "Show or hide grid lines that are added for accurate adjustments of the axes points, "
794 "which can improve accuracy in distorted graphs"));
795 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
797 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
798 m_actionViewBackgroundNone->setCheckable (
true);
799 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
800 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n"
801 "No image is shown so points are easier to see"));
803 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
804 m_actionViewBackgroundOriginal->setCheckable (
true);
805 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
806 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n"
807 "Show the original image underneath the points"));
809 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
810 m_actionViewBackgroundFiltered->setCheckable (
true);
811 m_actionViewBackgroundFiltered->setChecked (
true);
812 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
813 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n"
814 "Show the filtered image underneath the points.\n\n"
815 "The filtered image is created from the original image according to the "
816 "Filter preferences so unimportant information is hidden and important "
817 "information is emphasized"));
819 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
820 m_actionViewCurvesNone->setCheckable (
true);
821 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
822 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n"
823 "No axis points or digitized graph curves are shown so the image is easier to see."));
825 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
826 m_actionViewCurvesSelected->setCheckable (
true);
827 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
828 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n"
829 "Show only the digitized points and line that belong to the currently selected curve."));
831 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
832 m_actionViewCurvesAll->setCheckable (
true);
833 m_actionViewCurvesAll->setChecked (
true);
834 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
835 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n"
836 "Show all digitized axis points and graph curves"));
838 m_groupBackground =
new QActionGroup(
this);
839 m_groupBackground->addAction (m_actionViewBackgroundNone);
840 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
841 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
842 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
844 m_groupCurves =
new QActionGroup(
this);
845 m_groupCurves->addAction (m_actionViewCurvesNone);
846 m_groupCurves->addAction (m_actionViewCurvesSelected);
847 m_groupCurves->addAction (m_actionViewCurvesAll);
848 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
850 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
851 m_actionStatusNever->setCheckable(
true);
852 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
853 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
855 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
856 m_actionStatusTemporary->setCheckable(
true);
857 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
858 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
860 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
861 m_actionStatusAlways->setCheckable(
true);
862 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
863 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, "
864 "the status bar also displays information about the cursor position."));
866 m_groupStatus =
new QActionGroup(
this);
867 m_groupStatus->addAction (m_actionStatusNever);
868 m_groupStatus->addAction (m_actionStatusTemporary);
869 m_groupStatus->addAction (m_actionStatusAlways);
870 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
872 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
873 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
875 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
877 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
878 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
880 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
882 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
883 m_actionZoom16To1->setCheckable (
true);
884 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
885 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
887 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
888 m_actionZoom8To1->setCheckable (
true);
889 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
890 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
892 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
893 m_actionZoom4To1->setCheckable (
true);
894 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
895 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
897 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
898 m_actionZoom2To1->setCheckable (
true);
899 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
900 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
902 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
903 m_actionZoom1To1->setCheckable (
true);
904 m_actionZoom1To1->setChecked (
true);
905 m_actionZoom1To1->setStatusTip (tr (
"Zoom 1:1"));
906 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
908 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
909 m_actionZoom1To2->setCheckable (
true);
910 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
911 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
913 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
914 m_actionZoom1To4->setCheckable (
true);
915 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
916 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
918 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
919 m_actionZoom1To8->setCheckable (
true);
920 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
921 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
923 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
924 m_actionZoom1To16->setCheckable (
true);
925 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
926 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
928 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
929 m_actionZoomFill->setCheckable (
true);
930 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
931 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
933 m_groupZoom =
new QActionGroup (
this);
934 m_groupZoom->addAction (m_actionZoom16To1);
935 m_groupZoom->addAction (m_actionZoom8To1);
936 m_groupZoom->addAction (m_actionZoom4To1);
937 m_groupZoom->addAction (m_actionZoom2To1);
938 m_groupZoom->addAction (m_actionZoom1To1);
939 m_groupZoom->addAction (m_actionZoom1To2);
940 m_groupZoom->addAction (m_actionZoom1To4);
941 m_groupZoom->addAction (m_actionZoom1To8);
942 m_groupZoom->addAction (m_actionZoom1To16);
943 m_groupZoom->addAction (m_actionZoomFill);
946 void MainWindow::createCentralWidget ()
948 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
950 QWidget *widget =
new QWidget;
951 setCentralWidget (widget);
952 m_layout =
new QVBoxLayout;
953 widget->setLayout (m_layout);
956 void MainWindow::createCommandStackShadow ()
958 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
963 void MainWindow::createDockableWidgets ()
965 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
969 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
973 connect (m_dockFittingWindow, SIGNAL (signalFittingWindowClosed()),
974 this, SLOT (slotFittingWindowClosed()));
975 connect (m_dockFittingWindow, SIGNAL (signalCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)),
976 this, SLOT (slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)));
980 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
981 this, SLOT (slotGeometryWindowClosed()));
985 void MainWindow::createHelpWindow ()
987 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
991 m_helpWindow->hide ();
992 addDockWidget (Qt::RightDockWidgetArea,
994 m_helpWindow->setFloating (
true);
996 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
1000 void MainWindow::createIcons()
1002 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
1005 QPixmap icon16 (bannerapp_16);
1006 QPixmap icon32 (bannerapp_32);
1007 QPixmap icon64 (bannerapp_64);
1008 QPixmap icon128 (bannerapp_128);
1009 QPixmap icon256 (bannerapp_256);
1011 icon.addPixmap (icon16);
1012 icon.addPixmap (icon32);
1013 icon.addPixmap (icon64);
1014 icon.addPixmap (icon128);
1015 icon.addPixmap (icon256);
1017 setWindowIcon (icon);
1020 void MainWindow::createLoadImageFromUrl ()
1027 void MainWindow::createMenus()
1029 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
1031 m_menuFile = menuBar()->addMenu(tr(
"&File"));
1032 m_menuFile->addAction (m_actionImport);
1033 m_menuFile->addAction (m_actionImportAdvanced);
1034 m_menuFile->addAction (m_actionImportImageReplace);
1035 m_menuFile->addAction (m_actionOpen);
1037 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
1038 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
1039 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
1041 m_menuFile->addMenu (m_menuFileOpenRecent);
1043 m_menuFile->addAction (m_actionClose);
1044 m_menuFile->insertSeparator (m_actionSave);
1045 m_menuFile->addAction (m_actionSave);
1046 m_menuFile->addAction (m_actionSaveAs);
1047 m_menuFile->addAction (m_actionExport);
1048 m_menuFile->insertSeparator (m_actionPrint);
1049 m_menuFile->addAction (m_actionPrint);
1050 m_menuFile->insertSeparator (m_actionExit);
1051 m_menuFile->addAction (m_actionExit);
1053 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1054 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1055 m_menuEdit->addAction (m_actionEditUndo);
1056 m_menuEdit->addAction (m_actionEditRedo);
1057 m_menuEdit->insertSeparator (m_actionEditCut);
1058 m_menuEdit->addAction (m_actionEditCut);
1059 m_menuEdit->addAction (m_actionEditCopy);
1060 m_menuEdit->addAction (m_actionEditPaste);
1061 m_menuEdit->addAction (m_actionEditDelete);
1062 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1063 m_menuEdit->addAction (m_actionEditPasteAsNew);
1064 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1066 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1067 m_menuDigitize->addAction (m_actionDigitizeSelect);
1068 m_menuDigitize->addAction (m_actionDigitizeAxis);
1069 m_menuDigitize->addAction (m_actionDigitizeScale);
1070 m_menuDigitize->addAction (m_actionDigitizeCurve);
1071 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1072 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1073 m_menuDigitize->addAction (m_actionDigitizeSegment);
1075 m_menuView = menuBar()->addMenu(tr(
"View"));
1076 m_menuView->addAction (m_actionViewBackground);
1077 m_menuView->addAction (m_actionViewDigitize);
1078 m_menuView->addAction (m_actionViewChecklistGuide);
1079 m_menuView->addAction (m_actionViewFittingWindow);
1080 m_menuView->addAction (m_actionViewGeometryWindow);
1081 m_menuView->addAction (m_actionViewSettingsViews);
1082 m_menuView->addAction (m_actionViewCoordSystem);
1083 m_menuView->insertSeparator (m_actionViewToolTips);
1084 m_menuView->addAction (m_actionViewToolTips);
1085 m_menuView->addAction (m_actionViewGridLines);
1086 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1087 m_menuViewBackground =
new QMenu (tr (
"Background"));
1088 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1089 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1090 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1091 m_menuView->addMenu (m_menuViewBackground);
1092 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1093 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1094 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1095 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1096 m_menuView->addMenu (m_menuViewCurves);
1097 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1098 m_menuViewStatus->addAction (m_actionStatusNever);
1099 m_menuViewStatus->addAction (m_actionStatusTemporary);
1100 m_menuViewStatus->addAction (m_actionStatusAlways);
1101 m_menuView->addMenu (m_menuViewStatus);
1102 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1103 m_menuViewZoom->addAction (m_actionZoomOut);
1104 m_menuViewZoom->addAction (m_actionZoomIn);
1105 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1106 m_menuViewZoom->addAction (m_actionZoom16To1);
1107 m_menuViewZoom->addAction (m_actionZoom8To1);
1108 m_menuViewZoom->addAction (m_actionZoom4To1);
1109 m_menuViewZoom->addAction (m_actionZoom2To1);
1110 m_menuViewZoom->addAction (m_actionZoom1To1);
1111 m_menuViewZoom->addAction (m_actionZoom1To2);
1112 m_menuViewZoom->addAction (m_actionZoom1To4);
1113 m_menuViewZoom->addAction (m_actionZoom1To8);
1114 m_menuViewZoom->addAction (m_actionZoom1To16);
1115 m_menuViewZoom->addAction (m_actionZoomFill);
1116 m_menuView->addMenu (m_menuViewZoom);
1118 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1119 m_menuSettings->addAction (m_actionSettingsCoords);
1120 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1121 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1122 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1123 m_menuSettings->addAction (m_actionSettingsExport);
1124 m_menuSettings->addAction (m_actionSettingsColorFilter);
1125 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1126 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1127 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1128 m_menuSettings->addAction (m_actionSettingsPointMatch);
1129 m_menuSettings->addAction (m_actionSettingsSegments);
1130 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1131 m_menuSettings->addAction (m_actionSettingsGeneral);
1132 m_menuSettings->addAction (m_actionSettingsMainWindow);
1134 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1135 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1136 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1137 m_menuHelp->addAction (m_actionHelpWhatsThis);
1138 m_menuHelp->addAction (m_actionHelpTutorial);
1140 m_menuHelp->addAction (m_actionHelpHelp);
1142 m_menuHelp->addAction (m_actionHelpAbout);
1144 updateRecentFileList();
1147 void MainWindow::createNetwork ()
1149 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1156 void MainWindow::createSettingsDialogs ()
1158 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1174 m_dlgSettingsCoords->setVisible (
false);
1175 m_dlgSettingsCurveAddRemove->setVisible (
false);
1176 m_dlgSettingsCurveProperties->setVisible (
false);
1177 m_dlgSettingsDigitizeCurve->setVisible (
false);
1178 m_dlgSettingsExportFormat->setVisible (
false);
1179 m_dlgSettingsColorFilter->setVisible (
false);
1180 m_dlgSettingsAxesChecker->setVisible (
false);
1181 m_dlgSettingsGridDisplay->setVisible (
false);
1182 m_dlgSettingsGridRemoval->setVisible (
false);
1183 m_dlgSettingsPointMatch->setVisible (
false);
1184 m_dlgSettingsSegments->setVisible (
false);
1185 m_dlgSettingsGeneral->setVisible (
false);
1186 m_dlgSettingsMainWindow->setVisible (
false);
1189 void MainWindow::createScene ()
1191 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1195 m_layout->addWidget (m_view);
1198 void MainWindow::createStateContextBackground ()
1200 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1205 void MainWindow::createStateContextDigitize ()
1207 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1214 void MainWindow::createStateContextTransformation ()
1216 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1218 ENGAUGE_CHECK_PTR (m_scene);
1224 void MainWindow::createStatusBar ()
1226 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1228 m_statusBar =
new StatusBar (*statusBar ());
1229 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1230 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1233 void MainWindow::createToolBars ()
1235 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1237 const int VIEW_SIZE = 22;
1240 m_cmbBackground =
new QComboBox ();
1241 m_cmbBackground->setEnabled (
false);
1242 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1243 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n"
1244 "Select background image:\n"
1245 "1) No background which highlights points\n"
1246 "2) Original image which shows everything\n"
1247 "3) Filtered image which highlights important details"));
1248 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1249 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1250 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1252 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1255 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1256 m_toolBackground->addWidget (m_cmbBackground);
1257 addToolBar (m_toolBackground);
1260 m_cmbCurve =
new QComboBox ();
1261 m_cmbCurve->setEnabled (
false);
1262 m_cmbCurve->setMinimumWidth (180);
1263 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1264 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n"
1265 "Select curve for any new points. Every point belongs to one curve.\n\n"
1266 "This can be changed while in Curve Point, Point Match, Color Picker or Segment Fill mode."));
1267 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1270 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1271 m_toolDigitize->addAction (m_actionDigitizeSelect);
1272 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1273 m_toolDigitize->addAction (m_actionDigitizeAxis);
1274 m_toolDigitize->addAction (m_actionDigitizeScale);
1275 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1276 m_toolDigitize->addAction (m_actionDigitizeCurve);
1277 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1278 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1279 m_toolDigitize->addAction (m_actionDigitizeSegment);
1280 m_toolDigitize->addWidget (m_cmbCurve);
1281 addToolBar (m_toolDigitize);
1285 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1286 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1287 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1288 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n"
1289 "Points style for the currently selected curve. The points style is only "
1290 "displayed in this toolbar. To change the points style, "
1291 "use the Curve Properties dialog."));
1294 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1295 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1296 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1297 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n"
1298 "View of filter for the current curve in Segment Fill mode. The filter settings are only "
1299 "displayed in this toolbar. To changed the filter settings, "
1300 "use the Color Picker mode or the Filter Settings dialog."));
1303 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1304 m_toolSettingsViews->addWidget (m_viewPointStyle);
1305 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1306 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1307 addToolBar (m_toolSettingsViews);
1310 m_cmbCoordSystem =
new QComboBox;
1311 m_cmbCoordSystem->setEnabled (
false);
1312 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1313 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n"
1314 "Currently selected coordinate system. This is used to switch between coordinate systems "
1315 "in documents with multiple coordinate systems"));
1316 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1318 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1319 m_btnShowAll->setEnabled (
false);
1320 m_btnShowAll->setAcceptDrops(
false);
1321 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1322 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n"
1323 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1324 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1325 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1327 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1328 m_btnPrintAll->setEnabled (
false);
1329 m_btnPrintAll->setAcceptDrops(
false);
1330 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1331 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n"
1332 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1333 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1335 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1336 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1337 m_toolCoordSystem->addWidget (m_btnShowAll);
1338 m_toolCoordSystem->addWidget (m_btnPrintAll);
1339 addToolBar (m_toolCoordSystem);
1342 void MainWindow::createTutorial ()
1344 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1347 m_tutorialDlg->setModal (
true);
1348 m_tutorialDlg->setMinimumSize (500, 400);
1349 m_tutorialDlg->hide();
1352 void MainWindow::createZoomMap ()
1354 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1356 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1357 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1358 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1359 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1360 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1361 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1362 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1363 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1364 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1365 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1368 ZoomFactor MainWindow::currentZoomFactor ()
const
1370 if (m_actionZoom1To1->isChecked()) {
1372 }
else if (m_actionZoom1To2->isChecked()) {
1374 }
else if (m_actionZoom1To4->isChecked()) {
1376 }
else if (m_actionZoom1To8->isChecked()) {
1378 }
else if (m_actionZoom1To16->isChecked()) {
1379 return ZOOM_1_TO_16;
1380 }
else if (m_actionZoom2To1->isChecked()) {
1382 }
else if (m_actionZoom4To1->isChecked()) {
1384 }
else if (m_actionZoom8To1->isChecked()) {
1386 }
else if (m_actionZoom16To1->isChecked()) {
1387 return ZOOM_16_TO_1;
1388 }
else if (m_actionZoomFill->isChecked()) {
1391 ENGAUGE_ASSERT (
false);
1397 if (event->type () == QEvent::KeyPress) {
1399 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1402 if ((eventKeyPress->key() == Qt::Key_E) &&
1403 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1404 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1414 return QObject::eventFilter (target, event);
1418 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1420 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1427 QString regressionFile = QString (
"%1_%2")
1428 .arg (m_regressionFile)
1442 fileExport (regressionFile,
1449 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const
1451 QString outFileName = fileName;
1453 outFileName = outFileName.replace (
".xml",
".csv_actual");
1454 outFileName = outFileName.replace (
".dig",
".csv_actual");
1455 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1460 void MainWindow::fileExport(
const QString &fileName,
1463 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport"
1464 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1465 <<
" fileName=" << fileName.toLatin1().data();
1467 QFile file (fileName);
1468 if (file.open(QIODevice::WriteOnly)) {
1470 QTextStream str (&file);
1481 updateChecklistGuide ();
1486 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport"
1487 <<
" file=" << fileName.toLatin1().data()
1488 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1489 QMessageBox::critical (0,
1490 engaugeWindowTitle(),
1491 tr (
"Unable to export to file ") + fileName);
1495 void MainWindow::fileImport (
const QString &fileName,
1496 ImportType importType)
1498 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport"
1499 <<
" fileName=" << fileName.toLatin1 ().data ()
1500 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1501 <<
" importType=" << importType;
1503 QString originalFileOld = m_originalFile;
1504 bool originalFileWasImported = m_originalFileWasImported;
1506 m_originalFile = fileName;
1507 m_originalFileWasImported =
true;
1509 if (importType == IMPORT_TYPE_ADVANCED) {
1520 bool loaded =
false;
1522 #ifdef ENGAUGE_JPEG2000
1524 loaded = jpeg2000.
load (fileName,
1526 #endif // ENGAUGE_JPEG2000
1532 PdfReturn pdfReturn = pdf.
load (fileName,
1536 m_isErrorReportRegressionTest);
1537 if (pdfReturn == PDF_RETURN_CANCELED) {
1544 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1546 #endif // ENGAUGE_PDF
1550 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1553 m_isErrorReportRegressionTest);
1554 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1561 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1565 QString msg = QString(
"%1 %2 %3 %4.")
1566 .arg (tr (
"Cannot read file"))
1568 .arg (tr (
"from directory"))
1569 .arg (QDir::currentPath());
1570 QMessageBox::warning (
this,
1571 engaugeWindowTitle(),
1575 m_originalFile = originalFileOld;
1576 m_originalFileWasImported = originalFileWasImported;
1580 loaded = loadImage (fileName,
1587 if (importType == IMPORT_TYPE_ADVANCED) {
1597 m_originalFile = originalFileOld;
1598 m_originalFileWasImported = originalFileWasImported;
1604 void MainWindow::fileImportWithPrompts (ImportType importType)
1606 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts"
1607 <<
" importType=" << importType;
1611 bool okToContinue =
true;
1612 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1613 okToContinue = maybeSave ();
1619 QTextStream str (&filter);
1622 QList<QByteArray>::const_iterator itr;
1623 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1624 QStringList supportedImageFormatStrings;
1625 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1626 QByteArray arr = *itr;
1627 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1628 supportedImageFormatStrings << extensionAsWildcard;
1630 #ifdef ENGAUGE_JPEG2000
1633 #endif // ENGAUGE_JPEG2000
1636 supportedImageFormatStrings <<
"*.pdf";
1637 #endif // ENGAUGE_PDF
1639 supportedImageFormatStrings.sort();
1641 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1645 str <<
";; All Files (*.*)";
1647 QString fileName = QFileDialog::getOpenFileName (
this,
1649 QDir::currentPath (),
1651 if (!fileName.isEmpty ()) {
1654 fileImport (fileName,
1660 void MainWindow::filePaste (ImportType importType)
1662 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste"
1663 <<
" importType=" << importType;
1665 QString originalFileOld = m_originalFile;
1666 bool originalFileWasImported = m_originalFileWasImported;
1668 QString fileName (
"clipboard");
1669 m_originalFile = fileName;
1670 m_originalFileWasImported =
true;
1672 if (importType == IMPORT_TYPE_ADVANCED) {
1683 QImage image = QApplication::clipboard()->image();
1685 bool loaded =
false;
1687 loaded = !image.isNull();
1691 QMessageBox::warning (
this,
1692 engaugeWindowTitle(),
1693 QString(
"%1 %2 %3 %4.")
1694 .arg (tr (
"Cannot read file"))
1696 .arg (tr (
"from directory"))
1697 .arg (QDir::currentPath ()));
1700 m_originalFile = originalFileOld;
1701 m_originalFileWasImported = originalFileWasImported;
1705 loaded = loadImage (fileName,
1712 if (importType == IMPORT_TYPE_ADVANCED) {
1722 m_originalFile = originalFileOld;
1723 m_originalFileWasImported = originalFileWasImported;
1729 void MainWindow::ghostsCreate ()
1731 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1733 ENGAUGE_ASSERT (m_ghosts == 0);
1755 void MainWindow::ghostsDestroy ()
1757 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1759 ENGAUGE_CHECK_PTR (m_ghosts);
1777 void MainWindow::loadCoordSystemListFromCmdMediator ()
1779 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1781 m_cmbCoordSystem->clear();
1785 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1786 int index1Based = i + 1;
1787 m_cmbCoordSystem->addItem (QString::number (index1Based),
1792 m_cmbCoordSystem->setCurrentIndex (0);
1795 bool enable = (m_cmbCoordSystem->count() > 1);
1796 m_cmbCoordSystem->setEnabled (enable);
1797 m_btnShowAll->setEnabled (enable);
1798 m_btnPrintAll->setEnabled (enable);
1801 void MainWindow::loadCurveListFromCmdMediator ()
1803 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1805 m_cmbCurve->clear ();
1807 QStringList::iterator itr;
1808 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1810 QString curvesGraphName = *itr;
1811 m_cmbCurve->addItem (curvesGraphName);
1818 void MainWindow::loadDocumentFile (
const QString &fileName)
1820 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1822 QApplication::setOverrideCursor(Qt::WaitCursor);
1828 setCurrentPathFromFile (fileName);
1829 rebuildRecentFileListForCurrentFile(fileName);
1830 m_currentFile = fileName;
1832 if (m_cmdMediator != 0) {
1833 delete m_cmdMediator;
1838 setupAfterLoadNewDocument (fileName,
1840 IMPORT_TYPE_SIMPLE);
1843 m_actionDigitizeSelect->setChecked (
true);
1844 slotDigitizeSelect();
1846 m_engaugeFile = fileName;
1847 m_originalFile = fileName;
1848 m_originalFileWasImported =
false;
1853 QApplication::restoreOverrideCursor();
1857 QApplication::restoreOverrideCursor();
1859 QMessageBox::warning (
this,
1860 engaugeWindowTitle(),
1861 QString(
"%1 %2 %3 %4:\n%5.")
1862 .arg (tr (
"Cannot read file"))
1864 .arg (tr (
"from directory"))
1865 .arg (QDir::currentPath ())
1872 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1874 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile"
1875 <<
" file=" << errorReportFile.toLatin1().data();
1877 QFile file (errorReportFile);
1878 if (!file.exists()) {
1880 QFileInfo fileInfo (errorReportFile);
1882 QMessageBox::critical (
this,
1883 engaugeWindowTitle(),
1884 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1889 QXmlStreamReader reader (&file);
1890 file.open(QIODevice::ReadOnly | QIODevice::Text);
1900 setupAfterLoadNewDocument (errorReportFile,
1901 "Error report opened",
1902 IMPORT_TYPE_SIMPLE);
1905 m_actionDigitizeSelect->setChecked (
true);
1906 slotDigitizeSelect();
1911 bool MainWindow::loadImage (
const QString &fileName,
1912 const QImage &image,
1913 ImportType importType)
1915 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage"
1916 <<
" fileName=" << fileName.toLatin1 ().data ()
1917 <<
" importType=" << importType;
1920 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1921 success = loadImageReplacingImage (fileName,
1925 success = loadImageNewDocument (fileName,
1933 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1934 const QImage &image,
1935 ImportType importType)
1937 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument"
1938 <<
" fileName=" << fileName.toLatin1 ().data ()
1939 <<
" importType=" << importType;
1941 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1943 QApplication::setOverrideCursor(Qt::WaitCursor);
1946 QApplication::restoreOverrideCursor();
1948 setCurrentPathFromFile (fileName);
1950 m_engaugeFile = EMPTY_FILENAME;
1952 if (m_cmdMediator != 0) {
1953 delete m_cmdMediator;
1958 bool accepted = setupAfterLoadNewDocument (fileName,
1959 tr (
"File imported"),
1965 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1966 (m_fileCmdScript == 0)) {
1971 if (wizard->exec() == QDialog::Accepted) {
1973 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1987 m_actionViewChecklistGuide->setChecked (
true);
1990 loadCurveListFromCmdMediator();
1993 loadCoordSystemListFromCmdMediator();
1999 m_actionDigitizeAxis->setChecked (
true);
2003 slotDigitizeScale ();
2004 }
else if (modeGraph ()) {
2005 slotDigitizeAxis ();
2014 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
2015 const QImage &image,
2016 ImportType importType)
2018 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage"
2019 <<
" fileName=" << fileName.toLatin1 ().data ()
2020 <<
" importType=" << importType;
2022 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
2024 setCurrentPathFromFile (fileName);
2026 m_engaugeFile = EMPTY_FILENAME;
2028 ENGAUGE_ASSERT (m_cmdMediator != 0);
2032 bool accepted = setupAfterLoadReplacingImage (fileName,
2033 tr (
"File imported"),
2041 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
2043 QFile file (m_originalFile);
2047 if (!file.open (QIODevice::ReadOnly)) {
2051 domInputFile.setContent (&file);
2055 void MainWindow::loadToolTips()
2057 if (m_actionViewToolTips->isChecked ()) {
2060 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2061 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2062 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
2063 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2064 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2065 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2066 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2067 m_cmbBackground->setToolTip (tr (
"Background image."));
2068 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2069 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2070 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2075 m_actionDigitizeSelect->setToolTip (
"");
2076 m_actionDigitizeAxis->setToolTip (
"");
2077 m_actionDigitizeScale->setToolTip (
"");
2078 m_actionDigitizeCurve->setToolTip (
"");
2079 m_actionDigitizePointMatch->setToolTip (
"");
2080 m_actionDigitizeColorPicker->setToolTip (
"");
2081 m_actionDigitizeSegment->setToolTip (
"");
2082 m_cmbBackground->setToolTip (
"");
2083 m_cmbCurve->setToolTip (
"");
2084 m_viewPointStyle->setToolTip (
"");
2085 m_viewSegmentFilter->setToolTip (
"");
2090 bool MainWindow::modeGraph ()
const
2092 bool success =
false;
2094 if (m_cmdMediator != 0) {
2101 bool MainWindow::modeMap ()
const
2103 bool success =
false;
2105 if (m_cmdMediator != 0) {
2112 bool MainWindow::maybeSave()
2114 if (m_cmdMediator != 0) {
2116 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2117 engaugeWindowTitle(),
2118 tr(
"The document has been modified.\n"
2119 "Do you want to save your changes?"),
2120 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2121 if (ret == QMessageBox::Save) {
2122 return slotFileSave();
2123 }
else if (ret == QMessageBox::Cancel) {
2134 const QString &fileName)
const
2142 QString csvExtension = QString (
".%1")
2144 QString tsvExtension = QString (
".%1")
2146 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2147 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2151 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2152 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2153 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2154 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2158 return modelExportFormatAfter;
2163 return m_modelMainWindow;
2166 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2168 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2170 setWindowFilePath (filePath);
2172 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2173 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2174 recentFilePaths.removeAll (filePath);
2175 recentFilePaths.prepend (filePath);
2176 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2177 recentFilePaths.removeLast ();
2179 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2181 updateRecentFileList();
2186 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2188 if (m_actionZoomFill->isChecked ()) {
2193 bool MainWindow::saveDocumentFile (
const QString &fileName)
2195 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2197 QFile file(fileName);
2198 if (!file.open(QFile::WriteOnly)) {
2199 QMessageBox::warning (
this,
2200 engaugeWindowTitle(),
2201 QString (
"%1 %2: \n%3.")
2202 .arg(tr (
"Cannot write file"))
2204 .arg(file.errorString()));
2208 rebuildRecentFileListForCurrentFile (fileName);
2210 QApplication::setOverrideCursor (Qt::WaitCursor);
2211 QXmlStreamWriter writer(&file);
2212 writer.setAutoFormatting(
true);
2213 writer.writeStartDocument();
2214 writer.writeDTD(
"<!DOCTYPE engauge>");
2216 writer.writeEndDocument();
2217 QApplication::restoreOverrideCursor ();
2221 m_cmdMediator->setClean ();
2223 setCurrentFile(fileName);
2224 m_engaugeFile = fileName;
2234 const char *comment)
const
2238 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2240 QString report = saveErrorReportFileAndExitXml (context,
2248 if (dlg.exec() == QDialog::Accepted) {
2261 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2264 const char *comment)
const
2266 const bool DEEP_COPY =
true;
2268 QString xmlErrorReport;
2269 QXmlStreamWriter writer (&xmlErrorReport);
2270 writer.setAutoFormatting(
true);
2273 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2276 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2277 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2278 writer.writeEndElement();
2282 QXmlStreamReader reader (m_startingDocumentSnapshot);
2283 while (!reader.atEnd ()) {
2285 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2286 reader.tokenType() != QXmlStreamReader::EndDocument) {
2287 writer.writeCurrentToken (reader);
2292 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2293 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2294 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2295 writer.writeEndElement();
2298 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2299 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2300 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2301 writer.writeEndElement();
2304 m_cmdMediator->
saveXml(writer);
2307 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2308 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2309 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2310 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2311 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2312 writer.writeEndElement();
2314 writer.writeEndElement();
2317 QDomDocument domErrorReport (
"ErrorReport");
2318 domErrorReport.setContent (xmlErrorReport);
2321 if (!m_originalFileWasImported) {
2325 QDomDocument domInputFile;
2326 loadInputFileForErrorReport (domInputFile);
2327 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2328 if (!domInputFile.isNull()) {
2329 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2331 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2332 if (nodesFileTo.count () > 0) {
2333 QDomNode nodeFileTo = nodesFileTo.at (0);
2334 nodeFileTo.appendChild (fragmentFileFrom);
2341 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2342 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2343 QDomNode nodeDocument = nodesDocument.at (i);
2344 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2345 if (!elemImage.isNull()) {
2348 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2349 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2351 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2352 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2354 QDomNode nodeReplacement;
2355 QDomElement elemReplacement = nodeReplacement.toElement();
2356 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2357 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2360 nodeDocument.insertBefore (nodeReplacement,
2362 nodeDocument.removeChild(elemImage);
2368 return domErrorReport.toString();
2371 void MainWindow::saveStartingDocumentSnapshot()
2373 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2375 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2376 writer.setAutoFormatting (
true);
2382 ENGAUGE_CHECK_PTR (m_scene);
2388 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2390 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2392 int index = m_cmbBackground->findData (backgroundImage);
2393 ENGAUGE_ASSERT (index >= 0);
2395 m_cmbBackground->setCurrentIndex(index);
2397 return previousBackground;
2402 return m_cmbCurve->currentText ();
2405 void MainWindow::setCurrentFile (
const QString &fileName)
2407 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2409 QString fileNameStripped;
2410 if (!fileName.isEmpty()) {
2413 QFileInfo fileInfo (fileName);
2414 fileNameStripped = fileInfo.baseName();
2417 m_currentFile = fileNameStripped;
2418 m_currentFileWithPathAndFileExtension = fileName;
2420 updateWindowTitle ();
2423 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2425 QDir dir = QFileInfo (fileName).absoluteDir();
2427 if (dir.exists ()) {
2429 bool success = QDir::setCurrent (dir.absolutePath ());
2430 ENGAUGE_ASSERT (success);
2438 void MainWindow::setPixmap (
const QString &curveSelected,
2439 const QPixmap &pixmap)
2441 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2448 m_backgroundStateContext->
setPixmap (m_transformation,
2455 void MainWindow::settingsRead (
bool isReset)
2457 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2464 settingsReadEnvironment (settings);
2465 settingsReadMainWindow (settings);
2468 void MainWindow::settingsReadEnvironment (QSettings &settings)
2470 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2471 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2472 QDir::currentPath ()).toString ());
2473 settings.endGroup ();
2476 void MainWindow::settingsReadMainWindow (QSettings &settings)
2478 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2481 resize (settings.value (SETTINGS_SIZE,
2482 QSize (600, 600)).toSize ());
2483 move (settings.value (SETTINGS_POS,
2484 QPoint (200, 200)).toPoint ());
2488 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2489 QSize (900, 600)).toSize();
2490 m_helpWindow->resize (helpSize);
2491 if (settings.contains (SETTINGS_HELP_POS)) {
2492 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2493 m_helpWindow->move (helpPos);
2498 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2502 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2504 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2505 m_toolBackground->setVisible (viewBackgroundToolBar);
2506 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2507 BACKGROUND_IMAGE_FILTERED).toInt ();
2508 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2509 m_cmbBackground->setCurrentIndex (indexBackground);
2512 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2514 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2515 m_toolDigitize->setVisible (viewDigitizeToolBar);
2518 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2520 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2521 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2524 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2526 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2527 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2530 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2532 m_actionViewToolTips->setChecked (viewToolTips);
2536 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2539 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2540 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2541 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2543 addDockWindow (m_dockChecklistGuide,
2545 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2546 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2547 Qt::RightDockWidgetArea);
2548 addDockWindow (m_dockFittingWindow,
2550 SETTINGS_FITTING_WINDOW_DOCK_AREA,
2551 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
2552 Qt::RightDockWidgetArea);
2553 addDockWindow (m_dockGeometryWindow,
2555 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2556 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2557 Qt::RightDockWidgetArea);
2562 QLocale localeDefault;
2563 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2564 QVariant (localeDefault.language())).toInt();
2565 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2566 QVariant (localeDefault.country())).toInt();
2567 QLocale locale (language,
2569 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2570 QVariant (ZOOM_1_TO_1)).toInt());
2572 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2573 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2574 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2575 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2576 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2577 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2578 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2579 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2580 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2581 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2583 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2585 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2586 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
2587 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
2589 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
2592 updateSmallDialogs();
2594 settings.endGroup();
2597 void MainWindow::settingsWrite ()
2599 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2601 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2602 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2603 settings.endGroup ();
2605 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2606 settings.setValue (SETTINGS_SIZE, size ());
2607 settings.setValue (SETTINGS_POS, pos ());
2609 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2610 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2612 if (m_dockChecklistGuide->isFloating()) {
2614 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2615 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2619 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2622 if (m_dockFittingWindow->isFloating()) {
2624 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2625 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
2628 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
2630 if (m_dockGeometryWindow->isFloating()) {
2632 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2633 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2637 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2640 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2641 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2642 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
2643 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2644 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2645 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2646 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2647 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2648 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2649 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2650 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
2651 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2652 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2653 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2654 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2655 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2656 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2657 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2658 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2659 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2660 settings.endGroup ();
2663 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2664 const QString &temporaryMessage ,
2665 ImportType importType)
2667 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument"
2668 <<
" file=" << fileName.toLatin1().data()
2669 <<
" message=" << temporaryMessage.toLatin1().data()
2670 <<
" importType=" << importType;
2675 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2679 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2683 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2685 m_cmdMediator->
pixmap ());
2689 if (importType == IMPORT_TYPE_ADVANCED) {
2691 applyZoomFactorAfterLoad();
2694 dlgImportAdvanced.exec();
2696 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2700 int numberCoordSystem = dlgImportAdvanced.numberCoordSystem();
2709 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2710 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2711 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2712 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2713 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2714 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2715 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2716 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2717 loadCurveListFromCmdMediator ();
2718 loadCoordSystemListFromCmdMediator ();
2721 m_isDocumentExported =
false;
2730 m_cmbCurve->currentText ());
2731 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2733 applyZoomFactorAfterLoad();
2735 setCurrentFile(fileName);
2739 saveStartingDocumentSnapshot();
2746 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2747 const QString &temporaryMessage ,
2748 ImportType importType)
2750 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage"
2751 <<
" file=" << fileName.toLatin1().data()
2752 <<
" message=" << temporaryMessage.toLatin1().data()
2753 <<
" importType=" << importType;
2758 m_cmdMediator->clear();
2761 m_cmdMediator->
pixmap ());
2763 m_isDocumentExported =
false;
2765 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2767 applyZoomFactorAfterLoad();
2769 setCurrentFile(fileName);
2773 saveStartingDocumentSnapshot();
2782 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent"
2783 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2785 QMainWindow::showEvent (event);
2787 if (m_loadStartupFiles.count() > 0) {
2789 m_timerLoadStartupFiles =
new QTimer;
2790 m_timerLoadStartupFiles->setSingleShot (
true);
2791 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2792 m_timerLoadStartupFiles->start (0);
2802 void MainWindow::slotBtnPrintAll ()
2804 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2808 QPrinter printer (QPrinter::HighResolution);
2809 QPrintDialog dlg (&printer,
this);
2810 if (dlg.exec() == QDialog::Accepted) {
2811 QPainter painter (&printer);
2812 m_view->render (&painter);
2819 void MainWindow::slotBtnShowAllPressed ()
2821 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2827 void MainWindow::slotBtnShowAllReleased ()
2829 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2835 void MainWindow::slotCanRedoChanged (
bool canRedo)
2837 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2839 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2842 void MainWindow::slotCanUndoChanged (
bool canUndo)
2844 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2846 m_actionEditUndo->setEnabled (canUndo);
2849 void MainWindow::slotChecklistClosed()
2851 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2853 m_actionViewChecklistGuide->setChecked (
false);
2856 void MainWindow::slotCleanChanged(
bool clean)
2858 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2860 setWindowModified (!clean);
2863 void MainWindow::slotCmbBackground(
int currentIndex)
2865 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2867 switch (currentIndex) {
2868 case BACKGROUND_IMAGE_NONE:
2869 if (!m_actionViewBackgroundNone->isChecked()) {
2870 m_actionViewBackgroundNone->toggle();
2874 case BACKGROUND_IMAGE_ORIGINAL:
2875 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2876 m_actionViewBackgroundOriginal->toggle();
2880 case BACKGROUND_IMAGE_FILTERED:
2881 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2882 m_actionViewBackgroundFiltered->toggle();
2890 void MainWindow::slotCmbCoordSystem(
int index)
2892 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2898 m_cmdMediator->push (cmd);
2901 void MainWindow::slotCmbCurve(
int )
2903 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2908 m_cmbCurve->currentText ());
2912 updateViewedCurves();
2914 updateFittingWindow();
2915 updateGeometryWindow();
2918 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2920 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2926 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2928 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2934 void MainWindow::slotDigitizeAxis ()
2936 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2939 DIGITIZE_STATE_AXIS);
2940 m_cmbCurve->setEnabled (
false);
2946 void MainWindow::slotDigitizeColorPicker ()
2948 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2951 DIGITIZE_STATE_COLOR_PICKER);
2952 m_cmbCurve->setEnabled (
true);
2958 void MainWindow::slotDigitizeCurve ()
2960 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2963 DIGITIZE_STATE_CURVE);
2964 m_cmbCurve->setEnabled (
true);
2970 void MainWindow::slotDigitizePointMatch ()
2972 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2975 DIGITIZE_STATE_POINT_MATCH);
2976 m_cmbCurve->setEnabled (
true);
2982 void MainWindow::slotDigitizeScale ()
2984 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeScale";
2987 DIGITIZE_STATE_SCALE);
2988 m_cmbCurve->setEnabled (
false);
2994 void MainWindow::slotDigitizeSegment ()
2996 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2999 DIGITIZE_STATE_SEGMENT);
3000 m_cmbCurve->setEnabled (
true);
3006 void MainWindow::slotDigitizeSelect ()
3008 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
3011 DIGITIZE_STATE_SELECT);
3012 m_cmbCurve->setEnabled (
false);
3018 void MainWindow::slotEditCopy ()
3020 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
3023 bool tableFittingIsActive, tableFittingIsCopyable;
3024 bool tableGeometryIsActive, tableGeometryIsCopyable;
3025 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3026 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3028 if (tableFittingIsActive) {
3031 m_dockFittingWindow->
doCopy ();
3033 }
else if (tableGeometryIsActive) {
3036 m_dockGeometryWindow->
doCopy ();
3042 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3053 void MainWindow::slotEditCut ()
3055 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
3058 bool tableFittingIsActive, tableFittingIsCopyable;
3059 bool tableGeometryIsActive, tableGeometryIsCopyable;
3060 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3061 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3063 if (tableFittingIsActive || tableGeometryIsActive) {
3071 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3082 void MainWindow::slotEditDelete ()
3084 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
3087 bool tableFittingIsActive, tableFittingIsCopyable;
3088 bool tableGeometryIsActive, tableGeometryIsCopyable;
3089 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3090 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3092 if (tableFittingIsActive || tableGeometryIsActive) {
3105 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3106 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
3117 void MainWindow::slotEditMenu ()
3119 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
3121 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
3122 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
3125 void MainWindow::slotEditPaste ()
3127 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
3129 QList<QPoint> points;
3130 QList<double> ordinals;
3139 m_cmbCurve->currentText (),
3146 void MainWindow::slotEditPasteAsNew ()
3148 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
3150 filePaste (IMPORT_TYPE_SIMPLE);
3153 void MainWindow::slotEditPasteAsNewAdvanced ()
3155 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
3157 filePaste (IMPORT_TYPE_ADVANCED);
3160 void MainWindow::slotFileClose()
3162 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
3176 DIGITIZE_STATE_EMPTY);
3179 if (m_fittingCurve != 0) {
3180 m_scene->removeItem (m_fittingCurve);
3188 m_backgroundStateContext->
close ();
3191 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
3194 m_dockFittingWindow->
clear ();
3197 m_dockGeometryWindow->
clear ();
3200 delete m_cmdMediator;
3206 setWindowTitle (engaugeWindowTitle ());
3208 m_gridLines.
clear();
3213 void MainWindow::slotFileExport ()
3215 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3220 QString filter = QString (
"%1;;%2;;All files (*.*)")
3225 QString defaultFileName = QString (
"%1/%2.%3")
3226 .arg (QDir::currentPath ())
3227 .arg (m_currentFile)
3230 QString filterCsv = exportStrategy.
filterCsv ();
3231 QString fileName = dlg.getSaveFileName (
this,
3236 if (!fileName.isEmpty ()) {
3238 fileExport(fileName,
3247 void MainWindow::slotFileImport ()
3249 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3251 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3254 void MainWindow::slotFileImportAdvanced ()
3256 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3258 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3261 void MainWindow::slotFileImportDraggedImage(QImage image)
3263 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3268 IMPORT_TYPE_SIMPLE);
3271 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3273 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3280 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3282 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3285 loadImage (fileName,
3287 IMPORT_TYPE_SIMPLE);
3290 void MainWindow::slotFileImportImageReplace ()
3292 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3294 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3297 void MainWindow::slotFileOpen()
3299 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3305 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3306 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3307 .arg (ENGAUGE_FILENAME_EXTENSION);
3309 QString fileName = QFileDialog::getOpenFileName (
this,
3310 tr(
"Open Document"),
3311 QDir::currentPath (),
3313 if (!fileName.isEmpty ()) {
3315 loadDocumentFile (fileName);
3321 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3323 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3325 loadDocumentFile (fileName);
3328 void MainWindow::slotFilePrint()
3330 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3332 QPrinter printer (QPrinter::HighResolution);
3333 QPrintDialog dlg (&printer,
this);
3334 if (dlg.exec() == QDialog::Accepted) {
3335 QPainter painter (&printer);
3336 m_view->render (&painter);
3341 bool MainWindow::slotFileSave()
3343 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3345 if (m_engaugeFile.isEmpty()) {
3346 return slotFileSaveAs();
3348 return saveDocumentFile (m_engaugeFile);
3352 bool MainWindow::slotFileSaveAs()
3354 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3357 QString filenameDefault = m_currentFile;
3358 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3359 filenameDefault = QString (
"%1.%2")
3360 .arg (m_currentFile)
3361 .arg (ENGAUGE_FILENAME_EXTENSION);
3364 if (!m_engaugeFile.isEmpty()) {
3365 filenameDefault = m_engaugeFile;
3368 QString filterDigitizer = QString (
"%1 (*.%2)")
3369 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3370 .arg (ENGAUGE_FILENAME_EXTENSION);
3371 QString filterAll (
"All files (*. *)");
3373 QStringList filters;
3374 filters << filterDigitizer;
3375 filters << filterAll;
3377 QFileDialog dlg(
this);
3378 dlg.setFileMode (QFileDialog::AnyFile);
3379 dlg.selectNameFilter (filterDigitizer);
3380 dlg.setNameFilters (filters);
3381 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
3384 dlg.setWindowModality(Qt::WindowModal);
3386 dlg.setAcceptMode(QFileDialog::AcceptSave);
3387 dlg.selectFile(filenameDefault);
3390 QStringList files = dlg.selectedFiles();
3391 return saveDocumentFile(files.at(0));
3397 void MainWindow::slotFittingWindowClosed()
3399 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
3401 m_actionViewFittingWindow->setChecked (
false);
3404 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
3411 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit"
3412 <<
" order=" << fittingCurveCoef.size() - 1;
3414 if (m_fittingCurve != 0) {
3415 m_scene->removeItem (m_fittingCurve);
3416 delete m_fittingCurve;
3426 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
3427 m_scene->addItem (m_fittingCurve);
3430 void MainWindow::slotGeometryWindowClosed()
3432 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3434 m_actionViewGeometryWindow->setChecked (
false);
3437 void MainWindow::slotHelpAbout()
3439 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3445 void MainWindow::slotHelpTutorial()
3447 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3449 m_tutorialDlg->show ();
3450 m_tutorialDlg->exec ();
3453 void MainWindow::slotKeyPress (Qt::Key key,
3454 bool atLeastOneSelectedItem)
3456 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress"
3457 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3458 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3462 atLeastOneSelectedItem);
3465 void MainWindow::slotLoadStartupFiles ()
3467 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3469 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3471 QString fileName = m_loadStartupFiles.front();
3472 m_loadStartupFiles.pop_front();
3478 loadDocumentFile (fileName);
3482 fileImport (fileName,
3483 IMPORT_TYPE_SIMPLE);
3487 if (m_loadStartupFiles.count() > 0) {
3491 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3492 m_loadStartupFiles);
3496 void MainWindow::slotMouseMove (QPointF pos)
3501 if (m_cmdMediator != 0) {
3503 QString needMoreText = (modeMap () ?
3504 QObject::tr (
"Need scale bar") :
3505 QObject::tr (
"Need more axis points"));
3508 QString coordsScreen, coordsGraph, resolutionGraph;
3528 void MainWindow::slotMousePress (QPointF pos)
3530 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3538 void MainWindow::slotMouseRelease (QPointF pos)
3540 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3542 if (pos.x() < 0 || pos.y() < 0) {
3556 void MainWindow::slotRecentFileAction ()
3558 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3560 QAction *action = qobject_cast<QAction*>(sender ());
3563 QString fileName = action->data().toString();
3564 loadDocumentFile (fileName);
3568 void MainWindow::slotRecentFileClear ()
3570 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3572 QStringList emptyList;
3574 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3575 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3578 updateRecentFileList();
3581 void MainWindow::slotRedoTextChanged (
const QString &text)
3583 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3585 QString completeText (
"Redo");
3586 if (!text.isEmpty ()) {
3587 completeText += QString (
" \"%1\"").arg (text);
3589 m_actionEditRedo->setText (completeText);
3592 void MainWindow::slotSettingsAxesChecker ()
3594 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3596 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3597 m_dlgSettingsAxesChecker->show ();
3600 void MainWindow::slotSettingsColorFilter ()
3602 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3604 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3605 m_dlgSettingsColorFilter->show ();
3608 void MainWindow::slotSettingsCoords ()
3610 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3612 m_dlgSettingsCoords->
load (*m_cmdMediator);
3613 m_dlgSettingsCoords->show ();
3616 void MainWindow::slotSettingsCurveAddRemove ()
3618 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3620 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3621 m_dlgSettingsCurveAddRemove->show ();
3624 void MainWindow::slotSettingsCurveProperties ()
3626 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3628 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3630 m_dlgSettingsCurveProperties->show ();
3633 void MainWindow::slotSettingsDigitizeCurve ()
3635 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3637 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3638 m_dlgSettingsDigitizeCurve->show ();
3641 void MainWindow::slotSettingsExportFormat ()
3643 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3646 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3647 m_dlgSettingsExportFormat->show ();
3654 void MainWindow::slotSettingsGeneral ()
3656 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3658 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3659 m_dlgSettingsGeneral->show ();
3662 void MainWindow::slotSettingsGridDisplay()
3664 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3666 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3667 m_dlgSettingsGridDisplay->show ();
3670 void MainWindow::slotSettingsGridRemoval ()
3672 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3674 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3675 m_dlgSettingsGridRemoval->show ();
3678 void MainWindow::slotSettingsPointMatch ()
3680 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3682 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3683 m_dlgSettingsPointMatch->show ();
3686 void MainWindow::slotSettingsSegments ()
3688 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3690 m_dlgSettingsSegments->
load (*m_cmdMediator);
3691 m_dlgSettingsSegments->show ();
3694 void MainWindow::slotTableStatusChange ()
3696 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
3703 void MainWindow::slotSettingsMainWindow ()
3705 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3709 m_dlgSettingsMainWindow->show ();
3712 void MainWindow::slotTimeoutRegressionErrorReport ()
3714 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport"
3715 <<
" cmdStackIndex=" << m_cmdMediator->index()
3716 <<
" cmdStackCount=" << m_cmdMediator->count();
3718 if (m_cmdStackShadow->
canRedo()) {
3721 QDir::setCurrent (m_startupDirectory);
3726 QDir::setCurrent (m_startupDirectory);
3731 exportAllCoordinateSystemsAfterRegressionTests ();
3735 m_cmdMediator->setClean();
3741 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3743 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3745 if (m_fileCmdScript->
canRedo()) {
3748 QDir::setCurrent (m_startupDirectory);
3750 m_fileCmdScript->
redo(*
this);
3753 QDir::setCurrent (m_startupDirectory);
3758 if (m_cmdMediator != 0) {
3761 exportAllCoordinateSystemsAfterRegressionTests ();
3765 m_cmdMediator->setClean();
3775 void MainWindow::slotUndoTextChanged (
const QString &text)
3777 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3779 QString completeText (
"Undo");
3780 if (!text.isEmpty ()) {
3781 completeText += QString (
" \"%1\"").arg (text);
3783 m_actionEditUndo->setText (completeText);
3786 void MainWindow::slotViewGridLines ()
3788 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3793 void MainWindow::slotViewGroupBackground(QAction *action)
3795 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3798 BackgroundImage backgroundImage;
3799 int indexBackground;
3800 if (action == m_actionViewBackgroundNone) {
3801 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3802 backgroundImage = BACKGROUND_IMAGE_NONE;
3803 }
else if (action == m_actionViewBackgroundOriginal) {
3804 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3805 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3806 }
else if (action == m_actionViewBackgroundFiltered) {
3807 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3808 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3810 ENGAUGE_ASSERT (
false);
3813 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3814 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3817 m_cmbBackground->setCurrentIndex (indexBackground);
3821 void MainWindow::slotViewGroupCurves(QAction * )
3823 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3825 updateViewedCurves ();
3828 void MainWindow::slotViewGroupStatus(QAction *action)
3830 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3832 ENGAUGE_CHECK_PTR (m_statusBar);
3834 if (action == m_actionStatusNever) {
3836 }
else if (action == m_actionStatusTemporary) {
3843 void MainWindow::slotViewToolBarBackground ()
3845 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3847 if (m_actionViewBackground->isChecked ()) {
3848 m_toolBackground->show();
3850 m_toolBackground->hide();
3854 void MainWindow::slotViewToolBarChecklistGuide ()
3856 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3858 if (m_actionViewChecklistGuide->isChecked ()) {
3859 m_dockChecklistGuide->show();
3861 m_dockChecklistGuide->hide();
3865 void MainWindow::slotViewToolBarCoordSystem ()
3867 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3869 if (m_actionViewCoordSystem->isChecked ()) {
3870 m_toolCoordSystem->show();
3872 m_toolCoordSystem->hide();
3876 void MainWindow::slotViewToolBarDigitize ()
3878 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3880 if (m_actionViewDigitize->isChecked ()) {
3881 m_toolDigitize->show();
3883 m_toolDigitize->hide();
3887 void MainWindow::slotViewToolBarFittingWindow()
3889 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
3891 if (m_actionViewFittingWindow->isChecked()) {
3892 m_dockFittingWindow->show ();
3893 if (m_fittingCurve != 0) {
3894 m_fittingCurve->setVisible (
true);
3897 m_dockFittingWindow->hide ();
3898 if (m_fittingCurve != 0) {
3899 m_fittingCurve->setVisible (
false);
3904 void MainWindow::slotViewToolBarGeometryWindow ()
3906 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3908 if (m_actionViewGeometryWindow->isChecked ()) {
3909 m_dockGeometryWindow->show();
3911 m_dockGeometryWindow->hide();
3915 void MainWindow::slotViewToolBarSettingsViews ()
3917 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3919 if (m_actionViewSettingsViews->isChecked ()) {
3920 m_toolSettingsViews->show();
3922 m_toolSettingsViews->hide();
3926 void MainWindow::slotViewToolTips ()
3928 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3933 void MainWindow::slotViewZoom(
int zoom)
3935 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3938 switch ((ZoomFactor) zoom) {
3940 m_actionZoom16To1->setChecked(
true);
3941 slotViewZoom16To1 ();
3944 m_actionZoom8To1->setChecked(
true);
3945 slotViewZoom8To1 ();
3948 m_actionZoom4To1->setChecked(
true);
3949 slotViewZoom4To1 ();
3952 m_actionZoom2To1->setChecked(
true);
3953 slotViewZoom2To1 ();
3956 m_actionZoom1To1->setChecked(
true);
3957 slotViewZoom1To1 ();
3960 m_actionZoom1To2->setChecked(
true);
3961 slotViewZoom1To2 ();
3964 m_actionZoom1To4->setChecked(
true);
3965 slotViewZoom1To4 ();
3968 m_actionZoom1To8->setChecked(
true);
3969 slotViewZoom1To8 ();
3972 m_actionZoom1To16->setChecked(
true);
3973 slotViewZoom1To16 ();
3976 m_actionZoomFill->setChecked(
true);
3977 slotViewZoomFill ();
3982 void MainWindow::slotViewZoom16To1 ()
3984 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3986 QTransform transform;
3987 transform.scale (16.0, 16.0);
3988 m_view->setTransform (transform);
3992 void MainWindow::slotViewZoom8To1 ()
3994 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3996 QTransform transform;
3997 transform.scale (8.0, 8.0);
3998 m_view->setTransform (transform);
4002 void MainWindow::slotViewZoom4To1 ()
4004 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
4006 QTransform transform;
4007 transform.scale (4.0, 4.0);
4008 m_view->setTransform (transform);
4012 void MainWindow::slotViewZoom2To1 ()
4014 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
4016 QTransform transform;
4017 transform.scale (2.0, 2.0);
4018 m_view->setTransform (transform);
4022 void MainWindow::slotViewZoom1To1 ()
4024 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
4026 QTransform transform;
4027 transform.scale (1.0, 1.0);
4028 m_view->setTransform (transform);
4032 void MainWindow::slotViewZoom1To2 ()
4034 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
4036 QTransform transform;
4037 transform.scale (0.5, 0.5);
4038 m_view->setTransform (transform);
4042 void MainWindow::slotViewZoom1To4 ()
4044 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
4046 QTransform transform;
4047 transform.scale (0.25, 0.25);
4048 m_view->setTransform (transform);
4052 void MainWindow::slotViewZoom1To8 ()
4054 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
4056 QTransform transform;
4057 transform.scale (0.125, 0.125);
4058 m_view->setTransform (transform);
4062 void MainWindow::slotViewZoom1To16 ()
4064 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
4066 QTransform transform;
4067 transform.scale (0.0625, 0.0625);
4068 m_view->setTransform (transform);
4072 void MainWindow::slotViewZoomFill ()
4074 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
4076 m_backgroundStateContext->
fitInView (*m_view);
4081 void MainWindow::slotViewZoomIn ()
4083 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
4087 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4088 bool goto1To1 =
false;
4089 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4090 if (m_actionZoomFill->isChecked ()) {
4093 double xScale = m_view->transform().m11();
4094 double yScale = m_view->transform().m22();
4095 double scale = qMin(xScale, yScale);
4096 if (scale < 0.125) {
4098 }
else if (scale < 0.25) {
4100 }
else if (scale < 0.5) {
4102 }
else if (scale < 1) {
4104 }
else if (scale < 2) {
4106 }
else if (scale < 4) {
4108 }
else if (scale < 8) {
4114 goto16To1 = m_actionZoom8To1->isChecked ();
4115 goto8To1 = m_actionZoom4To1->isChecked ();
4116 goto4To1 = m_actionZoom2To1->isChecked ();
4117 goto2To1 = m_actionZoom1To1->isChecked ();
4118 goto1To1 = m_actionZoom1To2->isChecked ();
4119 goto1To2 = m_actionZoom1To4->isChecked ();
4120 goto1To4 = m_actionZoom1To8->isChecked ();
4121 goto1To8 = m_actionZoom1To16->isChecked ();
4126 m_actionZoom16To1->setChecked (
true);
4127 slotViewZoom16To1 ();
4128 }
else if (goto8To1) {
4129 m_actionZoom8To1->setChecked (
true);
4130 slotViewZoom8To1 ();
4131 }
else if (goto4To1) {
4132 m_actionZoom4To1->setChecked (
true);
4133 slotViewZoom4To1 ();
4134 }
else if (goto2To1) {
4135 m_actionZoom2To1->setChecked (
true);
4136 slotViewZoom2To1 ();
4137 }
else if (goto1To1) {
4138 m_actionZoom1To1->setChecked (
true);
4139 slotViewZoom1To1 ();
4140 }
else if (goto1To2) {
4141 m_actionZoom1To2->setChecked (
true);
4142 slotViewZoom1To2 ();
4143 }
else if (goto1To4) {
4144 m_actionZoom1To4->setChecked (
true);
4145 slotViewZoom1To4 ();
4146 }
else if (goto1To8) {
4147 m_actionZoom1To8->setChecked (
true);
4148 slotViewZoom1To8 ();
4149 }
else if (goto1To16) {
4150 m_actionZoom1To16->setChecked (
true);
4151 slotViewZoom1To16 ();
4155 void MainWindow::slotViewZoomInFromWheelEvent ()
4157 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
4159 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4160 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4163 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4168 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4172 void MainWindow::slotViewZoomOut ()
4174 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
4178 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4179 bool goto1To1 =
false;
4180 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4181 if (m_actionZoomFill->isChecked ()) {
4184 double xScale = m_view->transform().m11();
4185 double yScale = m_view->transform().m22();
4186 double scale = qMax(xScale, yScale);
4189 }
else if (scale > 4) {
4191 }
else if (scale > 2) {
4193 }
else if (scale > 1) {
4195 }
else if (scale > 0.5) {
4197 }
else if (scale > 0.25) {
4199 }
else if (scale > 0.125) {
4205 goto8To1 = m_actionZoom16To1->isChecked ();
4206 goto4To1 = m_actionZoom8To1->isChecked ();
4207 goto2To1 = m_actionZoom4To1->isChecked ();
4208 goto1To1 = m_actionZoom2To1->isChecked ();
4209 goto1To2 = m_actionZoom1To1->isChecked ();
4210 goto1To4 = m_actionZoom1To2->isChecked ();
4211 goto1To8 = m_actionZoom1To4->isChecked ();
4212 goto1To16 = m_actionZoom1To8->isChecked ();
4217 m_actionZoom1To16->setChecked (
true);
4218 slotViewZoom1To16 ();
4219 }
else if (goto1To8) {
4220 m_actionZoom1To8->setChecked (
true);
4221 slotViewZoom1To8 ();
4222 }
else if (goto1To4) {
4223 m_actionZoom1To4->setChecked (
true);
4224 slotViewZoom1To4 ();
4225 }
else if (goto1To2) {
4226 m_actionZoom1To2->setChecked (
true);
4227 slotViewZoom1To2 ();
4228 }
else if (goto1To1) {
4229 m_actionZoom1To1->setChecked (
true);
4230 slotViewZoom1To1 ();
4231 }
else if (goto2To1) {
4232 m_actionZoom2To1->setChecked (
true);
4233 slotViewZoom2To1 ();
4234 }
else if (goto4To1) {
4235 m_actionZoom4To1->setChecked (
true);
4236 slotViewZoom4To1 ();
4237 }
else if (goto8To1) {
4238 m_actionZoom8To1->setChecked (
true);
4239 slotViewZoom8To1 ();
4240 }
else if (goto16To1) {
4241 m_actionZoom16To1->setChecked (
true);
4242 slotViewZoom16To1 ();
4246 void MainWindow::slotViewZoomOutFromWheelEvent ()
4248 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
4250 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4251 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4254 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4259 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4263 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
4265 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4274 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4276 m_timerRegressionErrorReport =
new QTimer();
4277 m_timerRegressionErrorReport->setSingleShot(
false);
4278 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4280 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4283 void MainWindow::startRegressionTestFileCmdScript()
4285 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4287 m_timerRegressionFileCmdScript =
new QTimer();
4288 m_timerRegressionFileCmdScript->setSingleShot(
false);
4289 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4291 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4296 return m_transformation;
4306 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4308 ENGAUGE_CHECK_PTR (m_cmdMediator);
4312 updateAfterCommandStatusBarCoords ();
4314 updateHighlightOpacity ();
4320 updateChecklistGuide ();
4321 updateFittingWindow ();
4322 updateGeometryWindow();
4326 writeCheckpointToLogFile ();
4330 m_view->setFocus ();
4333 void MainWindow::updateAfterCommandStatusBarCoords ()
4335 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4340 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4344 updateTransformationAndItsDependencies();
4347 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
4355 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
4363 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4372 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4373 QPointF posScreen = m_view->mapToScene (posLocal);
4375 slotMouseMove (posScreen);
4380 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4385 void MainWindow::updateChecklistGuide ()
4387 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4389 m_isDocumentExported =
true;
4390 m_dockChecklistGuide->
update (*m_cmdMediator,
4391 m_isDocumentExported);
4394 void MainWindow::updateControls ()
4396 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls"
4397 <<
" selectedItems=" << m_scene->selectedItems().count();
4399 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4401 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4403 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4404 (m_actionRecentFiles.at(0)->isVisible ()));
4406 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4407 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4408 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4409 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4410 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4412 if (m_cmdMediator == 0) {
4413 m_actionEditUndo->setEnabled (
false);
4414 m_actionEditRedo->setEnabled (
false);
4416 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4417 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4419 bool tableFittingIsActive, tableFittingIsCopyable;
4420 bool tableGeometryIsActive, tableGeometryIsCopyable;
4421 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
4422 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
4423 m_actionEditCut->setEnabled (!tableFittingIsActive &&
4424 !tableGeometryIsActive &&
4425 m_scene->selectedItems().count () > 0);
4426 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
4427 (tableFittingIsActive && tableFittingIsCopyable) ||
4428 (tableGeometryIsActive && tableGeometryIsCopyable));
4429 m_actionEditPaste->setEnabled (m_digitizeStateContext->
canPaste (m_transformation,
4431 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
4432 !tableGeometryIsActive &&
4433 m_scene->selectedItems().count () > 0);
4436 m_actionDigitizeAxis->setEnabled (modeGraph ());
4437 m_actionDigitizeScale->setEnabled (modeMap ());
4438 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4439 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4440 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4441 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4442 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4444 m_actionViewGridLines->setEnabled (
true);
4446 m_actionViewGridLines->setEnabled (
false);
4447 m_actionViewGridLines->setChecked (
false);
4449 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4450 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4451 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4452 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4454 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4455 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4456 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4457 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4458 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4459 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4460 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4461 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4462 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4463 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4464 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4465 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4467 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4468 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4469 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4471 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4472 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4477 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4482 loadCurveListFromCmdMediator ();
4484 updateTransformationAndItsDependencies();
4496 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4498 switch (digitizeState) {
4499 case DIGITIZE_STATE_AXIS:
4500 m_actionDigitizeAxis->setChecked(
true);
4504 case DIGITIZE_STATE_COLOR_PICKER:
4505 m_actionDigitizeColorPicker->setChecked(
true);
4506 slotDigitizeColorPicker();
4509 case DIGITIZE_STATE_CURVE:
4510 m_actionDigitizeCurve->setChecked(
true);
4511 slotDigitizeCurve();
4514 case DIGITIZE_STATE_EMPTY:
4517 case DIGITIZE_STATE_POINT_MATCH:
4518 m_actionDigitizePointMatch->setChecked(
true);
4519 slotDigitizePointMatch();
4522 case DIGITIZE_STATE_SCALE:
4523 m_actionDigitizeScale->setChecked(
true);
4524 slotDigitizeScale();
4527 case DIGITIZE_STATE_SEGMENT:
4528 m_actionDigitizeSegment->setChecked(
true);
4529 slotDigitizeSegment();
4532 case DIGITIZE_STATE_SELECT:
4533 m_actionDigitizeSelect->setChecked(
true);
4534 slotDigitizeSelect();
4538 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4543 void MainWindow::updateFittingWindow ()
4545 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
4547 if (m_cmdMediator != 0 &&
4551 m_dockFittingWindow->
update (*m_cmdMediator,
4553 m_cmbCurve->currentText (),
4558 void MainWindow::updateGeometryWindow ()
4560 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4562 if (m_cmdMediator != 0 &&
4566 m_dockGeometryWindow->
update (*m_cmdMediator,
4568 m_cmbCurve->currentText (),
4575 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4581 void MainWindow::updateGridLines ()
4583 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4586 m_gridLines.
clear ();
4597 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4600 void MainWindow::updateHighlightOpacity ()
4602 if (m_cmdMediator != 0) {
4608 m_dockGeometryWindow);
4612 void MainWindow::updateRecentFileList()
4614 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4617 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4618 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4621 unsigned int count = recentFilePaths.size();
4622 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4623 count = MAX_RECENT_FILE_LIST_SIZE;
4628 for (i = 0; i < count; i++) {
4629 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4630 m_actionRecentFiles.at (i)->setText (strippedName);
4631 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4632 m_actionRecentFiles.at (i)->setVisible (
true);
4636 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4637 m_actionRecentFiles.at (i)->setVisible (
false);
4644 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4647 if (m_transformation.transformIsDefined()) {
4651 m_cmbCurve->currentText());
4656 m_cmbCurve->currentText());
4662 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4668 m_cmbCurve->currentText());
4675 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4682 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4685 loadCurveListFromCmdMediator();
4691 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4700 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4704 modelDigitizeCurve);
4709 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4716 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4723 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4730 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4735 void MainWindow::updateSettingsMainWindow()
4737 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4739 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4740 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4742 m_actionZoomIn->setShortcut (tr (
""));
4743 m_actionZoomOut->setShortcut (tr (
""));
4747 m_actionZoomIn->setShortcut (tr (
"+"));
4748 m_actionZoomOut->setShortcut (tr (
"-"));
4752 if ((m_scene != 0) &&
4753 (m_cmdMediator != 0)) {
4757 updateHighlightOpacity();
4758 updateWindowTitle();
4759 updateFittingWindow();
4760 updateGeometryWindow();
4765 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4773 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4780 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4786 void MainWindow::updateSmallDialogs ()
4803 void MainWindow::updateTransformationAndItsDependencies()
4805 m_transformation.update (!m_currentFile.isEmpty (),
4813 m_cmbCurve->currentText ());
4820 void MainWindow::updateViewedCurves ()
4822 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4824 if (m_actionViewCurvesAll->isChecked ()) {
4828 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4832 }
else if (m_actionViewCurvesNone->isChecked ()) {
4837 ENGAUGE_ASSERT (
false);
4843 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4845 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4852 if (activeCurve.isEmpty ()) {
4865 m_cmdMediator->
pixmap ());
4870 void MainWindow::updateWindowTitle ()
4872 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4874 const QString PLACEHOLDER (
"[*]");
4876 QString title = QString (tr (
"Engauge Digitizer %1")
4877 .arg (VERSION_NUMBER));
4879 QString fileNameMaybeStripped;
4880 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4882 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4886 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4887 fileNameMaybeStripped = fileInfo.baseName();
4890 case MAIN_TITLE_BAR_FORMAT_PATH:
4891 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4895 title += QString (
": %1")
4896 .arg (fileNameMaybeStripped);
4901 title += PLACEHOLDER;
4903 setWindowTitle (title);
4908 ENGAUGE_CHECK_PTR (m_view);
4914 ENGAUGE_CHECK_PTR (m_view);
4918 void MainWindow::writeCheckpointToLogFile ()
4921 QString checkpointDoc;
4922 QTextStream strDoc (&checkpointDoc);
4927 QString checkpointScene;
4928 QTextStream strScene (&checkpointScene);
4933 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4935 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n"
4936 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4937 << checkpointDoc.toLatin1().data()
4938 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4939 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4940 << checkpointScene.toLatin1().data()
4941 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine...
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
void unsetPointStyle()
Apply no PointStyle.
Given a set of point identifiers, if a map is in effect (with its two axis endpoints) then both axis ...
void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Dialog for sending error report with networking.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings, const QPixmap &pixmap)
Apply the color filter of the currently selected curve. The pixmap is included so the background colo...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
unsigned int coordSystemCount() const
Number of CoordSystem.
void setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
void createGhosts(QGraphicsScene &scene)
Create ghosts from the path/rect/polygon lists.
void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Returns information about files.
void updateAfterPointAddition()
Update the graphics attributes.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Command for cutting all selected Points.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
Dialog for saving error report to local hard drive.
void clear()
Deallocate and remove all grid lines.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
Wrapper around the Poppler library.
Class that displays the current Segment Filter in a MainWindow toolbar.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
Dialog for editing point match settings, for DigitizeStatePointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
Context class for transformation state machine.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
Wrapper around the QImage class for read and importing non-PDF files.
void updateSettingsCurveAddRemove(const CurvesGraphs &curvesGraphs)
Update with new curves.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
bool canRedo() const
Returns true if there is at least one command on the stack.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isRegressionTest, bool isGnuplot, bool isReset, QStringList loadStartupFiles, QWidget *parent=0)
Single constructor.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void setCoordinates(const QString &coordsScreen, const QString &coordsGraph, const QString &resolutionGraph)
Populate the coordinates fields. Unavailable values are empty. Html-encoding to highlight with colors...
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void cmdFileClose()
Close file. This is called from a file script command.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow)
Update the Points and their Curves after executing a command.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
PointStyle pointStyle() const
Get method for PointStyle.
void triggerStateTransition(TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
Window that displays the geometry information, as a table, for the current curve. ...
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
NonPdfReturn load(const QString &fileName, QImage &image, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void wakeUp()
Enable all widgets in the status bar. This is called just after a Document becomes active...
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
static void bindToMainWindow(const MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
Dialog for editing grid removal settings.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void uploadErrorReport(const QString &report)
Upload the error report asynchronously.
void setPixmap(const QImage &image)
Set method for the background pixmap.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
Dialog for editing curve names settings.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
int maximumGridLines() const
Maximum number of grid lines.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool dragDropExport() const
Get method for drag and drop export.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
bool smallDialogs() const
Get method for small dialogs flag.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Dockable text window containing checklist guide.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Dialog for editing filtering settings.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
ZoomControl zoomControl() const
Get method for zoom control.
QString fileExtensionTsv() const
File extension for tsv export files.
Details for a specific Point.
Class for exporting during regression, when the Transformation has not yet been defined.
Container for all graph curves. The axes point curve is external to this class.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Wrapper around QStatusBar to manage permanent widgets.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
Client for interacting with Engauge server.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Context class that manages the background image state machine.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
virtual void doCopy()
Copy the current selection to the clipboard.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsMainWindow.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
bool canRedo() const
Return true if there is a command available.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that operation is compatible with...
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...
Command for adding one or more graph points. This is for Segment Fill mode.
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Dialog for editing grid display settings.
void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Command for deleting all selected Points.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
Dialog for editing DigitizeStateCurve settings.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
Class that displays a view of the current Curve's point style.
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
double highlightOpacity() const
Get method for highlight opacity.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
const ColorFilterSettings colorFilterSettings(const QString &curveName) const
Get method for copying one color filter. Cannot return just a reference or else there is a warning ab...
Dialog for editing main window settings, which are entirely independent of all documents.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Import of point data from clipboard.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
bool isGnuplot() const
Get method for gnuplot flag.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Dialog for editing curve properties settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.
void resizeEvent(QResizeEvent *event)
Intercept resize event so graphics scene can be appropriately resized when in Fill mode...
QStringList supportedImageWildcards() const
List the supported jpeg2000 file extensions, for filtering import files.
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
File that manages a command stack for regression testing of file import/open/export/close.
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
PdfReturn load(const QString &fileName, QImage &image, int resolution, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
QString filterCsv() const
QFileDialog filter for CSV files.
ImportCropping importCropping() const
Get method for import cropping.
Command for moving all selected Points by a specified translation.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
Window that displays curve fitting as applied to the currently selected curve.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
QLocale locale() const
Get method for locale.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
Command for changing the currently selected CoordSystem.
void showCurves(bool show, bool showAll=false, const QString &curveName="")
Show or hide all Curves (if showAll is true) or just the selected Curve (if showAll is false);...
Dialog for editing axes checker settings.
void setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
void updateGraphicsLinesToMatchGraphicsPoints()
Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
MainWindowModel modelMainWindow() const
Get method for main window model.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
virtual void clear()
Clear stale information.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
virtual void clear()
Clear stale information.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.