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 "DlgSettingsGridRemoval.h"
45 #include "DlgSettingsMainWindow.h"
46 #include "DlgSettingsPointMatch.h"
47 #include "DlgSettingsSegments.h"
48 #include "DocumentSerialize.h"
49 #include "EngaugeAssert.h"
50 #include "EnumsToQt.h"
51 #include "ExportToFile.h"
52 #include "FileCmdScript.h"
54 #include "GraphicsItemType.h"
55 #include "GraphicsScene.h"
56 #include "GraphicsView.h"
57 #include "HelpWindow.h"
58 #ifdef ENGAUGE_JPEG2000
60 #endif // ENGAUGE_JPEG2000
61 #include "LoadFileInfo.h"
62 #include "LoadImageFromUrl.h"
64 #include "MainTitleBarFormat.h"
65 #include "MainWindow.h"
66 #include "NetworkClient.h"
68 #include <QApplication>
69 #include <QCloseEvent>
72 #include <QDesktopServices>
73 #include <QDockWidget>
74 #include <QDomDocument>
76 #include <QFileDialog>
78 #include <QGraphicsLineItem>
79 #include <QImageReader>
81 #include <QKeySequence>
85 #include <QMessageBox>
86 #include <QMouseEvent>
87 #include <QPrintDialog>
90 #include <QTextStream>
94 #include <QToolButton>
95 #include "QtToString.h"
96 #include <QVBoxLayout>
98 #include <QXmlStreamReader>
99 #include <QXmlStreamWriter>
100 #include "Settings.h"
101 #include "StatusBar.h"
102 #include "TransformationStateContext.h"
103 #include "TutorialDlg.h"
105 #include "ViewPointStyle.h"
106 #include "ViewSegmentFilter.h"
107 #include "ZoomFactor.h"
108 #include "ZoomFactorInitial.h"
111 const QString DIGITIZE_ACTION_AXIS_POINT (QObject::tr (
"Axis Point Tool"));
112 const QString DIGITIZE_ACTION_COLOR_PICKER (QObject::tr (
"Color Picker Tool"));
113 const QString DIGITIZE_ACTION_CURVE_POINT (QObject::tr (
"Curve Point Tool"));
114 const QString DIGITIZE_ACTION_POINT_MATCH (QObject::tr (
"Point Match Tool"));
115 const QString DIGITIZE_ACTION_SEGMENT_POINTS (QObject::tr (
"Segment Fill Tool"));
116 const QString DIGITIZE_ACTION_SELECT (QObject::tr (
"Select Tool"));
118 const QString EMPTY_FILENAME (
"");
119 const QString ENGAUGE_FILENAME_DESCRIPTION (
"Engauge Document");
120 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
122 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
125 const QString &fileCmdScriptFile,
126 bool isRegressionTest,
128 QStringList loadStartupFiles,
131 m_isDocumentExported (false),
132 m_engaugeFile (EMPTY_FILENAME),
133 m_currentFile (EMPTY_FILENAME),
138 m_digitizeStateContext (0),
139 m_transformationStateContext (0),
140 m_backgroundStateContext (0),
141 m_isGnuplot (isGnuplot),
143 m_timerRegressionErrorReport(0),
145 m_timerRegressionFileCmdScript(0)
147 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow"
148 <<
" curDir=" << QDir::currentPath().toLatin1().data();
152 QString initialPath = QDir::currentPath();
156 setWindowFlags (Qt::WindowContextHelpButtonHint | windowFlags ());
157 setWindowTitle (engaugeWindowTitle ());
159 createCentralWidget();
168 createLoadImageFromUrl ();
169 createStateContextBackground ();
170 createStateContextDigitize ();
171 createStateContextTransformation ();
172 createSettingsDialogs ();
173 createCommandStackShadow ();
178 setUnifiedTitleAndToolBarOnMac(
true);
180 installEventFilter(
this);
181 if (!errorReportFile.isEmpty()) {
182 loadErrorReportFile(initialPath,
184 if (isRegressionTest) {
185 startRegressionTestErrorReport(errorReportFile);
187 }
else if (!fileCmdScriptFile.isEmpty()) {
189 startRegressionTestFileCmdScript();
194 m_loadStartupFiles = loadStartupFiles;
198 MainWindow::~MainWindow()
202 void MainWindow::applyZoomFactorAfterLoad()
204 ZoomFactor zoomFactor;
208 case ZOOM_INITIAL_16_TO_1:
209 zoomFactor = ZOOM_16_TO_1;
212 case ZOOM_INITIAL_8_TO_1:
213 zoomFactor = ZOOM_8_TO_1;
216 case ZOOM_INITIAL_4_TO_1:
217 zoomFactor = ZOOM_4_TO_1;
220 case ZOOM_INITIAL_2_TO_1:
221 zoomFactor = ZOOM_2_TO_1;
224 case ZOOM_INITIAL_1_TO_1:
225 zoomFactor = ZOOM_1_TO_1;
228 case ZOOM_INITIAL_1_TO_2:
229 zoomFactor = ZOOM_1_TO_2;
232 case ZOOM_INITIAL_1_TO_4:
233 zoomFactor = ZOOM_1_TO_4;
236 case ZOOM_INITIAL_1_TO_8:
237 zoomFactor = ZOOM_1_TO_8;
240 case ZOOM_INITIAL_1_TO_16:
241 zoomFactor = ZOOM_1_TO_16;
244 case ZOOM_INITIAL_FILL:
245 zoomFactor = ZOOM_FILL;
248 case ZOOM_INITIAL_PREVIOUS:
249 zoomFactor = currentZoomFactor();
253 ENGAUGE_ASSERT (
false);
254 zoomFactor = currentZoomFactor();
258 slotViewZoom (zoomFactor);
261 void MainWindow::closeEvent(QCloseEvent *event)
273 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
275 setWindowModified (
false);
281 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
290 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
292 m_regressionFile = exportFilenameFromInputFilename (fileName);
293 fileImport (fileName,
299 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
301 m_regressionFile = exportFilenameFromInputFilename (fileName);
302 loadDocumentFile(fileName);
308 return m_cmdMediator;
311 void MainWindow::createActions()
313 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActions";
315 createActionsFile ();
316 createActionsEdit ();
317 createActionsDigitize ();
318 createActionsView ();
319 createActionsSettings ();
320 createActionsHelp ();
323 void MainWindow::createActionsDigitize ()
325 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsDigitize";
327 QPixmap pixmapAxis (DigitAxis_xpm);
328 QPixmap pixmapCurve (DigitCurve_xpm);
329 QPixmap pixmapColorPicker (DigitColorPicker_xpm);
330 QPixmap pixmapPointMatch (DigitPointMatch_xpm);
331 QPixmap pixmapSegment (DigitSegment_xpm);
332 QPixmap pixmapSelect (DigitSelect_xpm);
334 QIcon iconAxis (pixmapAxis);
335 QIcon iconCurve (pixmapCurve);
336 QIcon iconColorPicker (pixmapColorPicker);
337 QIcon iconPointMatch (pixmapPointMatch);
338 QIcon iconSegment (pixmapSegment);
339 QIcon iconSelect (pixmapSelect);
341 m_actionDigitizeSelect =
new QAction (iconSelect, DIGITIZE_ACTION_SELECT,
this);
342 m_actionDigitizeSelect->setShortcut (QKeySequence (tr (
"Shift+F2")));
343 m_actionDigitizeSelect->setCheckable (
true);
344 m_actionDigitizeSelect->setStatusTip (tr (
"Select points on screen."));
345 m_actionDigitizeSelect->setWhatsThis (tr (
"Select\n\n"
346 "Select points on the screen."));
347 connect (m_actionDigitizeSelect, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSelect ()));
349 m_actionDigitizeAxis =
new QAction (iconAxis, DIGITIZE_ACTION_AXIS_POINT,
this);
350 m_actionDigitizeAxis->setShortcut (QKeySequence (tr (
"Shift+F3")));
351 m_actionDigitizeAxis->setCheckable (
true);
352 m_actionDigitizeAxis->setStatusTip (tr (
"Digitize axis points."));
353 m_actionDigitizeAxis->setWhatsThis (tr (
"Digitize Axis Point\n\n"
354 "Digitizes an axis point by placing a new point at the cursor "
355 "after a mouse click. The coordinates of the axis point are then "
356 "entered. In a graph, three axis points are required to define "
357 "the graph coordinates."));
358 connect (m_actionDigitizeAxis, SIGNAL (triggered ()),
this, SLOT (slotDigitizeAxis ()));
360 m_actionDigitizeCurve =
new QAction (iconCurve, DIGITIZE_ACTION_CURVE_POINT,
this);
361 m_actionDigitizeCurve->setShortcut (QKeySequence (tr (
"Shift+F4")));
362 m_actionDigitizeCurve->setCheckable (
true);
363 m_actionDigitizeCurve->setStatusTip (tr (
"Digitize curve points."));
364 m_actionDigitizeCurve->setWhatsThis (tr (
"Digitize Curve Point\n\n"
365 "Digitizes a curve point by placing a new point at the cursor "
366 "after a mouse click. Use this mode to digitize points along curves "
368 "New points will be assigned to the currently selected curve."));
369 connect (m_actionDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotDigitizeCurve ()));
371 m_actionDigitizePointMatch =
new QAction (iconPointMatch, DIGITIZE_ACTION_POINT_MATCH,
this);
372 m_actionDigitizePointMatch->setShortcut (QKeySequence (tr (
"Shift+F5")));
373 m_actionDigitizePointMatch->setCheckable (
true);
374 m_actionDigitizePointMatch->setStatusTip (tr (
"Digitize curve points in a point plot by matching a point."));
375 m_actionDigitizePointMatch->setWhatsThis (tr (
"Digitize Curve Points by Point Matching\n\n"
376 "Digitizes curve points in a point plot by finding points that match a sample point. The process "
377 "starts by selecting a representative sample point.\n\n"
378 "New points will be assigned to the currently selected curve."));
379 connect (m_actionDigitizePointMatch, SIGNAL (triggered ()),
this, SLOT (slotDigitizePointMatch ()));
381 m_actionDigitizeColorPicker =
new QAction (iconColorPicker, DIGITIZE_ACTION_COLOR_PICKER,
this);
382 m_actionDigitizeColorPicker->setShortcut (QKeySequence (tr (
"Shift+F6")));
383 m_actionDigitizeColorPicker->setCheckable (
true);
384 m_actionDigitizeColorPicker->setStatusTip (tr (
"Select color settings for filtering in Segment Fill mode."));
385 m_actionDigitizeColorPicker->setWhatsThis (tr (
"Select color settings for Segment Fill filtering\n\n"
386 "Select a pixel along the currently selected curve. That pixel and its neighbors will "
387 "define the filter settings (color, brightness, and so on) of the currently selected curve "
388 "while in Segment Fill mode."));
389 connect (m_actionDigitizeColorPicker, SIGNAL (triggered ()),
this, SLOT (slotDigitizeColorPicker ()));
391 m_actionDigitizeSegment =
new QAction (iconSegment, DIGITIZE_ACTION_SEGMENT_POINTS,
this);
392 m_actionDigitizeSegment->setShortcut (QKeySequence (tr (
"Shift+F7")));
393 m_actionDigitizeSegment->setCheckable (
true);
394 m_actionDigitizeSegment->setStatusTip (tr (
"Digitize curve points along a segment of a curve."));
395 m_actionDigitizeSegment->setWhatsThis (tr (
"Digitize Curve Points With Segment Fill\n\n"
396 "Digitizes curve points by placing new points along the highlighted "
397 "segment under the cursor. Use this mode to quickly digitize multiple points along a "
398 "curve with a single click.\n\n"
399 "New points will be assigned to the currently selected curve."));
400 connect (m_actionDigitizeSegment, SIGNAL (triggered ()),
this, SLOT (slotDigitizeSegment ()));
402 m_groupDigitize =
new QActionGroup (
this);
403 m_groupDigitize->addAction (m_actionDigitizeSelect);
404 m_groupDigitize->addAction (m_actionDigitizeAxis);
405 m_groupDigitize->addAction (m_actionDigitizeCurve);
406 m_groupDigitize->addAction (m_actionDigitizePointMatch);
407 m_groupDigitize->addAction (m_actionDigitizeColorPicker);
408 m_groupDigitize->addAction (m_actionDigitizeSegment);
411 void MainWindow::createActionsEdit ()
413 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsEdit";
415 m_actionEditUndo =
new QAction(tr (
"&Undo"),
this);
416 m_actionEditUndo->setShortcut (QKeySequence::Undo);
417 m_actionEditUndo->setStatusTip (tr (
"Undo the last operation."));
418 m_actionEditUndo->setWhatsThis (tr (
"Undo\n\n"
419 "Undo the last operation."));
422 m_actionEditRedo =
new QAction(tr (
"&Redo"),
this);
423 m_actionEditRedo->setShortcut (QKeySequence::Redo);
424 m_actionEditRedo->setStatusTip (tr (
"Redo the last operation."));
425 m_actionEditRedo->setWhatsThis (tr (
"Redo\n\n"
426 "Redo the last operation."));
429 m_actionEditCut =
new QAction (tr (
"Cut"),
this);
430 m_actionEditCut->setShortcut (QKeySequence::Cut);
431 m_actionEditCut->setStatusTip (tr (
"Cuts the selected points and copies them to the clipboard."));
432 m_actionEditCut->setWhatsThis (tr (
"Cut\n\n"
433 "Cuts the selected points and copies them to the clipboard."));
434 connect (m_actionEditCut, SIGNAL (triggered ()),
this, SLOT (slotEditCut ()));
436 m_actionEditCopy =
new QAction (tr (
"Copy"),
this);
437 m_actionEditCopy->setShortcut (QKeySequence::Copy);
438 m_actionEditCopy->setStatusTip (tr (
"Copies the selected points to the clipboard."));
439 m_actionEditCopy->setWhatsThis (tr (
"Copy\n\n"
440 "Copies the selected points to the clipboard."));
441 connect (m_actionEditCopy, SIGNAL (triggered ()),
this, SLOT (slotEditCopy ()));
443 m_actionEditPaste =
new QAction (tr (
"Paste"),
this);
444 m_actionEditPaste->setShortcut (QKeySequence::Paste);
445 m_actionEditPaste->setStatusTip (tr (
"Pastes the selected points from the clipboard."));
446 m_actionEditPaste->setWhatsThis (tr (
"Paste\n\n"
447 "Pastes the selected points from the clipboard. They will be assigned to the current curve."));
448 connect (m_actionEditPaste, SIGNAL (triggered ()),
this, SLOT (slotEditPaste ()));
450 m_actionEditDelete =
new QAction (tr (
"Delete"),
this);
451 m_actionEditDelete->setShortcut (QKeySequence::Delete);
452 m_actionEditDelete->setStatusTip (tr (
"Deletes the selected points, after copying them to the clipboard."));
453 m_actionEditDelete->setWhatsThis (tr (
"Delete\n\n"
454 "Deletes the selected points, after copying them to the clipboard."));
455 connect (m_actionEditDelete, SIGNAL (triggered ()),
this, SLOT (slotEditDelete ()));
457 m_actionEditPasteAsNew =
new QAction (tr (
"Paste As New"),
this);
458 m_actionEditPasteAsNew->setStatusTip (tr (
"Pastes an image from the clipboard."));
459 m_actionEditPasteAsNew->setWhatsThis (tr (
"Paste as New\n\n"
460 "Creates a new document by pasting an image from the clipboard."));
461 connect (m_actionEditPasteAsNew, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNew ()));
463 m_actionEditPasteAsNewAdvanced =
new QAction (tr (
"Paste As New (Advanced)..."),
this);
464 m_actionEditPasteAsNewAdvanced->setStatusTip (tr (
"Pastes an image from the clipboard, in advanced mode."));
465 m_actionEditPasteAsNewAdvanced->setWhatsThis (tr (
"Paste as New (Advanced)\n\n"
466 "Creates a new document by pasting an image from the clipboard, in advanced mode."));
467 connect (m_actionEditPasteAsNewAdvanced, SIGNAL (triggered ()),
this, SLOT (slotEditPasteAsNewAdvanced ()));
470 void MainWindow::createActionsFile ()
472 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsFile";
474 m_actionImport =
new QAction(tr (
"&Import..."),
this);
475 m_actionImport->setShortcut (tr (
"Ctrl+I"));
476 m_actionImport->setStatusTip (tr (
"Creates a new document by importing an image with a single coordinate system."));
477 m_actionImport->setWhatsThis (tr (
"Import Image\n\n"
478 "Creates a new document by importing an image with a single coordinate system."));
479 connect (m_actionImport, SIGNAL (triggered ()),
this, SLOT (slotFileImport ()));
481 m_actionImportAdvanced =
new QAction(tr (
"Import (Advanced)..."),
this);
482 m_actionImportAdvanced->setStatusTip (tr (
"Creates a new document by importing an image with support for advanced feaures."));
483 m_actionImportAdvanced->setWhatsThis (tr (
"Import (Advanced)\n\n"
484 "Creates a new document by importing an image with support for advanced feaures. In "
485 "advanced mode, there can be multiple coordinate systems and/or floating axes."));
486 connect (m_actionImportAdvanced, SIGNAL (triggered ()),
this, SLOT (slotFileImportAdvanced ()));
488 m_actionOpen =
new QAction(tr (
"&Open..."),
this);
489 m_actionOpen->setShortcut (QKeySequence::Open);
490 m_actionOpen->setStatusTip (tr (
"Opens an existing document."));
491 m_actionOpen->setWhatsThis (tr (
"Open Document\n\n"
492 "Opens an existing document."));
493 connect (m_actionOpen, SIGNAL (triggered ()),
this, SLOT (slotFileOpen ()));
495 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
496 QAction *recentFileAction =
new QAction (
this);
497 recentFileAction->setVisible (
true);
498 connect (recentFileAction, SIGNAL (triggered ()),
this, SLOT (slotRecentFileAction ()));
499 m_actionRecentFiles.append (recentFileAction);
502 m_actionClose =
new QAction(tr (
"&Close"),
this);
503 m_actionClose->setShortcut (QKeySequence::Close);
504 m_actionClose->setStatusTip (tr (
"Closes the open document document."));
505 m_actionClose->setWhatsThis (tr (
"Close Document\n\n"
506 "Closes the open document."));
507 connect (m_actionClose, SIGNAL (triggered ()),
this, SLOT (slotFileClose ()));
509 m_actionSave =
new QAction(tr (
"&Save"),
this);
510 m_actionSave->setShortcut (QKeySequence::Save);
511 m_actionSave->setStatusTip (tr (
"Saves the current document."));
512 m_actionSave->setWhatsThis (tr (
"Save Document\n\n"
513 "Saves the current document."));
514 connect (m_actionSave, SIGNAL (triggered ()),
this, SLOT (slotFileSave ()));
516 m_actionSaveAs =
new QAction(tr (
"Save As..."),
this);
517 m_actionSaveAs->setShortcut (QKeySequence::SaveAs);
518 m_actionSaveAs->setStatusTip (tr (
"Saves the current document under a new filename."));
519 m_actionSaveAs->setWhatsThis (tr (
"Save Document As\n\n"
520 "Saves the current document under a new filename."));
521 connect (m_actionSaveAs, SIGNAL (triggered ()),
this, SLOT (slotFileSaveAs ()));
523 m_actionExport =
new QAction (tr (
"Export..."),
this);
524 m_actionExport->setShortcut (tr (
"Ctrl+E"));
525 m_actionExport->setStatusTip (tr (
"Exports the current document into a text file."));
526 m_actionExport->setWhatsThis (tr (
"Export Document\n\n"
527 "Exports the current document into a text file."));
528 connect (m_actionExport, SIGNAL (triggered ()),
this, SLOT (slotFileExport ()));
530 m_actionPrint =
new QAction (tr (
"&Print..."),
this);
531 m_actionPrint->setShortcut (QKeySequence::Print);
532 m_actionPrint->setStatusTip (tr (
"Print the current document."));
533 m_actionPrint->setWhatsThis (tr (
"Print Document\n\n"
534 "Print the current document to a printer or file."));
535 connect (m_actionPrint, SIGNAL (triggered ()),
this, SLOT (slotFilePrint ()));
537 m_actionExit =
new QAction(tr (
"&Exit"),
this);
538 m_actionExit->setShortcut (QKeySequence::Quit);
539 m_actionExit->setStatusTip (tr (
"Quits the application."));
540 m_actionExit->setWhatsThis (tr (
"Exit\n\n"
541 "Quits the application."));
542 connect (m_actionExit, SIGNAL (triggered ()),
this, SLOT (close ()));
545 void MainWindow::createActionsHelp ()
547 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsHelp";
549 m_actionHelpChecklistGuideWizard =
new QAction (tr (
"Checklist Guide Wizard"),
this);
550 m_actionHelpChecklistGuideWizard->setCheckable (
true);
551 m_actionHelpChecklistGuideWizard->setStatusTip (tr (
"Open Checklist Guide Wizard during import to define digitizing steps"));
552 m_actionHelpChecklistGuideWizard->setWhatsThis (tr (
"Checklist Guide Wizard\n\n"
553 "Use Checklist Guide Wizard during import to generate a checklist of steps "
554 "for the imported document"));
556 m_actionHelpWhatsThis = QWhatsThis::createAction(
this);
557 m_actionHelpWhatsThis->setShortcut (QKeySequence::WhatsThis);
559 m_actionHelpTutorial =
new QAction (tr (
"Tutorial"),
this);
560 m_actionHelpTutorial->setStatusTip (tr (
"Play tutorial showing steps for digitizing curves"));
561 m_actionHelpTutorial->setWhatsThis (tr (
"Tutorial\n\n"
562 "Play tutorial showing steps for digitizing points from curves drawn with lines "
564 connect (m_actionHelpTutorial, SIGNAL (triggered ()),
this, SLOT (slotHelpTutorial()));
566 m_actionHelpHelp =
new QAction (tr (
"Help"),
this);
567 m_actionHelpHelp->setShortcut (QKeySequence::HelpContents);
568 m_actionHelpHelp->setStatusTip (tr (
"Help documentation"));
569 m_actionHelpHelp->setWhatsThis (tr (
"Help Documentation\n\n"
570 "Searchable help documentation"));
573 m_actionHelpAbout =
new QAction(tr (
"About Engauge"),
this);
574 m_actionHelpAbout->setStatusTip (tr (
"About the application."));
575 m_actionHelpAbout->setWhatsThis (tr (
"About Engauge\n\nAbout the application."));
576 connect (m_actionHelpAbout, SIGNAL (triggered ()),
this, SLOT (slotHelpAbout ()));
579 void MainWindow::createActionsSettings ()
581 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsSettings";
583 m_actionSettingsCoords =
new QAction (tr (
"Coordinates..."),
this);
584 m_actionSettingsCoords->setStatusTip (tr (
"Edit Coordinate settings."));
585 m_actionSettingsCoords->setWhatsThis (tr (
"Coordinate Settings\n\n"
586 "Coordinate settings determine how the graph coordinates are mapped to the pixels in the image"));
587 connect (m_actionSettingsCoords, SIGNAL (triggered ()),
this, SLOT (slotSettingsCoords ()));
589 m_actionSettingsCurveAddRemove =
new QAction (tr (
"Add/Remove Curve..."),
this);
590 m_actionSettingsCurveAddRemove->setStatusTip (tr (
"Add or Remove Curves."));
591 m_actionSettingsCurveAddRemove->setWhatsThis (tr (
"Add/Remove Curve\n\n"
592 "Add/Remove Curve settings control which curves are included in the current document"));
593 connect (m_actionSettingsCurveAddRemove, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveAddRemove ()));
595 m_actionSettingsCurveProperties =
new QAction (tr (
"Curve Properties..."),
this);
596 m_actionSettingsCurveProperties->setStatusTip (tr (
"Edit Curve Properties settings."));
597 m_actionSettingsCurveProperties->setWhatsThis (tr (
"Curve Properties Settings\n\n"
598 "Curves properties settings determine how each curve appears"));
599 connect (m_actionSettingsCurveProperties, SIGNAL (triggered ()),
this, SLOT (slotSettingsCurveProperties ()));
601 m_actionSettingsDigitizeCurve =
new QAction (tr (
"Digitize Curve..."),
this);
602 m_actionSettingsDigitizeCurve->setStatusTip (tr (
"Edit Digitize Axis and Graph Curve settings."));
603 m_actionSettingsDigitizeCurve->setWhatsThis (tr (
"Digitize Axis and Graph Curve Settings\n\n"
604 "Digitize Curve settings determine how points are digitized in Digitize Axis Point and "
605 "Digitize Graph Point modes"));
606 connect (m_actionSettingsDigitizeCurve, SIGNAL (triggered ()),
this, SLOT (slotSettingsDigitizeCurve ()));
608 m_actionSettingsExport =
new QAction (tr (
"Export Format..."),
this);
609 m_actionSettingsExport->setStatusTip (tr (
"Edit Export Format settings."));
610 m_actionSettingsExport->setWhatsThis (tr (
"Export Format Settings\n\n"
611 "Export format settings affect how exported files are formatted"));
612 connect (m_actionSettingsExport, SIGNAL (triggered ()),
this, SLOT (slotSettingsExportFormat ()));
614 m_actionSettingsColorFilter =
new QAction (tr (
"Color Filter..."),
this);
615 m_actionSettingsColorFilter->setStatusTip (tr (
"Edit Color Filter settings."));
616 m_actionSettingsColorFilter->setWhatsThis (tr (
"Color Filter Settings\n\n"
617 "Color filtering simplifies the graphs for easier Point Matching and Segment Filling"));
618 connect (m_actionSettingsColorFilter, SIGNAL (triggered ()),
this, SLOT (slotSettingsColorFilter ()));
620 m_actionSettingsAxesChecker =
new QAction (tr (
"Axes Checker..."),
this);
621 m_actionSettingsAxesChecker->setStatusTip (tr (
"Edit Axes Checker settings."));
622 m_actionSettingsAxesChecker->setWhatsThis (tr (
"Axes Checker Settings\n\n"
623 "Axes checker can reveal any axis point mistakes, which are otherwise hard to find."));
624 connect (m_actionSettingsAxesChecker, SIGNAL (triggered ()),
this, SLOT (slotSettingsAxesChecker ()));
626 m_actionSettingsGridRemoval =
new QAction (tr (
"Grid Line Removal..."),
this);
627 m_actionSettingsGridRemoval->setStatusTip (tr (
"Edit Grid Line Removal settings."));
628 m_actionSettingsGridRemoval->setWhatsThis (tr (
"Grid Line Removal Settings\n\n"
629 "Grid line removal isolates curve lines for easier Point Matching and Segment Filling, when "
630 "Color Filtering is not able to separate grid lines from curve lines."));
631 connect (m_actionSettingsGridRemoval, SIGNAL (triggered ()),
this, SLOT (slotSettingsGridRemoval ()));
633 m_actionSettingsPointMatch =
new QAction (tr (
"Point Match..."),
this);
634 m_actionSettingsPointMatch->setStatusTip (tr (
"Edit Point Match settings."));
635 m_actionSettingsPointMatch->setWhatsThis (tr (
"Point Match Settings\n\n"
636 "Point match settings determine how points are matched while in Point Match mode"));
637 connect (m_actionSettingsPointMatch, SIGNAL (triggered ()),
this, SLOT (slotSettingsPointMatch ()));
639 m_actionSettingsSegments =
new QAction (tr (
"Segment Fill..."),
this);
640 m_actionSettingsSegments->setStatusTip (tr (
"Edit Segment Fill settings."));
641 m_actionSettingsSegments->setWhatsThis (tr (
"Segment Fill Settings\n\n"
642 "Segment fill settings determine how points are generated in the Segment Fill mode"));
643 connect (m_actionSettingsSegments, SIGNAL (triggered ()),
this, SLOT (slotSettingsSegments ()));
645 m_actionSettingsGeneral =
new QAction (tr (
"General..."),
this);
646 m_actionSettingsGeneral->setStatusTip (tr (
"Edit General settings."));
647 m_actionSettingsGeneral->setWhatsThis (tr (
"General Settings\n\n"
648 "General settings are document-specific settings that affect multiple modes. For example, the cursor size setting affects "
649 "both Color Picker and Point Match modes"));
650 connect (m_actionSettingsGeneral, SIGNAL (triggered ()),
this, SLOT (slotSettingsGeneral ()));
652 m_actionSettingsMainWindow =
new QAction (tr (
"Main Window..."),
this);
653 m_actionSettingsMainWindow->setEnabled (
true);
654 m_actionSettingsMainWindow->setStatusTip (tr (
"Edit Main Window settings."));
655 m_actionSettingsMainWindow->setWhatsThis (tr (
"Main Window Settings\n\n"
656 "Main window settings affect the user interface and are not specific to any document"));
657 connect (m_actionSettingsMainWindow, SIGNAL (triggered ()),
this, SLOT (slotSettingsMainWindow ()));
660 void MainWindow::createActionsView ()
662 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createActionsView";
664 m_actionViewBackground =
new QAction (tr (
"Background Toolbar"),
this);
665 m_actionViewBackground->setCheckable (
true);
666 m_actionViewBackground->setChecked (
true);
667 m_actionViewBackground->setStatusTip (tr (
"Show or hide the background toolbar."));
668 m_actionViewBackground->setWhatsThis (tr (
"View Background ToolBar\n\n"
669 "Show or hide the background toolbar"));
670 connect (m_actionViewBackground, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarBackground ()));
672 m_actionViewChecklistGuide =
new QAction (tr (
"Checklist Guide Toolbar"),
this);
673 m_actionViewChecklistGuide->setCheckable (
true);
674 m_actionViewChecklistGuide->setChecked (
false);
675 m_actionViewChecklistGuide->setStatusTip (tr (
"Show or hide the checklist guide toolbar."));
676 m_actionViewChecklistGuide->setWhatsThis (tr (
"View Checklist Guide ToolBar\n\n"
677 "Show or hide the checklist guide toolbar"));
678 connect (m_actionViewChecklistGuide, SIGNAL (changed ()),
this, SLOT (slotViewToolBarChecklistGuide()));
680 m_actionViewDigitize =
new QAction (tr (
"Digitizing Tools Toolbar"),
this);
681 m_actionViewDigitize->setCheckable (
true);
682 m_actionViewDigitize->setChecked (
true);
683 m_actionViewDigitize->setStatusTip (tr (
"Show or hide the digitizing tools toolbar."));
684 m_actionViewDigitize->setWhatsThis (tr (
"View Digitizing Tools ToolBar\n\n"
685 "Show or hide the digitizing tools toolbar"));
686 connect (m_actionViewDigitize, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarDigitize()));
688 m_actionViewSettingsViews =
new QAction (tr (
"Settings Views Toolbar"),
this);
689 m_actionViewSettingsViews->setCheckable (
true);
690 m_actionViewSettingsViews->setChecked (
true);
691 m_actionViewSettingsViews->setStatusTip (tr (
"Show or hide the settings views toolbar."));
692 m_actionViewSettingsViews->setWhatsThis (tr (
"View Settings Views ToolBar\n\n"
693 "Show or hide the settings views toolbar. These views graphically show the "
694 "most important settings."));
695 connect (m_actionViewSettingsViews, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarSettingsViews()));
697 m_actionViewCoordSystem =
new QAction (tr (
"Coordinate System Toolbar"),
this);
698 m_actionViewCoordSystem->setCheckable (
true);
699 m_actionViewCoordSystem->setChecked (
false);
700 m_actionViewCoordSystem->setStatusTip (tr (
"Show or hide the coordinate system toolbar."));
701 m_actionViewCoordSystem->setWhatsThis (tr (
"View Coordinate Systems ToolBar\n\n"
702 "Show or hide the coordinate system selection toolbar. This toolbar is used "
703 "to select the current coordinate system when the document has multiple "
704 "coordinate systems. This toolbar is also used to view and print all coordinate "
706 "This toolbar is disabled when there is only one coordinate system."));
707 connect (m_actionViewCoordSystem, SIGNAL (triggered ()),
this, SLOT (slotViewToolBarCoordSystem()));
709 m_actionViewToolTips =
new QAction (tr (
"Tool Tips"),
this);
710 m_actionViewToolTips->setCheckable (
true);
711 m_actionViewToolTips->setChecked (
true);
712 m_actionViewToolTips->setStatusTip (tr (
"Show or hide the tool tips."));
713 m_actionViewToolTips->setWhatsThis (tr (
"View Tool Tips\n\n"
714 "Show or hide the tool tips"));
715 connect (m_actionViewToolTips, SIGNAL (triggered ()),
this, SLOT (slotViewToolTips()));
717 m_actionViewBackgroundNone =
new QAction (tr (
"No Background"),
this);
718 m_actionViewBackgroundNone->setCheckable (
true);
719 m_actionViewBackgroundNone->setStatusTip (tr (
"Do not show the image underneath the points."));
720 m_actionViewBackgroundNone->setWhatsThis (tr (
"No Background\n\n"
721 "No image is shown so points are easier to see"));
723 m_actionViewBackgroundOriginal =
new QAction (tr (
"Show Original Image"),
this);
724 m_actionViewBackgroundOriginal->setCheckable (
true);
725 m_actionViewBackgroundOriginal->setStatusTip (tr (
"Show the original image underneath the points."));
726 m_actionViewBackgroundOriginal->setWhatsThis (tr (
"Show Original Image\n\n"
727 "Show the original image underneath the points"));
729 m_actionViewBackgroundFiltered =
new QAction (tr (
"Show Filtered Image"),
this);
730 m_actionViewBackgroundFiltered->setCheckable (
true);
731 m_actionViewBackgroundFiltered->setChecked (
true);
732 m_actionViewBackgroundFiltered->setStatusTip (tr (
"Show the filtered image underneath the points."));
733 m_actionViewBackgroundFiltered->setWhatsThis (tr (
"Show Filtered Image\n\n"
734 "Show the filtered image underneath the points.\n\n"
735 "The filtered image is created from the original image according to the "
736 "Filter preferences so unimportant information is hidden and important "
737 "information is emphasized"));
739 m_actionViewCurvesNone =
new QAction (tr (
"Hide All Curves"),
this);
740 m_actionViewCurvesNone->setCheckable (
true);
741 m_actionViewCurvesNone->setStatusTip (tr (
"Hide all digitized curves."));
742 m_actionViewCurvesNone->setWhatsThis (tr (
"Hide All Curves\n\n"
743 "No axis points or digitized graph curves are shown so the image is easier to see."));
745 m_actionViewCurvesSelected =
new QAction (tr (
"Show Selected Curve"),
this);
746 m_actionViewCurvesSelected->setCheckable (
true);
747 m_actionViewCurvesSelected->setStatusTip (tr (
"Show only the currently selected curve."));
748 m_actionViewCurvesSelected->setWhatsThis (tr (
"Show Selected Curve\n\n"
749 "Show only the digitized points and line that belong to the currently selected curve."));
751 m_actionViewCurvesAll =
new QAction (tr (
"Show All Curves"),
this);
752 m_actionViewCurvesAll->setCheckable (
true);
753 m_actionViewCurvesAll->setChecked (
true);
754 m_actionViewCurvesAll->setStatusTip (tr (
"Show all curves."));
755 m_actionViewCurvesAll->setWhatsThis (tr (
"Show All Curves\n\n"
756 "Show all digitized axis points and graph curves"));
758 m_groupBackground =
new QActionGroup(
this);
759 m_groupBackground->addAction (m_actionViewBackgroundNone);
760 m_groupBackground->addAction (m_actionViewBackgroundOriginal);
761 m_groupBackground->addAction (m_actionViewBackgroundFiltered);
762 connect (m_groupBackground, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupBackground(QAction*)));
764 m_groupCurves =
new QActionGroup(
this);
765 m_groupCurves->addAction (m_actionViewCurvesNone);
766 m_groupCurves->addAction (m_actionViewCurvesSelected);
767 m_groupCurves->addAction (m_actionViewCurvesAll);
768 connect (m_groupCurves, SIGNAL(triggered (QAction*)),
this, SLOT (slotViewGroupCurves(QAction*)));
770 m_actionStatusNever =
new QAction (tr (
"Hide Always"),
this);
771 m_actionStatusNever->setCheckable(
true);
772 m_actionStatusNever->setStatusTip (tr (
"Always hide the status bar."));
773 m_actionStatusNever->setWhatsThis (tr (
"Hide the status bar. No temporary status or feedback messages will appear."));
775 m_actionStatusTemporary =
new QAction (tr (
"Show Temporary Messages"),
this);
776 m_actionStatusTemporary->setCheckable(
true);
777 m_actionStatusTemporary->setStatusTip (tr (
"Hide the status bar except when display temporary messages."));
778 m_actionStatusTemporary->setWhatsThis (tr (
"Hide the status bar, except when displaying temporary status and feedback messages."));
780 m_actionStatusAlways =
new QAction (tr (
"Show Always"),
this);
781 m_actionStatusAlways->setCheckable(
true);
782 m_actionStatusAlways->setStatusTip (tr (
"Always show the status bar."));
783 m_actionStatusAlways->setWhatsThis (tr (
"Show the status bar. Besides displaying temporary status and feedback messages, "
784 "the status bar also displays information about the cursor position."));
786 m_groupStatus =
new QActionGroup(
this);
787 m_groupStatus->addAction (m_actionStatusNever);
788 m_groupStatus->addAction (m_actionStatusTemporary);
789 m_groupStatus->addAction (m_actionStatusAlways);
790 connect (m_groupStatus, SIGNAL (triggered (QAction*)),
this, SLOT (slotViewGroupStatus(QAction*)));
792 m_actionZoomOut =
new QAction (tr (
"Zoom Out"),
this);
793 m_actionZoomOut->setStatusTip (tr (
"Zoom out"));
795 connect (m_actionZoomOut, SIGNAL (triggered ()),
this, SLOT (slotViewZoomOut ()));
797 m_actionZoomIn =
new QAction (tr (
"Zoom In"),
this);
798 m_actionZoomIn->setStatusTip (tr (
"Zoom in"));
800 connect (m_actionZoomIn, SIGNAL (triggered ()),
this, SLOT (slotViewZoomIn ()));
802 m_actionZoom16To1 =
new QAction (tr (
"16:1 (1600%)"),
this);
803 m_actionZoom16To1->setCheckable (
true);
804 m_actionZoom16To1->setStatusTip (tr (
"Zoom 16:1"));
805 connect (m_actionZoom16To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom16To1 ()));
807 m_actionZoom8To1 =
new QAction (tr (
"8:1 (800%)"),
this);
808 m_actionZoom8To1->setCheckable (
true);
809 m_actionZoom8To1->setStatusTip (tr (
"Zoom 8:1"));
810 connect (m_actionZoom8To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom8To1 ()));
812 m_actionZoom4To1 =
new QAction (tr (
"4:1 (400%)"),
this);
813 m_actionZoom4To1->setCheckable (
true);
814 m_actionZoom4To1->setStatusTip (tr (
"Zoom 4:1"));
815 connect (m_actionZoom4To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom4To1 ()));
817 m_actionZoom2To1 =
new QAction (tr (
"2:1 (200%)"),
this);
818 m_actionZoom2To1->setCheckable (
true);
819 m_actionZoom2To1->setStatusTip (tr (
"Zoom 2:1"));
820 connect (m_actionZoom2To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom2To1 ()));
822 m_actionZoom1To1 =
new QAction (tr (
"1:1 (100%)"),
this);
823 m_actionZoom1To1->setCheckable (
true);
824 m_actionZoom1To1->setChecked (
true);
825 m_actionZoom1To1->setStatusTip (tr (
"Zoom 6:1"));
826 connect (m_actionZoom1To1, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To1 ()));
828 m_actionZoom1To2 =
new QAction (tr (
"1:2 (50%)"),
this);
829 m_actionZoom1To2->setCheckable (
true);
830 m_actionZoom1To2->setStatusTip (tr (
"Zoom 1:2"));
831 connect (m_actionZoom1To2, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To2 ()));
833 m_actionZoom1To4 =
new QAction (tr (
"1:4 (25%)"),
this);
834 m_actionZoom1To4->setCheckable (
true);
835 m_actionZoom1To4->setStatusTip (tr (
"Zoom 1:4"));
836 connect (m_actionZoom1To4, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To4 ()));
838 m_actionZoom1To8 =
new QAction (tr (
"1:8 (12.5%)"),
this);
839 m_actionZoom1To8->setCheckable (
true);
840 m_actionZoom1To8->setStatusTip (tr (
"Zoom 1:8"));
841 connect (m_actionZoom1To8, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To8 ()));
843 m_actionZoom1To16 =
new QAction (tr (
"1:16 (6.25%)"),
this);
844 m_actionZoom1To16->setCheckable (
true);
845 m_actionZoom1To16->setStatusTip (tr (
"Zoom 1:16"));
846 connect (m_actionZoom1To16, SIGNAL (triggered ()),
this, SLOT (slotViewZoom1To16 ()));
848 m_actionZoomFill =
new QAction (tr (
"Fill"),
this);
849 m_actionZoomFill->setCheckable (
true);
850 m_actionZoomFill->setStatusTip (tr (
"Zoom with stretching to fill window"));
851 connect (m_actionZoomFill, SIGNAL (triggered ()),
this, SLOT (slotViewZoomFill ()));
853 m_groupZoom =
new QActionGroup (
this);
854 m_groupZoom->addAction (m_actionZoom16To1);
855 m_groupZoom->addAction (m_actionZoom8To1);
856 m_groupZoom->addAction (m_actionZoom4To1);
857 m_groupZoom->addAction (m_actionZoom2To1);
858 m_groupZoom->addAction (m_actionZoom1To1);
859 m_groupZoom->addAction (m_actionZoom1To2);
860 m_groupZoom->addAction (m_actionZoom1To4);
861 m_groupZoom->addAction (m_actionZoom1To8);
862 m_groupZoom->addAction (m_actionZoom1To16);
863 m_groupZoom->addAction (m_actionZoomFill);
866 void MainWindow::createCentralWidget ()
868 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCentralWidget";
870 QWidget *widget =
new QWidget;
871 setCentralWidget (widget);
872 m_layout =
new QVBoxLayout;
873 widget->setLayout (m_layout);
876 void MainWindow::createCommandStackShadow ()
878 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createCommandStackShadow";
883 void MainWindow::createHelpWindow ()
885 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createHelpWindow";
888 m_helpWindow->hide ();
889 addDockWidget (Qt::RightDockWidgetArea,
891 m_helpWindow->setFloating (
true);
893 connect (m_actionHelpHelp, SIGNAL (triggered ()), m_helpWindow, SLOT (show ()));
896 void MainWindow::createIcons()
898 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createIcons";
901 QPixmap icon16 (bannerapp_16);
902 QPixmap icon32 (bannerapp_32);
903 QPixmap icon64 (bannerapp_64);
904 QPixmap icon128 (bannerapp_128);
905 QPixmap icon256 (bannerapp_256);
907 icon.addPixmap (icon16);
908 icon.addPixmap (icon32);
909 icon.addPixmap (icon64);
910 icon.addPixmap (icon128);
911 icon.addPixmap (icon256);
913 setWindowIcon (icon);
916 void MainWindow::createLoadImageFromUrl ()
921 void MainWindow::createMenus()
923 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createMenus";
925 m_menuFile = menuBar()->addMenu(tr(
"&File"));
926 m_menuFile->addAction (m_actionImport);
927 m_menuFile->addAction (m_actionImportAdvanced);
928 m_menuFile->addAction (m_actionOpen);
929 m_menuFileOpenRecent =
new QMenu (tr (
"Open &Recent"));
930 for (
unsigned int i = 0; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
931 m_menuFileOpenRecent->addAction (m_actionRecentFiles.at (i));
933 m_menuFile->addMenu (m_menuFileOpenRecent);
934 m_menuFile->addAction (m_actionClose);
935 m_menuFile->insertSeparator (m_actionSave);
936 m_menuFile->addAction (m_actionSave);
937 m_menuFile->addAction (m_actionSaveAs);
938 m_menuFile->addAction (m_actionExport);
939 m_menuFile->insertSeparator (m_actionPrint);
940 m_menuFile->addAction (m_actionPrint);
941 m_menuFile->insertSeparator (m_actionExit);
942 m_menuFile->addAction (m_actionExit);
944 m_menuEdit = menuBar()->addMenu(tr(
"&Edit"));
945 connect (m_menuEdit, SIGNAL (aboutToShow ()),
this, SLOT (slotEditMenu ()));
946 m_menuEdit->addAction (m_actionEditUndo);
947 m_menuEdit->addAction (m_actionEditRedo);
948 m_menuEdit->insertSeparator (m_actionEditCut);
949 m_menuEdit->addAction (m_actionEditCut);
950 m_menuEdit->addAction (m_actionEditCopy);
951 m_menuEdit->addAction (m_actionEditPaste);
952 m_menuEdit->addAction (m_actionEditDelete);
953 m_menuEdit->insertSeparator (m_actionEditPasteAsNew);
954 m_menuEdit->addAction (m_actionEditPasteAsNew);
955 m_menuEdit->addAction (m_actionEditPasteAsNewAdvanced);
957 m_menuDigitize = menuBar()->addMenu(tr(
"Digitize"));
958 m_menuDigitize->addAction (m_actionDigitizeSelect);
959 m_menuDigitize->addAction (m_actionDigitizeAxis);
960 m_menuDigitize->addAction (m_actionDigitizeCurve);
961 m_menuDigitize->addAction (m_actionDigitizePointMatch);
962 m_menuDigitize->addAction (m_actionDigitizeColorPicker);
963 m_menuDigitize->addAction (m_actionDigitizeSegment);
965 m_menuView = menuBar()->addMenu(tr(
"View"));
966 m_menuView->addAction (m_actionViewBackground);
967 m_menuView->addAction (m_actionViewDigitize);
968 m_menuView->addAction (m_actionViewChecklistGuide);
969 m_menuView->addAction (m_actionViewSettingsViews);
970 m_menuView->addAction (m_actionViewCoordSystem);
971 m_menuView->insertSeparator (m_actionViewToolTips);
972 m_menuView->addAction (m_actionViewToolTips);
973 m_menuView->insertSeparator (m_actionViewBackgroundNone);
974 m_menuViewBackground =
new QMenu (tr (
"Background"));
975 m_menuViewBackground->addAction (m_actionViewBackgroundNone);
976 m_menuViewBackground->addAction (m_actionViewBackgroundOriginal);
977 m_menuViewBackground->addAction (m_actionViewBackgroundFiltered);
978 m_menuView->addMenu (m_menuViewBackground);
979 m_menuViewCurves =
new QMenu (tr (
"Curves"));
980 m_menuViewCurves->addAction (m_actionViewCurvesNone);
981 m_menuViewCurves->addAction (m_actionViewCurvesSelected);
982 m_menuViewCurves->addAction (m_actionViewCurvesAll);
983 m_menuView->addMenu (m_menuViewCurves);
984 m_menuViewStatus =
new QMenu (tr (
"Status Bar"));
985 m_menuViewStatus->addAction (m_actionStatusNever);
986 m_menuViewStatus->addAction (m_actionStatusTemporary);
987 m_menuViewStatus->addAction (m_actionStatusAlways);
988 m_menuView->addMenu (m_menuViewStatus);
989 m_menuViewZoom =
new QMenu (tr (
"Zoom"));
990 m_menuViewZoom->addAction (m_actionZoomOut);
991 m_menuViewZoom->addAction (m_actionZoomIn);
992 m_menuViewZoom->insertSeparator (m_actionZoom16To1);
993 m_menuViewZoom->addAction (m_actionZoom16To1);
994 m_menuViewZoom->addAction (m_actionZoom8To1);
995 m_menuViewZoom->addAction (m_actionZoom4To1);
996 m_menuViewZoom->addAction (m_actionZoom2To1);
997 m_menuViewZoom->addAction (m_actionZoom1To1);
998 m_menuViewZoom->addAction (m_actionZoom1To2);
999 m_menuViewZoom->addAction (m_actionZoom1To4);
1000 m_menuViewZoom->addAction (m_actionZoom1To8);
1001 m_menuViewZoom->addAction (m_actionZoom1To16);
1002 m_menuViewZoom->addAction (m_actionZoomFill);
1003 m_menuView->addMenu (m_menuViewZoom);
1005 m_menuSettings = menuBar()->addMenu(tr (
"Settings"));
1006 m_menuSettings->addAction (m_actionSettingsCoords);
1007 m_menuSettings->addAction (m_actionSettingsCurveAddRemove);
1008 m_menuSettings->addAction (m_actionSettingsCurveProperties);
1009 m_menuSettings->addAction (m_actionSettingsDigitizeCurve);
1010 m_menuSettings->addAction (m_actionSettingsExport);
1011 m_menuSettings->addAction (m_actionSettingsColorFilter);
1012 m_menuSettings->addAction (m_actionSettingsAxesChecker);
1013 m_menuSettings->addAction (m_actionSettingsGridRemoval);
1014 m_menuSettings->addAction (m_actionSettingsPointMatch);
1015 m_menuSettings->addAction (m_actionSettingsSegments);
1016 m_menuSettings->insertSeparator (m_actionSettingsGeneral);
1017 m_menuSettings->addAction (m_actionSettingsGeneral);
1018 m_menuSettings->addAction (m_actionSettingsMainWindow);
1020 m_menuHelp = menuBar()->addMenu(tr(
"&Help"));
1021 m_menuHelp->addAction (m_actionHelpChecklistGuideWizard);
1022 m_menuHelp->insertSeparator(m_actionHelpWhatsThis);
1023 m_menuHelp->addAction (m_actionHelpWhatsThis);
1024 m_menuHelp->addAction (m_actionHelpTutorial);
1025 m_menuHelp->addAction (m_actionHelpHelp);
1026 m_menuHelp->addAction (m_actionHelpAbout);
1028 updateRecentFileList();
1031 void MainWindow::createNetwork ()
1033 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createNetwork";
1038 void MainWindow::createSettingsDialogs ()
1040 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createSettingsDialogs";
1055 m_dlgSettingsCoords->setVisible (
false);
1056 m_dlgSettingsCurveAddRemove->setVisible (
false);
1057 m_dlgSettingsCurveProperties->setVisible (
false);
1058 m_dlgSettingsDigitizeCurve->setVisible (
false);
1059 m_dlgSettingsExportFormat->setVisible (
false);
1060 m_dlgSettingsColorFilter->setVisible (
false);
1061 m_dlgSettingsAxesChecker->setVisible (
false);
1062 m_dlgSettingsGridRemoval->setVisible (
false);
1063 m_dlgSettingsPointMatch->setVisible (
false);
1064 m_dlgSettingsSegments->setVisible (
false);
1065 m_dlgSettingsGeneral->setVisible (
false);
1066 m_dlgSettingsMainWindow->setVisible (
false);
1069 void MainWindow::createScene ()
1071 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createScene";
1075 m_layout->addWidget (m_view);
1078 void MainWindow::createStateContextBackground ()
1080 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextBackground";
1085 void MainWindow::createStateContextDigitize ()
1087 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextDigitize";
1094 void MainWindow::createStateContextTransformation ()
1096 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStateContextTransformation";
1098 ENGAUGE_CHECK_PTR (m_scene);
1104 void MainWindow::createStatusBar ()
1106 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createStatusBar";
1108 m_statusBar =
new StatusBar (*statusBar ());
1109 connect (
this, SIGNAL (
signalZoom(
int)), m_statusBar, SLOT (slotZoom(
int)));
1110 connect (m_statusBar, SIGNAL (
signalZoom (
int)),
this, SLOT (slotViewZoom (
int)));
1113 void MainWindow::createToolBars ()
1115 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createToolBars";
1117 const int VIEW_SIZE = 22;
1120 m_cmbBackground =
new QComboBox ();
1121 m_cmbBackground->setEnabled (
false);
1122 m_cmbBackground->setStatusTip (tr (
"Select background image"));
1123 m_cmbBackground->setWhatsThis (tr (
"Selected Background\n\n"
1124 "Select background image:\n"
1125 "1) No background which highlights points\n"
1126 "2) Original image which shows everything\n"
1127 "3) Filtered image which highlights important details"));
1128 m_cmbBackground->addItem (tr (
"No background"), QVariant (BACKGROUND_IMAGE_NONE));
1129 m_cmbBackground->addItem (tr (
"Original image"), QVariant (BACKGROUND_IMAGE_ORIGINAL));
1130 m_cmbBackground->addItem (tr (
"Filtered image"), QVariant (BACKGROUND_IMAGE_FILTERED));
1132 connect (m_cmbBackground, SIGNAL (currentIndexChanged (
int)),
this, SLOT (slotCmbBackground (
int)));
1135 m_toolBackground =
new QToolBar (tr (
"Background"),
this);
1136 m_toolBackground->addWidget (m_cmbBackground);
1137 addToolBar (m_toolBackground);
1140 m_cmbCurve =
new QComboBox ();
1141 m_cmbCurve->setEnabled (
false);
1142 m_cmbCurve->setMinimumWidth (180);
1143 m_cmbCurve->setStatusTip (tr (
"Select curve for new points."));
1144 m_cmbCurve->setWhatsThis (tr (
"Selected Curve Name\n\n"
1145 "Select curve for any new points. Every point belongs to one curve."));
1146 connect (m_cmbCurve, SIGNAL (activated (
int)),
this, SLOT (slotCmbCurve (
int)));
1149 m_toolDigitize =
new QToolBar (tr (
"Drawing"),
this);
1150 m_toolDigitize->addAction (m_actionDigitizeSelect);
1151 m_toolDigitize->insertSeparator (m_actionDigitizeAxis);
1152 m_toolDigitize->addAction (m_actionDigitizeAxis);
1153 m_toolDigitize->insertSeparator (m_actionDigitizeCurve);
1154 m_toolDigitize->addAction (m_actionDigitizeCurve);
1155 m_toolDigitize->addAction (m_actionDigitizePointMatch);
1156 m_toolDigitize->addAction (m_actionDigitizeColorPicker);
1157 m_toolDigitize->addAction (m_actionDigitizeSegment);
1158 m_toolDigitize->addWidget (m_cmbCurve);
1159 addToolBar (m_toolDigitize);
1163 m_viewPointStyle->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1164 m_viewPointStyle->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1165 m_viewPointStyle->setStatusTip (tr (
"Points style for the currently selected curve"));
1166 m_viewPointStyle->setWhatsThis (tr (
"Points Style\n\n"
1167 "Points style for the currently selected curve. The points style is only "
1168 "displayed in this toolbar. To change the points style, "
1169 "use the Curve Properties dialog."));
1172 m_viewSegmentFilter->setMinimumSize(VIEW_SIZE, VIEW_SIZE);
1173 m_viewSegmentFilter->setMaximumSize(VIEW_SIZE, VIEW_SIZE);
1174 m_viewSegmentFilter->setStatusTip (tr (
"View of filter for current curve in Segment Fill mode"));
1175 m_viewSegmentFilter->setWhatsThis (tr (
"Segment Fill Filter\n\n"
1176 "View of filter for the current curve in Segment Fill mode. The filter settings are only "
1177 "displayed in this toolbar. To changed the filter settings, "
1178 "use the Color Picker mode or the Filter Settings dialog."));
1181 m_toolSettingsViews =
new QToolBar (tr (
"Views"),
this);
1182 m_toolSettingsViews->addWidget (m_viewPointStyle);
1183 m_toolSettingsViews->addWidget (
new QLabel (
" "));
1184 m_toolSettingsViews->addWidget (m_viewSegmentFilter);
1185 addToolBar (m_toolSettingsViews);
1188 m_cmbCoordSystem =
new QComboBox;
1189 m_cmbCoordSystem->setEnabled (
false);
1190 m_cmbCoordSystem->setStatusTip (tr (
"Currently selected coordinate system"));
1191 m_cmbCoordSystem->setWhatsThis (tr (
"Selected Coordinate System\n\n"
1192 "Currently selected coordinate system. This is used to switch between coordinate systems "
1193 "in documents with multiple coordinate systems"));
1194 connect (m_cmbCoordSystem, SIGNAL (activated (
int)),
this, SLOT (slotCmbCoordSystem (
int)));
1196 m_btnShowAll =
new QPushButton(QIcon(
":/engauge/img/icon_show_all.png"),
"");
1197 m_btnShowAll->setEnabled (
false);
1198 m_btnShowAll->setAcceptDrops(
false);
1199 m_btnShowAll->setStatusTip (tr (
"Show all coordinate systems"));
1200 m_btnShowAll->setWhatsThis (tr (
"Show All Coordinate Systems\n\n"
1201 "When pressed and held, this button shows all digitized points and lines for all coordinate systems."));
1202 connect (m_btnShowAll, SIGNAL (pressed ()),
this, SLOT (slotBtnShowAllPressed ()));
1203 connect (m_btnShowAll, SIGNAL (released ()),
this, SLOT (slotBtnShowAllReleased ()));
1205 m_btnPrintAll =
new QPushButton(QIcon(
":/engauge/img/icon_print_all.png"),
"");
1206 m_btnPrintAll->setEnabled (
false);
1207 m_btnPrintAll->setAcceptDrops(
false);
1208 m_btnPrintAll->setStatusTip (tr (
"Print all coordinate systems"));
1209 m_btnPrintAll->setWhatsThis (tr (
"Print All Coordinate Systems\n\n"
1210 "When pressed, this button Prints all digitized points and lines for all coordinate systems."));
1211 connect (m_btnPrintAll, SIGNAL (pressed ()),
this, SLOT (slotBtnPrintAll ()));
1213 m_toolCoordSystem =
new QToolBar (tr (
"Coordinate System"),
this);
1214 m_toolCoordSystem->addWidget (m_cmbCoordSystem);
1215 m_toolCoordSystem->addWidget (m_btnShowAll);
1216 m_toolCoordSystem->addWidget (m_btnPrintAll);
1217 addToolBar (m_toolCoordSystem);
1221 connect (m_dockChecklistGuide, SIGNAL (signalChecklistClosed()),
this, SLOT (slotChecklistClosed()));
1224 void MainWindow::createTutorial ()
1226 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::createTutorial";
1229 m_tutorialDlg->setModal (
true);
1230 m_tutorialDlg->setMinimumSize (500, 400);
1231 m_tutorialDlg->hide();
1234 ZoomFactor MainWindow::currentZoomFactor ()
const
1236 if (m_actionZoom1To1->isChecked()) {
1238 }
else if (m_actionZoom1To2->isChecked()) {
1240 }
else if (m_actionZoom1To4->isChecked()) {
1242 }
else if (m_actionZoom1To8->isChecked()) {
1244 }
else if (m_actionZoom1To16->isChecked()) {
1245 return ZOOM_1_TO_16;
1246 }
else if (m_actionZoom2To1->isChecked()) {
1248 }
else if (m_actionZoom4To1->isChecked()) {
1250 }
else if (m_actionZoom8To1->isChecked()) {
1252 }
else if (m_actionZoom16To1->isChecked()) {
1253 return ZOOM_16_TO_1;
1254 }
else if (m_actionZoomFill->isChecked()) {
1257 ENGAUGE_ASSERT (
false);
1263 if (event->type () == QEvent::KeyPress) {
1265 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
1268 if ((eventKeyPress->key() == Qt::Key_E) &&
1269 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
1270 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
1280 return QObject::eventFilter (target, event);
1283 void MainWindow::exportAllCoordinateSystems()
1285 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystems";
1294 QString regressionFile = QString (
"%1_%2")
1295 .arg (m_regressionFile)
1297 fileExport (regressionFile,
1302 QString MainWindow::exportFilenameFromInputFilename (
const QString &fileName)
const
1304 QString outFileName = fileName;
1306 outFileName = outFileName.replace (
".xml",
".csv_actual");
1307 outFileName = outFileName.replace (
".dig",
".csv_actual");
1312 void MainWindow::fileExport(
const QString &fileName,
1315 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport"
1316 <<
" fileName=" << fileName.toLatin1().data();
1318 QFile file (fileName);
1319 if (file.open(QIODevice::WriteOnly)) {
1321 QTextStream str (&file);
1333 m_isDocumentExported =
true;
1334 m_dockChecklistGuide->
update (*m_cmdMediator,
1335 m_isDocumentExported);
1339 QMessageBox::critical (0,
1340 engaugeWindowTitle(),
1341 tr (
"Unable to export to file ") + fileName);
1345 void MainWindow::fileImport (
const QString &fileName,
1346 ImportType importType)
1348 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport"
1349 <<
" fileName=" << fileName.toLatin1 ().data ()
1350 <<
" curDir=" << QDir::currentPath().toLatin1().data()
1351 <<
" importType=" << importType;
1353 QString originalFileOld = m_originalFile;
1354 bool originalFileWasImported = m_originalFileWasImported;
1356 m_originalFile = fileName;
1357 m_originalFileWasImported =
true;
1359 if (importType == IMPORT_TYPE_ADVANCED) {
1370 bool loaded =
false;
1371 #ifdef ENGAUGE_JPEG2000
1373 loaded = jpeg2000.
load (fileName,
1375 #endif // ENGAUGE_JPEG2000
1377 loaded = image.load (fileName);
1381 QMessageBox::warning (
this,
1382 engaugeWindowTitle(),
1384 .arg (tr (
"Cannot read file"))
1388 m_originalFile = originalFileOld;
1389 m_originalFileWasImported = originalFileWasImported;
1393 loaded = loadImage (fileName,
1400 if (importType == IMPORT_TYPE_ADVANCED) {
1410 m_originalFile = originalFileOld;
1411 m_originalFileWasImported = originalFileWasImported;
1417 void MainWindow::fileImportWithPrompts (ImportType importType)
1419 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts"
1420 <<
" importType=" << importType;
1425 QTextStream str (&filter);
1428 QList<QByteArray>::const_iterator itr;
1429 QList<QByteArray> supportedImageFormats = QImageReader::supportedImageFormats();
1430 QStringList supportedImageFormatStrings;
1431 for (itr = supportedImageFormats.begin (); itr != supportedImageFormats.end (); itr++) {
1432 QByteArray arr = *itr;
1433 QString extensionAsWildcard = QString (
"*.%1").arg (QString (arr));
1434 supportedImageFormatStrings << extensionAsWildcard;
1436 #ifdef ENGAUGE_JPEG2000
1439 #endif // ENGAUGE_JPEG2000
1441 supportedImageFormatStrings.sort();
1443 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
1447 str <<
";; All Files (*.*)";
1449 QString fileName = QFileDialog::getOpenFileName (
this,
1451 QDir::currentPath (),
1453 if (!fileName.isEmpty ()) {
1456 fileImport (fileName,
1462 void MainWindow::filePaste (ImportType importType)
1464 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste"
1465 <<
" importType=" << importType;
1467 QString originalFileOld = m_originalFile;
1468 bool originalFileWasImported = m_originalFileWasImported;
1470 QString fileName (
"clipboard");
1471 m_originalFile = fileName;
1472 m_originalFileWasImported =
true;
1474 if (importType == IMPORT_TYPE_ADVANCED) {
1485 QImage image = QApplication::clipboard()->image();
1487 bool loaded =
false;
1489 loaded = !image.isNull();
1493 QMessageBox::warning (
this,
1494 engaugeWindowTitle(),
1496 .arg (tr (
"Cannot read file"))
1500 m_originalFile = originalFileOld;
1501 m_originalFileWasImported = originalFileWasImported;
1505 loaded = loadImage (fileName,
1512 if (importType == IMPORT_TYPE_ADVANCED) {
1522 m_originalFile = originalFileOld;
1523 m_originalFileWasImported = originalFileWasImported;
1529 void MainWindow::ghostsCreate ()
1531 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
1533 ENGAUGE_ASSERT (m_ghosts == 0);
1555 void MainWindow::ghostsDestroy ()
1557 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
1559 ENGAUGE_CHECK_PTR (m_ghosts);
1577 void MainWindow::loadCoordSystemListFromCmdMediator ()
1579 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
1581 m_cmbCoordSystem->clear();
1585 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1586 int index1Based = i + 1;
1587 m_cmbCoordSystem->addItem (QString::number (index1Based),
1592 m_cmbCoordSystem->setCurrentIndex (0);
1595 bool enable = (m_cmbCoordSystem->count() > 1);
1596 m_cmbCoordSystem->setEnabled (enable);
1597 m_btnShowAll->setEnabled (enable);
1598 m_btnPrintAll->setEnabled (enable);
1601 void MainWindow::loadCurveListFromCmdMediator ()
1603 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
1605 m_cmbCurve->clear ();
1607 QStringList::iterator itr;
1608 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1610 QString curvesGraphName = *itr;
1611 m_cmbCurve->addItem (curvesGraphName);
1615 m_cmbCurve->setCurrentIndex (0);
1618 void MainWindow::loadDocumentFile (
const QString &fileName)
1620 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1622 QApplication::setOverrideCursor(Qt::WaitCursor);
1625 QApplication::restoreOverrideCursor();
1629 setCurrentPathFromFile (fileName);
1630 rebuildRecentFileListForCurrentFile(fileName);
1631 m_currentFile = fileName;
1633 if (m_cmdMediator != 0) {
1634 delete m_cmdMediator;
1639 setupAfterLoad(fileName,
1641 IMPORT_TYPE_SIMPLE);
1644 m_actionDigitizeSelect->setChecked (
true);
1645 slotDigitizeSelect();
1647 m_engaugeFile = fileName;
1648 m_originalFile = fileName;
1649 m_originalFileWasImported =
false;
1655 QMessageBox::warning (
this,
1656 engaugeWindowTitle(),
1657 QString(
"%1 %2:\n%3.")
1658 .arg (tr (
"Cannot read file"))
1666 void MainWindow::loadErrorReportFile(
const QString &initialPath,
1667 const QString &errorReportFile)
1669 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile"
1670 <<
" path=" << initialPath.toLatin1().data()
1671 <<
" file=" << errorReportFile.toLatin1().data();
1677 QString originalPath = QDir::currentPath();
1678 QDir::setCurrent(initialPath);
1680 QFile file (errorReportFile);
1681 if (!file.exists()) {
1683 QFileInfo fileInfo (errorReportFile);
1685 QMessageBox::critical (
this,
1686 engaugeWindowTitle(),
1687 tr (
"File not found:") +
" " + fileInfo.absoluteFilePath());
1692 QXmlStreamReader reader (&file);
1693 file.open(QIODevice::ReadOnly | QIODevice::Text);
1704 QDir::setCurrent(originalPath);
1706 setupAfterLoad(errorReportFile,
1707 "Error report opened",
1708 IMPORT_TYPE_SIMPLE);
1711 m_actionDigitizeSelect->setChecked (
true);
1712 slotDigitizeSelect();
1717 bool MainWindow::loadImage (
const QString &fileName,
1718 const QImage &image,
1719 ImportType importType)
1721 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage"
1722 <<
" fileName=" << fileName.toLatin1 ().data ()
1723 <<
" importType=" << importType;
1725 QApplication::setOverrideCursor(Qt::WaitCursor);
1728 QApplication::restoreOverrideCursor();
1730 setCurrentPathFromFile (fileName);
1732 m_engaugeFile = EMPTY_FILENAME;
1734 if (m_cmdMediator != 0) {
1735 delete m_cmdMediator;
1740 bool accepted = setupAfterLoad(fileName,
1741 tr (
"File imported"),
1747 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1748 (m_fileCmdScript == 0)) {
1753 if (wizard->exec() == QDialog::Accepted) {
1755 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1770 m_actionViewChecklistGuide->setChecked (
true);
1773 loadCurveListFromCmdMediator();
1776 loadCoordSystemListFromCmdMediator();
1782 m_actionDigitizeAxis->setChecked (
true);
1783 slotDigitizeAxis ();
1791 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
1793 QFile file (m_originalFile);
1797 if (!file.open (QIODevice::ReadOnly)) {
1801 domInputFile.setContent (&file);
1805 void MainWindow::loadToolTips()
1807 if (m_actionViewToolTips->isChecked ()) {
1810 m_actionDigitizeSelect->setToolTip (DIGITIZE_ACTION_SELECT);
1811 m_actionDigitizeAxis->setToolTip (DIGITIZE_ACTION_AXIS_POINT);
1812 m_actionDigitizeCurve->setToolTip (DIGITIZE_ACTION_CURVE_POINT);
1813 m_actionDigitizePointMatch->setToolTip (DIGITIZE_ACTION_POINT_MATCH);
1814 m_actionDigitizeColorPicker->setToolTip (DIGITIZE_ACTION_COLOR_PICKER);
1815 m_actionDigitizeSegment->setToolTip (DIGITIZE_ACTION_SEGMENT_POINTS);
1816 m_cmbBackground->setToolTip (tr (
"Background image."));
1817 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
1818 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
1819 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
1824 m_actionDigitizeSelect->setToolTip (
"");
1825 m_actionDigitizeAxis->setToolTip (
"");
1826 m_actionDigitizeCurve->setToolTip (
"");
1827 m_actionDigitizePointMatch->setToolTip (
"");
1828 m_actionDigitizeColorPicker->setToolTip (
"");
1829 m_actionDigitizeSegment->setToolTip (
"");
1830 m_cmbBackground->setToolTip (
"");
1831 m_cmbCurve->setToolTip (
"");
1832 m_viewPointStyle->setToolTip (
"");
1833 m_viewSegmentFilter->setToolTip (
"");
1838 bool MainWindow::maybeSave()
1840 if (m_cmdMediator != 0) {
1842 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
1843 engaugeWindowTitle(),
1844 tr(
"The document has been modified.\n"
1845 "Do you want to save your changes?"),
1846 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1847 if (ret == QMessageBox::Save) {
1848 return slotFileSave();
1849 }
else if (ret == QMessageBox::Cancel) {
1860 const QString &fileName)
const
1868 QString csvExtension = QString (
".%1")
1870 QString tsvExtension = QString (
".%1")
1872 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
1873 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
1877 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
1878 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
1879 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
1880 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
1884 return modelExportFormatAfter;
1889 return m_modelMainWindow;
1892 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
1894 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
1896 setWindowFilePath (filePath);
1898 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1899 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
1900 recentFilePaths.removeAll (filePath);
1901 recentFilePaths.prepend (filePath);
1902 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
1903 recentFilePaths.removeLast ();
1905 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
1907 updateRecentFileList();
1912 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
1914 if (m_actionZoomFill->isChecked ()) {
1919 bool MainWindow::saveDocumentFile (
const QString &fileName)
1921 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
1923 QFile file(fileName);
1924 if (!file.open(QFile::WriteOnly)) {
1925 QMessageBox::warning (
this,
1926 engaugeWindowTitle(),
1927 QString (
"%1 %2: \n%3.")
1928 .arg(tr (
"Cannot write file"))
1930 .arg(file.errorString()));
1934 rebuildRecentFileListForCurrentFile (fileName);
1936 QApplication::setOverrideCursor (Qt::WaitCursor);
1937 QXmlStreamWriter writer(&file);
1938 writer.setAutoFormatting(
true);
1939 writer.writeStartDocument();
1940 writer.writeDTD(
"<!DOCTYPE engauge>");
1942 writer.writeEndDocument();
1943 QApplication::restoreOverrideCursor ();
1947 m_cmdMediator->setClean ();
1949 setCurrentFile(fileName);
1950 m_engaugeFile = fileName;
1960 const char *comment)
const
1962 if (m_cmdMediator != 0) {
1964 QString report = saveErrorReportFileAndExitXml (context,
1971 if (dlg.exec() == QDialog::Accepted) {
1979 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1982 const char *comment)
const
1984 const bool DEEP_COPY =
true;
1986 QString xmlErrorReport;
1987 QXmlStreamWriter writer (&xmlErrorReport);
1988 writer.setAutoFormatting(
true);
1991 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
1994 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
1995 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
1996 writer.writeEndElement();
2000 QXmlStreamReader reader (m_startingDocumentSnapshot);
2001 while (!reader.atEnd ()) {
2003 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
2004 reader.tokenType() != QXmlStreamReader::EndDocument) {
2005 writer.writeCurrentToken (reader);
2010 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
2011 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
2012 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
2013 writer.writeEndElement();
2016 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
2017 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
2018 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
2019 writer.writeEndElement();
2022 m_cmdMediator->
saveXml(writer);
2025 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
2026 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
2027 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
2028 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
2029 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
2030 writer.writeEndElement();
2032 writer.writeEndElement();
2035 QDomDocument domErrorReport (
"ErrorReport");
2036 domErrorReport.setContent (xmlErrorReport);
2039 if (!m_originalFileWasImported) {
2043 QDomDocument domInputFile;
2044 loadInputFileForErrorReport (domInputFile);
2045 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
2046 if (!domInputFile.isNull()) {
2047 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
2049 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
2050 if (nodesFileTo.count () > 0) {
2051 QDomNode nodeFileTo = nodesFileTo.at (0);
2052 nodeFileTo.appendChild (fragmentFileFrom);
2059 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
2060 for (
int i = 0 ; i < nodesDocument.count(); i++) {
2061 QDomNode nodeDocument = nodesDocument.at (i);
2062 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
2063 if (!elemImage.isNull()) {
2066 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
2067 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
2069 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
2070 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
2072 QDomNode nodeReplacement;
2073 QDomElement elemReplacement = nodeReplacement.toElement();
2074 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
2075 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
2078 nodeDocument.insertBefore (nodeReplacement,
2080 nodeDocument.removeChild(elemImage);
2086 return domErrorReport.toString();
2089 void MainWindow::saveStartingDocumentSnapshot()
2091 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
2093 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
2094 writer.setAutoFormatting (
true);
2100 ENGAUGE_CHECK_PTR (m_scene);
2106 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
2108 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
2110 int index = m_cmbBackground->findData (backgroundImage);
2111 ENGAUGE_ASSERT (index >= 0);
2113 m_cmbBackground->setCurrentIndex(index);
2115 return previousBackground;
2120 return m_cmbCurve->currentText ();
2123 void MainWindow::setCurrentFile (
const QString &fileName)
2125 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
2127 QString fileNameStripped;
2128 if (!fileName.isEmpty()) {
2131 QFileInfo fileInfo (fileName);
2132 fileNameStripped = fileInfo.baseName();
2135 m_currentFile = fileNameStripped;
2136 m_currentFileWithPathAndFileExtension = fileName;
2138 updateWindowTitle ();
2141 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
2143 QDir dir = QFileInfo (fileName).absoluteDir();
2145 if (dir.exists ()) {
2147 bool success = QDir::setCurrent (dir.absolutePath ());
2148 ENGAUGE_ASSERT (success);
2156 void MainWindow::setPixmap (
const QPixmap &pixmap)
2158 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
2162 m_backgroundStateContext->
setPixmap (m_transformation,
2168 void MainWindow::settingsRead ()
2170 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2172 settingsReadEnvironment (settings);
2173 settingsReadMainWindow (settings);
2176 void MainWindow::settingsReadEnvironment (QSettings &settings)
2178 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2179 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
2180 QDir::currentPath ()).toString ());
2181 settings.endGroup ();
2184 void MainWindow::settingsReadMainWindow (QSettings &settings)
2186 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
2189 resize (settings.value (SETTINGS_SIZE,
2190 QSize (600, 600)).toSize ());
2191 move (settings.value (SETTINGS_POS,
2192 QPoint (200, 200)).toPoint ());
2195 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
2196 QSize (900, 600)).toSize();
2197 m_helpWindow->resize (helpSize);
2198 if (settings.contains (SETTINGS_HELP_POS)) {
2199 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
2200 m_helpWindow->move (helpPos);
2204 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
2208 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
2210 m_actionViewBackground->setChecked (viewBackgroundToolBar);
2211 m_toolBackground->setVisible (viewBackgroundToolBar);
2212 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
2213 BACKGROUND_IMAGE_FILTERED).toInt ();
2214 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
2215 m_cmbBackground->setCurrentIndex (indexBackground);
2218 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
2220 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
2221 m_toolDigitize->setVisible (viewDigitizeToolBar);
2224 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
2226 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
2227 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
2230 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
2232 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
2233 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
2236 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
2238 m_actionViewToolTips->setChecked (viewToolTips);
2242 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
2245 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
2246 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
2247 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
2252 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
2253 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
2254 Qt::NoDockWidgetArea).toInt();
2256 if (area == Qt::NoDockWidgetArea) {
2258 addDockWidget (Qt::RightDockWidgetArea,
2259 m_dockChecklistGuide);
2260 m_dockChecklistGuide->setFloating(DOCKED_EQUALS_NOT_FLOATING);
2261 if (settings.contains (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY)) {
2262 m_dockChecklistGuide->restoreGeometry (settings.value (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY).toByteArray());
2267 addDockWidget (area,
2268 m_dockChecklistGuide);
2274 QLocale localeDefault;
2275 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
2276 QVariant (localeDefault.language())).toInt();
2277 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
2278 QVariant (localeDefault.country())).toInt();
2279 QLocale locale (language,
2281 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
2282 QVariant (ZOOM_1_TO_1)).toInt());
2284 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
2285 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
2286 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
2287 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
2288 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
2289 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
2292 settings.endGroup();
2295 void MainWindow::settingsWrite ()
2297 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2299 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
2300 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
2301 settings.endGroup ();
2303 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
2304 settings.setValue (SETTINGS_SIZE, size ());
2305 settings.setValue (SETTINGS_POS, pos ());
2306 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
2307 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
2308 if (m_dockChecklistGuide->isFloating()) {
2310 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
2311 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
2315 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
2318 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
2319 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
2320 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
2321 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
2322 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
2323 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
2324 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
2325 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
2326 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
2327 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
2328 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
2329 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
2330 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
2331 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
2332 settings.endGroup ();
2335 bool MainWindow::setupAfterLoad (
const QString &fileName,
2336 const QString &temporaryMessage ,
2337 ImportType importType)
2339 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoad"
2340 <<
" file=" << fileName.toLatin1().data()
2341 <<
" message=" << temporaryMessage.toLatin1().data()
2342 <<
" importType=" << importType;
2344 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
2348 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
2352 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
2353 setPixmap (m_cmdMediator->
pixmap ());
2357 if (importType == IMPORT_TYPE_ADVANCED) {
2359 applyZoomFactorAfterLoad();
2362 dlgImportAdvanced.exec();
2364 if (dlgImportAdvanced.result() == QDialog::Rejected) {
2368 int numberCoordSystem = dlgImportAdvanced.numberCoordSystem();
2377 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
2378 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
2379 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
2380 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
2381 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
2382 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
2383 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
2384 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
2385 loadCurveListFromCmdMediator ();
2386 loadCoordSystemListFromCmdMediator ();
2389 m_isDocumentExported =
false;
2398 m_cmbCurve->currentText ());
2399 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
2401 applyZoomFactorAfterLoad();
2403 setCurrentFile(fileName);
2407 saveStartingDocumentSnapshot();
2416 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent"
2417 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2419 QMainWindow::showEvent (event);
2421 if (m_loadStartupFiles.count() > 0) {
2423 m_timerLoadStartupFiles =
new QTimer;
2424 m_timerLoadStartupFiles->setSingleShot (
true);
2425 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2426 m_timerLoadStartupFiles->start (0);
2436 void MainWindow::slotBtnPrintAll ()
2438 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
2442 QPrinter printer (QPrinter::HighResolution);
2443 QPrintDialog dlg (&printer,
this);
2444 if (dlg.exec() == QDialog::Accepted) {
2445 QPainter painter (&printer);
2446 m_view->render (&painter);
2453 void MainWindow::slotBtnShowAllPressed ()
2455 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
2461 void MainWindow::slotBtnShowAllReleased ()
2463 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
2469 void MainWindow::slotCanRedoChanged (
bool canRedo)
2471 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
2473 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2476 void MainWindow::slotCanUndoChanged (
bool canUndo)
2478 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
2480 m_actionEditUndo->setEnabled (canUndo);
2483 void MainWindow::slotChecklistClosed()
2485 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
2487 m_actionViewChecklistGuide->setChecked (
false);
2490 void MainWindow::slotCleanChanged(
bool clean)
2492 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
2494 setWindowModified (!clean);
2497 void MainWindow::slotCmbBackground(
int currentIndex)
2499 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
2501 switch (currentIndex) {
2502 case BACKGROUND_IMAGE_NONE:
2503 if (!m_actionViewBackgroundNone->isChecked()) {
2504 m_actionViewBackgroundNone->toggle();
2508 case BACKGROUND_IMAGE_ORIGINAL:
2509 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2510 m_actionViewBackgroundOriginal->toggle();
2514 case BACKGROUND_IMAGE_FILTERED:
2515 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2516 m_actionViewBackgroundFiltered->toggle();
2524 void MainWindow::slotCmbCoordSystem(
int index)
2526 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
2532 m_cmdMediator->push (cmd);
2535 void MainWindow::slotCmbCurve(
int )
2537 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
2542 m_cmbCurve->currentText ());
2545 updateViewedCurves();
2549 void MainWindow::slotContextMenuEvent (QString pointIdentifier)
2551 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEvent point=" << pointIdentifier.toLatin1 ().data ();
2557 void MainWindow::slotDigitizeAxis ()
2559 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
2562 DIGITIZE_STATE_AXIS);
2563 m_cmbCurve->setEnabled (
false);
2568 void MainWindow::slotDigitizeColorPicker ()
2570 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
2573 DIGITIZE_STATE_COLOR_PICKER);
2574 m_cmbCurve->setEnabled (
true);
2579 void MainWindow::slotDigitizeCurve ()
2581 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2584 DIGITIZE_STATE_CURVE);
2585 m_cmbCurve->setEnabled (
true);
2590 void MainWindow::slotDigitizePointMatch ()
2592 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2595 DIGITIZE_STATE_POINT_MATCH);
2596 m_cmbCurve->setEnabled (
true);
2601 void MainWindow::slotDigitizeSegment ()
2603 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2606 DIGITIZE_STATE_SEGMENT);
2607 m_cmbCurve->setEnabled (
true);
2612 void MainWindow::slotDigitizeSelect ()
2614 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2617 DIGITIZE_STATE_SELECT);
2618 m_cmbCurve->setEnabled (
false);
2623 void MainWindow::slotEditCopy ()
2625 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2634 void MainWindow::slotEditCut ()
2636 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2645 void MainWindow::slotEditDelete ()
2647 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
2656 void MainWindow::slotEditMenu ()
2658 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
2660 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2661 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2664 void MainWindow::slotEditPaste ()
2666 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
2669 void MainWindow::slotEditPasteAsNew ()
2671 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
2673 filePaste (IMPORT_TYPE_SIMPLE);
2676 void MainWindow::slotEditPasteAsNewAdvanced ()
2678 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
2680 filePaste (IMPORT_TYPE_ADVANCED);
2683 void MainWindow::slotFileClose()
2685 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
2699 DIGITIZE_STATE_EMPTY);
2705 m_backgroundStateContext->
close ();
2708 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2711 delete m_cmdMediator;
2717 setWindowTitle (engaugeWindowTitle ());
2723 void MainWindow::slotFileExport ()
2725 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
2730 QString filter = QString (
"%1;;%2;;All files (*.*)")
2733 QString defaultFileName = QString (
"%1/%2.%3")
2734 .arg (QDir::currentPath ())
2735 .arg (m_currentFile)
2738 QString filterCsv = exportStrategy.
filterCsv ();
2739 QString fileName = dlg.getSaveFileName (
this,
2744 if (!fileName.isEmpty ()) {
2746 fileExport(fileName,
2755 void MainWindow::slotFileImport ()
2757 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
2759 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2762 void MainWindow::slotFileImportAdvanced ()
2764 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
2766 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2769 void MainWindow::slotFileImportDraggedImage(QImage image)
2771 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
2776 IMPORT_TYPE_SIMPLE);
2779 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
2781 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
2786 void MainWindow::slotFileImportImage(QString fileName, QImage image)
2788 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
2791 loadImage (fileName,
2793 IMPORT_TYPE_SIMPLE);
2796 void MainWindow::slotFileOpen()
2798 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
2804 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
2805 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2806 .arg (ENGAUGE_FILENAME_EXTENSION);
2808 QString fileName = QFileDialog::getOpenFileName (
this,
2809 tr(
"Open Document"),
2810 QDir::currentPath (),
2812 if (!fileName.isEmpty ()) {
2814 loadDocumentFile (fileName);
2820 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
2822 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
2824 loadDocumentFile (fileName);
2827 void MainWindow::slotFilePrint()
2829 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
2831 QPrinter printer (QPrinter::HighResolution);
2832 QPrintDialog dlg (&printer,
this);
2833 if (dlg.exec() == QDialog::Accepted) {
2834 QPainter painter (&printer);
2835 m_view->render (&painter);
2840 bool MainWindow::slotFileSave()
2842 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
2844 if (m_engaugeFile.isEmpty()) {
2845 return slotFileSaveAs();
2847 return saveDocumentFile (m_engaugeFile);
2851 bool MainWindow::slotFileSaveAs()
2853 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
2856 QString filenameDefault = m_currentFile;
2857 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
2858 filenameDefault = QString (
"%1.%2")
2859 .arg (m_currentFile)
2860 .arg (ENGAUGE_FILENAME_EXTENSION);
2863 if (!m_engaugeFile.isEmpty()) {
2864 filenameDefault = m_engaugeFile;
2867 QString filterDigitizer = QString (
"%1 (*.%2)")
2868 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2869 .arg (ENGAUGE_FILENAME_EXTENSION);
2870 QString filterAll (
"All files (*. *)");
2872 QStringList filters;
2873 filters << filterDigitizer;
2874 filters << filterAll;
2876 QFileDialog dlg(
this);
2877 dlg.selectNameFilter (filterDigitizer);
2878 dlg.setNameFilters (filters);
2879 dlg.setWindowModality(Qt::WindowModal);
2880 dlg.setAcceptMode(QFileDialog::AcceptSave);
2881 dlg.selectFile(filenameDefault);
2884 QStringList files = dlg.selectedFiles();
2885 return saveDocumentFile(files.at(0));
2891 void MainWindow::slotHelpAbout()
2893 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
2899 void MainWindow::slotHelpTutorial()
2901 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
2903 m_tutorialDlg->show ();
2904 m_tutorialDlg->exec ();
2907 void MainWindow::slotKeyPress (Qt::Key key,
2908 bool atLeastOneSelectedItem)
2910 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress"
2911 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
2912 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
2916 atLeastOneSelectedItem);
2919 void MainWindow::slotLeave ()
2921 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotLeave";
2923 m_digitizeStateContext->
handleLeave (m_cmdMediator);
2926 void MainWindow::slotLoadStartupFiles ()
2928 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
2930 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
2932 QString fileName = m_loadStartupFiles.front();
2933 m_loadStartupFiles.pop_front();
2939 loadDocumentFile (fileName);
2943 fileImport (fileName,
2944 IMPORT_TYPE_SIMPLE);
2948 if (m_loadStartupFiles.count() > 0) {
2952 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2953 m_loadStartupFiles);
2957 void MainWindow::slotMouseMove (QPointF pos)
2962 if (m_cmdMediator != 0) {
2965 QString coordsScreen, coordsGraph, resolutionGraph;
2984 void MainWindow::slotMousePress (QPointF pos)
2986 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
2994 void MainWindow::slotMouseRelease (QPointF pos)
2996 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
2998 if (pos.x() < 0 || pos.y() < 0) {
3012 void MainWindow::slotRecentFileAction ()
3014 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
3016 QAction *action = qobject_cast<QAction*>(sender ());
3019 QString fileName = action->data().toString();
3020 loadDocumentFile (fileName);
3024 void MainWindow::slotRecentFileClear ()
3026 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
3028 QStringList emptyList;
3030 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3031 settings.setValue (SETTINGS_RECENT_FILE_LIST,
3034 updateRecentFileList();
3037 void MainWindow::slotRedoTextChanged (
const QString &text)
3039 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
3041 QString completeText (
"Redo");
3042 if (!text.isEmpty ()) {
3043 completeText += QString (
" \"%1\"").arg (text);
3045 m_actionEditRedo->setText (completeText);
3048 void MainWindow::slotSetOverrideCursor (QCursor cursor)
3050 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSetOverrideCursor";
3056 void MainWindow::slotSettingsAxesChecker ()
3058 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
3060 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
3061 m_dlgSettingsAxesChecker->show ();
3064 void MainWindow::slotSettingsColorFilter ()
3066 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
3068 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
3069 m_dlgSettingsColorFilter->show ();
3072 void MainWindow::slotSettingsCoords ()
3074 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
3076 m_dlgSettingsCoords->
load (*m_cmdMediator);
3077 m_dlgSettingsCoords->show ();
3080 void MainWindow::slotSettingsCurveAddRemove ()
3082 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveAddRemove";
3084 m_dlgSettingsCurveAddRemove->
load (*m_cmdMediator);
3085 m_dlgSettingsCurveAddRemove->show ();
3088 void MainWindow::slotSettingsCurveProperties ()
3090 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
3092 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3094 m_dlgSettingsCurveProperties->show ();
3097 void MainWindow::slotSettingsDigitizeCurve ()
3099 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
3101 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3102 m_dlgSettingsDigitizeCurve->show ();
3105 void MainWindow::slotSettingsExportFormat ()
3107 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
3110 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3111 m_dlgSettingsExportFormat->show ();
3118 void MainWindow::slotSettingsGeneral ()
3120 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
3122 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3123 m_dlgSettingsGeneral->show ();
3126 void MainWindow::slotSettingsGridRemoval ()
3128 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
3130 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3131 m_dlgSettingsGridRemoval->show ();
3134 void MainWindow::slotSettingsPointMatch ()
3136 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
3138 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3139 m_dlgSettingsPointMatch->show ();
3142 void MainWindow::slotSettingsSegments ()
3144 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
3146 m_dlgSettingsSegments->
load (*m_cmdMediator);
3147 m_dlgSettingsSegments->show ();
3150 void MainWindow::slotSettingsMainWindow ()
3152 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
3156 m_dlgSettingsMainWindow->show ();
3159 void MainWindow::slotTimeoutRegressionErrorReport ()
3161 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport"
3162 <<
" cmdStackIndex=" << m_cmdMediator->index()
3163 <<
" cmdStackCount=" << m_cmdMediator->count();
3165 if (m_cmdStackShadow->
canRedo()) {
3171 exportAllCoordinateSystems ();
3174 m_cmdMediator->setClean();
3180 void MainWindow::slotTimeoutRegressionFileCmdScript ()
3182 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
3184 if (m_fileCmdScript->
canRedo()) {
3186 m_fileCmdScript->
redo(*
this);
3191 if (m_cmdMediator != 0) {
3193 exportAllCoordinateSystems ();
3196 m_cmdMediator->setClean();
3206 void MainWindow::slotUndoTextChanged (
const QString &text)
3208 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
3210 QString completeText (
"Undo");
3211 if (!text.isEmpty ()) {
3212 completeText += QString (
" \"%1\"").arg (text);
3214 m_actionEditUndo->setText (completeText);
3217 void MainWindow::slotViewGroupBackground(QAction *action)
3219 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
3222 BackgroundImage backgroundImage;
3223 int indexBackground;
3224 if (action == m_actionViewBackgroundNone) {
3225 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
3226 backgroundImage = BACKGROUND_IMAGE_NONE;
3227 }
else if (action == m_actionViewBackgroundOriginal) {
3228 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3229 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3230 }
else if (action == m_actionViewBackgroundFiltered) {
3231 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
3232 backgroundImage = BACKGROUND_IMAGE_FILTERED;
3234 ENGAUGE_ASSERT (
false);
3237 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
3238 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
3241 m_cmbBackground->setCurrentIndex (indexBackground);
3245 void MainWindow::slotViewGroupCurves(QAction * )
3247 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
3249 updateViewedCurves ();
3252 void MainWindow::slotViewGroupStatus(QAction *action)
3254 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
3256 ENGAUGE_CHECK_PTR (m_statusBar);
3258 if (action == m_actionStatusNever) {
3260 }
else if (action == m_actionStatusTemporary) {
3267 void MainWindow::slotViewToolBarBackground ()
3269 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
3271 if (m_actionViewBackground->isChecked ()) {
3272 m_toolBackground->show();
3274 m_toolBackground->hide();
3278 void MainWindow::slotViewToolBarChecklistGuide ()
3280 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
3282 if (m_actionViewChecklistGuide->isChecked ()) {
3283 m_dockChecklistGuide->show();
3285 m_dockChecklistGuide->hide();
3289 void MainWindow::slotViewToolBarCoordSystem ()
3291 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
3293 if (m_actionViewCoordSystem->isChecked ()) {
3294 m_toolCoordSystem->show();
3296 m_toolCoordSystem->hide();
3300 void MainWindow::slotViewToolBarDigitize ()
3302 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
3304 if (m_actionViewDigitize->isChecked ()) {
3305 m_toolDigitize->show();
3307 m_toolDigitize->hide();
3311 void MainWindow::slotViewToolBarSettingsViews ()
3313 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
3315 if (m_actionViewSettingsViews->isChecked ()) {
3316 m_toolSettingsViews->show();
3318 m_toolSettingsViews->hide();
3322 void MainWindow::slotViewToolTips ()
3324 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
3329 void MainWindow::slotViewZoom(
int zoom)
3331 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
3334 switch ((ZoomFactor) zoom) {
3336 m_actionZoom16To1->setChecked(
true);
3337 slotViewZoom16To1 ();
3340 m_actionZoom8To1->setChecked(
true);
3341 slotViewZoom8To1 ();
3344 m_actionZoom4To1->setChecked(
true);
3345 slotViewZoom4To1 ();
3348 m_actionZoom2To1->setChecked(
true);
3349 slotViewZoom2To1 ();
3352 m_actionZoom1To1->setChecked(
true);
3353 slotViewZoom1To1 ();
3356 m_actionZoom1To2->setChecked(
true);
3357 slotViewZoom1To2 ();
3360 m_actionZoom1To4->setChecked(
true);
3361 slotViewZoom1To4 ();
3364 m_actionZoom1To8->setChecked(
true);
3365 slotViewZoom1To8 ();
3368 m_actionZoom1To16->setChecked(
true);
3369 slotViewZoom1To16 ();
3372 m_actionZoomFill->setChecked(
true);
3373 slotViewZoomFill ();
3378 void MainWindow::slotViewZoom16To1 ()
3380 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom16To1";
3382 QTransform transform;
3383 transform.scale (16.0, 16.0);
3384 m_view->setTransform (transform);
3388 void MainWindow::slotViewZoom8To1 ()
3390 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom8To1";
3392 QTransform transform;
3393 transform.scale (8.0, 8.0);
3394 m_view->setTransform (transform);
3398 void MainWindow::slotViewZoom4To1 ()
3400 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom4To1";
3402 QTransform transform;
3403 transform.scale (4.0, 4.0);
3404 m_view->setTransform (transform);
3408 void MainWindow::slotViewZoom2To1 ()
3410 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom2To1";
3412 QTransform transform;
3413 transform.scale (2.0, 2.0);
3414 m_view->setTransform (transform);
3418 void MainWindow::slotViewZoom1To1 ()
3420 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom1To1";
3422 QTransform transform;
3423 transform.scale (1.0, 1.0);
3424 m_view->setTransform (transform);
3428 void MainWindow::slotViewZoom1To2 ()
3430 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To2";
3432 QTransform transform;
3433 transform.scale (0.5, 0.5);
3434 m_view->setTransform (transform);
3438 void MainWindow::slotViewZoom1To4 ()
3440 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To4";
3442 QTransform transform;
3443 transform.scale (0.25, 0.25);
3444 m_view->setTransform (transform);
3448 void MainWindow::slotViewZoom1To8 ()
3450 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To8";
3452 QTransform transform;
3453 transform.scale (0.125, 0.125);
3454 m_view->setTransform (transform);
3458 void MainWindow::slotViewZoom1To16 ()
3460 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotZoom1To16";
3462 QTransform transform;
3463 transform.scale (0.0625, 0.0625);
3464 m_view->setTransform (transform);
3468 void MainWindow::slotViewZoomFill ()
3470 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFill";
3472 m_backgroundStateContext->
fitInView (*m_view);
3477 void MainWindow::slotViewZoomIn ()
3479 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3483 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3484 bool goto1To1 =
false;
3485 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3486 if (m_actionZoomFill->isChecked ()) {
3489 double xScale = m_view->transform().m11();
3490 double yScale = m_view->transform().m22();
3491 double scale = qMin(xScale, yScale);
3492 if (scale < 0.125) {
3494 }
else if (scale < 0.25) {
3496 }
else if (scale < 0.5) {
3498 }
else if (scale < 1) {
3500 }
else if (scale < 2) {
3502 }
else if (scale < 4) {
3504 }
else if (scale < 8) {
3510 goto16To1 = m_actionZoom8To1->isChecked ();
3511 goto8To1 = m_actionZoom4To1->isChecked ();
3512 goto4To1 = m_actionZoom2To1->isChecked ();
3513 goto2To1 = m_actionZoom1To1->isChecked ();
3514 goto1To1 = m_actionZoom1To2->isChecked ();
3515 goto1To2 = m_actionZoom1To4->isChecked ();
3516 goto1To4 = m_actionZoom1To8->isChecked ();
3517 goto1To8 = m_actionZoom1To16->isChecked ();
3522 m_actionZoom16To1->setChecked (
true);
3523 slotViewZoom16To1 ();
3524 }
else if (goto8To1) {
3525 m_actionZoom8To1->setChecked (
true);
3526 slotViewZoom8To1 ();
3527 }
else if (goto4To1) {
3528 m_actionZoom4To1->setChecked (
true);
3529 slotViewZoom4To1 ();
3530 }
else if (goto2To1) {
3531 m_actionZoom2To1->setChecked (
true);
3532 slotViewZoom2To1 ();
3533 }
else if (goto1To1) {
3534 m_actionZoom1To1->setChecked (
true);
3535 slotViewZoom1To1 ();
3536 }
else if (goto1To2) {
3537 m_actionZoom1To2->setChecked (
true);
3538 slotViewZoom1To2 ();
3539 }
else if (goto1To4) {
3540 m_actionZoom1To4->setChecked (
true);
3541 slotViewZoom1To4 ();
3542 }
else if (goto1To8) {
3543 m_actionZoom1To8->setChecked (
true);
3544 slotViewZoom1To8 ();
3545 }
else if (goto1To16) {
3546 m_actionZoom1To16->setChecked (
true);
3547 slotViewZoom1To16 ();
3551 void MainWindow::slotViewZoomInFromWheelEvent ()
3553 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
3555 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3556 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3563 void MainWindow::slotViewZoomOut ()
3565 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
3569 bool goto16To1 =
false, goto8To1 =
false, goto4To1 =
false, goto2To1 =
false;
3570 bool goto1To1 =
false;
3571 bool goto1To2 =
false, goto1To4 =
false, goto1To8 =
false, goto1To16 =
false;
3572 if (m_actionZoomFill->isChecked ()) {
3575 double xScale = m_view->transform().m11();
3576 double yScale = m_view->transform().m22();
3577 double scale = qMax(xScale, yScale);
3580 }
else if (scale > 4) {
3582 }
else if (scale > 2) {
3584 }
else if (scale > 1) {
3586 }
else if (scale > 0.5) {
3588 }
else if (scale > 0.25) {
3590 }
else if (scale > 0.125) {
3596 goto8To1 = m_actionZoom16To1->isChecked ();
3597 goto4To1 = m_actionZoom8To1->isChecked ();
3598 goto2To1 = m_actionZoom4To1->isChecked ();
3599 goto1To1 = m_actionZoom2To1->isChecked ();
3600 goto1To2 = m_actionZoom1To1->isChecked ();
3601 goto1To4 = m_actionZoom1To2->isChecked ();
3602 goto1To8 = m_actionZoom1To4->isChecked ();
3603 goto1To16 = m_actionZoom1To8->isChecked ();
3608 m_actionZoom1To16->setChecked (
true);
3609 slotViewZoom1To16 ();
3610 }
else if (goto1To8) {
3611 m_actionZoom1To8->setChecked (
true);
3612 slotViewZoom1To8 ();
3613 }
else if (goto1To4) {
3614 m_actionZoom1To4->setChecked (
true);
3615 slotViewZoom1To4 ();
3616 }
else if (goto1To2) {
3617 m_actionZoom1To2->setChecked (
true);
3618 slotViewZoom1To2 ();
3619 }
else if (goto1To1) {
3620 m_actionZoom1To1->setChecked (
true);
3621 slotViewZoom1To1 ();
3622 }
else if (goto2To1) {
3623 m_actionZoom2To1->setChecked (
true);
3624 slotViewZoom2To1 ();
3625 }
else if (goto4To1) {
3626 m_actionZoom4To1->setChecked (
true);
3627 slotViewZoom4To1 ();
3628 }
else if (goto8To1) {
3629 m_actionZoom8To1->setChecked (
true);
3630 slotViewZoom8To1 ();
3631 }
else if (goto16To1) {
3632 m_actionZoom16To1->setChecked (
true);
3633 slotViewZoom16To1 ();
3637 void MainWindow::slotViewZoomOutFromWheelEvent ()
3639 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
3641 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3642 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3649 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3651 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
3653 const int REGRESSION_INTERVAL = 400;
3656 m_regressionFile = exportFilenameFromInputFilename (regressionInputFile);
3658 m_timerRegressionErrorReport =
new QTimer();
3659 m_timerRegressionErrorReport->setSingleShot(
false);
3660 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
3662 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
3665 void MainWindow::startRegressionTestFileCmdScript()
3667 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
3669 const int REGRESSION_INTERVAL = 400;
3671 m_timerRegressionFileCmdScript =
new QTimer();
3672 m_timerRegressionFileCmdScript->setSingleShot(
false);
3673 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
3675 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
3680 return m_transformation;
3690 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
3692 ENGAUGE_CHECK_PTR (m_cmdMediator);
3696 updateAfterCommandStatusBarCoords ();
3705 m_dockChecklistGuide->
update (*m_cmdMediator,
3706 m_isDocumentExported);
3710 writeCheckpointToLogFile ();
3713 void MainWindow::updateAfterCommandStatusBarCoords ()
3715 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
3720 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
3724 updateTransformationAndItsDependencies();
3727 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
3735 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
3743 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
3752 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
3753 QPointF posScreen = m_view->mapToScene (posLocal);
3755 slotMouseMove (posScreen);
3760 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
3765 void MainWindow::updateControls ()
3767 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls"
3768 <<
" selectedItems=" << m_scene->selectedItems().count();
3770 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3772 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3773 (m_actionRecentFiles.at(0)->isVisible ()));
3774 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3775 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3776 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3777 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3778 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3780 if (m_cmdMediator == 0) {
3781 m_actionEditUndo->setEnabled (
false);
3782 m_actionEditRedo->setEnabled (
false);
3784 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3785 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
3787 m_actionEditCut->setEnabled (m_scene->selectedItems().count () > 0);
3788 m_actionEditCopy->setEnabled (m_scene->selectedItems().count () > 0);
3789 m_actionEditPaste->setEnabled (
false);
3790 m_actionEditDelete->setEnabled (m_scene->selectedItems().count () > 0);
3793 m_actionDigitizeAxis->setEnabled (!m_currentFile.isEmpty ());
3794 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
3795 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3796 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3797 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3798 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3800 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
3801 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
3802 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
3803 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
3805 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3806 m_actionSettingsCurveAddRemove->setEnabled (!m_currentFile.isEmpty ());
3807 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3808 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3809 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3810 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3811 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3812 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3813 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3814 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3815 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3817 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3818 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3819 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3821 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3822 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3827 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
3830 updateTransformationAndItsDependencies();
3842 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3844 switch (digitizeState) {
3845 case DIGITIZE_STATE_AXIS:
3846 m_actionDigitizeAxis->setChecked(
true);
3850 case DIGITIZE_STATE_COLOR_PICKER:
3851 m_actionDigitizeColorPicker->setChecked(
true);
3852 slotDigitizeColorPicker();
3855 case DIGITIZE_STATE_CURVE:
3856 m_actionDigitizeCurve->setChecked(
true);
3857 slotDigitizeCurve();
3860 case DIGITIZE_STATE_EMPTY:
3863 case DIGITIZE_STATE_POINT_MATCH:
3864 m_actionDigitizePointMatch->setChecked(
true);
3865 slotDigitizePointMatch();
3868 case DIGITIZE_STATE_SEGMENT:
3869 m_actionDigitizeSegment->setChecked(
true);
3870 slotDigitizeSegment();
3873 case DIGITIZE_STATE_SELECT:
3874 m_actionDigitizeSelect->setChecked(
true);
3875 slotDigitizeSelect();
3879 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3886 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
3892 void MainWindow::updateRecentFileList()
3894 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
3896 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3897 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
3900 unsigned int count = recentFilePaths.size();
3901 if (count > MAX_RECENT_FILE_LIST_SIZE) {
3902 count = MAX_RECENT_FILE_LIST_SIZE;
3907 for (i = 0; i < count; i++) {
3908 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
3909 m_actionRecentFiles.at (i)->setText (strippedName);
3910 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
3911 m_actionRecentFiles.at (i)->setVisible (
true);
3915 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
3916 m_actionRecentFiles.at (i)->setVisible (
false);
3922 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
3929 m_cmbCurve->currentText());
3934 m_cmbCurve->currentText());
3940 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
3952 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
3959 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveAddRemove";
3962 loadCurveListFromCmdMediator();
3968 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
3977 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
3981 modelDigitizeCurve);
3986 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
3993 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
4000 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
4005 void MainWindow::updateSettingsMainWindow()
4007 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4009 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
4010 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
4012 m_actionZoomIn->setShortcut (tr (
""));
4013 m_actionZoomOut->setShortcut (tr (
""));
4017 m_actionZoomIn->setShortcut (tr (
"+"));
4018 m_actionZoomOut->setShortcut (tr (
"-"));
4022 updateWindowTitle();
4027 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
4035 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
4042 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
4048 void MainWindow::updateTransformationAndItsDependencies()
4050 m_transformation.
update (!m_currentFile.isEmpty (),
4058 m_cmbCurve->currentText ());
4061 void MainWindow::updateViewedCurves ()
4063 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
4065 if (m_actionViewCurvesAll->isChecked ()) {
4069 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4073 }
else if (m_actionViewCurvesNone->isChecked ()) {
4078 ENGAUGE_ASSERT (
false);
4084 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
4086 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4093 if (activeCurve.isEmpty ()) {
4106 m_cmdMediator->
pixmap ());
4111 void MainWindow::updateWindowTitle ()
4113 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
4115 const QString PLACEHOLDER (
"[*]");
4117 QString title = QString (tr (
"Engauge Digitizer %1")
4118 .arg (VERSION_NUMBER));
4120 QString fileNameMaybeStripped;
4121 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4123 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4127 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
4128 fileNameMaybeStripped = fileInfo.baseName();
4131 case MAIN_TITLE_BAR_FORMAT_PATH:
4132 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4136 title += QString (
": %1")
4137 .arg (fileNameMaybeStripped);
4142 title += PLACEHOLDER;
4144 setWindowTitle (title);
4149 ENGAUGE_CHECK_PTR (m_view);
4155 ENGAUGE_CHECK_PTR (m_view);
4159 void MainWindow::writeCheckpointToLogFile ()
4162 QString checkpointDoc;
4163 QTextStream strDoc (&checkpointDoc);
4168 QString checkpointScene;
4169 QTextStream strScene (&checkpointScene);
4174 if (mainCat->getPriority() == log4cpp::Priority::DEBUG) {
4176 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n"
4177 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4178 << checkpointDoc.toLatin1().data()
4179 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4180 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4181 << checkpointScene.toLatin1().data()
4182 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
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 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.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Returns information about files.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
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 updateAfterCommand(CmdMediator &cmdMediator)
Update the Points and their Curves after executing a command.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
Class that displays the current Segment Filter in a MainWindow toolbar.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
Dialog for editing Segments settings, for DigitizeStateSegment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
Dialog for editing point match settings, for DigitizeStatePointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void 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 updateSettingsCurveAddRemove(const CurvesGraphs &curvesGraphs)
Update with new curves.
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 updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
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...
QStringList selectedPointIdentifiers() const
Return a list of identifiers for the currently selected points.
void cmdFileClose()
Close file. This is called from a file script command.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
PointStyle pointStyle() const
Get method for PointStyle.
void triggerStateTransition(TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
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.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
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...
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isRegressionTest, bool isGnuplot, QStringList loadStartupFiles, QWidget *parent=0)
Single constructor.
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.
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.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Dockable text window containing checklist guide.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Dialog for editing filtering settings.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal)
Update the images of all states, rather than just the current state.
ZoomControl zoomControl() const
Get method for zoom control.
QString fileExtensionTsv() const
File extension for tsv export files.
Details for a specific Point.
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 setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
Client for interacting with Engauge server.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Context class that manages the background image state machine.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsMainWindow.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
bool canRedo() const
Return true if there is a command available.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Dialog for editing general settings.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void 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 updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Command for deleting all selected Points.
Dialog for editing DigitizeStateCurve settings.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
Class that displays a view of the current Curve's point style.
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
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.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
void load(CmdMediator &cmdMediator)
Load settings from Document.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
bool isGnuplot() const
Get method for gnuplot flag.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Dialog for editing curve properties settings.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter)
Apply color filter settings.
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 handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
void handleSetOverrideCursor(CmdMediator *cmdMediator, const QCursor &cursor)
See DigitizeStateAbstractBase::handleSetOverrideCursor.
QString filterCsv() const
QFileDialog filter for CSV files.
void handleContextMenuEvent(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEvent.
Command for moving all selected Points by a specified translation.
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 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.
MainWindowModel modelMainWindow() const
Get method for main window model.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
void handleLeave(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleLeave.
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.