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 "FittingCurve.h"
56 #include "FittingWindow.h"
57 #include "GeometryWindow.h"
59 #include "GraphicsItemsExtractor.h"
60 #include "GraphicsItemType.h"
61 #include "GraphicsScene.h"
62 #include "GraphicsView.h"
63 #include "GridLineFactory.h"
64 #include "GridLineLimiter.h"
65 #include "HelpWindow.h"
66 #ifdef ENGAUGE_JPEG2000
68 #endif // ENGAUGE_JPEG2000
69 #include "LoadFileInfo.h"
70 #include "LoadImageFromUrl.h"
72 #include "MainTitleBarFormat.h"
73 #include "MainWindow.h"
74 #include "NetworkClient.h"
79 #include "PdfResolution.h"
81 #include <QApplication>
82 #include <QCloseEvent>
85 #include <QDesktopServices>
86 #include <QDockWidget>
87 #include <QDomDocument>
89 #include <QFileDialog>
91 #include <QGraphicsLineItem>
92 #include <QImageReader>
94 #include <QKeySequence>
98 #include <QMessageBox>
99 #include <QMouseEvent>
100 #include <QPrintDialog>
103 #include <QTextStream>
107 #include <QToolButton>
108 #include "QtToString.h"
109 #include <QVBoxLayout>
110 #include <QWhatsThis>
111 #include <QXmlStreamReader>
112 #include <QXmlStreamWriter>
113 #include "Settings.h"
114 #include "StatusBar.h"
115 #include "TransformationStateContext.h"
116 #include "TutorialDlg.h"
118 #include "ViewPointStyle.h"
119 #include "ViewSegmentFilter.h"
120 #include "ZoomFactor.h"
121 #include "ZoomFactorInitial.h"
123 const QString EMPTY_FILENAME (
"");
124 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
125 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
126 const int REGRESSION_INTERVAL = 400;
127 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
130 const QString &fileCmdScriptFile,
131 bool isRegressionTest,
134 QStringList loadStartupFiles,
137 m_isDocumentExported (false),
138 m_engaugeFile (EMPTY_FILENAME),
139 m_currentFile (EMPTY_FILENAME),
144 m_digitizeStateContext (0),
145 m_transformationStateContext (0),
146 m_backgroundStateContext (0),
147 m_isGnuplot (isGnuplot),
149 m_timerRegressionErrorReport(0),
151 m_isErrorReportRegressionTest (isRegressionTest),
152 m_timerRegressionFileCmdScript(0),
155 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow"
156 <<
" curDir=" << QDir::currentPath().toLatin1().data();
158 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
159 qApp->setApplicationName (
"Engauge Digitizer");
160 qApp->setOrganizationDomain (
"Mark Mitchell");
165 m_startupDirectory = QDir::currentPath();
169 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
170 setWindowTitle (engaugeWindowTitle ());
172 createCentralWidget();
177 createDockableWidgets ();
182 createLoadImageFromUrl ();
183 createStateContextBackground ();
184 createStateContextDigitize ();
185 createStateContextTransformation ();
186 createSettingsDialogs ();
187 createCommandStackShadow ();
191 settingsRead (isReset);
193 setUnifiedTitleAndToolBarOnMac(
true);
195 installEventFilter(
this);
199 QString originalPath = QDir::currentPath();
200 QDir::setCurrent (m_startupDirectory);
201 if (!errorReportFile.isEmpty()) {
202 loadErrorReportFile(errorReportFile);
203 if (m_isErrorReportRegressionTest) {
204 startRegressionTestErrorReport(errorReportFile);
206 }
else if (!fileCmdScriptFile.isEmpty()) {
208 startRegressionTestFileCmdScript();
213 m_loadStartupFiles = loadStartupFiles;
215 QDir::setCurrent (originalPath);
218 MainWindow::~MainWindow()
222 void MainWindow::addDockWindow (QDockWidget *dockWidget,
224 const QString &settingsTokenArea,
225 const QString &settingsTokenGeometry,
226 Qt::DockWidgetArea dockWidgetArea)
231 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
232 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
233 Qt::NoDockWidgetArea).toInt();
235 if (area == Qt::NoDockWidgetArea) {
237 addDockWidget (dockWidgetArea,
239 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
240 if (settings.contains (settingsTokenGeometry)) {
241 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
252 void MainWindow::applyZoomFactorAfterLoad()
254 ZoomFactor zoomFactor;
257 if (m_zoomMap.contains (zoomFactorInitial)) {
258 zoomFactor = m_zoomMap [zoomFactorInitial];
259 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
260 zoomFactor = currentZoomFactor ();
262 ENGAUGE_ASSERT (
false);
263 zoomFactor = currentZoomFactor();
266 slotViewZoom (zoomFactor);
269 void MainWindow::closeEvent(QCloseEvent *event)
281 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
283 setWindowModified (
false);
289 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
298 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
300 m_regressionFile = exportFilenameFromInputFilename (fileName);
301 fileImport (fileName,
307 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
309 m_regressionFile = exportFilenameFromInputFilename (fileName);
310 loadDocumentFile(fileName);
316 return m_cmdMediator;
319 void MainWindow::createActions()
321 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
323 createActionsFile ();
324 createActionsEdit ();
325 createActionsDigitize ();
326 createActionsView ();
327 createActionsSettings ();
328 createActionsHelp ();
331 void MainWindow::createActionsDigitize ()
333 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
335 QPixmap pixmapAxis (DigitAxis_xpm);
336 QPixmap pixmapCurve (DigitCurve_xpm);
337 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
338 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
339 QPixmap pixmapSegment (DigitSegment_xpm);
340 QPixmap pixmapSelect (DigitSelect_xpm);
342 QIcon iconAxis (pixmapAxis);
343 QIcon iconCurve (pixmapCurve);
344 QIcon iconColorPicker (pixmapColorPicker);
345 QIcon iconPointMatch (pixmapPointMatch);
346 QIcon iconSegment (pixmapSegment);
347 QIcon iconSelect (pixmapSelect);
349 m_actionDigitizeSelect =
new QAction (iconSelect, tr (
"Select Tool"),
this);
350 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
351 m_actionDigitizeSelect->setCheckable (
true);
352 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
353 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n"
354 "Select points on the screen."));
355 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
357 m_actionDigitizeAxis =
new QAction (iconAxis, tr (
"Axis Point Tool"),
this);
358 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
359 m_actionDigitizeAxis->setCheckable (
true);
360 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points."));
361 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n"
362 "Digitizes an axis point by placing a new point at the cursor "
363 "after a mouse click. The coordinates of the axis point are then "
364 "entered. In a graph, three axis points are required to define "
365 "the graph coordinates."));
366 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
368 m_actionDigitizeCurve =
new QAction (iconCurve, tr (
"Curve Point Tool"),
this);
369 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
370 m_actionDigitizeCurve->setCheckable (
true);
371 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
372 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n"
373 "Digitizes a curve point by placing a new point at the cursor "
374 "after a mouse click. Use this mode to digitize points along curves "
376 "New points will be assigned to the currently selected curve."));
377 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
379 m_actionDigitizePointMatch =
new QAction (iconPointMatch, tr (
"Point Match Tool"),
this);
380 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
381 m_actionDigitizePointMatch->setCheckable (
true);
382 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
383 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n"
384 "Digitizes curve points in a point plot by finding points that match a sample point. The process "
385 "starts by selecting a representative sample point.\n\n"
386 "New points will be assigned to the currently selected curve."));
387 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
389 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, tr (
"Color Picker Tool"),
this);
390 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
391 m_actionDigitizeColorPicker->setCheckable (
true);
392 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
393 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n"
394 "Select a pixel along the currently selected curve. That pixel and its neighbors will "
395 "define the filter settings (color, brightness, and so on) of the currently selected curve "
396 "while in Segment Fill mode."));
397 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
399 m_actionDigitizeSegment =
new QAction (iconSegment, tr (
"Segment Fill Tool"),
this);
400 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
401 m_actionDigitizeSegment->setCheckable (
true);
402 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
403 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n"
404 "Digitizes curve points by placing new points along the highlighted "
405 "segment under the cursor. Use this mode to quickly digitize multiple points along a "
406 "curve with a single click.\n\n"
407 "New points will be assigned to the currently selected curve."));
408 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
410 m_groupDigitize =
new QActionGroup (
this);
411 m_groupDigitize->addAction (m_actionDigitizeSelect);
412 m_groupDigitize->addAction (m_actionDigitizeAxis);
413 m_groupDigitize->addAction (m_actionDigitizeCurve);
414 m_groupDigitize->addAction (m_actionDigitizePointMatch);
415 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
416 m_groupDigitize->addAction (m_actionDigitizeSegment);
419 void MainWindow::createActionsEdit ()
421 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
423 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
424 m_actionEditUndo->setShortcut (QKeySequence::Undo);
425 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
426 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n"
427 "Undo the last operation."));
430 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
431 m_actionEditRedo->setShortcut (QKeySequence::Redo);
432 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
433 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n"
434 "Redo the last operation."));
437 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
438 m_actionEditCut->setShortcut (QKeySequence::Cut);
439 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
440 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n"
441 "Cuts the selected points and copies them to the clipboard."));
442 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
444 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
445 m_actionEditCopy->setShortcut (QKeySequence::Copy);
446 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
447 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n"
448 "Copies the selected points to the clipboard."));
449 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
451 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
452 m_actionEditPaste->setShortcut (QKeySequence::Paste);
453 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
454 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n"
455 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
456 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
458 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
459 m_actionEditDelete->setShortcut (QKeySequence::Delete);
460 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
461 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n"
462 "Deletes the selected points, after copying them to the clipboard."));
463 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
465 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
466 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
467 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n"
468 "Creates a new document by pasting an image from the clipboard."));
469 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
471 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
472 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
473 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n"
474 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
475 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
478 void MainWindow::createActionsFile ()
480 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
482 m_actionImport =
new QAction(tr (
"&Import..."),
this);
483 m_actionImport->setShortcut (tr (
"Ctrl+I"));
484 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an simple image."));
485 m_actionImport->setWhatsThis (tr (
"Import Image\n\n"
486 "Creates a new document by importing an image with a single coordinate system, "
487 "and axes both coordinates known.\n\n"
488 "For more complicated images with multiple coordinate systems, "
489 "and/or floating axes, Import (Advanced) is used instead."));
490 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
492 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
493 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
494 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n"
495 "Creates a new document by importing an image with support for advanced feaures. In "
496 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
497 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
499 m_actionImportImageReplace =
new QAction (tr (
"Import (Image Replace)..."),
this);
500 m_actionImportImageReplace->setStatusTip (tr (
"Imports a new image into the current document, replacing the existing image."));
501 m_actionImportImageReplace->setWhatsThis (tr (
"Import (Image Replace)\n\n"
502 "Imports a new image into the current document. The existing image is replaced, "
503 "and all curves in the document are preserved. This operation is useful for applying "
504 "the axis points and other settings from an existing document to a different image."));
505 connect (m_actionImportImageReplace, SIGNAL (triggered ()),
this, SLOT (slotFileImportImageReplace ()));
507 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
508 m_actionOpen->setShortcut (QKeySequence::Open);
509 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
510 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n"
511 "Opens an existing document."));
512 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
515 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
516 QAction *recentFileAction =
new QAction (
this);
517 recentFileAction->setVisible (
true);
518 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
519 m_actionRecentFiles.append (recentFileAction);
523 m_actionClose =
new QAction(tr (
"&Close"),
this);
524 m_actionClose->setShortcut (QKeySequence::Close);
525 m_actionClose->setStatusTip (tr (
"Closes the open document."));
526 m_actionClose->setWhatsThis (tr (
"Close Document\n\n"
527 "Closes the open document."));
528 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
530 m_actionSave =
new QAction(tr (
"&Save"),
this);
531 m_actionSave->setShortcut (QKeySequence::Save);
532 m_actionSave->setStatusTip (tr (
"Saves the current document."));
533 m_actionSave->setWhatsThis (tr (
"Save Document\n\n"
534 "Saves the current document."));
535 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
537 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
538 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
539 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
540 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n"
541 "Saves the current document under a new filename."));
542 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
544 m_actionExport =
new QAction (tr (
"Export..."),
this);
545 m_actionExport->setShortcut (tr (
"Ctrl+E"));
546 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
547 m_actionExport->setWhatsThis (tr (
"Export Document\n\n"
548 "Exports the current document into a text file."));
549 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
551 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
552 m_actionPrint->setShortcut (QKeySequence::Print);
553 m_actionPrint->setStatusTip (tr (
"Print the current document."));
554 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n"
555 "Print the current document to a printer or file."));
556 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
558 m_actionExit =
new QAction(tr (
"&Exit"),
this);
559 m_actionExit->setShortcut (QKeySequence::Quit);
560 m_actionExit->setStatusTip (tr (
"Quits the application."));
561 m_actionExit->setWhatsThis (tr (
"Exit\n\n"
562 "Quits the application."));
563 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
566 void MainWindow::createActionsHelp ()
568 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
570 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
571 m_actionHelpChecklistGuideWizard->setCheckable (
true);
572 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
573 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n"
574 "Use Checklist Guide Wizard during import to generate a checklist of steps "
575 "for the imported document"));
577 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
578 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
580 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
581 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
582 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n"
583 "Play tutorial showing steps for digitizing points from curves drawn with lines "
585 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
588 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
589 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
590 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
591 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n"
592 "Searchable help documentation"));
596 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
597 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
598 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
599 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
602 void MainWindow::createActionsSettings ()
604 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
606 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
607 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
608 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n"
609 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
610 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
612 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
613 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
614 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n"
615 "Add/Remove Curve settings control which curves are included in the current document"));
616 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
618 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
619 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
620 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n"
621 "Curves properties settings determine how each curve appears"));
622 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
624 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
625 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
626 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n"
627 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and "
628 "Digitize Graph Point modes"));
629 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
631 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
632 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
633 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n"
634 "Export format settings affect how exported files are formatted"));
635 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
637 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
638 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
639 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n"
640 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
641 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
643 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
644 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
645 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n"
646 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
647 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
649 m_actionSettingsGridDisplay =
new QAction (tr (
"Grid Line Display..."),
this);
650 m_actionSettingsGridDisplay->setStatusTip (tr (
"Edit Grid Line Display settings."));
651 m_actionSettingsGridDisplay->setWhatsThis (tr (
"Grid Line Display Settings\n\n"
652 "Grid lines displayed on the graph can provide more accuracy than the Axis Checker, for distorted graphs. "
653 "In a distorted graph, the grid lines can be used to adjust the axis points for more accuracy in different regions."));
654 connect (m_actionSettingsGridDisplay, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridDisplay ()));
656 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
657 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
658 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n"
659 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when "
660 "Color Filtering is not able to separate grid lines from curve lines."));
661 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
663 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
664 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
665 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n"
666 "Point match settings determine how points are matched while in Point Match mode"));
667 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
669 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
670 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
671 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n"
672 "Segment fill settings determine how points are generated in the Segment Fill mode"));
673 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
675 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
676 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
677 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n"
678 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects "
679 "both Color Picker and Point Match modes"));
680 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
682 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
683 m_actionSettingsMainWindow->setEnabled (
true);
684 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
685 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n"
686 "Main window settings affect the user interface and are not specific to any document"));
687 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
690 void MainWindow::createActionsView ()
692 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
694 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
695 m_actionViewBackground->setCheckable (
true);
696 m_actionViewBackground->setChecked (
true);
697 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
698 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n"
699 "Show or hide the background toolbar"));
700 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
702 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
703 m_actionViewChecklistGuide->setCheckable (
true);
704 m_actionViewChecklistGuide->setChecked (
false);
705 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide."));
706 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide\n\n"
707 "Show or hide the checklist guide"));
708 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
710 m_actionViewFittingWindow =
new QAction (tr (
"Curve Fitting Window"),
this);
711 m_actionViewFittingWindow->setCheckable (
true);
712 m_actionViewFittingWindow->setChecked (
false);
713 m_actionViewFittingWindow->setStatusTip (tr (
"Show or hide the curve fitting window."));
714 m_actionViewFittingWindow->setWhatsThis (tr (
"View Curve Fitting Window\n\n"
715 "Show or hide the curve fitting window"));
716 connect (m_actionViewFittingWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarFittingWindow()));
718 m_actionViewGeometryWindow =
new QAction (tr (
"Geometry Window"),
this);
719 m_actionViewGeometryWindow->setCheckable (
true);
720 m_actionViewGeometryWindow->setChecked (
false);
721 m_actionViewGeometryWindow->setStatusTip (tr (
"Show or hide the geometry window."));
722 m_actionViewGeometryWindow->setWhatsThis (tr (
"View Geometry Window\n\n"
723 "Show or hide the geometry window"));
724 connect (m_actionViewGeometryWindow, SIGNAL (changed ()),
this, SLOT (slotViewToolBarGeometryWindow()));
726 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
727 m_actionViewDigitize->setCheckable (
true);
728 m_actionViewDigitize->setChecked (
true);
729 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
730 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n"
731 "Show or hide the digitizing tools toolbar"));
732 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
734 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
735 m_actionViewSettingsViews->setCheckable (
true);
736 m_actionViewSettingsViews->setChecked (
true);
737 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
738 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n"
739 "Show or hide the settings views toolbar. These views graphically show the "
740 "most important settings."));
741 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
743 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
744 m_actionViewCoordSystem->setCheckable (
true);
745 m_actionViewCoordSystem->setChecked (
false);
746 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
747 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n"
748 "Show or hide the coordinate system selection toolbar. This toolbar is used "
749 "to select the current coordinate system when the document has multiple "
750 "coordinate systems. This toolbar is also used to view and print all coordinate "
752 "This toolbar is disabled when there is only one coordinate system."));
753 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
755 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
756 m_actionViewToolTips->setCheckable (
true);
757 m_actionViewToolTips->setChecked (
true);
758 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
759 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n"
760 "Show or hide the tool tips"));
761 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
763 m_actionViewGridLines =
new QAction (tr (
"Grid Lines"),
this);
764 m_actionViewGridLines->setCheckable (
true);
765 m_actionViewGridLines->setChecked (
false);
766 m_actionViewGridLines->setStatusTip (tr (
"Show or hide grid lines."));
767 m_actionViewGridLines->setWhatsThis (tr (
"View Grid Lines\n\n"
768 "Show or hide grid lines that are added for accurate adjustments of the axes points, "
769 "which can improve accuracy in distorted graphs"));
770 connect (m_actionViewGridLines, SIGNAL (triggered ()),
this, SLOT (slotViewGridLines()));
772 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
773 m_actionViewBackgroundNone->setCheckable (
true);
774 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
775 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n"
776 "No image is shown so points are easier to see"));
778 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
779 m_actionViewBackgroundOriginal->setCheckable (
true);
780 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
781 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n"
782 "Show the original image underneath the points"));
784 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
785 m_actionViewBackgroundFiltered->setCheckable (
true);
786 m_actionViewBackgroundFiltered->setChecked (
true);
787 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
788 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n"
789 "Show the filtered image underneath the points.\n\n"
790 "The filtered image is created from the original image according to the "
791 "Filter preferences so unimportant information is hidden and important "
792 "information is emphasized"));
794 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
795 m_actionViewCurvesNone->setCheckable (
true);
796 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
797 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n"
798 "No axis points or digitized graph curves are shown so the image is easier to see."));
800 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
801 m_actionViewCurvesSelected->setCheckable (
true);
802 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
803 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n"
804 "Show only the digitized points and line that belong to the currently selected curve."));
806 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
807 m_actionViewCurvesAll->setCheckable (
true);
808 m_actionViewCurvesAll->setChecked (
true);
809 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
810 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n"
811 "Show all digitized axis points and graph curves"));
813 m_groupBackground =
new QActionGroup(
this);
814 m_groupBackground->addAction (m_actionViewBackgroundNone);
815 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
816 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
817 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
819 m_groupCurves =
new QActionGroup(
this);
820 m_groupCurves->addAction (m_actionViewCurvesNone);
821 m_groupCurves->addAction (m_actionViewCurvesSelected);
822 m_groupCurves->addAction (m_actionViewCurvesAll);
823 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
825 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
826 m_actionStatusNever->setCheckable(
true);
827 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
828 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
830 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
831 m_actionStatusTemporary->setCheckable(
true);
832 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
833 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
835 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
836 m_actionStatusAlways->setCheckable(
true);
837 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
838 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, "
839 "the status bar also displays information about the cursor position."));
841 m_groupStatus =
new QActionGroup(
this);
842 m_groupStatus->addAction (m_actionStatusNever);
843 m_groupStatus->addAction (m_actionStatusTemporary);
844 m_groupStatus->addAction (m_actionStatusAlways);
845 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
847 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
848 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
850 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
852 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
853 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
855 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
857 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
858 m_actionZoom16To1->setCheckable (
true);
859 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
860 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
862 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
863 m_actionZoom8To1->setCheckable (
true);
864 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
865 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
867 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
868 m_actionZoom4To1->setCheckable (
true);
869 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
870 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
872 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
873 m_actionZoom2To1->setCheckable (
true);
874 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
875 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
877 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
878 m_actionZoom1To1->setCheckable (
true);
879 m_actionZoom1To1->setChecked (
true);
880 m_actionZoom1To1->setStatusTip (tr (
"Zoom 1:1"));
881 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
883 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
884 m_actionZoom1To2->setCheckable (
true);
885 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
886 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
888 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
889 m_actionZoom1To4->setCheckable (
true);
890 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
891 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
893 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
894 m_actionZoom1To8->setCheckable (
true);
895 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
896 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
898 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
899 m_actionZoom1To16->setCheckable (
true);
900 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
901 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
903 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
904 m_actionZoomFill->setCheckable (
true);
905 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
906 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
908 m_groupZoom =
new QActionGroup (
this);
909 m_groupZoom->addAction (m_actionZoom16To1);
910 m_groupZoom->addAction (m_actionZoom8To1);
911 m_groupZoom->addAction (m_actionZoom4To1);
912 m_groupZoom->addAction (m_actionZoom2To1);
913 m_groupZoom->addAction (m_actionZoom1To1);
914 m_groupZoom->addAction (m_actionZoom1To2);
915 m_groupZoom->addAction (m_actionZoom1To4);
916 m_groupZoom->addAction (m_actionZoom1To8);
917 m_groupZoom->addAction (m_actionZoom1To16);
918 m_groupZoom->addAction (m_actionZoomFill);
921 void MainWindow::createCentralWidget ()
923 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
925 QWidget *widget =
new QWidget;
926 setCentralWidget (widget);
927 m_layout =
new QVBoxLayout;
928 widget->setLayout (m_layout);
931 void MainWindow::createCommandStackShadow ()
933 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
938 void MainWindow::createDockableWidgets ()
940 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createDockableWidgets";
944 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
948 connect (m_dockFittingWindow, SIGNAL (signalFittingWindowClosed()),
949 this, SLOT (slotFittingWindowClosed()));
950 connect (m_dockFittingWindow, SIGNAL (signalCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)),
951 this, SLOT (slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool)));
955 connect (m_dockGeometryWindow, SIGNAL (signalGeometryWindowClosed()),
956 this, SLOT (slotGeometryWindowClosed()));
960 void MainWindow::createHelpWindow ()
962 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
966 m_helpWindow->hide ();
967 addDockWidget (Qt::RightDockWidgetArea,
969 m_helpWindow->setFloating (
true);
971 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
975 void MainWindow::createIcons()
977 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
980 QPixmap icon16 (bannerapp_16);
981 QPixmap icon32 (bannerapp_32);
982 QPixmap icon64 (bannerapp_64);
983 QPixmap icon128 (bannerapp_128);
984 QPixmap icon256 (bannerapp_256);
986 icon.addPixmap (icon16);
987 icon.addPixmap (icon32);
988 icon.addPixmap (icon64);
989 icon.addPixmap (icon128);
990 icon.addPixmap (icon256);
992 setWindowIcon (icon);
995 void MainWindow::createLoadImageFromUrl ()
1000 void MainWindow::createMenus()
1002 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
1004 m_menuFile = menuBar()->addMenu(tr(
"&File"));
1005 m_menuFile->addAction (m_actionImport);
1006 m_menuFile->addAction (m_actionImportAdvanced);
1007 m_menuFile->addAction (m_actionImportImageReplace);
1008 m_menuFile->addAction (m_actionOpen);
1010 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
1011 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
1012 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
1014 m_menuFile->addMenu (m_menuFileOpenRecent);
1016 m_menuFile->addAction (m_actionClose);
1017 m_menuFile->insertSeparator (m_actionSave);
1018 m_menuFile->addAction (m_actionSave);
1019 m_menuFile->addAction (m_actionSaveAs);
1020 m_menuFile->addAction (m_actionExport);
1021 m_menuFile->insertSeparator (m_actionPrint);
1022 m_menuFile->addAction (m_actionPrint);
1023 m_menuFile->insertSeparator (m_actionExit);
1024 m_menuFile->addAction (m_actionExit);
1026 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
1027 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
1028 m_menuEdit->addAction (m_actionEditUndo);
1029 m_menuEdit->addAction (m_actionEditRedo);
1030 m_menuEdit->insertSeparator (m_actionEditCut);
1031 m_menuEdit->addAction (m_actionEditCut);
1032 m_menuEdit->addAction (m_actionEditCopy);
1033 m_menuEdit->addAction (m_actionEditPaste);
1034 m_menuEdit->addAction (m_actionEditDelete);
1035 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
1036 m_menuEdit->addAction (m_actionEditPasteAsNew);
1037 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
1039 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
1040 m_menuDigitize->addAction (m_actionDigitizeSelect);
1041 m_menuDigitize->addAction (m_actionDigitizeAxis);
1042 m_menuDigitize->addAction (m_actionDigitizeCurve);
1043 m_menuDigitize->addAction (m_actionDigitizePointMatch);
1044 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
1045 m_menuDigitize->addAction (m_actionDigitizeSegment);
1047 m_menuView = menuBar()->addMenu(tr(
"View"));
1048 m_menuView->addAction (m_actionViewBackground);
1049 m_menuView->addAction (m_actionViewDigitize);
1050 m_menuView->addAction (m_actionViewChecklistGuide);
1051 m_menuView->addAction (m_actionViewFittingWindow);
1052 m_menuView->addAction (m_actionViewGeometryWindow);
1053 m_menuView->addAction (m_actionViewSettingsViews);
1054 m_menuView->addAction (m_actionViewCoordSystem);
1055 m_menuView->insertSeparator (m_actionViewToolTips);
1056 m_menuView->addAction (m_actionViewToolTips);
1057 m_menuView->addAction (m_actionViewGridLines);
1058 m_menuView->insertSeparator (m_actionViewBackgroundNone);
1059 m_menuViewBackground =
new QMenu (tr (
"Background"));
1060 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
1061 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
1062 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
1063 m_menuView->addMenu (m_menuViewBackground);
1064 m_menuViewCurves =
new QMenu (tr (
"Curves"));
1065 m_menuViewCurves->addAction (m_actionViewCurvesNone);
1066 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
1067 m_menuViewCurves->addAction (m_actionViewCurvesAll);
1068 m_menuView->addMenu (m_menuViewCurves);
1069 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
1070 m_menuViewStatus->addAction (m_actionStatusNever);
1071 m_menuViewStatus->addAction (m_actionStatusTemporary);
1072 m_menuViewStatus->addAction (m_actionStatusAlways);
1073 m_menuView->addMenu (m_menuViewStatus);
1074 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
1075 m_menuViewZoom->addAction (m_actionZoomOut);
1076 m_menuViewZoom->addAction (m_actionZoomIn);
1077 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
1078 m_menuViewZoom->addAction (m_actionZoom16To1);
1079 m_menuViewZoom->addAction (m_actionZoom8To1);
1080 m_menuViewZoom->addAction (m_actionZoom4To1);
1081 m_menuViewZoom->addAction (m_actionZoom2To1);
1082 m_menuViewZoom->addAction (m_actionZoom1To1);
1083 m_menuViewZoom->addAction (m_actionZoom1To2);
1084 m_menuViewZoom->addAction (m_actionZoom1To4);
1085 m_menuViewZoom->addAction (m_actionZoom1To8);
1086 m_menuViewZoom->addAction (m_actionZoom1To16);
1087 m_menuViewZoom->addAction (m_actionZoomFill);
1088 m_menuView->addMenu (m_menuViewZoom);
1090 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1091 m_menuSettings->addAction (m_actionSettingsCoords);
1092 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1093 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1094 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1095 m_menuSettings->addAction (m_actionSettingsExport);
1096 m_menuSettings->addAction (m_actionSettingsColorFilter);
1097 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1098 m_menuSettings->addAction (m_actionSettingsGridDisplay);
1099 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1100 m_menuSettings->addAction (m_actionSettingsPointMatch);
1101 m_menuSettings->addAction (m_actionSettingsSegments);
1102 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1103 m_menuSettings->addAction (m_actionSettingsGeneral);
1104 m_menuSettings->addAction (m_actionSettingsMainWindow);
1106 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1107 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1108 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1109 m_menuHelp->addAction (m_actionHelpWhatsThis);
1110 m_menuHelp->addAction (m_actionHelpTutorial);
1112 m_menuHelp->addAction (m_actionHelpHelp);
1114 m_menuHelp->addAction (m_actionHelpAbout);
1116 updateRecentFileList();
1119 void MainWindow::createNetwork ()
1121 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1126 void MainWindow::createSettingsDialogs ()
1128 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1144 m_dlgSettingsCoords->setVisible (
false);
1145 m_dlgSettingsCurveAddRemove->setVisible (
false);
1146 m_dlgSettingsCurveProperties->setVisible (
false);
1147 m_dlgSettingsDigitizeCurve->setVisible (
false);
1148 m_dlgSettingsExportFormat->setVisible (
false);
1149 m_dlgSettingsColorFilter->setVisible (
false);
1150 m_dlgSettingsAxesChecker->setVisible (
false);
1151 m_dlgSettingsGridDisplay->setVisible (
false);
1152 m_dlgSettingsGridRemoval->setVisible (
false);
1153 m_dlgSettingsPointMatch->setVisible (
false);
1154 m_dlgSettingsSegments->setVisible (
false);
1155 m_dlgSettingsGeneral->setVisible (
false);
1156 m_dlgSettingsMainWindow->setVisible (
false);
1159 void MainWindow::createScene ()
1161 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1165 m_layout->addWidget (m_view);
1168 void MainWindow::createStateContextBackground ()
1170 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1175 void MainWindow::createStateContextDigitize ()
1177 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1184 void MainWindow::createStateContextTransformation ()
1186 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1188 ENGAUGE_CHECK_PTR (m_scene);
1194 void MainWindow::createStatusBar ()
1196 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1198 m_statusBar =
new StatusBar (*statusBar ());
1199 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1200 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1203 void MainWindow::createToolBars ()
1205 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1207 const int VIEW_SIZE = 22;
1210 m_cmbBackground =
new QComboBox ();
1211 m_cmbBackground->setEnabled (
false);
1212 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1213 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n"
1214 "Select background image:\n"
1215 "1) No background which highlights points\n"
1216 "2) Original image which shows everything\n"
1217 "3) Filtered image which highlights important details"));
1218 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1219 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1220 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1222 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1225 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1226 m_toolBackground->addWidget (m_cmbBackground);
1227 addToolBar (m_toolBackground);
1230 m_cmbCurve =
new QComboBox ();
1231 m_cmbCurve->setEnabled (
false);
1232 m_cmbCurve->setMinimumWidth (180);
1233 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1234 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n"
1235 "Select curve for any new points. Every point belongs to one curve.\n\n"
1236 "This can be changed while in Curve Point, Point Match, Color Picker or Segment Fill mode."));
1237 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1240 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1241 m_toolDigitize->addAction (m_actionDigitizeSelect);
1242 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1243 m_toolDigitize->addAction (m_actionDigitizeAxis);
1244 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1245 m_toolDigitize->addAction (m_actionDigitizeCurve);
1246 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1247 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1248 m_toolDigitize->addAction (m_actionDigitizeSegment);
1249 m_toolDigitize->addWidget (m_cmbCurve);
1250 addToolBar (m_toolDigitize);
1254 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1255 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1256 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1257 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n"
1258 "Points style for the currently selected curve. The points style is only "
1259 "displayed in this toolbar. To change the points style, "
1260 "use the Curve Properties dialog."));
1263 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1264 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1265 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1266 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n"
1267 "View of filter for the current curve in Segment Fill mode. The filter settings are only "
1268 "displayed in this toolbar. To changed the filter settings, "
1269 "use the Color Picker mode or the Filter Settings dialog."));
1272 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1273 m_toolSettingsViews->addWidget (m_viewPointStyle);
1274 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1275 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1276 addToolBar (m_toolSettingsViews);
1279 m_cmbCoordSystem =
new QComboBox;
1280 m_cmbCoordSystem->setEnabled (
false);
1281 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1282 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n"
1283 "Currently selected coordinate system. This is used to switch between coordinate systems "
1284 "in documents with multiple coordinate systems"));
1285 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1287 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1288 m_btnShowAll->setEnabled (
false);
1289 m_btnShowAll->setAcceptDrops(
false);
1290 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1291 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n"
1292 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1293 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1294 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1296 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1297 m_btnPrintAll->setEnabled (
false);
1298 m_btnPrintAll->setAcceptDrops(
false);
1299 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1300 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n"
1301 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1302 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1304 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1305 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1306 m_toolCoordSystem->addWidget (m_btnShowAll);
1307 m_toolCoordSystem->addWidget (m_btnPrintAll);
1308 addToolBar (m_toolCoordSystem);
1311 void MainWindow::createTutorial ()
1313 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1316 m_tutorialDlg->setModal (
true);
1317 m_tutorialDlg->setMinimumSize (500, 400);
1318 m_tutorialDlg->hide();
1321 void MainWindow::createZoomMap ()
1323 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createZoomMap";
1325 m_zoomMap [ZOOM_INITIAL_16_TO_1] = ZOOM_16_TO_1;
1326 m_zoomMap [ZOOM_INITIAL_8_TO_1] = ZOOM_8_TO_1;
1327 m_zoomMap [ZOOM_INITIAL_4_TO_1] = ZOOM_4_TO_1;
1328 m_zoomMap [ZOOM_INITIAL_2_TO_1] = ZOOM_2_TO_1;
1329 m_zoomMap [ZOOM_INITIAL_1_TO_1] = ZOOM_1_TO_1;
1330 m_zoomMap [ZOOM_INITIAL_1_TO_2] = ZOOM_1_TO_2;
1331 m_zoomMap [ZOOM_INITIAL_1_TO_4] = ZOOM_1_TO_4;
1332 m_zoomMap [ZOOM_INITIAL_1_TO_8] = ZOOM_1_TO_8;
1333 m_zoomMap [ZOOM_INITIAL_1_TO_16] = ZOOM_1_TO_16;
1334 m_zoomMap [ZOOM_INITIAL_FILL] = ZOOM_FILL;
1337 ZoomFactor MainWindow::currentZoomFactor ()
const
1339 if (m_actionZoom1To1->isChecked()) {
1341 }
else if (m_actionZoom1To2->isChecked()) {
1343 }
else if (m_actionZoom1To4->isChecked()) {
1345 }
else if (m_actionZoom1To8->isChecked()) {
1347 }
else if (m_actionZoom1To16->isChecked()) {
1348 return ZOOM_1_TO_16;
1349 }
else if (m_actionZoom2To1->isChecked()) {
1351 }
else if (m_actionZoom4To1->isChecked()) {
1353 }
else if (m_actionZoom8To1->isChecked()) {
1355 }
else if (m_actionZoom16To1->isChecked()) {
1356 return ZOOM_16_TO_1;
1357 }
else if (m_actionZoomFill->isChecked()) {
1360 ENGAUGE_ASSERT (
false);
1366 if (event->type () == QEvent::KeyPress) {
1368 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1371 if ((eventKeyPress->key() == Qt::Key_E) &&
1372 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1373 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1383 return QObject::eventFilter (target, event);
1387 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
1389 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
1396 QString regressionFile = QString (
"%1_%2")
1397 .arg (m_regressionFile)
1411 fileExport (regressionFile,
1418 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const
1420 QString outFileName = fileName;
1422 outFileName = outFileName.replace (
".xml",
".csv_actual");
1423 outFileName = outFileName.replace (
".dig",
".csv_actual");
1424 outFileName = outFileName.replace (
".pdf",
".csv_actual");
1429 void MainWindow::fileExport(
const QString &fileName,
1432 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport"
1433 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1434 <<
" fileName=" << fileName.toLatin1().data();
1436 QFile file (fileName);
1437 if (file.open(QIODevice::WriteOnly)) {
1439 QTextStream str (&file);
1450 updateChecklistGuide ();
1454 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport"
1455 <<
" file=" << fileName.toLatin1().data()
1456 <<
" curDir=" << QDir::currentPath().toLatin1().data();
1457 QMessageBox::critical (0,
1458 engaugeWindowTitle(),
1459 tr (
"Unable to export to file ") + fileName);
1463 void MainWindow::fileImport (
const QString &fileName,
1464 ImportType importType)
1466 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport"
1467 <<
" fileName=" << fileName.toLatin1 ().data ()
1468 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1469 <<
" importType=" << importType;
1471 QString originalFileOld = m_originalFile;
1472 bool originalFileWasImported = m_originalFileWasImported;
1474 m_originalFile = fileName;
1475 m_originalFileWasImported =
true;
1477 if (importType == IMPORT_TYPE_ADVANCED) {
1488 bool loaded =
false;
1490 #ifdef ENGAUGE_JPEG2000
1492 loaded = jpeg2000.
load (fileName,
1494 #endif // ENGAUGE_JPEG2000
1500 PdfReturn pdfReturn = pdf.
load (fileName,
1504 m_isErrorReportRegressionTest);
1505 if (pdfReturn == PDF_RETURN_CANCELED) {
1512 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
1514 #endif // ENGAUGE_PDF
1518 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
1521 m_isErrorReportRegressionTest);
1522 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
1529 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
1533 QString msg = QString(
"%1 %2 %3 %4.")
1534 .arg (tr (
"Cannot read file"))
1536 .arg (tr (
"from directory"))
1537 .arg (QDir::currentPath());
1538 QMessageBox::warning (
this,
1539 engaugeWindowTitle(),
1543 m_originalFile = originalFileOld;
1544 m_originalFileWasImported = originalFileWasImported;
1548 loaded = loadImage (fileName,
1555 if (importType == IMPORT_TYPE_ADVANCED) {
1565 m_originalFile = originalFileOld;
1566 m_originalFileWasImported = originalFileWasImported;
1572 void MainWindow::fileImportWithPrompts (ImportType importType)
1574 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts"
1575 <<
" importType=" << importType;
1579 bool okToContinue =
true;
1580 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
1581 okToContinue = maybeSave ();
1587 QTextStream str (&filter);
1590 QList<QByteArray>::const_iterator itr;
1591 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1592 QStringList supportedImageFormatStrings;
1593 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1594 QByteArray arr = *itr;
1595 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1596 supportedImageFormatStrings << extensionAsWildcard;
1598 #ifdef ENGAUGE_JPEG2000
1601 #endif // ENGAUGE_JPEG2000
1604 supportedImageFormatStrings <<
"*.pdf";
1605 #endif // ENGAUGE_PDF
1607 supportedImageFormatStrings.sort();
1609 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1613 str <<
";; All Files (*.*)";
1615 QString fileName = QFileDialog::getOpenFileName (
this,
1617 QDir::currentPath (),
1619 if (!fileName.isEmpty ()) {
1622 fileImport (fileName,
1628 void MainWindow::filePaste (ImportType importType)
1630 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste"
1631 <<
" importType=" << importType;
1633 QString originalFileOld = m_originalFile;
1634 bool originalFileWasImported = m_originalFileWasImported;
1636 QString fileName (
"clipboard");
1637 m_originalFile = fileName;
1638 m_originalFileWasImported =
true;
1640 if (importType == IMPORT_TYPE_ADVANCED) {
1651 QImage image = QApplication::clipboard()->image();
1653 bool loaded =
false;
1655 loaded = !image.isNull();
1659 QMessageBox::warning (
this,
1660 engaugeWindowTitle(),
1661 QString(
"%1 %2 %3 %4.")
1662 .arg (tr (
"Cannot read file"))
1664 .arg (tr (
"from directory"))
1665 .arg (QDir::currentPath ()));
1668 m_originalFile = originalFileOld;
1669 m_originalFileWasImported = originalFileWasImported;
1673 loaded = loadImage (fileName,
1680 if (importType == IMPORT_TYPE_ADVANCED) {
1690 m_originalFile = originalFileOld;
1691 m_originalFileWasImported = originalFileWasImported;
1697 void MainWindow::ghostsCreate ()
1699 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1701 ENGAUGE_ASSERT (m_ghosts == 0);
1723 void MainWindow::ghostsDestroy ()
1725 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1727 ENGAUGE_CHECK_PTR (m_ghosts);
1745 void MainWindow::loadCoordSystemListFromCmdMediator ()
1747 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1749 m_cmbCoordSystem->clear();
1753 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1754 int index1Based = i + 1;
1755 m_cmbCoordSystem->addItem (QString::number (index1Based),
1760 m_cmbCoordSystem->setCurrentIndex (0);
1763 bool enable = (m_cmbCoordSystem->count() > 1);
1764 m_cmbCoordSystem->setEnabled (enable);
1765 m_btnShowAll->setEnabled (enable);
1766 m_btnPrintAll->setEnabled (enable);
1769 void MainWindow::loadCurveListFromCmdMediator ()
1771 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1773 m_cmbCurve->clear ();
1775 QStringList::iterator itr;
1776 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1778 QString curvesGraphName = *itr;
1779 m_cmbCurve->addItem (curvesGraphName);
1786 void MainWindow::loadDocumentFile (
const QString &fileName)
1788 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1790 QApplication::setOverrideCursor(Qt::WaitCursor);
1796 setCurrentPathFromFile (fileName);
1797 rebuildRecentFileListForCurrentFile(fileName);
1798 m_currentFile = fileName;
1800 if (m_cmdMediator != 0) {
1801 delete m_cmdMediator;
1806 setupAfterLoadNewDocument (fileName,
1808 IMPORT_TYPE_SIMPLE);
1811 m_actionDigitizeSelect->setChecked (
true);
1812 slotDigitizeSelect();
1814 m_engaugeFile = fileName;
1815 m_originalFile = fileName;
1816 m_originalFileWasImported =
false;
1821 QApplication::restoreOverrideCursor();
1825 QApplication::restoreOverrideCursor();
1827 QMessageBox::warning (
this,
1828 engaugeWindowTitle(),
1829 QString(
"%1 %2 %3 %4:\n%5.")
1830 .arg (tr (
"Cannot read file"))
1832 .arg (tr (
"from directory"))
1833 .arg (QDir::currentPath ())
1840 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1842 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile"
1843 <<
" file=" << errorReportFile.toLatin1().data();
1845 QFile file (errorReportFile);
1846 if (!file.exists()) {
1848 QFileInfo fileInfo (errorReportFile);
1850 QMessageBox::critical (
this,
1851 engaugeWindowTitle(),
1852 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1857 QXmlStreamReader reader (&file);
1858 file.open(QIODevice::ReadOnly | QIODevice::Text);
1868 setupAfterLoadNewDocument (errorReportFile,
1869 "Error report opened",
1870 IMPORT_TYPE_SIMPLE);
1873 m_actionDigitizeSelect->setChecked (
true);
1874 slotDigitizeSelect();
1879 bool MainWindow::loadImage (
const QString &fileName,
1880 const QImage &image,
1881 ImportType importType)
1883 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage"
1884 <<
" fileName=" << fileName.toLatin1 ().data ()
1885 <<
" importType=" << importType;
1888 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1889 success = loadImageReplacingImage (fileName,
1893 success = loadImageNewDocument (fileName,
1901 bool MainWindow::loadImageNewDocument (
const QString &fileName,
1902 const QImage &image,
1903 ImportType importType)
1905 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument"
1906 <<
" fileName=" << fileName.toLatin1 ().data ()
1907 <<
" importType=" << importType;
1909 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
1911 QApplication::setOverrideCursor(Qt::WaitCursor);
1914 QApplication::restoreOverrideCursor();
1916 setCurrentPathFromFile (fileName);
1918 m_engaugeFile = EMPTY_FILENAME;
1920 if (m_cmdMediator != 0) {
1921 delete m_cmdMediator;
1926 bool accepted = setupAfterLoadNewDocument (fileName,
1927 tr (
"File imported"),
1933 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1934 (m_fileCmdScript == 0)) {
1939 if (wizard->exec() == QDialog::Accepted) {
1941 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1955 m_actionViewChecklistGuide->setChecked (
true);
1958 loadCurveListFromCmdMediator();
1961 loadCoordSystemListFromCmdMediator();
1967 m_actionDigitizeAxis->setChecked (
true);
1968 slotDigitizeAxis ();
1976 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1977 const QImage &image,
1978 ImportType importType)
1980 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage"
1981 <<
" fileName=" << fileName.toLatin1 ().data ()
1982 <<
" importType=" << importType;
1984 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1986 setCurrentPathFromFile (fileName);
1988 m_engaugeFile = EMPTY_FILENAME;
1990 ENGAUGE_ASSERT (m_cmdMediator != 0);
1994 bool accepted = setupAfterLoadReplacingImage (fileName,
1995 tr (
"File imported"),
2003 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
2005 QFile file (m_originalFile);
2009 if (!file.open (QIODevice::ReadOnly)) {
2013 domInputFile.setContent (&file);
2017 void MainWindow::loadToolTips()
2019 if (m_actionViewToolTips->isChecked ()) {
2022 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
2023 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
2024 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
2025 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
2026 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
2027 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
2028 m_cmbBackground->setToolTip (tr (
"Background image."));
2029 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
2030 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
2031 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
2036 m_actionDigitizeSelect->setToolTip (
"");
2037 m_actionDigitizeAxis->setToolTip (
"");
2038 m_actionDigitizeCurve->setToolTip (
"");
2039 m_actionDigitizePointMatch->setToolTip (
"");
2040 m_actionDigitizeColorPicker->setToolTip (
"");
2041 m_actionDigitizeSegment->setToolTip (
"");
2042 m_cmbBackground->setToolTip (
"");
2043 m_cmbCurve->setToolTip (
"");
2044 m_viewPointStyle->setToolTip (
"");
2045 m_viewSegmentFilter->setToolTip (
"");
2050 bool MainWindow::maybeSave()
2052 if (m_cmdMediator != 0) {
2054 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
2055 engaugeWindowTitle(),
2056 tr(
"The document has been modified.\n"
2057 "Do you want to save your changes?"),
2058 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
2059 if (ret == QMessageBox::Save) {
2060 return slotFileSave();
2061 }
else if (ret == QMessageBox::Cancel) {
2072 const QString &fileName)
const
2080 QString csvExtension = QString (
".%1")
2082 QString tsvExtension = QString (
".%1")
2084 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
2085 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
2089 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
2090 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
2091 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
2092 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
2096 return modelExportFormatAfter;
2101 return m_modelMainWindow;
2104 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
2106 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
2108 setWindowFilePath (filePath);
2110 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2111 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
2112 recentFilePaths.removeAll (filePath);
2113 recentFilePaths.prepend (filePath);
2114 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
2115 recentFilePaths.removeLast ();
2117 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
2119 updateRecentFileList();
2124 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
2126 if (m_actionZoomFill->isChecked ()) {
2131 bool MainWindow::saveDocumentFile (
const QString &fileName)
2133 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
2135 QFile file(fileName);
2136 if (!file.open(QFile::WriteOnly)) {
2137 QMessageBox::warning (
this,
2138 engaugeWindowTitle(),
2139 QString (
"%1 %2: \n%3.")
2140 .arg(tr (
"Cannot write file"))
2142 .arg(file.errorString()));
2146 rebuildRecentFileListForCurrentFile (fileName);
2148 QApplication::setOverrideCursor (Qt::WaitCursor);
2149 QXmlStreamWriter writer(&file);
2150 writer.setAutoFormatting(
true);
2151 writer.writeStartDocument();
2152 writer.writeDTD(
"<!DOCTYPE engauge>");
2154 writer.writeEndDocument();
2155 QApplication::restoreOverrideCursor ();
2159 m_cmdMediator->setClean ();
2161 setCurrentFile(fileName);
2162 m_engaugeFile = fileName;
2172 const char *comment)
const
2176 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
2178 QString report = saveErrorReportFileAndExitXml (context,
2185 if (dlg.exec() == QDialog::Accepted) {
2193 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
2196 const char *comment)
const
2198 const bool DEEP_COPY =
true;
2200 QString xmlErrorReport;
2201 QXmlStreamWriter writer (&xmlErrorReport);
2202 writer.setAutoFormatting(
true);
2205 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
2208 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
2209 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
2210 writer.writeEndElement();
2214 QXmlStreamReader reader (m_startingDocumentSnapshot);
2215 while (!reader.atEnd ()) {
2217 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2218 reader.tokenType() != QXmlStreamReader::EndDocument) {
2219 writer.writeCurrentToken (reader);
2224 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2225 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2226 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2227 writer.writeEndElement();
2230 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2231 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2232 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2233 writer.writeEndElement();
2236 m_cmdMediator->
saveXml(writer);
2239 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2240 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2241 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2242 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2243 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2244 writer.writeEndElement();
2246 writer.writeEndElement();
2249 QDomDocument domErrorReport (
"ErrorReport");
2250 domErrorReport.setContent (xmlErrorReport);
2253 if (!m_originalFileWasImported) {
2257 QDomDocument domInputFile;
2258 loadInputFileForErrorReport (domInputFile);
2259 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2260 if (!domInputFile.isNull()) {
2261 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2263 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2264 if (nodesFileTo.count () > 0) {
2265 QDomNode nodeFileTo = nodesFileTo.at (0);
2266 nodeFileTo.appendChild (fragmentFileFrom);
2273 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2274 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2275 QDomNode nodeDocument = nodesDocument.at (i);
2276 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2277 if (!elemImage.isNull()) {
2280 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2281 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2283 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2284 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2286 QDomNode nodeReplacement;
2287 QDomElement elemReplacement = nodeReplacement.toElement();
2288 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2289 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2292 nodeDocument.insertBefore (nodeReplacement,
2294 nodeDocument.removeChild(elemImage);
2300 return domErrorReport.toString();
2303 void MainWindow::saveStartingDocumentSnapshot()
2305 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2307 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2308 writer.setAutoFormatting (
true);
2314 ENGAUGE_CHECK_PTR (m_scene);
2320 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2322 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2324 int index = m_cmbBackground->findData (backgroundImage);
2325 ENGAUGE_ASSERT (index >= 0);
2327 m_cmbBackground->setCurrentIndex(index);
2329 return previousBackground;
2334 return m_cmbCurve->currentText ();
2337 void MainWindow::setCurrentFile (
const QString &fileName)
2339 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2341 QString fileNameStripped;
2342 if (!fileName.isEmpty()) {
2345 QFileInfo fileInfo (fileName);
2346 fileNameStripped = fileInfo.baseName();
2349 m_currentFile = fileNameStripped;
2350 m_currentFileWithPathAndFileExtension = fileName;
2352 updateWindowTitle ();
2355 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2357 QDir dir = QFileInfo (fileName).absoluteDir();
2359 if (dir.exists ()) {
2361 bool success = QDir::setCurrent (dir.absolutePath ());
2362 ENGAUGE_ASSERT (success);
2370 void MainWindow::setPixmap (
const QString &curveSelected,
2371 const QPixmap &pixmap)
2373 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2380 m_backgroundStateContext->
setPixmap (m_transformation,
2387 void MainWindow::settingsRead (
bool isReset)
2389 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2396 settingsReadEnvironment (settings);
2397 settingsReadMainWindow (settings);
2400 void MainWindow::settingsReadEnvironment (QSettings &settings)
2402 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2403 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2404 QDir::currentPath ()).toString ());
2405 settings.endGroup ();
2408 void MainWindow::settingsReadMainWindow (QSettings &settings)
2410 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2413 resize (settings.value (SETTINGS_SIZE,
2414 QSize (600, 600)).toSize ());
2415 move (settings.value (SETTINGS_POS,
2416 QPoint (200, 200)).toPoint ());
2420 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2421 QSize (900, 600)).toSize();
2422 m_helpWindow->resize (helpSize);
2423 if (settings.contains (SETTINGS_HELP_POS)) {
2424 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2425 m_helpWindow->move (helpPos);
2430 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2434 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2436 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2437 m_toolBackground->setVisible (viewBackgroundToolBar);
2438 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2439 BACKGROUND_IMAGE_FILTERED).toInt ();
2440 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2441 m_cmbBackground->setCurrentIndex (indexBackground);
2444 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2446 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2447 m_toolDigitize->setVisible (viewDigitizeToolBar);
2450 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2452 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2453 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2456 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2458 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2459 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2462 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2464 m_actionViewToolTips->setChecked (viewToolTips);
2468 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2471 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2472 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2473 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2475 addDockWindow (m_dockChecklistGuide,
2477 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2478 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
2479 Qt::RightDockWidgetArea);
2480 addDockWindow (m_dockFittingWindow,
2482 SETTINGS_FITTING_WINDOW_DOCK_AREA,
2483 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
2484 Qt::RightDockWidgetArea);
2485 addDockWindow (m_dockGeometryWindow,
2487 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
2488 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
2489 Qt::RightDockWidgetArea);
2494 QLocale localeDefault;
2495 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2496 QVariant (localeDefault.language())).toInt();
2497 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2498 QVariant (localeDefault.country())).toInt();
2499 QLocale locale (language,
2501 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2502 QVariant (ZOOM_1_TO_1)).toInt());
2504 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2505 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2506 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2507 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2508 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2509 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2510 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
2511 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
2512 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
2513 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
2515 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
2517 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
2518 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
2519 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
2521 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
2524 updateSmallDialogs();
2526 settings.endGroup();
2529 void MainWindow::settingsWrite ()
2531 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2533 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2534 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2535 settings.endGroup ();
2537 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2538 settings.setValue (SETTINGS_SIZE, size ());
2539 settings.setValue (SETTINGS_POS, pos ());
2541 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2542 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2544 if (m_dockChecklistGuide->isFloating()) {
2546 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2547 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2551 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2554 if (m_dockFittingWindow->isFloating()) {
2556 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2557 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
2560 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
2562 if (m_dockGeometryWindow->isFloating()) {
2564 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
2565 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
2569 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
2572 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2573 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2574 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
2575 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
2576 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
2577 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
2578 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2579 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2580 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2581 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
2582 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
2583 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2584 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2585 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2586 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2587 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2588 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2589 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2590 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2591 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2592 settings.endGroup ();
2595 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
2596 const QString &temporaryMessage ,
2597 ImportType importType)
2599 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument"
2600 <<
" file=" << fileName.toLatin1().data()
2601 <<
" message=" << temporaryMessage.toLatin1().data()
2602 <<
" importType=" << importType;
2607 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2611 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2615 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2617 m_cmdMediator->
pixmap ());
2621 if (importType == IMPORT_TYPE_ADVANCED) {
2623 applyZoomFactorAfterLoad();
2626 dlgImportAdvanced.exec();
2628 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2632 int numberCoordSystem = dlgImportAdvanced.numberCoordSystem();
2641 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2642 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2643 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2644 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2645 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2646 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2647 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2648 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2649 loadCurveListFromCmdMediator ();
2650 loadCoordSystemListFromCmdMediator ();
2653 m_isDocumentExported =
false;
2662 m_cmbCurve->currentText ());
2663 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2665 applyZoomFactorAfterLoad();
2667 setCurrentFile(fileName);
2671 saveStartingDocumentSnapshot();
2678 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2679 const QString &temporaryMessage ,
2680 ImportType importType)
2682 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage"
2683 <<
" file=" << fileName.toLatin1().data()
2684 <<
" message=" << temporaryMessage.toLatin1().data()
2685 <<
" importType=" << importType;
2690 m_cmdMediator->clear();
2693 m_cmdMediator->
pixmap ());
2695 m_isDocumentExported =
false;
2697 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2699 applyZoomFactorAfterLoad();
2701 setCurrentFile(fileName);
2705 saveStartingDocumentSnapshot();
2714 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent"
2715 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2717 QMainWindow::showEvent (event);
2719 if (m_loadStartupFiles.count() > 0) {
2721 m_timerLoadStartupFiles =
new QTimer;
2722 m_timerLoadStartupFiles->setSingleShot (
true);
2723 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2724 m_timerLoadStartupFiles->start (0);
2734 void MainWindow::slotBtnPrintAll ()
2736 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2740 QPrinter printer (QPrinter::HighResolution);
2741 QPrintDialog dlg (&printer,
this);
2742 if (dlg.exec() == QDialog::Accepted) {
2743 QPainter painter (&printer);
2744 m_view->render (&painter);
2751 void MainWindow::slotBtnShowAllPressed ()
2753 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2759 void MainWindow::slotBtnShowAllReleased ()
2761 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2767 void MainWindow::slotCanRedoChanged (
bool canRedo)
2769 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2771 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2774 void MainWindow::slotCanUndoChanged (
bool canUndo)
2776 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2778 m_actionEditUndo->setEnabled (canUndo);
2781 void MainWindow::slotChecklistClosed()
2783 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2785 m_actionViewChecklistGuide->setChecked (
false);
2788 void MainWindow::slotCleanChanged(
bool clean)
2790 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2792 setWindowModified (!clean);
2795 void MainWindow::slotCmbBackground(
int currentIndex)
2797 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2799 switch (currentIndex) {
2800 case BACKGROUND_IMAGE_NONE:
2801 if (!m_actionViewBackgroundNone->isChecked()) {
2802 m_actionViewBackgroundNone->toggle();
2806 case BACKGROUND_IMAGE_ORIGINAL:
2807 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2808 m_actionViewBackgroundOriginal->toggle();
2812 case BACKGROUND_IMAGE_FILTERED:
2813 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2814 m_actionViewBackgroundFiltered->toggle();
2822 void MainWindow::slotCmbCoordSystem(
int index)
2824 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2830 m_cmdMediator->push (cmd);
2833 void MainWindow::slotCmbCurve(
int )
2835 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2840 m_cmbCurve->currentText ());
2844 updateViewedCurves();
2846 updateFittingWindow();
2847 updateGeometryWindow();
2850 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2852 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2858 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2860 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2866 void MainWindow::slotDigitizeAxis ()
2868 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2871 DIGITIZE_STATE_AXIS);
2872 m_cmbCurve->setEnabled (
false);
2877 void MainWindow::slotDigitizeColorPicker ()
2879 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2882 DIGITIZE_STATE_COLOR_PICKER);
2883 m_cmbCurve->setEnabled (
true);
2888 void MainWindow::slotDigitizeCurve ()
2890 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2893 DIGITIZE_STATE_CURVE);
2894 m_cmbCurve->setEnabled (
true);
2899 void MainWindow::slotDigitizePointMatch ()
2901 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2904 DIGITIZE_STATE_POINT_MATCH);
2905 m_cmbCurve->setEnabled (
true);
2910 void MainWindow::slotDigitizeSegment ()
2912 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2915 DIGITIZE_STATE_SEGMENT);
2916 m_cmbCurve->setEnabled (
true);
2921 void MainWindow::slotDigitizeSelect ()
2923 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2926 DIGITIZE_STATE_SELECT);
2927 m_cmbCurve->setEnabled (
false);
2932 void MainWindow::slotEditCopy ()
2934 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2937 bool tableFittingIsActive, tableFittingIsCopyable;
2938 bool tableGeometryIsActive, tableGeometryIsCopyable;
2939 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2940 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2942 if (tableFittingIsActive) {
2945 m_dockFittingWindow->
doCopy ();
2947 }
else if (tableGeometryIsActive) {
2950 m_dockGeometryWindow->
doCopy ();
2956 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2967 void MainWindow::slotEditCut ()
2969 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2972 bool tableFittingIsActive, tableFittingIsCopyable;
2973 bool tableGeometryIsActive, tableGeometryIsCopyable;
2974 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2975 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2977 if (tableFittingIsActive || tableGeometryIsActive) {
2985 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2996 void MainWindow::slotEditDelete ()
2998 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
3001 bool tableFittingIsActive, tableFittingIsCopyable;
3002 bool tableGeometryIsActive, tableGeometryIsCopyable;
3003 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3004 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3006 if (tableFittingIsActive || tableGeometryIsActive) {
3014 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
3025 void MainWindow::slotEditMenu ()
3027 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
3029 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
3030 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
3033 void MainWindow::slotEditPaste ()
3035 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
3038 void MainWindow::slotEditPasteAsNew ()
3040 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
3042 filePaste (IMPORT_TYPE_SIMPLE);
3045 void MainWindow::slotEditPasteAsNewAdvanced ()
3047 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
3049 filePaste (IMPORT_TYPE_ADVANCED);
3052 void MainWindow::slotFileClose()
3054 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
3068 DIGITIZE_STATE_EMPTY);
3071 if (m_fittingCurve != 0) {
3072 m_scene->removeItem (m_fittingCurve);
3080 m_backgroundStateContext->
close ();
3083 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
3086 m_dockFittingWindow->
clear ();
3089 m_dockGeometryWindow->
clear ();
3092 delete m_cmdMediator;
3098 setWindowTitle (engaugeWindowTitle ());
3100 m_gridLines.
clear();
3105 void MainWindow::slotFileExport ()
3107 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
3112 QString filter = QString (
"%1;;%2;;All files (*.*)")
3117 QString defaultFileName = QString (
"%1/%2.%3")
3118 .arg (QDir::currentPath ())
3119 .arg (m_currentFile)
3122 QString filterCsv = exportStrategy.
filterCsv ();
3123 QString fileName = dlg.getSaveFileName (
this,
3128 if (!fileName.isEmpty ()) {
3130 fileExport(fileName,
3139 void MainWindow::slotFileImport ()
3141 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
3143 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
3146 void MainWindow::slotFileImportAdvanced ()
3148 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
3150 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
3153 void MainWindow::slotFileImportDraggedImage(QImage image)
3155 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
3160 IMPORT_TYPE_SIMPLE);
3163 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
3165 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
3170 void MainWindow::slotFileImportImage(QString fileName, QImage image)
3172 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
3175 loadImage (fileName,
3177 IMPORT_TYPE_SIMPLE);
3180 void MainWindow::slotFileImportImageReplace ()
3182 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
3184 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
3187 void MainWindow::slotFileOpen()
3189 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
3195 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
3196 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3197 .arg (ENGAUGE_FILENAME_EXTENSION);
3199 QString fileName = QFileDialog::getOpenFileName (
this,
3200 tr(
"Open Document"),
3201 QDir::currentPath (),
3203 if (!fileName.isEmpty ()) {
3205 loadDocumentFile (fileName);
3211 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
3213 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
3215 loadDocumentFile (fileName);
3218 void MainWindow::slotFilePrint()
3220 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
3222 QPrinter printer (QPrinter::HighResolution);
3223 QPrintDialog dlg (&printer,
this);
3224 if (dlg.exec() == QDialog::Accepted) {
3225 QPainter painter (&printer);
3226 m_view->render (&painter);
3231 bool MainWindow::slotFileSave()
3233 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
3235 if (m_engaugeFile.isEmpty()) {
3236 return slotFileSaveAs();
3238 return saveDocumentFile (m_engaugeFile);
3242 bool MainWindow::slotFileSaveAs()
3244 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
3247 QString filenameDefault = m_currentFile;
3248 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
3249 filenameDefault = QString (
"%1.%2")
3250 .arg (m_currentFile)
3251 .arg (ENGAUGE_FILENAME_EXTENSION);
3254 if (!m_engaugeFile.isEmpty()) {
3255 filenameDefault = m_engaugeFile;
3258 QString filterDigitizer = QString (
"%1 (*.%2)")
3259 .arg (ENGAUGE_FILENAME_DESCRIPTION)
3260 .arg (ENGAUGE_FILENAME_EXTENSION);
3261 QString filterAll (
"All files (*. *)");
3263 QStringList filters;
3264 filters << filterDigitizer;
3265 filters << filterAll;
3267 QFileDialog dlg(
this);
3268 dlg.setFileMode (QFileDialog::AnyFile);
3269 dlg.selectNameFilter (filterDigitizer);
3270 dlg.setNameFilters (filters);
3271 #if defined(OSX_DEBUG) || defined(OSX_RELEASE)
3274 dlg.setWindowModality(Qt::WindowModal);
3276 dlg.setAcceptMode(QFileDialog::AcceptSave);
3277 dlg.selectFile(filenameDefault);
3280 QStringList files = dlg.selectedFiles();
3281 return saveDocumentFile(files.at(0));
3287 void MainWindow::slotFittingWindowClosed()
3289 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
3291 m_actionViewFittingWindow->setChecked (
false);
3294 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
3301 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit"
3302 <<
" order=" << fittingCurveCoef.size() - 1;
3304 if (m_fittingCurve != 0) {
3305 m_scene->removeItem (m_fittingCurve);
3306 delete m_fittingCurve;
3316 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
3317 m_scene->addItem (m_fittingCurve);
3320 void MainWindow::slotGeometryWindowClosed()
3322 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
3324 m_actionViewGeometryWindow->setChecked (
false);
3327 void MainWindow::slotHelpAbout()
3329 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
3335 void MainWindow::slotHelpTutorial()
3337 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
3339 m_tutorialDlg->show ();
3340 m_tutorialDlg->exec ();
3343 void MainWindow::slotKeyPress (Qt::Key key,
3344 bool atLeastOneSelectedItem)
3346 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress"
3347 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
3348 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
3352 atLeastOneSelectedItem);
3355 void MainWindow::slotLoadStartupFiles ()
3357 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
3359 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
3361 QString fileName = m_loadStartupFiles.front();
3362 m_loadStartupFiles.pop_front();
3368 loadDocumentFile (fileName);
3372 fileImport (fileName,
3373 IMPORT_TYPE_SIMPLE);
3377 if (m_loadStartupFiles.count() > 0) {
3381 QProcess::startDetached (QCoreApplication::applicationFilePath(),
3382 m_loadStartupFiles);
3386 void MainWindow::slotMouseMove (QPointF pos)
3391 if (m_cmdMediator != 0) {
3394 QString coordsScreen, coordsGraph, resolutionGraph;
3413 void MainWindow::slotMousePress (QPointF pos)
3415 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
3423 void MainWindow::slotMouseRelease (QPointF pos)
3425 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
3427 if (pos.x() < 0 || pos.y() < 0) {
3441 void MainWindow::slotRecentFileAction ()
3443 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3445 QAction *action = qobject_cast<QAction*>(sender ());
3448 QString fileName = action->data().toString();
3449 loadDocumentFile (fileName);
3453 void MainWindow::slotRecentFileClear ()
3455 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3457 QStringList emptyList;
3459 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3460 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3463 updateRecentFileList();
3466 void MainWindow::slotRedoTextChanged (
const QString &text)
3468 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3470 QString completeText (
"Redo");
3471 if (!text.isEmpty ()) {
3472 completeText += QString (
" \"%1\"").arg (text);
3474 m_actionEditRedo->setText (completeText);
3477 void MainWindow::slotSettingsAxesChecker ()
3479 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3481 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3482 m_dlgSettingsAxesChecker->show ();
3485 void MainWindow::slotSettingsColorFilter ()
3487 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3489 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3490 m_dlgSettingsColorFilter->show ();
3493 void MainWindow::slotSettingsCoords ()
3495 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3497 m_dlgSettingsCoords->
load (*m_cmdMediator);
3498 m_dlgSettingsCoords->show ();
3501 void MainWindow::slotSettingsCurveAddRemove ()
3503 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3505 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3506 m_dlgSettingsCurveAddRemove->show ();
3509 void MainWindow::slotSettingsCurveProperties ()
3511 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3513 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3515 m_dlgSettingsCurveProperties->show ();
3518 void MainWindow::slotSettingsDigitizeCurve ()
3520 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3522 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3523 m_dlgSettingsDigitizeCurve->show ();
3526 void MainWindow::slotSettingsExportFormat ()
3528 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3531 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3532 m_dlgSettingsExportFormat->show ();
3539 void MainWindow::slotSettingsGeneral ()
3541 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3543 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3544 m_dlgSettingsGeneral->show ();
3547 void MainWindow::slotSettingsGridDisplay()
3549 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
3551 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3552 m_dlgSettingsGridDisplay->show ();
3555 void MainWindow::slotSettingsGridRemoval ()
3557 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3559 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3560 m_dlgSettingsGridRemoval->show ();
3563 void MainWindow::slotSettingsPointMatch ()
3565 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3567 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3568 m_dlgSettingsPointMatch->show ();
3571 void MainWindow::slotSettingsSegments ()
3573 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3575 m_dlgSettingsSegments->
load (*m_cmdMediator);
3576 m_dlgSettingsSegments->show ();
3579 void MainWindow::slotTableStatusChange ()
3581 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
3588 void MainWindow::slotSettingsMainWindow ()
3590 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3594 m_dlgSettingsMainWindow->show ();
3597 void MainWindow::slotTimeoutRegressionErrorReport ()
3599 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport"
3600 <<
" cmdStackIndex=" << m_cmdMediator->index()
3601 <<
" cmdStackCount=" << m_cmdMediator->count();
3603 if (m_cmdStackShadow->
canRedo()) {
3606 QDir::setCurrent (m_startupDirectory);
3611 QDir::setCurrent (m_startupDirectory);
3616 exportAllCoordinateSystemsAfterRegressionTests ();
3620 m_cmdMediator->setClean();
3626 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3628 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3630 if (m_fileCmdScript->
canRedo()) {
3633 QDir::setCurrent (m_startupDirectory);
3635 m_fileCmdScript->
redo(*
this);
3638 QDir::setCurrent (m_startupDirectory);
3643 if (m_cmdMediator != 0) {
3646 exportAllCoordinateSystemsAfterRegressionTests ();
3650 m_cmdMediator->setClean();
3660 void MainWindow::slotUndoTextChanged (
const QString &text)
3662 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3664 QString completeText (
"Undo");
3665 if (!text.isEmpty ()) {
3666 completeText += QString (
" \"%1\"").arg (text);
3668 m_actionEditUndo->setText (completeText);
3671 void MainWindow::slotViewGridLines ()
3673 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
3678 void MainWindow::slotViewGroupBackground(QAction *action)
3680 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3683 BackgroundImage backgroundImage;
3684 int indexBackground;
3685 if (action == m_actionViewBackgroundNone) {
3686 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3687 backgroundImage = BACKGROUND_IMAGE_NONE;
3688 }
else if (action == m_actionViewBackgroundOriginal) {
3689 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3690 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3691 }
else if (action == m_actionViewBackgroundFiltered) {
3692 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3693 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3695 ENGAUGE_ASSERT (
false);
3698 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3699 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3702 m_cmbBackground->setCurrentIndex (indexBackground);
3706 void MainWindow::slotViewGroupCurves(QAction * )
3708 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3710 updateViewedCurves ();
3713 void MainWindow::slotViewGroupStatus(QAction *action)
3715 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3717 ENGAUGE_CHECK_PTR (m_statusBar);
3719 if (action == m_actionStatusNever) {
3721 }
else if (action == m_actionStatusTemporary) {
3728 void MainWindow::slotViewToolBarBackground ()
3730 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3732 if (m_actionViewBackground->isChecked ()) {
3733 m_toolBackground->show();
3735 m_toolBackground->hide();
3739 void MainWindow::slotViewToolBarChecklistGuide ()
3741 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3743 if (m_actionViewChecklistGuide->isChecked ()) {
3744 m_dockChecklistGuide->show();
3746 m_dockChecklistGuide->hide();
3750 void MainWindow::slotViewToolBarCoordSystem ()
3752 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3754 if (m_actionViewCoordSystem->isChecked ()) {
3755 m_toolCoordSystem->show();
3757 m_toolCoordSystem->hide();
3761 void MainWindow::slotViewToolBarDigitize ()
3763 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3765 if (m_actionViewDigitize->isChecked ()) {
3766 m_toolDigitize->show();
3768 m_toolDigitize->hide();
3772 void MainWindow::slotViewToolBarFittingWindow()
3774 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
3776 if (m_actionViewFittingWindow->isChecked()) {
3777 m_dockFittingWindow->show ();
3778 if (m_fittingCurve != 0) {
3779 m_fittingCurve->setVisible (
true);
3782 m_dockFittingWindow->hide ();
3783 if (m_fittingCurve != 0) {
3784 m_fittingCurve->setVisible (
false);
3789 void MainWindow::slotViewToolBarGeometryWindow ()
3791 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
3793 if (m_actionViewGeometryWindow->isChecked ()) {
3794 m_dockGeometryWindow->show();
3796 m_dockGeometryWindow->hide();
3800 void MainWindow::slotViewToolBarSettingsViews ()
3802 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3804 if (m_actionViewSettingsViews->isChecked ()) {
3805 m_toolSettingsViews->show();
3807 m_toolSettingsViews->hide();
3811 void MainWindow::slotViewToolTips ()
3813 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3818 void MainWindow::slotViewZoom(
int zoom)
3820 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3823 switch ((ZoomFactor) zoom) {
3825 m_actionZoom16To1->setChecked(
true);
3826 slotViewZoom16To1 ();
3829 m_actionZoom8To1->setChecked(
true);
3830 slotViewZoom8To1 ();
3833 m_actionZoom4To1->setChecked(
true);
3834 slotViewZoom4To1 ();
3837 m_actionZoom2To1->setChecked(
true);
3838 slotViewZoom2To1 ();
3841 m_actionZoom1To1->setChecked(
true);
3842 slotViewZoom1To1 ();
3845 m_actionZoom1To2->setChecked(
true);
3846 slotViewZoom1To2 ();
3849 m_actionZoom1To4->setChecked(
true);
3850 slotViewZoom1To4 ();
3853 m_actionZoom1To8->setChecked(
true);
3854 slotViewZoom1To8 ();
3857 m_actionZoom1To16->setChecked(
true);
3858 slotViewZoom1To16 ();
3861 m_actionZoomFill->setChecked(
true);
3862 slotViewZoomFill ();
3867 void MainWindow::slotViewZoom16To1 ()
3869 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3871 QTransform transform;
3872 transform.scale (16.0, 16.0);
3873 m_view->setTransform (transform);
3877 void MainWindow::slotViewZoom8To1 ()
3879 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3881 QTransform transform;
3882 transform.scale (8.0, 8.0);
3883 m_view->setTransform (transform);
3887 void MainWindow::slotViewZoom4To1 ()
3889 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3891 QTransform transform;
3892 transform.scale (4.0, 4.0);
3893 m_view->setTransform (transform);
3897 void MainWindow::slotViewZoom2To1 ()
3899 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3901 QTransform transform;
3902 transform.scale (2.0, 2.0);
3903 m_view->setTransform (transform);
3907 void MainWindow::slotViewZoom1To1 ()
3909 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
3911 QTransform transform;
3912 transform.scale (1.0, 1.0);
3913 m_view->setTransform (transform);
3917 void MainWindow::slotViewZoom1To2 ()
3919 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
3921 QTransform transform;
3922 transform.scale (0.5, 0.5);
3923 m_view->setTransform (transform);
3927 void MainWindow::slotViewZoom1To4 ()
3929 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
3931 QTransform transform;
3932 transform.scale (0.25, 0.25);
3933 m_view->setTransform (transform);
3937 void MainWindow::slotViewZoom1To8 ()
3939 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
3941 QTransform transform;
3942 transform.scale (0.125, 0.125);
3943 m_view->setTransform (transform);
3947 void MainWindow::slotViewZoom1To16 ()
3949 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
3951 QTransform transform;
3952 transform.scale (0.0625, 0.0625);
3953 m_view->setTransform (transform);
3957 void MainWindow::slotViewZoomFill ()
3959 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
3961 m_backgroundStateContext->
fitInView (*m_view);
3966 void MainWindow::slotViewZoomIn ()
3968 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3972 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3973 bool goto1To1 =
false;
3974 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3975 if (m_actionZoomFill->isChecked ()) {
3978 double xScale = m_view->transform().m11();
3979 double yScale = m_view->transform().m22();
3980 double scale = qMin(xScale, yScale);
3981 if (scale < 0.125) {
3983 }
else if (scale < 0.25) {
3985 }
else if (scale < 0.5) {
3987 }
else if (scale < 1) {
3989 }
else if (scale < 2) {
3991 }
else if (scale < 4) {
3993 }
else if (scale < 8) {
3999 goto16To1 = m_actionZoom8To1->isChecked ();
4000 goto8To1 = m_actionZoom4To1->isChecked ();
4001 goto4To1 = m_actionZoom2To1->isChecked ();
4002 goto2To1 = m_actionZoom1To1->isChecked ();
4003 goto1To1 = m_actionZoom1To2->isChecked ();
4004 goto1To2 = m_actionZoom1To4->isChecked ();
4005 goto1To4 = m_actionZoom1To8->isChecked ();
4006 goto1To8 = m_actionZoom1To16->isChecked ();
4011 m_actionZoom16To1->setChecked (
true);
4012 slotViewZoom16To1 ();
4013 }
else if (goto8To1) {
4014 m_actionZoom8To1->setChecked (
true);
4015 slotViewZoom8To1 ();
4016 }
else if (goto4To1) {
4017 m_actionZoom4To1->setChecked (
true);
4018 slotViewZoom4To1 ();
4019 }
else if (goto2To1) {
4020 m_actionZoom2To1->setChecked (
true);
4021 slotViewZoom2To1 ();
4022 }
else if (goto1To1) {
4023 m_actionZoom1To1->setChecked (
true);
4024 slotViewZoom1To1 ();
4025 }
else if (goto1To2) {
4026 m_actionZoom1To2->setChecked (
true);
4027 slotViewZoom1To2 ();
4028 }
else if (goto1To4) {
4029 m_actionZoom1To4->setChecked (
true);
4030 slotViewZoom1To4 ();
4031 }
else if (goto1To8) {
4032 m_actionZoom1To8->setChecked (
true);
4033 slotViewZoom1To8 ();
4034 }
else if (goto1To16) {
4035 m_actionZoom1To16->setChecked (
true);
4036 slotViewZoom1To16 ();
4040 void MainWindow::slotViewZoomInFromWheelEvent ()
4042 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
4044 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4045 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4048 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4053 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4057 void MainWindow::slotViewZoomOut ()
4059 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
4063 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
4064 bool goto1To1 =
false;
4065 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
4066 if (m_actionZoomFill->isChecked ()) {
4069 double xScale = m_view->transform().m11();
4070 double yScale = m_view->transform().m22();
4071 double scale = qMax(xScale, yScale);
4074 }
else if (scale > 4) {
4076 }
else if (scale > 2) {
4078 }
else if (scale > 1) {
4080 }
else if (scale > 0.5) {
4082 }
else if (scale > 0.25) {
4084 }
else if (scale > 0.125) {
4090 goto8To1 = m_actionZoom16To1->isChecked ();
4091 goto4To1 = m_actionZoom8To1->isChecked ();
4092 goto2To1 = m_actionZoom4To1->isChecked ();
4093 goto1To1 = m_actionZoom2To1->isChecked ();
4094 goto1To2 = m_actionZoom1To1->isChecked ();
4095 goto1To4 = m_actionZoom1To2->isChecked ();
4096 goto1To8 = m_actionZoom1To4->isChecked ();
4097 goto1To16 = m_actionZoom1To8->isChecked ();
4102 m_actionZoom1To16->setChecked (
true);
4103 slotViewZoom1To16 ();
4104 }
else if (goto1To8) {
4105 m_actionZoom1To8->setChecked (
true);
4106 slotViewZoom1To8 ();
4107 }
else if (goto1To4) {
4108 m_actionZoom1To4->setChecked (
true);
4109 slotViewZoom1To4 ();
4110 }
else if (goto1To2) {
4111 m_actionZoom1To2->setChecked (
true);
4112 slotViewZoom1To2 ();
4113 }
else if (goto1To1) {
4114 m_actionZoom1To1->setChecked (
true);
4115 slotViewZoom1To1 ();
4116 }
else if (goto2To1) {
4117 m_actionZoom2To1->setChecked (
true);
4118 slotViewZoom2To1 ();
4119 }
else if (goto4To1) {
4120 m_actionZoom4To1->setChecked (
true);
4121 slotViewZoom4To1 ();
4122 }
else if (goto8To1) {
4123 m_actionZoom8To1->setChecked (
true);
4124 slotViewZoom8To1 ();
4125 }
else if (goto16To1) {
4126 m_actionZoom16To1->setChecked (
true);
4127 slotViewZoom16To1 ();
4131 void MainWindow::slotViewZoomOutFromWheelEvent ()
4133 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
4135 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
4136 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
4139 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
4144 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
4148 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
4150 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
4159 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
4161 m_timerRegressionErrorReport =
new QTimer();
4162 m_timerRegressionErrorReport->setSingleShot(
false);
4163 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
4165 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
4168 void MainWindow::startRegressionTestFileCmdScript()
4170 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
4172 m_timerRegressionFileCmdScript =
new QTimer();
4173 m_timerRegressionFileCmdScript->setSingleShot(
false);
4174 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
4176 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
4181 return m_transformation;
4191 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
4193 ENGAUGE_CHECK_PTR (m_cmdMediator);
4197 updateAfterCommandStatusBarCoords ();
4199 updateHighlightOpacity ();
4205 updateChecklistGuide ();
4206 updateFittingWindow ();
4207 updateGeometryWindow();
4211 writeCheckpointToLogFile ();
4215 m_view->setFocus ();
4218 void MainWindow::updateAfterCommandStatusBarCoords ()
4220 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
4225 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
4229 updateTransformationAndItsDependencies();
4232 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
4240 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
4248 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
4257 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
4258 QPointF posScreen = m_view->mapToScene (posLocal);
4260 slotMouseMove (posScreen);
4265 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
4270 void MainWindow::updateChecklistGuide ()
4272 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
4274 m_isDocumentExported =
true;
4275 m_dockChecklistGuide->
update (*m_cmdMediator,
4276 m_isDocumentExported);
4279 void MainWindow::updateControls ()
4281 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls"
4282 <<
" selectedItems=" << m_scene->selectedItems().count();
4284 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
4286 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
4288 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
4289 (m_actionRecentFiles.at(0)->isVisible ()));
4291 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
4292 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
4293 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
4294 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
4295 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
4297 if (m_cmdMediator == 0) {
4298 m_actionEditUndo->setEnabled (
false);
4299 m_actionEditRedo->setEnabled (
false);
4301 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
4302 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
4304 bool tableFittingIsActive, tableFittingIsCopyable;
4305 bool tableGeometryIsActive, tableGeometryIsCopyable;
4306 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
4307 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
4308 m_actionEditCut->setEnabled (!tableFittingIsActive &&
4309 !tableGeometryIsActive &&
4310 m_scene->selectedItems().count () > 0);
4311 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
4312 (tableFittingIsActive && tableFittingIsCopyable) ||
4313 (tableGeometryIsActive && tableGeometryIsCopyable));
4314 m_actionEditPaste->setEnabled (
false);
4315 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
4316 !tableGeometryIsActive &&
4317 m_scene->selectedItems().count () > 0);
4320 m_actionDigitizeAxis->setEnabled (!m_currentFile.isEmpty ());
4321 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
4322 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
4323 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
4324 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
4325 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
4327 m_actionViewGridLines->setEnabled (
true);
4329 m_actionViewGridLines->setEnabled (
false);
4330 m_actionViewGridLines->setChecked (
false);
4332 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
4333 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
4334 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
4335 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
4337 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
4338 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
4339 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
4340 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
4341 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
4342 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
4343 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
4344 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
4345 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
4346 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
4347 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
4348 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
4350 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
4351 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
4352 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
4354 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
4355 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
4360 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
4365 loadCurveListFromCmdMediator ();
4367 updateTransformationAndItsDependencies();
4379 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4381 switch (digitizeState) {
4382 case DIGITIZE_STATE_AXIS:
4383 m_actionDigitizeAxis->setChecked(
true);
4387 case DIGITIZE_STATE_COLOR_PICKER:
4388 m_actionDigitizeColorPicker->setChecked(
true);
4389 slotDigitizeColorPicker();
4392 case DIGITIZE_STATE_CURVE:
4393 m_actionDigitizeCurve->setChecked(
true);
4394 slotDigitizeCurve();
4397 case DIGITIZE_STATE_EMPTY:
4400 case DIGITIZE_STATE_POINT_MATCH:
4401 m_actionDigitizePointMatch->setChecked(
true);
4402 slotDigitizePointMatch();
4405 case DIGITIZE_STATE_SEGMENT:
4406 m_actionDigitizeSegment->setChecked(
true);
4407 slotDigitizeSegment();
4410 case DIGITIZE_STATE_SELECT:
4411 m_actionDigitizeSelect->setChecked(
true);
4412 slotDigitizeSelect();
4416 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
4421 void MainWindow::updateFittingWindow ()
4423 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
4425 if (m_cmdMediator != 0 &&
4429 m_dockFittingWindow->
update (*m_cmdMediator,
4431 m_cmbCurve->currentText (),
4436 void MainWindow::updateGeometryWindow ()
4438 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
4440 if (m_cmdMediator != 0 &&
4444 m_dockGeometryWindow->
update (*m_cmdMediator,
4446 m_cmbCurve->currentText (),
4453 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
4459 void MainWindow::updateGridLines ()
4461 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
4464 m_gridLines.
clear ();
4475 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
4478 void MainWindow::updateHighlightOpacity ()
4480 if (m_cmdMediator != 0) {
4486 m_dockGeometryWindow);
4490 void MainWindow::updateRecentFileList()
4492 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
4495 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
4496 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
4499 unsigned int count = recentFilePaths.size();
4500 if (count > MAX_RECENT_FILE_LIST_SIZE) {
4501 count = MAX_RECENT_FILE_LIST_SIZE;
4506 for (i = 0; i < count; i++) {
4507 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
4508 m_actionRecentFiles.at (i)->setText (strippedName);
4509 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
4510 m_actionRecentFiles.at (i)->setVisible (
true);
4514 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
4515 m_actionRecentFiles.at (i)->setVisible (
false);
4522 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
4525 if (m_transformation.transformIsDefined()) {
4529 m_cmbCurve->currentText());
4534 m_cmbCurve->currentText());
4540 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
4546 m_cmbCurve->currentText());
4553 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
4560 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
4563 loadCurveListFromCmdMediator();
4569 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
4578 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
4582 modelDigitizeCurve);
4587 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
4594 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
4608 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4613 void MainWindow::updateSettingsMainWindow()
4615 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4617 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4618 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4620 m_actionZoomIn->setShortcut (tr (
""));
4621 m_actionZoomOut->setShortcut (tr (
""));
4625 m_actionZoomIn->setShortcut (tr (
"+"));
4626 m_actionZoomOut->setShortcut (tr (
"-"));
4630 if ((m_scene != 0) &&
4631 (m_cmdMediator != 0)) {
4635 updateHighlightOpacity();
4636 updateWindowTitle();
4637 updateFittingWindow();
4638 updateGeometryWindow();
4643 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4651 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4658 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4664 void MainWindow::updateSmallDialogs ()
4681 void MainWindow::updateTransformationAndItsDependencies()
4683 m_transformation.update (!m_currentFile.isEmpty (),
4691 m_cmbCurve->currentText ());
4698 void MainWindow::updateViewedCurves ()
4700 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4702 if (m_actionViewCurvesAll->isChecked ()) {
4706 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4710 }
else if (m_actionViewCurvesNone->isChecked ()) {
4715 ENGAUGE_ASSERT (
false);
4721 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4723 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4730 if (activeCurve.isEmpty ()) {
4743 m_cmdMediator->
pixmap ());
4748 void MainWindow::updateWindowTitle ()
4750 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4752 const QString PLACEHOLDER (
"[*]");
4754 QString title = QString (tr (
"Engauge Digitizer %1")
4755 .arg (VERSION_NUMBER));
4757 QString fileNameMaybeStripped;
4758 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4760 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4764 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4765 fileNameMaybeStripped = fileInfo.baseName();
4768 case MAIN_TITLE_BAR_FORMAT_PATH:
4769 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4773 title += QString (
": %1")
4774 .arg (fileNameMaybeStripped);
4779 title += PLACEHOLDER;
4781 setWindowTitle (title);
4786 ENGAUGE_CHECK_PTR (m_view);
4792 ENGAUGE_CHECK_PTR (m_view);
4796 void MainWindow::writeCheckpointToLogFile ()
4799 QString checkpointDoc;
4800 QTextStream strDoc (&checkpointDoc);
4805 QString checkpointScene;
4806 QTextStream strScene (&checkpointScene);
4811 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4813 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n"
4814 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4815 << checkpointDoc.toLatin1().data()
4816 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4817 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4818 << checkpointScene.toLatin1().data()
4819 <<
"-----------------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.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Command for cutting all selected Points.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void clear()
Deallocate and remove all grid lines.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
Wrapper around the Poppler library.
Class that displays the current Segment Filter in a MainWindow toolbar.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
Dialog for editing point match settings, for DigitizeStatePointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
Context class for transformation state machine.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
Wrapper around the QImage class for read and importing non-PDF files.
void updateSettingsCurveAddRemove(const CurvesGraphs &curvesGraphs)
Update with new curves.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
bool canRedo() const
Returns true if there is at least one command on the stack.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isRegressionTest, bool isGnuplot, bool isReset, QStringList loadStartupFiles, QWidget *parent=0)
Single constructor.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void setCoordinates(const QString &coordsScreen, const QString &coordsGraph, const QString &resolutionGraph)
Populate the coordinates fields. Unavailable values are empty. Html-encoding to highlight with colors...
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void cmdFileClose()
Close file. This is called from a file script command.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow)
Update the Points and their Curves after executing a command.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
PointStyle pointStyle() const
Get method for PointStyle.
void triggerStateTransition(TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
Window that displays the geometry information, as a table, for the current curve. ...
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
QString xmlToUpload() const
Xml to be uploaded. Includes document if user has approved.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
NonPdfReturn load(const QString &fileName, QImage &image, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void wakeUp()
Enable all widgets in the status bar. This is called just after a Document becomes active...
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
static void bindToMainWindow(const MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
Dialog for editing grid removal settings.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void uploadErrorReport(const QString &report)
Upload the error report asynchronously.
void setPixmap(const QImage &image)
Set method for the background pixmap.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Dialog for editing curve names settings.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
int maximumGridLines() const
Maximum number of grid lines.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool dragDropExport() const
Get method for drag and drop export.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
bool smallDialogs() const
Get method for small dialogs flag.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Dockable text window containing checklist guide.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Dialog for editing filtering settings.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
ZoomControl zoomControl() const
Get method for zoom control.
QString fileExtensionTsv() const
File extension for tsv export files.
Details for a specific Point.
Class for exporting during regression, when the Transformation has not yet been defined.
Container for all graph curves. The axes point curve is external to this class.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Wrapper around QStatusBar to manage permanent widgets.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
Client for interacting with Engauge server.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Context class that manages the background image state machine.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
virtual void doCopy()
Copy the current selection to the clipboard.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsMainWindow.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
bool canRedo() const
Return true if there is a command available.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Dialog for editing grid display settings.
void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Command for deleting all selected Points.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
Dialog for editing DigitizeStateCurve settings.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
Class that displays a view of the current Curve's point style.
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
double highlightOpacity() const
Get method for highlight opacity.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
const ColorFilterSettings colorFilterSettings(const QString &curveName) const
Get method for copying one color filter. Cannot return just a reference or else there is a warning ab...
Dialog for editing main window settings, which are entirely independent of all documents.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
bool isGnuplot() const
Get method for gnuplot flag.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Dialog for editing curve properties settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.
void resizeEvent(QResizeEvent *event)
Intercept resize event so graphics scene can be appropriately resized when in Fill mode...
QStringList supportedImageWildcards() const
List the supported jpeg2000 file extensions, for filtering import files.
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
File that manages a command stack for regression testing of file import/open/export/close.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
PdfReturn load(const QString &fileName, QImage &image, int resolution, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
QString filterCsv() const
QFileDialog filter for CSV files.
ImportCropping importCropping() const
Get method for import cropping.
Command for moving all selected Points by a specified translation.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
Window that displays curve fitting as applied to the currently selected curve.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
QLocale locale() const
Get method for locale.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
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.
virtual void clear()
Clear stale information.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
virtual void clear()
Clear stale information.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.