7 #include "BackgroundImage.h"
8 #include "BackgroundStateContext.h"
9 #include "img/bannerapp_16.xpm"
10 #include "img/bannerapp_32.xpm"
11 #include "img/bannerapp_64.xpm"
12 #include "img/bannerapp_128.xpm"
13 #include "img/bannerapp_256.xpm"
14 #include "ChecklistGuide.h"
15 #include "ChecklistGuideWizard.h"
18 #include "CmdDelete.h"
19 #include "CmdMediator.h"
20 #include "CmdSelectCoordSystem.h"
21 #include "CmdStackShadow.h"
22 #include "ColorFilter.h"
25 #include "DigitizeStateContext.h"
26 #include "DigitAxis.xpm"
27 #include "DigitColorPicker.xpm"
28 #include "DigitCurve.xpm"
29 #include "DigitPointMatch.xpm"
30 #include "DigitSegment.xpm"
31 #include "DigitSelect.xpm"
33 #include "DlgErrorReport.h"
34 #include "DlgImportAdvanced.h"
35 #include "DlgRequiresTransform.h"
36 #include "DlgSettingsAxesChecker.h"
37 #include "DlgSettingsColorFilter.h"
38 #include "DlgSettingsCoords.h"
39 #include "DlgSettingsCurveAddRemove.h"
40 #include "DlgSettingsCurveProperties.h"
41 #include "DlgSettingsDigitizeCurve.h"
42 #include "DlgSettingsExportFormat.h"
43 #include "DlgSettingsGeneral.h"
44 #include "DlgSettingsGridDisplay.h"
45 #include "DlgSettingsGridRemoval.h"
46 #include "DlgSettingsMainWindow.h"
47 #include "DlgSettingsPointMatch.h"
48 #include "DlgSettingsSegments.h"
49 #include "DocumentSerialize.h"
50 #include "EngaugeAssert.h"
51 #include "EnumsToQt.h"
52 #include "ExportImageForRegression.h"
53 #include "ExportToFile.h"
54 #include "FileCmdScript.h"
55 #include "GeometryWindow.h"
57 #include "GraphicsItemsExtractor.h"
58 #include "GraphicsItemType.h"
59 #include "GraphicsScene.h"
60 #include "GraphicsView.h"
61 #include "GridLineFactory.h"
62 #include "GridLineLimiter.h"
63 #include "HelpWindow.h"
64 #ifdef ENGAUGE_JPEG2000
66 #endif // ENGAUGE_JPEG2000
67 #include "LoadFileInfo.h"
68 #include "LoadImageFromUrl.h"
70 #include "MainTitleBarFormat.h"
71 #include "MainWindow.h"
72 #include "NetworkClient.h"
77 #include "PdfResolution.h"
79 #include <QApplication>
80 #include <QCloseEvent>
83 #include <QDesktopServices>
84 #include <QDockWidget>
85 #include <QDomDocument>
87 #include <QFileDialog>
89 #include <QGraphicsLineItem>
90 #include <QImageReader>
92 #include <QKeySequence>
96 #include <QMessageBox>
97 #include <QMouseEvent>
98 #include <QPrintDialog>
101 #include <QTextStream>
105 #include <QToolButton>
106 #include "QtToString.h"
107 #include <QVBoxLayout>
108 #include <QWhatsThis>
109 #include <QXmlStreamReader>
110 #include <QXmlStreamWriter>
111 #include "Settings.h"
112 #include "StatusBar.h"
113 #include "TransformationStateContext.h"
114 #include "TutorialDlg.h"
116 #include "ViewPointStyle.h"
117 #include "ViewSegmentFilter.h"
118 #include "ZoomFactor.h"
119 #include "ZoomFactorInitial.h"
121 const QString EMPTY_FILENAME (
"");
122 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
123 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
124 const int REGRESSION_INTERVAL = 400;
125 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
128 const QString &fileCmdScriptFile,
129 bool isRegressionTest,
132 QStringList loadStartupFiles,
135 m_isDocumentExported (false),
136 m_engaugeFile (EMPTY_FILENAME),
137 m_currentFile (EMPTY_FILENAME),
142 m_digitizeStateContext (0),
143 m_transformationStateContext (0),
144 m_backgroundStateContext (0),
145 m_isGnuplot (isGnuplot),
147 m_timerRegressionErrorReport(0),
149 m_isErrorReportRegressionTest (isRegressionTest),
150 m_timerRegressionFileCmdScript(0)
152 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow"
153 <<
" curDir=" << QDir::currentPath().toLatin1().data();
155 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
156 qApp->setApplicationName (
"Engauge Digitizer");
157 qApp->setOrganizationDomain (
"Mark Mitchell");
162 m_startupDirectory = QDir::currentPath();
166 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
167 setWindowTitle (engaugeWindowTitle ());
169 createCentralWidget();
174 createDockableWidgets ();
179 createLoadImageFromUrl ();
180 createStateContextBackground ();
181 createStateContextDigitize ();
182 createStateContextTransformation ();
183 createSettingsDialogs ();
184 createCommandStackShadow ();
188 settingsRead (isReset);
190 setUnifiedTitleAndToolBarOnMac(
true);
192 installEventFilter(
this);
196 QString originalPath = QDir::currentPath();
197 QDir::setCurrent (m_startupDirectory);
198 if (!errorReportFile.isEmpty()) {
199 loadErrorReportFile(errorReportFile);
200 if (m_isErrorReportRegressionTest) {
201 startRegressionTestErrorReport(errorReportFile);
203 }
else if (!fileCmdScriptFile.isEmpty()) {
205 startRegressionTestFileCmdScript();
210 m_loadStartupFiles = loadStartupFiles;
212 QDir::setCurrent (originalPath);
215 MainWindow::~MainWindow()
219 void MainWindow::addDockWindow (QDockWidget *dockWidget,
221 const QString &settingsTokenArea,
222 const QString &settingsTokenGeometry,
223 Qt::DockWidgetArea dockWidgetArea)
228 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
229 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
230 Qt::NoDockWidgetArea).toInt();
232 if (area == Qt::NoDockWidgetArea) {
234 addDockWidget (dockWidgetArea,
236 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
237 if (settings.contains (settingsTokenGeometry)) {
238 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
249 void MainWindow::applyZoomFactorAfterLoad()
251 ZoomFactor zoomFactor;
254 if (m_zoomMap.contains (zoomFactorInitial)) {
255 zoomFactor = m_zoomMap [zoomFactorInitial];
256 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
257 zoomFactor = currentZoomFactor ();
259 ENGAUGE_ASSERT (
false);
260 zoomFactor = currentZoomFactor();
263 slotViewZoom (zoomFactor);
266 void MainWindow::closeEvent(QCloseEvent *event)
278 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
280 setWindowModified (
false);
286 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
295 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
297 m_regressionFile = exportFilenameFromInputFilename (fileName);
298 fileImport (fileName,
304 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
306 m_regressionFile = exportFilenameFromInputFilename (fileName);
307 loadDocumentFile(fileName);
313 return m_cmdMediator;
316 void MainWindow::createActions()
318 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
320 createActionsFile ();
321 createActionsEdit ();
322 createActionsDigitize ();
323 createActionsView ();
324 createActionsSettings ();
325 createActionsHelp ();
328 void MainWindow::createActionsDigitize ()
330 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
332 QPixmap pixmapAxis (DigitAxis_xpm);
333 QPixmap pixmapCurve (DigitCurve_xpm);
334 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
335 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
336 QPixmap pixmapSegment (DigitSegment_xpm);
337 QPixmap pixmapSelect (DigitSelect_xpm);
339 QIcon iconAxis (pixmapAxis);
340 QIcon iconCurve (pixmapCurve);
341 QIcon iconColorPicker (pixmapColorPicker);
342 QIcon iconPointMatch (pixmapPointMatch);
343 QIcon iconSegment (pixmapSegment);
344 QIcon iconSelect (pixmapSelect);
346 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
347 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
348 m_actionDigitizeSelect->setCheckable (
true);
349 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
350 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n"
351 "Select points on the screen."));
352 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
354 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
355 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
356 m_actionDigitizeAxis->setCheckable (
true);
357 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points."));
358 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n"
359 "Digitizes an axis point by placing a new point at the cursor "
360 "after a mouse click. The coordinates of the axis point are then "
361 "entered. In a graph, three axis points are required to define "
362 "the graph coordinates."));
363 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
365 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
366 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
367 m_actionDigitizeCurve->setCheckable (
true);
368 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
369 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n"
370 "Digitizes a curve point by placing a new point at the cursor "
371 "after a mouse click. Use this mode to digitize points along curves "
373 "New points will be assigned to the currently selected curve."));
374 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
376 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
377 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
378 m_actionDigitizePointMatch->setCheckable (
true);
379 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
380 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n"
381 "Digitizes curve points in a point plot by finding points that match a sample point. The process "
382 "starts by selecting a representative sample point.\n\n"
383 "New points will be assigned to the currently selected curve."));
384 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
386 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
387 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
388 m_actionDigitizeColorPicker->setCheckable (
true);
389 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
390 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n"
391 "Select a pixel along the currently selected curve. That pixel and its neighbors will "
392 "define the filter settings (color, brightness, and so on) of the currently selected curve "
393 "while in Segment Fill mode."));
394 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
396 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
397 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
398 m_actionDigitizeSegment->setCheckable (
true);
399 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
400 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n"
401 "Digitizes curve points by placing new points along the highlighted "
402 "segment under the cursor. Use this mode to quickly digitize multiple points along a "
403 "curve with a single click.\n\n"
404 "New points will be assigned to the currently selected curve."));
405 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
407 m_groupDigitize =
new QActionGroup (
this);
408 m_groupDigitize->addAction (m_actionDigitizeSelect);
409 m_groupDigitize->addAction (m_actionDigitizeAxis);
410 m_groupDigitize->addAction (m_actionDigitizeCurve);
411 m_groupDigitize->addAction (m_actionDigitizePointMatch);
412 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
413 m_groupDigitize->addAction (m_actionDigitizeSegment);
416 void MainWindow::createActionsEdit ()
418 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
420 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
421 m_actionEditUndo->setShortcut (QKeySequence::Undo);
422 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
423 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n"
424 "Undo the last operation."));
427 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
428 m_actionEditRedo->setShortcut (QKeySequence::Redo);
429 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
430 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n"
431 "Redo the last operation."));
434 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
435 m_actionEditCut->setShortcut (QKeySequence::Cut);
436 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
437 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n"
438 "Cuts the selected points and copies them to the clipboard."));
439 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
441 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
442 m_actionEditCopy->setShortcut (QKeySequence::Copy);
443 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
444 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n"
445 "Copies the selected points to the clipboard."));
446 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
448 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
449 m_actionEditPaste->setShortcut (QKeySequence::Paste);
450 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
451 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n"
452 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
453 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
455 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
456 m_actionEditDelete->setShortcut (QKeySequence::Delete);
457 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
458 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n"
459 "Deletes the selected points, after copying them to the clipboard."));
460 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
462 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
463 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
464 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n"
465 "Creates a new document by pasting an image from the clipboard."));
466 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
468 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
469 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
470 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n"
471 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
472 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
475 void MainWindow::createActionsFile ()
477 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
479 m_actionImport =
new QAction(tr (
"&Import..."),
this);
480 m_actionImport->setShortcut (tr (
"Ctrl+I"));
481 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
482 m_actionImport->setWhatsThis (tr (
"Import Image\n\n"
483 "Creates a new document by importing an image with a single coordinate system, "
484 "and axes both coordinates known.\n\n"
485 "For more complicated images with multiple coordinate systems, "
486 "and/or floating axes, Import (Advanced) is used instead."));
487 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
489 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
490 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
491 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n"
492 "Creates a new document by importing an image with support for advanced feaures. In "
493 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
494 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
496 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
497 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
498 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n"
499 "Imports a new image into the current document. The existing image is replaced, "
500 "and all curves in the document are preserved. This operation is useful for applying "
501 "the axis points and other settings from an existing document to a different image."));
502 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
504 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
505 m_actionOpen->setShortcut (QKeySequence::Open);
506 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
507 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n"
508 "Opens an existing document."));
509 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
512 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
513 QAction *recentFileAction =
new QAction (
this);
514 recentFileAction->setVisible (
true);
515 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
516 m_actionRecentFiles.append (recentFileAction);
520 m_actionClose =
new QAction(tr (
"&Close"),
this);
521 m_actionClose->setShortcut (QKeySequence::Close);
522 m_actionClose->setStatusTip (tr (
"Closes the open document document."));
523 m_actionClose->setWhatsThis (tr (
"Close Document\n\n"
524 "Closes the open document."));
525 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
527 m_actionSave =
new QAction(tr (
"&Save"),
this);
528 m_actionSave->setShortcut (QKeySequence::Save);
529 m_actionSave->setStatusTip (tr (
"Saves the current document."));
530 m_actionSave->setWhatsThis (tr (
"Save Document\n\n"
531 "Saves the current document."));
532 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
534 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
535 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
536 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
537 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n"
538 "Saves the current document under a new filename."));
539 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
541 m_actionExport =
new QAction (tr (
"Export..."),
this);
542 m_actionExport->setShortcut (tr (
"Ctrl+E"));
543 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
544 m_actionExport->setWhatsThis (tr (
"Export Document\n\n"
545 "Exports the current document into a text file."));
546 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
548 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
549 m_actionPrint->setShortcut (QKeySequence::Print);
550 m_actionPrint->setStatusTip (tr (
"Print the current document."));
551 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n"
552 "Print the current document to a printer or file."));
553 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
555 m_actionExit =
new QAction(tr (
"&Exit"),
this);
556 m_actionExit->setShortcut (QKeySequence::Quit);
557 m_actionExit->setStatusTip (tr (
"Quits the application."));
558 m_actionExit->setWhatsThis (tr (
"Exit\n\n"
559 "Quits the application."));
560 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
563 void MainWindow::createActionsHelp ()
565 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
567 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
568 m_actionHelpChecklistGuideWizard->setCheckable (
true);
569 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
570 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n"
571 "Use Checklist Guide Wizard during import to generate a checklist of steps "
572 "for the imported document"));
574 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
575 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
577 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
578 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
579 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n"
580 "Play tutorial showing steps for digitizing points from curves drawn with lines "
582 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
585 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
586 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
587 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
588 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n"
589 "Searchable help documentation"));
593 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
594 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
595 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
596 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
599 void MainWindow::createActionsSettings ()
601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
603 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
604 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
605 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n"
606 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
607 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
609 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
610 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
611 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n"
612 "Add/Remove Curve settings control which curves are included in the current document"));
613 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
615 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
616 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
617 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n"
618 "Curves properties settings determine how each curve appears"));
619 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
621 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
622 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
623 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n"
624 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and "
625 "Digitize Graph Point modes"));
626 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
628 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
629 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
630 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n"
631 "Export format settings affect how exported files are formatted"));
632 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
634 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
635 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
636 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n"
637 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
638 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
640 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
641 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
642 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n"
643 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
644 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
646 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
647 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
648 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n"
649 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. "
650 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
651 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
653 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
654 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
655 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n"
656 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when "
657 "Color Filtering is not able to separate grid lines from curve lines."));
658 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
660 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
661 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
662 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n"
663 "Point match settings determine how points are matched while in Point Match mode"));
664 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
666 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
667 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
668 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n"
669 "Segment fill settings determine how points are generated in the Segment Fill mode"));
670 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
672 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
673 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
674 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n"
675 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects "
676 "both Color Picker and Point Match modes"));
677 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
679 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
680 m_actionSettingsMainWindow->setEnabled (
true);
681 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
682 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n"
683 "Main window settings affect the user interface and are not specific to any document"));
684 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
687 void MainWindow::createActionsView ()
689 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
691 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
692 m_actionViewBackground->setCheckable (
true);
693 m_actionViewBackground->setChecked (
true);
694 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
695 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n"
696 "Show or hide the background toolbar"));
697 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
699 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
700 m_actionViewChecklistGuide->setCheckable (
true);
701 m_actionViewChecklistGuide->setChecked (
false);
702 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
703 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n"
704 "Show or hide the checklist guide"));
705 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
707 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
708 m_actionViewGeometryWindow->setCheckable (
true);
709 m_actionViewGeometryWindow->setChecked (
false);
710 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
711 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n"
712 "Show or hide the geometry window"));
713 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
715 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
716 m_actionViewDigitize->setCheckable (
true);
717 m_actionViewDigitize->setChecked (
true);
718 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
719 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n"
720 "Show or hide the digitizing tools toolbar"));
721 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
723 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
724 m_actionViewSettingsViews->setCheckable (
true);
725 m_actionViewSettingsViews->setChecked (
true);
726 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
727 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n"
728 "Show or hide the settings views toolbar. These views graphically show the "
729 "most important settings."));
730 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
732 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
733 m_actionViewCoordSystem->setCheckable (
true);
734 m_actionViewCoordSystem->setChecked (
false);
735 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
736 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n"
737 "Show or hide the coordinate system selection toolbar. This toolbar is used "
738 "to select the current coordinate system when the document has multiple "
739 "coordinate systems. This toolbar is also used to view and print all coordinate "
741 "This toolbar is disabled when there is only one coordinate system."));
742 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
744 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
745 m_actionViewToolTips->setCheckable (
true);
746 m_actionViewToolTips->setChecked (
true);
747 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
748 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n"
749 "Show or hide the tool tips"));
750 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
752 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
753 m_actionViewGridLines->setCheckable (
true);
754 m_actionViewGridLines->setChecked (
false);
755 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
756 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n"
757 "Show or hide grid lines that are added for accurate adjustments of the axes points, "
758 "which can improve accuracy in distorted graphs"));
759 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
761 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
762 m_actionViewBackgroundNone->setCheckable (
true);
763 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
764 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n"
765 "No image is shown so points are easier to see"));
767 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
768 m_actionViewBackgroundOriginal->setCheckable (
true);
769 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
770 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n"
771 "Show the original image underneath the points"));
773 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
774 m_actionViewBackgroundFiltered->setCheckable (
true);
775 m_actionViewBackgroundFiltered->setChecked (
true);
776 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
777 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n"
778 "Show the filtered image underneath the points.\n\n"
779 "The filtered image is created from the original image according to the "
780 "Filter preferences so unimportant information is hidden and important "
781 "information is emphasized"));
783 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
784 m_actionViewCurvesNone->setCheckable (
true);
785 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
786 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n"
787 "No axis points or digitized graph curves are shown so the image is easier to see."));
789 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
790 m_actionViewCurvesSelected->setCheckable (
true);
791 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
792 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n"
793 "Show only the digitized points and line that belong to the currently selected curve."));
795 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
796 m_actionViewCurvesAll->setCheckable (
true);
797 m_actionViewCurvesAll->setChecked (
true);
798 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
799 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n"
800 "Show all digitized axis points and graph curves"));
802 m_groupBackground =
new QActionGroup(
this);
803 m_groupBackground->addAction (m_actionViewBackgroundNone);
804 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
805 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
806 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
808 m_groupCurves =
new QActionGroup(
this);
809 m_groupCurves->addAction (m_actionViewCurvesNone);
810 m_groupCurves->addAction (m_actionViewCurvesSelected);
811 m_groupCurves->addAction (m_actionViewCurvesAll);
812 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
814 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
815 m_actionStatusNever->setCheckable(
true);
816 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
817 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
819 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
820 m_actionStatusTemporary->setCheckable(
true);
821 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
822 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
824 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
825 m_actionStatusAlways->setCheckable(
true);
826 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
827 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, "
828 "the status bar also displays information about the cursor position."));
830 m_groupStatus =
new QActionGroup(
this);
831 m_groupStatus->addAction (m_actionStatusNever);
832 m_groupStatus->addAction (m_actionStatusTemporary);
833 m_groupStatus->addAction (m_actionStatusAlways);
834 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
836 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
837 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
839 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
841 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
842 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
844 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
846 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
847 m_actionZoom16To1->setCheckable (
true);
848 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
849 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
851 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
852 m_actionZoom8To1->setCheckable (
true);
853 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
854 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
856 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
857 m_actionZoom4To1->setCheckable (
true);
858 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
859 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
861 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
862 m_actionZoom2To1->setCheckable (
true);
863 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
864 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
866 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
867 m_actionZoom1To1->setCheckable (
true);
868 m_actionZoom1To1->setChecked (
true);
869 m_actionZoom1To1->setStatusTip (tr (
"Zoom 6:1"));
870 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
872 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
873 m_actionZoom1To2->setCheckable (
true);
874 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
875 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
877 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
878 m_actionZoom1To4->setCheckable (
true);
879 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
880 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
882 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
883 m_actionZoom1To8->setCheckable (
true);
884 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
885 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
887 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
888 m_actionZoom1To16->setCheckable (
true);
889 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
890 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
892 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
893 m_actionZoomFill->setCheckable (
true);
894 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
895 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
897 m_groupZoom =
new QActionGroup (
this);
898 m_groupZoom->addAction (m_actionZoom16To1);
899 m_groupZoom->addAction (m_actionZoom8To1);
900 m_groupZoom->addAction (m_actionZoom4To1);
901 m_groupZoom->addAction (m_actionZoom2To1);
902 m_groupZoom->addAction (m_actionZoom1To1);
903 m_groupZoom->addAction (m_actionZoom1To2);
904 m_groupZoom->addAction (m_actionZoom1To4);
905 m_groupZoom->addAction (m_actionZoom1To8);
906 m_groupZoom->addAction (m_actionZoom1To16);
907 m_groupZoom->addAction (m_actionZoomFill);
910 void MainWindow::createCentralWidget ()
912 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
914 QWidget *widget =
new QWidget;
915 setCentralWidget (widget);
916 m_layout =
new QVBoxLayout;
917 widget->setLayout (m_layout);
920 void MainWindow::createCommandStackShadow ()
922 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
927 void MainWindow::createDockableWidgets ()
929 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
933 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
937 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
this, SLOT (slotGeometryWindowClosed()));
940 void MainWindow::createHelpWindow ()
942 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
946 m_helpWindow->hide ();
947 addDockWidget (Qt::RightDockWidgetArea,
949 m_helpWindow->setFloating (
true);
951 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
955 void MainWindow::createIcons()
957 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
960 QPixmap icon16 (bannerapp_16);
961 QPixmap icon32 (bannerapp_32);
962 QPixmap icon64 (bannerapp_64);
963 QPixmap icon128 (bannerapp_128);
964 QPixmap icon256 (bannerapp_256);
966 icon.addPixmap (icon16);
967 icon.addPixmap (icon32);
968 icon.addPixmap (icon64);
969 icon.addPixmap (icon128);
970 icon.addPixmap (icon256);
972 setWindowIcon (icon);
975 void MainWindow::createLoadImageFromUrl ()
980 void MainWindow::createMenus()
982 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
984 m_menuFile = menuBar()->addMenu(tr(
"&File"));
985 m_menuFile->addAction (m_actionImport);
986 m_menuFile->addAction (m_actionImportAdvanced);
987 m_menuFile->addAction (m_actionImportImageReplace);
988 m_menuFile->addAction (m_actionOpen);
990 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
991 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
992 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
994 m_menuFile->addMenu (m_menuFileOpenRecent);
996 m_menuFile->addAction (m_actionClose);
997 m_menuFile->insertSeparator (m_actionSave);
998 m_menuFile->addAction (m_actionSave);
999 m_menuFile->addAction (m_actionSaveAs);
1000 m_menuFile->addAction (m_actionExport);
1001 m_menuFile->insertSeparator (m_actionPrint);
1002 m_menuFile->addAction (m_actionPrint);
1003 m_menuFile->insertSeparator (m_actionExit);
1004 m_menuFile->addAction (m_actionExit);
1006 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1007 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1008 m_menuEdit->addAction (m_actionEditUndo);
1009 m_menuEdit->addAction (m_actionEditRedo);
1010 m_menuEdit->insertSeparator (m_actionEditCut);
1011 m_menuEdit->addAction (m_actionEditCut);
1012 m_menuEdit->addAction (m_actionEditCopy);
1013 m_menuEdit->addAction (m_actionEditPaste);
1014 m_menuEdit->addAction (m_actionEditDelete);
1015 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1016 m_menuEdit->addAction (m_actionEditPasteAsNew);
1017 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1019 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1020 m_menuDigitize->addAction (m_actionDigitizeSelect);
1021 m_menuDigitize->addAction (m_actionDigitizeAxis);
1022 m_menuDigitize->addAction (m_actionDigitizeCurve);
1023 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1024 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1025 m_menuDigitize->addAction (m_actionDigitizeSegment);
1027 m_menuView = menuBar()->addMenu(tr(
"View"));
1028 m_menuView->addAction (m_actionViewBackground);
1029 m_menuView->addAction (m_actionViewDigitize);
1030 m_menuView->addAction (m_actionViewChecklistGuide);
1031 m_menuView->addAction (m_actionViewGeometryWindow);
1032 m_menuView->addAction (m_actionViewSettingsViews);
1033 m_menuView->addAction (m_actionViewCoordSystem);
1034 m_menuView->insertSeparator (m_actionViewToolTips);
1035 m_menuView->addAction (m_actionViewToolTips);
1036 m_menuView->addAction (m_actionViewGridLines);
1037 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1038 m_menuViewBackground =
new QMenu (tr (
"Background"));
1039 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1040 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1041 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1042 m_menuView->addMenu (m_menuViewBackground);
1043 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1044 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1045 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1046 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1047 m_menuView->addMenu (m_menuViewCurves);
1048 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1049 m_menuViewStatus->addAction (m_actionStatusNever);
1050 m_menuViewStatus->addAction (m_actionStatusTemporary);
1051 m_menuViewStatus->addAction (m_actionStatusAlways);
1052 m_menuView->addMenu (m_menuViewStatus);
1053 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1054 m_menuViewZoom->addAction (m_actionZoomOut);
1055 m_menuViewZoom->addAction (m_actionZoomIn);
1056 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1057 m_menuViewZoom->addAction (m_actionZoom16To1);
1058 m_menuViewZoom->addAction (m_actionZoom8To1);
1059 m_menuViewZoom->addAction (m_actionZoom4To1);
1060 m_menuViewZoom->addAction (m_actionZoom2To1);
1061 m_menuViewZoom->addAction (m_actionZoom1To1);
1062 m_menuViewZoom->addAction (m_actionZoom1To2);
1063 m_menuViewZoom->addAction (m_actionZoom1To4);
1064 m_menuViewZoom->addAction (m_actionZoom1To8);
1065 m_menuViewZoom->addAction (m_actionZoom1To16);
1066 m_menuViewZoom->addAction (m_actionZoomFill);
1067 m_menuView->addMenu (m_menuViewZoom);
1069 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1070 m_menuSettings->addAction (m_actionSettingsCoords);
1071 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1072 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1073 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1074 m_menuSettings->addAction (m_actionSettingsExport);
1075 m_menuSettings->addAction (m_actionSettingsColorFilter);
1076 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1077 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1078 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1079 m_menuSettings->addAction (m_actionSettingsPointMatch);
1080 m_menuSettings->addAction (m_actionSettingsSegments);
1081 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1082 m_menuSettings->addAction (m_actionSettingsGeneral);
1083 m_menuSettings->addAction (m_actionSettingsMainWindow);
1085 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1086 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1087 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1088 m_menuHelp->addAction (m_actionHelpWhatsThis);
1089 m_menuHelp->addAction (m_actionHelpTutorial);
1091 m_menuHelp->addAction (m_actionHelpHelp);
1093 m_menuHelp->addAction (m_actionHelpAbout);
1095 updateRecentFileList();
1098 void MainWindow::createNetwork ()
1100 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1105 void MainWindow::createSettingsDialogs ()
1107 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1123 m_dlgSettingsCoords->setVisible (
false);
1124 m_dlgSettingsCurveAddRemove->setVisible (
false);
1125 m_dlgSettingsCurveProperties->setVisible (
false);
1126 m_dlgSettingsDigitizeCurve->setVisible (
false);
1127 m_dlgSettingsExportFormat->setVisible (
false);
1128 m_dlgSettingsColorFilter->setVisible (
false);
1129 m_dlgSettingsAxesChecker->setVisible (
false);
1130 m_dlgSettingsGridDisplay->setVisible (
false);
1131 m_dlgSettingsGridRemoval->setVisible (
false);
1132 m_dlgSettingsPointMatch->setVisible (
false);
1133 m_dlgSettingsSegments->setVisible (
false);
1134 m_dlgSettingsGeneral->setVisible (
false);
1135 m_dlgSettingsMainWindow->setVisible (
false);
1138 void MainWindow::createScene ()
1140 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1144 m_layout->addWidget (m_view);
1147 void MainWindow::createStateContextBackground ()
1149 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1154 void MainWindow::createStateContextDigitize ()
1156 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1163 void MainWindow::createStateContextTransformation ()
1165 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1167 ENGAUGE_CHECK_PTR (m_scene);
1173 void MainWindow::createStatusBar ()
1175 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1177 m_statusBar =
new StatusBar (*statusBar ());
1178 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1179 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1182 void MainWindow::createToolBars ()
1184 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1186 const int VIEW_SIZE = 22;
1189 m_cmbBackground =
new QComboBox ();
1190 m_cmbBackground->setEnabled (
false);
1191 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1192 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n"
1193 "Select background image:\n"
1194 "1) No background which highlights points\n"
1195 "2) Original image which shows everything\n"
1196 "3) Filtered image which highlights important details"));
1197 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1198 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1199 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1201 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1204 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1205 m_toolBackground->addWidget (m_cmbBackground);
1206 addToolBar (m_toolBackground);
1209 m_cmbCurve =
new QComboBox ();
1210 m_cmbCurve->setEnabled (
false);
1211 m_cmbCurve->setMinimumWidth (180);
1212 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1213 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n"
1214 "Select curve for any new points. Every point belongs to one curve."));
1215 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1218 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1219 m_toolDigitize->addAction (m_actionDigitizeSelect);
1220 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1221 m_toolDigitize->addAction (m_actionDigitizeAxis);
1222 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1223 m_toolDigitize->addAction (m_actionDigitizeCurve);
1224 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1225 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1226 m_toolDigitize->addAction (m_actionDigitizeSegment);
1227 m_toolDigitize->addWidget (m_cmbCurve);
1228 addToolBar (m_toolDigitize);
1232 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1233 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1234 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1235 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n"
1236 "Points style for the currently selected curve. The points style is only "
1237 "displayed in this toolbar. To change the points style, "
1238 "use the Curve Properties dialog."));
1241 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1242 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1243 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1244 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n"
1245 "View of filter for the current curve in Segment Fill mode. The filter settings are only "
1246 "displayed in this toolbar. To changed the filter settings, "
1247 "use the Color Picker mode or the Filter Settings dialog."));
1250 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1251 m_toolSettingsViews->addWidget (m_viewPointStyle);
1252 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1253 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1254 addToolBar (m_toolSettingsViews);
1257 m_cmbCoordSystem =
new QComboBox;
1258 m_cmbCoordSystem->setEnabled (
false);
1259 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1260 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n"
1261 "Currently selected coordinate system. This is used to switch between coordinate systems "
1262 "in documents with multiple coordinate systems"));
1263 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1265 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1266 m_btnShowAll->setEnabled (
false);
1267 m_btnShowAll->setAcceptDrops(
false);
1268 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1269 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n"
1270 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1271 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1272 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1274 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1275 m_btnPrintAll->setEnabled (
false);
1276 m_btnPrintAll->setAcceptDrops(
false);
1277 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1278 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n"
1279 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1280 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1282 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1283 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1284 m_toolCoordSystem->addWidget (m_btnShowAll);
1285 m_toolCoordSystem->addWidget (m_btnPrintAll);
1286 addToolBar (m_toolCoordSystem);
1289 void MainWindow::createTutorial ()
1291 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1294 m_tutorialDlg->setModal (
true);
1295 m_tutorialDlg->setMinimumSize (500, 400);
1296 m_tutorialDlg->hide();
1299 void MainWindow::createZoomMap ()
1301 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1303 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1304 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1305 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1306 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1307 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1308 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1309 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1310 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1311 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1312 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1315 ZoomFactor MainWindow::currentZoomFactor ()
const
1317 if (m_actionZoom1To1->isChecked()) {
1319 }
else if (m_actionZoom1To2->isChecked()) {
1321 }
else if (m_actionZoom1To4->isChecked()) {
1323 }
else if (m_actionZoom1To8->isChecked()) {
1325 }
else if (m_actionZoom1To16->isChecked()) {
1326 return ZOOM_1_TO_16;
1327 }
else if (m_actionZoom2To1->isChecked()) {
1329 }
else if (m_actionZoom4To1->isChecked()) {
1331 }
else if (m_actionZoom8To1->isChecked()) {
1333 }
else if (m_actionZoom16To1->isChecked()) {
1334 return ZOOM_16_TO_1;
1335 }
else if (m_actionZoomFill->isChecked()) {
1338 ENGAUGE_ASSERT (
false);
1344 if (event->type () == QEvent::KeyPress) {
1346 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1349 if ((eventKeyPress->key() == Qt::Key_E) &&
1350 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1351 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1361 return QObject::eventFilter (target, event);
1365 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1367 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1374 QString regressionFile = QString (
"%1_%2")
1375 .arg (m_regressionFile)
1389 fileExport (regressionFile,
1396 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const
1398 QString outFileName = fileName;
1400 outFileName = outFileName.replace (
".xml",
".csv_actual");
1401 outFileName = outFileName.replace (
".dig",
".csv_actual");
1402 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1407 void MainWindow::fileExport(
const QString &fileName,
1410 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport"
1411 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1412 <<
" fileName=" << fileName.toLatin1().data();
1414 QFile file (fileName);
1415 if (file.open(QIODevice::WriteOnly)) {
1417 QTextStream str (&file);
1428 updateChecklistGuide ();
1432 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport"
1433 <<
" file=" << fileName.toLatin1().data()
1434 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1435 QMessageBox::critical (0,
1436 engaugeWindowTitle(),
1437 tr (
"Unable to export to file ") + fileName);
1441 void MainWindow::fileImport (
const QString &fileName,
1442 ImportType importType)
1444 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport"
1445 <<
" fileName=" << fileName.toLatin1 ().data ()
1446 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1447 <<
" importType=" << importType;
1449 QString originalFileOld = m_originalFile;
1450 bool originalFileWasImported = m_originalFileWasImported;
1452 m_originalFile = fileName;
1453 m_originalFileWasImported =
true;
1455 if (importType == IMPORT_TYPE_ADVANCED) {
1466 bool loaded =
false;
1468 #ifdef ENGAUGE_JPEG2000
1470 loaded = jpeg2000.
load (fileName,
1472 #endif // ENGAUGE_JPEG2000
1478 PdfReturn pdfReturn = pdf.
load (fileName,
1482 m_isErrorReportRegressionTest);
1483 if (pdfReturn == PDF_RETURN_CANCELED) {
1490 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1492 #endif // ENGAUGE_PDF
1496 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1499 m_isErrorReportRegressionTest);
1500 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1507 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1511 QString msg = QString(
"%1 %2 %3 %4.")
1512 .arg (tr (
"Cannot read file"))
1514 .arg (tr (
"from directory"))
1515 .arg (QDir::currentPath());
1516 QMessageBox::warning (
this,
1517 engaugeWindowTitle(),
1521 m_originalFile = originalFileOld;
1522 m_originalFileWasImported = originalFileWasImported;
1526 loaded = loadImage (fileName,
1533 if (importType == IMPORT_TYPE_ADVANCED) {
1543 m_originalFile = originalFileOld;
1544 m_originalFileWasImported = originalFileWasImported;
1550 void MainWindow::fileImportWithPrompts (ImportType importType)
1552 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts"
1553 <<
" importType=" << importType;
1557 bool okToContinue =
true;
1558 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1559 okToContinue = maybeSave ();
1565 QTextStream str (&filter);
1568 QList<QByteArray>::const_iterator itr;
1569 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1570 QStringList supportedImageFormatStrings;
1571 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1572 QByteArray arr = *itr;
1573 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1574 supportedImageFormatStrings << extensionAsWildcard;
1576 #ifdef ENGAUGE_JPEG2000
1579 #endif // ENGAUGE_JPEG2000
1582 supportedImageFormatStrings <<
"*.pdf";
1583 #endif // ENGAUGE_PDF
1585 supportedImageFormatStrings.sort();
1587 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1591 str <<
";; All Files (*.*)";
1593 QString fileName = QFileDialog::getOpenFileName (
this,
1595 QDir::currentPath (),
1597 if (!fileName.isEmpty ()) {
1600 fileImport (fileName,
1606 void MainWindow::filePaste (ImportType importType)
1608 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste"
1609 <<
" importType=" << importType;
1611 QString originalFileOld = m_originalFile;
1612 bool originalFileWasImported = m_originalFileWasImported;
1614 QString fileName (
"clipboard");
1615 m_originalFile = fileName;
1616 m_originalFileWasImported =
true;
1618 if (importType == IMPORT_TYPE_ADVANCED) {
1629 QImage image = QApplication::clipboard()->image();
1631 bool loaded =
false;
1633 loaded = !image.isNull();
1637 QMessageBox::warning (
this,
1638 engaugeWindowTitle(),
1639 QString(
"%1 %2 %3 %4.")
1640 .arg (tr (
"Cannot read file"))
1642 .arg (tr (
"from directory"))
1643 .arg (QDir::currentPath ()));
1646 m_originalFile = originalFileOld;
1647 m_originalFileWasImported = originalFileWasImported;
1651 loaded = loadImage (fileName,
1658 if (importType == IMPORT_TYPE_ADVANCED) {
1668 m_originalFile = originalFileOld;
1669 m_originalFileWasImported = originalFileWasImported;
1675 void MainWindow::ghostsCreate ()
1677 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1679 ENGAUGE_ASSERT (m_ghosts == 0);
1701 void MainWindow::ghostsDestroy ()
1703 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1705 ENGAUGE_CHECK_PTR (m_ghosts);
1723 void MainWindow::loadCoordSystemListFromCmdMediator ()
1725 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1727 m_cmbCoordSystem->clear();
1731 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1732 int index1Based = i + 1;
1733 m_cmbCoordSystem->addItem (QString::number (index1Based),
1738 m_cmbCoordSystem->setCurrentIndex (0);
1741 bool enable = (m_cmbCoordSystem->count() > 1);
1742 m_cmbCoordSystem->setEnabled (enable);
1743 m_btnShowAll->setEnabled (enable);
1744 m_btnPrintAll->setEnabled (enable);
1747 void MainWindow::loadCurveListFromCmdMediator ()
1749 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1751 m_cmbCurve->clear ();
1753 QStringList::iterator itr;
1754 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1756 QString curvesGraphName = *itr;
1757 m_cmbCurve->addItem (curvesGraphName);
1764 void MainWindow::loadDocumentFile (
const QString &fileName)
1766 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1768 QApplication::setOverrideCursor(Qt::WaitCursor);
1774 setCurrentPathFromFile (fileName);
1775 rebuildRecentFileListForCurrentFile(fileName);
1776 m_currentFile = fileName;
1778 if (m_cmdMediator != 0) {
1779 delete m_cmdMediator;
1784 setupAfterLoadNewDocument (fileName,
1786 IMPORT_TYPE_SIMPLE);
1789 m_actionDigitizeSelect->setChecked (
true);
1790 slotDigitizeSelect();
1792 m_engaugeFile = fileName;
1793 m_originalFile = fileName;
1794 m_originalFileWasImported =
false;
1799 QApplication::restoreOverrideCursor();
1803 QApplication::restoreOverrideCursor();
1805 QMessageBox::warning (
this,
1806 engaugeWindowTitle(),
1807 QString(
"%1 %2 %3 %4:\n%5.")
1808 .arg (tr (
"Cannot read file"))
1810 .arg (tr (
"from directory"))
1811 .arg (QDir::currentPath ())
1818 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1820 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile"
1821 <<
" file=" << errorReportFile.toLatin1().data();
1823 QFile file (errorReportFile);
1824 if (!file.exists()) {
1826 QFileInfo fileInfo (errorReportFile);
1828 QMessageBox::critical (
this,
1829 engaugeWindowTitle(),
1830 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1835 QXmlStreamReader reader (&file);
1836 file.open(QIODevice::ReadOnly | QIODevice::Text);
1846 setupAfterLoadNewDocument (errorReportFile,
1847 "Error report opened",
1848 IMPORT_TYPE_SIMPLE);
1851 m_actionDigitizeSelect->setChecked (
true);
1852 slotDigitizeSelect();
1857 bool MainWindow::loadImage (
const QString &fileName,
1858 const QImage &image,
1859 ImportType importType)
1861 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage"
1862 <<
" fileName=" << fileName.toLatin1 ().data ()
1863 <<
" importType=" << importType;
1866 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1867 success = loadImageReplacingImage (fileName,
1871 success = loadImageNewDocument (fileName,
1879 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1880 const QImage &image,
1881 ImportType importType)
1883 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument"
1884 <<
" fileName=" << fileName.toLatin1 ().data ()
1885 <<
" importType=" << importType;
1887 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1889 QApplication::setOverrideCursor(Qt::WaitCursor);
1892 QApplication::restoreOverrideCursor();
1894 setCurrentPathFromFile (fileName);
1896 m_engaugeFile = EMPTY_FILENAME;
1898 if (m_cmdMediator != 0) {
1899 delete m_cmdMediator;
1904 bool accepted = setupAfterLoadNewDocument (fileName,
1905 tr (
"File imported"),
1911 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1912 (m_fileCmdScript == 0)) {
1917 if (wizard->exec() == QDialog::Accepted) {
1919 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1933 m_actionViewChecklistGuide->setChecked (
true);
1936 loadCurveListFromCmdMediator();
1939 loadCoordSystemListFromCmdMediator();
1945 m_actionDigitizeAxis->setChecked (
true);
1946 slotDigitizeAxis ();
1954 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1955 const QImage &image,
1956 ImportType importType)
1958 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage"
1959 <<
" fileName=" << fileName.toLatin1 ().data ()
1960 <<
" importType=" << importType;
1962 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1964 setCurrentPathFromFile (fileName);
1966 m_engaugeFile = EMPTY_FILENAME;
1968 ENGAUGE_ASSERT (m_cmdMediator != 0);
1972 bool accepted = setupAfterLoadReplacingImage (fileName,
1973 tr (
"File imported"),
1981 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
1983 QFile file (m_originalFile);
1987 if (!file.open (QIODevice::ReadOnly)) {
1991 domInputFile.setContent (&file);
1995 void MainWindow::loadToolTips()
1997 if (m_actionViewToolTips->isChecked ()) {
2000 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2001 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2002 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2003 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2004 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2005 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2006 m_cmbBackground->setToolTip (tr (
"Background image."));
2007 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2008 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2009 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2014 m_actionDigitizeSelect->setToolTip (
"");
2015 m_actionDigitizeAxis->setToolTip (
"");
2016 m_actionDigitizeCurve->setToolTip (
"");
2017 m_actionDigitizePointMatch->setToolTip (
"");
2018 m_actionDigitizeColorPicker->setToolTip (
"");
2019 m_actionDigitizeSegment->setToolTip (
"");
2020 m_cmbBackground->setToolTip (
"");
2021 m_cmbCurve->setToolTip (
"");
2022 m_viewPointStyle->setToolTip (
"");
2023 m_viewSegmentFilter->setToolTip (
"");
2028 bool MainWindow::maybeSave()
2030 if (m_cmdMediator != 0) {
2032 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2033 engaugeWindowTitle(),
2034 tr(
"The document has been modified.\n"
2035 "Do you want to save your changes?"),
2036 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2037 if (ret == QMessageBox::Save) {
2038 return slotFileSave();
2039 }
else if (ret == QMessageBox::Cancel) {
2050 const QString &fileName)
const
2058 QString csvExtension = QString (
".%1")
2060 QString tsvExtension = QString (
".%1")
2062 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2063 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2067 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2068 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2069 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2070 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2074 return modelExportFormatAfter;
2079 return m_modelMainWindow;
2082 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2084 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2086 setWindowFilePath (filePath);
2088 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2089 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2090 recentFilePaths.removeAll (filePath);
2091 recentFilePaths.prepend (filePath);
2092 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2093 recentFilePaths.removeLast ();
2095 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2097 updateRecentFileList();
2102 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2104 if (m_actionZoomFill->isChecked ()) {
2109 bool MainWindow::saveDocumentFile (
const QString &fileName)
2111 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2113 QFile file(fileName);
2114 if (!file.open(QFile::WriteOnly)) {
2115 QMessageBox::warning (
this,
2116 engaugeWindowTitle(),
2117 QString (
"%1 %2: \n%3.")
2118 .arg(tr (
"Cannot write file"))
2120 .arg(file.errorString()));
2124 rebuildRecentFileListForCurrentFile (fileName);
2126 QApplication::setOverrideCursor (Qt::WaitCursor);
2127 QXmlStreamWriter writer(&file);
2128 writer.setAutoFormatting(
true);
2129 writer.writeStartDocument();
2130 writer.writeDTD(
"<!DOCTYPE engauge>");
2132 writer.writeEndDocument();
2133 QApplication::restoreOverrideCursor ();
2137 m_cmdMediator->setClean ();
2139 setCurrentFile(fileName);
2140 m_engaugeFile = fileName;
2150 const char *comment)
const
2154 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2156 QString report = saveErrorReportFileAndExitXml (context,
2163 if (dlg.exec() == QDialog::Accepted) {
2171 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2174 const char *comment)
const
2176 const bool DEEP_COPY =
true;
2178 QString xmlErrorReport;
2179 QXmlStreamWriter writer (&xmlErrorReport);
2180 writer.setAutoFormatting(
true);
2183 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2186 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2187 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2188 writer.writeEndElement();
2192 QXmlStreamReader reader (m_startingDocumentSnapshot);
2193 while (!reader.atEnd ()) {
2195 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2196 reader.tokenType() != QXmlStreamReader::EndDocument) {
2197 writer.writeCurrentToken (reader);
2202 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2203 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2204 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2205 writer.writeEndElement();
2208 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2209 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2210 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2211 writer.writeEndElement();
2214 m_cmdMediator->
saveXml(writer);
2217 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2218 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2219 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2220 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2221 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2222 writer.writeEndElement();
2224 writer.writeEndElement();
2227 QDomDocument domErrorReport (
"ErrorReport");
2228 domErrorReport.setContent (xmlErrorReport);
2231 if (!m_originalFileWasImported) {
2235 QDomDocument domInputFile;
2236 loadInputFileForErrorReport (domInputFile);
2237 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2238 if (!domInputFile.isNull()) {
2239 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2241 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2242 if (nodesFileTo.count () > 0) {
2243 QDomNode nodeFileTo = nodesFileTo.at (0);
2244 nodeFileTo.appendChild (fragmentFileFrom);
2251 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2252 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2253 QDomNode nodeDocument = nodesDocument.at (i);
2254 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2255 if (!elemImage.isNull()) {
2258 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2259 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2261 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2262 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2264 QDomNode nodeReplacement;
2265 QDomElement elemReplacement = nodeReplacement.toElement();
2266 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2267 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2270 nodeDocument.insertBefore (nodeReplacement,
2272 nodeDocument.removeChild(elemImage);
2278 return domErrorReport.toString();
2281 void MainWindow::saveStartingDocumentSnapshot()
2283 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2285 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2286 writer.setAutoFormatting (
true);
2292 ENGAUGE_CHECK_PTR (m_scene);
2298 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2300 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2302 int index = m_cmbBackground->findData (backgroundImage);
2303 ENGAUGE_ASSERT (index >= 0);
2305 m_cmbBackground->setCurrentIndex(index);
2307 return previousBackground;
2312 return m_cmbCurve->currentText ();
2315 void MainWindow::setCurrentFile (
const QString &fileName)
2317 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2319 QString fileNameStripped;
2320 if (!fileName.isEmpty()) {
2323 QFileInfo fileInfo (fileName);
2324 fileNameStripped = fileInfo.baseName();
2327 m_currentFile = fileNameStripped;
2328 m_currentFileWithPathAndFileExtension = fileName;
2330 updateWindowTitle ();
2333 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2335 QDir dir = QFileInfo (fileName).absoluteDir();
2337 if (dir.exists ()) {
2339 bool success = QDir::setCurrent (dir.absolutePath ());
2340 ENGAUGE_ASSERT (success);
2348 void MainWindow::setPixmap (
const QString &curveSelected,
2349 const QPixmap &pixmap)
2351 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2358 m_backgroundStateContext->
setPixmap (m_transformation,
2365 void MainWindow::settingsRead (
bool isReset)
2367 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2374 settingsReadEnvironment (settings);
2375 settingsReadMainWindow (settings);
2378 void MainWindow::settingsReadEnvironment (QSettings &settings)
2380 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2381 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2382 QDir::currentPath ()).toString ());
2383 settings.endGroup ();
2386 void MainWindow::settingsReadMainWindow (QSettings &settings)
2388 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2391 resize (settings.value (SETTINGS_SIZE,
2392 QSize (600, 600)).toSize ());
2393 move (settings.value (SETTINGS_POS,
2394 QPoint (200, 200)).toPoint ());
2398 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2399 QSize (900, 600)).toSize();
2400 m_helpWindow->resize (helpSize);
2401 if (settings.contains (SETTINGS_HELP_POS)) {
2402 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2403 m_helpWindow->move (helpPos);
2408 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2412 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2414 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2415 m_toolBackground->setVisible (viewBackgroundToolBar);
2416 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2417 BACKGROUND_IMAGE_FILTERED).toInt ();
2418 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2419 m_cmbBackground->setCurrentIndex (indexBackground);
2422 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2424 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2425 m_toolDigitize->setVisible (viewDigitizeToolBar);
2428 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2430 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2431 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2434 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2436 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2437 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2440 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2442 m_actionViewToolTips->setChecked (viewToolTips);
2446 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2449 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2450 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2451 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2453 addDockWindow (m_dockChecklistGuide,
2455 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2456 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2457 Qt::RightDockWidgetArea);
2458 addDockWindow (m_dockGeometryWindow,
2460 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2461 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2462 Qt::RightDockWidgetArea);
2467 QLocale localeDefault;
2468 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2469 QVariant (localeDefault.language())).toInt();
2470 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2471 QVariant (localeDefault.country())).toInt();
2472 QLocale locale (language,
2474 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2475 QVariant (ZOOM_1_TO_1)).toInt());
2477 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2478 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2479 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2480 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2481 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2482 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2483 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2484 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2485 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2486 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2488 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2490 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2494 settings.endGroup();
2497 void MainWindow::settingsWrite ()
2499 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2501 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2502 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2503 settings.endGroup ();
2505 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2506 settings.setValue (SETTINGS_SIZE, size ());
2507 settings.setValue (SETTINGS_POS, pos ());
2509 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2510 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2512 if (m_dockChecklistGuide->isFloating()) {
2514 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2515 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2519 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2522 if (m_dockGeometryWindow->isFloating()) {
2524 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2525 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2529 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2532 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2533 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2534 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2535 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2536 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2537 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2538 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2539 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2540 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2541 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2542 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2543 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2544 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2545 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2546 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2547 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2548 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2549 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2550 settings.endGroup ();
2553 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2554 const QString &temporaryMessage ,
2555 ImportType importType)
2557 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument"
2558 <<
" file=" << fileName.toLatin1().data()
2559 <<
" message=" << temporaryMessage.toLatin1().data()
2560 <<
" importType=" << importType;
2565 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2569 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2573 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2575 m_cmdMediator->
pixmap ());
2579 if (importType == IMPORT_TYPE_ADVANCED) {
2581 applyZoomFactorAfterLoad();
2584 dlgImportAdvanced.exec();
2586 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2590 int numberCoordSystem = dlgImportAdvanced.numberCoordSystem();
2599 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2600 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2601 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2602 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2603 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2604 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2605 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2606 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2607 loadCurveListFromCmdMediator ();
2608 loadCoordSystemListFromCmdMediator ();
2611 m_isDocumentExported =
false;
2620 m_cmbCurve->currentText ());
2621 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2623 applyZoomFactorAfterLoad();
2625 setCurrentFile(fileName);
2629 saveStartingDocumentSnapshot();
2636 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2637 const QString &temporaryMessage ,
2638 ImportType importType)
2640 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage"
2641 <<
" file=" << fileName.toLatin1().data()
2642 <<
" message=" << temporaryMessage.toLatin1().data()
2643 <<
" importType=" << importType;
2648 m_cmdMediator->clear();
2651 m_cmdMediator->
pixmap ());
2653 m_isDocumentExported =
false;
2655 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2657 applyZoomFactorAfterLoad();
2659 setCurrentFile(fileName);
2663 saveStartingDocumentSnapshot();
2672 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent"
2673 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2675 QMainWindow::showEvent (event);
2677 if (m_loadStartupFiles.count() > 0) {
2679 m_timerLoadStartupFiles =
new QTimer;
2680 m_timerLoadStartupFiles->setSingleShot (
true);
2681 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2682 m_timerLoadStartupFiles->start (0);
2692 void MainWindow::slotBtnPrintAll ()
2694 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2698 QPrinter printer (QPrinter::HighResolution);
2699 QPrintDialog dlg (&printer,
this);
2700 if (dlg.exec() == QDialog::Accepted) {
2701 QPainter painter (&printer);
2702 m_view->render (&painter);
2709 void MainWindow::slotBtnShowAllPressed ()
2711 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2717 void MainWindow::slotBtnShowAllReleased ()
2719 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2725 void MainWindow::slotCanRedoChanged (
bool canRedo)
2727 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2729 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2732 void MainWindow::slotCanUndoChanged (
bool canUndo)
2734 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2736 m_actionEditUndo->setEnabled (canUndo);
2739 void MainWindow::slotChecklistClosed()
2741 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2743 m_actionViewChecklistGuide->setChecked (
false);
2746 void MainWindow::slotCleanChanged(
bool clean)
2748 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2750 setWindowModified (!clean);
2753 void MainWindow::slotCmbBackground(
int currentIndex)
2755 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2757 switch (currentIndex) {
2758 case BACKGROUND_IMAGE_NONE:
2759 if (!m_actionViewBackgroundNone->isChecked()) {
2760 m_actionViewBackgroundNone->toggle();
2764 case BACKGROUND_IMAGE_ORIGINAL:
2765 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2766 m_actionViewBackgroundOriginal->toggle();
2770 case BACKGROUND_IMAGE_FILTERED:
2771 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2772 m_actionViewBackgroundFiltered->toggle();
2780 void MainWindow::slotCmbCoordSystem(
int index)
2782 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2788 m_cmdMediator->push (cmd);
2791 void MainWindow::slotCmbCurve(
int )
2793 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2798 m_cmbCurve->currentText ());
2802 updateViewedCurves();
2804 updateGeometryWindow();
2807 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2809 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2815 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2817 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2823 void MainWindow::slotDigitizeAxis ()
2825 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2828 DIGITIZE_STATE_AXIS);
2829 m_cmbCurve->setEnabled (
false);
2834 void MainWindow::slotDigitizeColorPicker ()
2836 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2839 DIGITIZE_STATE_COLOR_PICKER);
2840 m_cmbCurve->setEnabled (
true);
2845 void MainWindow::slotDigitizeCurve ()
2847 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2850 DIGITIZE_STATE_CURVE);
2851 m_cmbCurve->setEnabled (
true);
2856 void MainWindow::slotDigitizePointMatch ()
2858 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2861 DIGITIZE_STATE_POINT_MATCH);
2862 m_cmbCurve->setEnabled (
true);
2867 void MainWindow::slotDigitizeSegment ()
2869 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2872 DIGITIZE_STATE_SEGMENT);
2873 m_cmbCurve->setEnabled (
true);
2878 void MainWindow::slotDigitizeSelect ()
2880 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2883 DIGITIZE_STATE_SELECT);
2884 m_cmbCurve->setEnabled (
false);
2889 void MainWindow::slotEditCopy ()
2891 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2894 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2904 void MainWindow::slotEditCut ()
2906 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2909 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2919 void MainWindow::slotEditDelete ()
2921 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
2924 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2934 void MainWindow::slotEditMenu ()
2936 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
2938 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2939 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2942 void MainWindow::slotEditPaste ()
2944 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
2947 void MainWindow::slotEditPasteAsNew ()
2949 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
2951 filePaste (IMPORT_TYPE_SIMPLE);
2954 void MainWindow::slotEditPasteAsNewAdvanced ()
2956 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
2958 filePaste (IMPORT_TYPE_ADVANCED);
2961 void MainWindow::slotFileClose()
2963 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
2977 DIGITIZE_STATE_EMPTY);
2983 m_backgroundStateContext->
close ();
2986 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2989 m_dockGeometryWindow->
clear ();
2992 delete m_cmdMediator;
2998 setWindowTitle (engaugeWindowTitle ());
3000 m_gridLines.
clear();
3005 void MainWindow::slotFileExport ()
3007 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3012 QString filter = QString (
"%1;;%2;;All files (*.*)")
3017 QString defaultFileName = QString (
"%1/%2.%3")
3018 .arg (QDir::currentPath ())
3019 .arg (m_currentFile)
3022 QString filterCsv = exportStrategy.
filterCsv ();
3023 QString fileName = dlg.getSaveFileName (
this,
3028 if (!fileName.isEmpty ()) {
3030 fileExport(fileName,
3039 void MainWindow::slotFileImport ()
3041 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3043 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3046 void MainWindow::slotFileImportAdvanced ()
3048 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3050 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3053 void MainWindow::slotFileImportDraggedImage(QImage image)
3055 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3060 IMPORT_TYPE_SIMPLE);
3063 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3065 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3070 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3072 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3075 loadImage (fileName,
3077 IMPORT_TYPE_SIMPLE);
3080 void MainWindow::slotFileImportImageReplace ()
3082 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3084 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3087 void MainWindow::slotFileOpen()
3089 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3095 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3096 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3097 .arg (ENGAUGE_FILENAME_EXTENSION);
3099 QString fileName = QFileDialog::getOpenFileName (
this,
3100 tr(
"Open Document"),
3101 QDir::currentPath (),
3103 if (!fileName.isEmpty ()) {
3105 loadDocumentFile (fileName);
3111 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3113 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3115 loadDocumentFile (fileName);
3118 void MainWindow::slotFilePrint()
3120 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3122 QPrinter printer (QPrinter::HighResolution);
3123 QPrintDialog dlg (&printer,
this);
3124 if (dlg.exec() == QDialog::Accepted) {
3125 QPainter painter (&printer);
3126 m_view->render (&painter);
3131 bool MainWindow::slotFileSave()
3133 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3135 if (m_engaugeFile.isEmpty()) {
3136 return slotFileSaveAs();
3138 return saveDocumentFile (m_engaugeFile);
3142 bool MainWindow::slotFileSaveAs()
3144 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3147 QString filenameDefault = m_currentFile;
3148 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3149 filenameDefault = QString (
"%1.%2")
3150 .arg (m_currentFile)
3151 .arg (ENGAUGE_FILENAME_EXTENSION);
3154 if (!m_engaugeFile.isEmpty()) {
3155 filenameDefault = m_engaugeFile;
3158 QString filterDigitizer = QString (
"%1 (*.%2)")
3159 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3160 .arg (ENGAUGE_FILENAME_EXTENSION);
3161 QString filterAll (
"All files (*. *)");
3163 QStringList filters;
3164 filters << filterDigitizer;
3165 filters << filterAll;
3167 QFileDialog dlg(
this);
3168 dlg.setFileMode (QFileDialog::AnyFile);
3169 dlg.selectNameFilter (filterDigitizer);
3170 dlg.setNameFilters (filters);
3171 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
3174 dlg.setWindowModality(Qt::WindowModal);
3176 dlg.setAcceptMode(QFileDialog::AcceptSave);
3177 dlg.selectFile(filenameDefault);
3180 QStringList files = dlg.selectedFiles();
3181 return saveDocumentFile(files.at(0));
3187 void MainWindow::slotGeometryWindowClosed()
3189 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3191 m_actionViewGeometryWindow->setChecked (
false);
3194 void MainWindow::slotHelpAbout()
3196 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3202 void MainWindow::slotHelpTutorial()
3204 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3206 m_tutorialDlg->show ();
3207 m_tutorialDlg->exec ();
3210 void MainWindow::slotKeyPress (Qt::Key key,
3211 bool atLeastOneSelectedItem)
3213 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress"
3214 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3215 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3219 atLeastOneSelectedItem);
3222 void MainWindow::slotLoadStartupFiles ()
3224 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3226 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3228 QString fileName = m_loadStartupFiles.front();
3229 m_loadStartupFiles.pop_front();
3235 loadDocumentFile (fileName);
3239 fileImport (fileName,
3240 IMPORT_TYPE_SIMPLE);
3244 if (m_loadStartupFiles.count() > 0) {
3248 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3249 m_loadStartupFiles);
3253 void MainWindow::slotMouseMove (QPointF pos)
3258 if (m_cmdMediator != 0) {
3261 QString coordsScreen, coordsGraph, resolutionGraph;
3280 void MainWindow::slotMousePress (QPointF pos)
3282 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3290 void MainWindow::slotMouseRelease (QPointF pos)
3292 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3294 if (pos.x() < 0 || pos.y() < 0) {
3308 void MainWindow::slotRecentFileAction ()
3310 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3312 QAction *action = qobject_cast<QAction*>(sender ());
3315 QString fileName = action->data().toString();
3316 loadDocumentFile (fileName);
3320 void MainWindow::slotRecentFileClear ()
3322 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3324 QStringList emptyList;
3326 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3327 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3330 updateRecentFileList();
3333 void MainWindow::slotRedoTextChanged (
const QString &text)
3335 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3337 QString completeText (
"Redo");
3338 if (!text.isEmpty ()) {
3339 completeText += QString (
" \"%1\"").arg (text);
3341 m_actionEditRedo->setText (completeText);
3344 void MainWindow::slotSettingsAxesChecker ()
3346 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3348 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3349 m_dlgSettingsAxesChecker->show ();
3352 void MainWindow::slotSettingsColorFilter ()
3354 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3356 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3357 m_dlgSettingsColorFilter->show ();
3360 void MainWindow::slotSettingsCoords ()
3362 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3364 m_dlgSettingsCoords->
load (*m_cmdMediator);
3365 m_dlgSettingsCoords->show ();
3368 void MainWindow::slotSettingsCurveAddRemove ()
3370 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3372 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3373 m_dlgSettingsCurveAddRemove->show ();
3376 void MainWindow::slotSettingsCurveProperties ()
3378 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3380 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3382 m_dlgSettingsCurveProperties->show ();
3385 void MainWindow::slotSettingsDigitizeCurve ()
3387 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3389 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3390 m_dlgSettingsDigitizeCurve->show ();
3393 void MainWindow::slotSettingsExportFormat ()
3395 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3398 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3399 m_dlgSettingsExportFormat->show ();
3406 void MainWindow::slotSettingsGeneral ()
3408 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3410 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3411 m_dlgSettingsGeneral->show ();
3414 void MainWindow::slotSettingsGridDisplay()
3416 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3418 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3419 m_dlgSettingsGridDisplay->show ();
3422 void MainWindow::slotSettingsGridRemoval ()
3424 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3426 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3427 m_dlgSettingsGridRemoval->show ();
3430 void MainWindow::slotSettingsPointMatch ()
3432 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3434 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3435 m_dlgSettingsPointMatch->show ();
3438 void MainWindow::slotSettingsSegments ()
3440 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3442 m_dlgSettingsSegments->
load (*m_cmdMediator);
3443 m_dlgSettingsSegments->show ();
3446 void MainWindow::slotSettingsMainWindow ()
3448 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3452 m_dlgSettingsMainWindow->show ();
3455 void MainWindow::slotTimeoutRegressionErrorReport ()
3457 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport"
3458 <<
" cmdStackIndex=" << m_cmdMediator->index()
3459 <<
" cmdStackCount=" << m_cmdMediator->count();
3461 if (m_cmdStackShadow->
canRedo()) {
3464 QDir::setCurrent (m_startupDirectory);
3469 QDir::setCurrent (m_startupDirectory);
3474 exportAllCoordinateSystemsAfterRegressionTests ();
3478 m_cmdMediator->setClean();
3484 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3486 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3488 if (m_fileCmdScript->
canRedo()) {
3491 QDir::setCurrent (m_startupDirectory);
3493 m_fileCmdScript->
redo(*
this);
3496 QDir::setCurrent (m_startupDirectory);
3501 if (m_cmdMediator != 0) {
3504 exportAllCoordinateSystemsAfterRegressionTests ();
3508 m_cmdMediator->setClean();
3518 void MainWindow::slotUndoTextChanged (
const QString &text)
3520 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3522 QString completeText (
"Undo");
3523 if (!text.isEmpty ()) {
3524 completeText += QString (
" \"%1\"").arg (text);
3526 m_actionEditUndo->setText (completeText);
3529 void MainWindow::slotViewGridLines ()
3531 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3536 void MainWindow::slotViewGroupBackground(QAction *action)
3538 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3541 BackgroundImage backgroundImage;
3542 int indexBackground;
3543 if (action == m_actionViewBackgroundNone) {
3544 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3545 backgroundImage = BACKGROUND_IMAGE_NONE;
3546 }
else if (action == m_actionViewBackgroundOriginal) {
3547 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3548 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3549 }
else if (action == m_actionViewBackgroundFiltered) {
3550 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3551 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3553 ENGAUGE_ASSERT (
false);
3556 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3557 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3560 m_cmbBackground->setCurrentIndex (indexBackground);
3564 void MainWindow::slotViewGroupCurves(QAction * )
3566 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3568 updateViewedCurves ();
3571 void MainWindow::slotViewGroupStatus(QAction *action)
3573 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3575 ENGAUGE_CHECK_PTR (m_statusBar);
3577 if (action == m_actionStatusNever) {
3579 }
else if (action == m_actionStatusTemporary) {
3586 void MainWindow::slotViewToolBarBackground ()
3588 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3590 if (m_actionViewBackground->isChecked ()) {
3591 m_toolBackground->show();
3593 m_toolBackground->hide();
3597 void MainWindow::slotViewToolBarChecklistGuide ()
3599 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3601 if (m_actionViewChecklistGuide->isChecked ()) {
3602 m_dockChecklistGuide->show();
3604 m_dockChecklistGuide->hide();
3608 void MainWindow::slotViewToolBarCoordSystem ()
3610 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3612 if (m_actionViewCoordSystem->isChecked ()) {
3613 m_toolCoordSystem->show();
3615 m_toolCoordSystem->hide();
3619 void MainWindow::slotViewToolBarDigitize ()
3621 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3623 if (m_actionViewDigitize->isChecked ()) {
3624 m_toolDigitize->show();
3626 m_toolDigitize->hide();
3630 void MainWindow::slotViewToolBarGeometryWindow ()
3632 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3634 if (m_actionViewGeometryWindow->isChecked ()) {
3635 m_dockGeometryWindow->show();
3637 m_dockGeometryWindow->hide();
3641 void MainWindow::slotViewToolBarSettingsViews ()
3643 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3645 if (m_actionViewSettingsViews->isChecked ()) {
3646 m_toolSettingsViews->show();
3648 m_toolSettingsViews->hide();
3652 void MainWindow::slotViewToolTips ()
3654 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3659 void MainWindow::slotViewZoom(
int zoom)
3661 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3664 switch ((ZoomFactor) zoom) {
3666 m_actionZoom16To1->setChecked(
true);
3667 slotViewZoom16To1 ();
3670 m_actionZoom8To1->setChecked(
true);
3671 slotViewZoom8To1 ();
3674 m_actionZoom4To1->setChecked(
true);
3675 slotViewZoom4To1 ();
3678 m_actionZoom2To1->setChecked(
true);
3679 slotViewZoom2To1 ();
3682 m_actionZoom1To1->setChecked(
true);
3683 slotViewZoom1To1 ();
3686 m_actionZoom1To2->setChecked(
true);
3687 slotViewZoom1To2 ();
3690 m_actionZoom1To4->setChecked(
true);
3691 slotViewZoom1To4 ();
3694 m_actionZoom1To8->setChecked(
true);
3695 slotViewZoom1To8 ();
3698 m_actionZoom1To16->setChecked(
true);
3699 slotViewZoom1To16 ();
3702 m_actionZoomFill->setChecked(
true);
3703 slotViewZoomFill ();
3708 void MainWindow::slotViewZoom16To1 ()
3710 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3712 QTransform transform;
3713 transform.scale (16.0, 16.0);
3714 m_view->setTransform (transform);
3718 void MainWindow::slotViewZoom8To1 ()
3720 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3722 QTransform transform;
3723 transform.scale (8.0, 8.0);
3724 m_view->setTransform (transform);
3728 void MainWindow::slotViewZoom4To1 ()
3730 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3732 QTransform transform;
3733 transform.scale (4.0, 4.0);
3734 m_view->setTransform (transform);
3738 void MainWindow::slotViewZoom2To1 ()
3740 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3742 QTransform transform;
3743 transform.scale (2.0, 2.0);
3744 m_view->setTransform (transform);
3748 void MainWindow::slotViewZoom1To1 ()
3750 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
3752 QTransform transform;
3753 transform.scale (1.0, 1.0);
3754 m_view->setTransform (transform);
3758 void MainWindow::slotViewZoom1To2 ()
3760 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
3762 QTransform transform;
3763 transform.scale (0.5, 0.5);
3764 m_view->setTransform (transform);
3768 void MainWindow::slotViewZoom1To4 ()
3770 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
3772 QTransform transform;
3773 transform.scale (0.25, 0.25);
3774 m_view->setTransform (transform);
3778 void MainWindow::slotViewZoom1To8 ()
3780 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
3782 QTransform transform;
3783 transform.scale (0.125, 0.125);
3784 m_view->setTransform (transform);
3788 void MainWindow::slotViewZoom1To16 ()
3790 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
3792 QTransform transform;
3793 transform.scale (0.0625, 0.0625);
3794 m_view->setTransform (transform);
3798 void MainWindow::slotViewZoomFill ()
3800 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
3802 m_backgroundStateContext->
fitInView (*m_view);
3807 void MainWindow::slotViewZoomIn ()
3809 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3813 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3814 bool goto1To1 =
false;
3815 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3816 if (m_actionZoomFill->isChecked ()) {
3819 double xScale = m_view->transform().m11();
3820 double yScale = m_view->transform().m22();
3821 double scale = qMin(xScale, yScale);
3822 if (scale < 0.125) {
3824 }
else if (scale < 0.25) {
3826 }
else if (scale < 0.5) {
3828 }
else if (scale < 1) {
3830 }
else if (scale < 2) {
3832 }
else if (scale < 4) {
3834 }
else if (scale < 8) {
3840 goto16To1 = m_actionZoom8To1->isChecked ();
3841 goto8To1 = m_actionZoom4To1->isChecked ();
3842 goto4To1 = m_actionZoom2To1->isChecked ();
3843 goto2To1 = m_actionZoom1To1->isChecked ();
3844 goto1To1 = m_actionZoom1To2->isChecked ();
3845 goto1To2 = m_actionZoom1To4->isChecked ();
3846 goto1To4 = m_actionZoom1To8->isChecked ();
3847 goto1To8 = m_actionZoom1To16->isChecked ();
3852 m_actionZoom16To1->setChecked (
true);
3853 slotViewZoom16To1 ();
3854 }
else if (goto8To1) {
3855 m_actionZoom8To1->setChecked (
true);
3856 slotViewZoom8To1 ();
3857 }
else if (goto4To1) {
3858 m_actionZoom4To1->setChecked (
true);
3859 slotViewZoom4To1 ();
3860 }
else if (goto2To1) {
3861 m_actionZoom2To1->setChecked (
true);
3862 slotViewZoom2To1 ();
3863 }
else if (goto1To1) {
3864 m_actionZoom1To1->setChecked (
true);
3865 slotViewZoom1To1 ();
3866 }
else if (goto1To2) {
3867 m_actionZoom1To2->setChecked (
true);
3868 slotViewZoom1To2 ();
3869 }
else if (goto1To4) {
3870 m_actionZoom1To4->setChecked (
true);
3871 slotViewZoom1To4 ();
3872 }
else if (goto1To8) {
3873 m_actionZoom1To8->setChecked (
true);
3874 slotViewZoom1To8 ();
3875 }
else if (goto1To16) {
3876 m_actionZoom1To16->setChecked (
true);
3877 slotViewZoom1To16 ();
3881 void MainWindow::slotViewZoomInFromWheelEvent ()
3883 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
3885 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3886 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3889 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3894 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3898 void MainWindow::slotViewZoomOut ()
3900 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
3904 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3905 bool goto1To1 =
false;
3906 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3907 if (m_actionZoomFill->isChecked ()) {
3910 double xScale = m_view->transform().m11();
3911 double yScale = m_view->transform().m22();
3912 double scale = qMax(xScale, yScale);
3915 }
else if (scale > 4) {
3917 }
else if (scale > 2) {
3919 }
else if (scale > 1) {
3921 }
else if (scale > 0.5) {
3923 }
else if (scale > 0.25) {
3925 }
else if (scale > 0.125) {
3931 goto8To1 = m_actionZoom16To1->isChecked ();
3932 goto4To1 = m_actionZoom8To1->isChecked ();
3933 goto2To1 = m_actionZoom4To1->isChecked ();
3934 goto1To1 = m_actionZoom2To1->isChecked ();
3935 goto1To2 = m_actionZoom1To1->isChecked ();
3936 goto1To4 = m_actionZoom1To2->isChecked ();
3937 goto1To8 = m_actionZoom1To4->isChecked ();
3938 goto1To16 = m_actionZoom1To8->isChecked ();
3943 m_actionZoom1To16->setChecked (
true);
3944 slotViewZoom1To16 ();
3945 }
else if (goto1To8) {
3946 m_actionZoom1To8->setChecked (
true);
3947 slotViewZoom1To8 ();
3948 }
else if (goto1To4) {
3949 m_actionZoom1To4->setChecked (
true);
3950 slotViewZoom1To4 ();
3951 }
else if (goto1To2) {
3952 m_actionZoom1To2->setChecked (
true);
3953 slotViewZoom1To2 ();
3954 }
else if (goto1To1) {
3955 m_actionZoom1To1->setChecked (
true);
3956 slotViewZoom1To1 ();
3957 }
else if (goto2To1) {
3958 m_actionZoom2To1->setChecked (
true);
3959 slotViewZoom2To1 ();
3960 }
else if (goto4To1) {
3961 m_actionZoom4To1->setChecked (
true);
3962 slotViewZoom4To1 ();
3963 }
else if (goto8To1) {
3964 m_actionZoom8To1->setChecked (
true);
3965 slotViewZoom8To1 ();
3966 }
else if (goto16To1) {
3967 m_actionZoom16To1->setChecked (
true);
3968 slotViewZoom16To1 ();
3972 void MainWindow::slotViewZoomOutFromWheelEvent ()
3974 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
3976 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3977 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3980 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3985 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3989 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3991 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4000 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4002 m_timerRegressionErrorReport =
new QTimer();
4003 m_timerRegressionErrorReport->setSingleShot(
false);
4004 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4006 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4009 void MainWindow::startRegressionTestFileCmdScript()
4011 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4013 m_timerRegressionFileCmdScript =
new QTimer();
4014 m_timerRegressionFileCmdScript->setSingleShot(
false);
4015 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4017 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4022 return m_transformation;
4032 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4034 ENGAUGE_CHECK_PTR (m_cmdMediator);
4038 updateAfterCommandStatusBarCoords ();
4040 updateHighlightOpacity ();
4046 updateChecklistGuide ();
4047 updateGeometryWindow();
4051 writeCheckpointToLogFile ();
4055 m_view->setFocus ();
4058 void MainWindow::updateAfterCommandStatusBarCoords ()
4060 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4065 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4069 updateTransformationAndItsDependencies();
4072 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
4080 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
4088 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4097 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4098 QPointF posScreen = m_view->mapToScene (posLocal);
4100 slotMouseMove (posScreen);
4105 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4110 void MainWindow::updateChecklistGuide ()
4112 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4114 m_isDocumentExported =
true;
4115 m_dockChecklistGuide->
update (*m_cmdMediator,
4116 m_isDocumentExported);
4119 void MainWindow::updateControls ()
4121 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls"
4122 <<
" selectedItems=" << m_scene->selectedItems().count();
4124 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4126 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4128 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4129 (m_actionRecentFiles.at(0)->isVisible ()));
4131 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4132 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4133 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4134 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4135 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4137 if (m_cmdMediator == 0) {
4138 m_actionEditUndo->setEnabled (
false);
4139 m_actionEditRedo->setEnabled (
false);
4141 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4142 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4144 m_actionEditCut->setEnabled (m_scene->selectedItems().count () > 0);
4145 m_actionEditCopy->setEnabled (m_scene->selectedItems().count () > 0);
4146 m_actionEditPaste->setEnabled (
false);
4147 m_actionEditDelete->setEnabled (m_scene->selectedItems().count () > 0);
4150 m_actionDigitizeAxis->setEnabled (!m_currentFile.isEmpty ());
4151 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4152 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4153 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4154 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4155 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4157 m_actionViewGridLines->setEnabled (
true);
4159 m_actionViewGridLines->setEnabled (
false);
4160 m_actionViewGridLines->setChecked (
false);
4162 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4163 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4164 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4165 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4167 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4168 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4169 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4170 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4171 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4172 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4173 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4174 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4175 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4176 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4177 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4178 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4180 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4181 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4182 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4184 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4185 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4190 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4195 loadCurveListFromCmdMediator ();
4197 updateTransformationAndItsDependencies();
4209 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4211 switch (digitizeState) {
4212 case DIGITIZE_STATE_AXIS:
4213 m_actionDigitizeAxis->setChecked(
true);
4217 case DIGITIZE_STATE_COLOR_PICKER:
4218 m_actionDigitizeColorPicker->setChecked(
true);
4219 slotDigitizeColorPicker();
4222 case DIGITIZE_STATE_CURVE:
4223 m_actionDigitizeCurve->setChecked(
true);
4224 slotDigitizeCurve();
4227 case DIGITIZE_STATE_EMPTY:
4230 case DIGITIZE_STATE_POINT_MATCH:
4231 m_actionDigitizePointMatch->setChecked(
true);
4232 slotDigitizePointMatch();
4235 case DIGITIZE_STATE_SEGMENT:
4236 m_actionDigitizeSegment->setChecked(
true);
4237 slotDigitizeSegment();
4240 case DIGITIZE_STATE_SELECT:
4241 m_actionDigitizeSelect->setChecked(
true);
4242 slotDigitizeSelect();
4246 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4251 void MainWindow::updateGeometryWindow ()
4253 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4256 m_dockGeometryWindow->
update (*m_cmdMediator,
4258 m_cmbCurve->currentText (),
4264 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4270 void MainWindow::updateGridLines ()
4272 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4275 m_gridLines.
clear ();
4285 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4288 void MainWindow::updateHighlightOpacity ()
4290 if (m_cmdMediator != 0) {
4296 m_dockGeometryWindow);
4300 void MainWindow::updateRecentFileList()
4302 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4305 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4306 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4309 unsigned int count = recentFilePaths.size();
4310 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4311 count = MAX_RECENT_FILE_LIST_SIZE;
4316 for (i = 0; i < count; i++) {
4317 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4318 m_actionRecentFiles.at (i)->setText (strippedName);
4319 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4320 m_actionRecentFiles.at (i)->setVisible (
true);
4324 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4325 m_actionRecentFiles.at (i)->setVisible (
false);
4332 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4335 if (m_transformation.transformIsDefined()) {
4339 m_cmbCurve->currentText());
4344 m_cmbCurve->currentText());
4350 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4356 m_cmbCurve->currentText());
4363 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4370 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4373 loadCurveListFromCmdMediator();
4379 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4388 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4392 modelDigitizeCurve);
4397 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4404 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4411 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4418 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4423 void MainWindow::updateSettingsMainWindow()
4425 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4427 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4428 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4430 m_actionZoomIn->setShortcut (tr (
""));
4431 m_actionZoomOut->setShortcut (tr (
""));
4435 m_actionZoomIn->setShortcut (tr (
"+"));
4436 m_actionZoomOut->setShortcut (tr (
"-"));
4440 if ((m_scene != 0) &&
4441 (m_cmdMediator != 0)) {
4445 updateHighlightOpacity();
4446 updateWindowTitle();
4451 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4459 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4466 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4472 void MainWindow::updateTransformationAndItsDependencies()
4474 m_transformation.update (!m_currentFile.isEmpty (),
4482 m_cmbCurve->currentText ());
4489 void MainWindow::updateViewedCurves ()
4491 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4493 if (m_actionViewCurvesAll->isChecked ()) {
4497 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4501 }
else if (m_actionViewCurvesNone->isChecked ()) {
4506 ENGAUGE_ASSERT (
false);
4512 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4514 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4521 if (activeCurve.isEmpty ()) {
4534 m_cmdMediator->
pixmap ());
4539 void MainWindow::updateWindowTitle ()
4541 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4543 const QString PLACEHOLDER (
"[*]");
4545 QString title = QString (tr (
"Engauge Digitizer %1")
4546 .arg (VERSION_NUMBER));
4548 QString fileNameMaybeStripped;
4549 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4551 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4555 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4556 fileNameMaybeStripped = fileInfo.baseName();
4559 case MAIN_TITLE_BAR_FORMAT_PATH:
4560 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4564 title += QString (
": %1")
4565 .arg (fileNameMaybeStripped);
4570 title += PLACEHOLDER;
4572 setWindowTitle (title);
4577 ENGAUGE_CHECK_PTR (m_view);
4583 ENGAUGE_CHECK_PTR (m_view);
4587 void MainWindow::writeCheckpointToLogFile ()
4590 QString checkpointDoc;
4591 QTextStream strDoc (&checkpointDoc);
4596 QString checkpointScene;
4597 QTextStream strScene (&checkpointScene);
4602 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4604 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n"
4605 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4606 << checkpointDoc.toLatin1().data()
4607 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4608 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4609 << checkpointScene.toLatin1().data()
4610 <<
"-----------------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.
void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings, const QPixmap &pixmap)
Apply the color filter of the currently selected curve. The pixmap is included so the background colo...
void 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.
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.
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...
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.
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 createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
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.
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.
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.
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.
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
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.
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.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
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...
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.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
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.
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.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
const ColorFilterSettings colorFilterSettings(const QString &curveName) const
Get method for copying one color filter. Cannot return just a reference or else there is a warning ab...
Dialog for editing main window settings, which are entirely independent of all documents.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
void load(CmdMediator &cmdMediator)
Load settings from Document.
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.
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.
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.
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.
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...
Dialog for sending error report.
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.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
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.