Engauge Digitizer 2
Loading...
Searching...
No Matches
MainWindow Class Reference

Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document Interface. More...

#include <MainWindow.h>

Inheritance diagram for MainWindow:
Inheritance graph
Collaboration diagram for MainWindow:
Collaboration graph

Signals

void signalDropRegression (QString)
 Send drag and drop regression test url.
void signalGong ()
 Send wakeup signal to unit test framework when all other commands have finished executing.
void signalZoom (int)
 Send zoom selection, picked from menu or keystroke, to StatusBar.

Public Member Functions

 MainWindow (const QString &errorReportFile, const QString &fileCmdScriptFile, bool isDropRegression, bool isRegressionTest, bool isGnuplot, bool isReset, bool isExportOnly, bool isExtractImageOnly, const QString &extractImageOnlyExtension, const QStringList &loadStartupFiles, const QStringList &commandLineWithoutLoadStartupFiles, QWidget *parent=nullptr)
 Single constructor.
 ~MainWindow ()
void cmdFileClose ()
 Close file. This is called from a file script command.
void cmdFileExport (const QString &fileName)
 Export file. This is called from a file script command.
void cmdFileImport (const QString &fileName)
 Import file. This is called from a file script command.
void cmdFileOpen (const QString &fileName)
 Open file. This is called from a file script command.
CmdMediatorcmdMediator ()
 Accessor for commands to process the Document.
DigitizeState digitizeState () const
 Get DigitizeState. This should only be used to populate arguments in CmdAbstract constructor!
virtual bool eventFilter (QObject *, QEvent *)
 Catch secret keypresses.
void guidelineAddXT (const QString &identifier, double xT)
 Add a X/T Guideline.
void guidelineAddYR (const QString &identifier, double yR)
 Add a Y/R Guideline.
void guidelineMoveXT (const QString &identifier, double xTAfter)
 Move a X/T Guideline.
void guidelineMoveYR (const QString &identifier, double yRAfter)
 Move a Y/R Guideline.
void guidelineRemove (const QString &identifier)
 Remove a X/T or Y/R Guideline.
bool guidelinesAreVisible () const
 True/false if guidelines are visible. Selectability is handled elsewhere.
void handleGuidelinesActiveChange (bool active)
 Handle Guidelines active status toggle.
QImage imageFiltered () const
 Background image that has been filtered for the current curve. This asserts if a curve-specific image is not being shown.
bool isGnuplot () const
 Get method for gnuplot flag.
MainWindowModel modelMainWindow () const
 Get method for main window model.
bool modeMap () const
 True if document scale is set using a scale bar, otherwise using axis points.
void resizeEvent (QResizeEvent *event)
 Intercept resize event so graphics scene can be appropriately resized when in Fill mode.
void saveErrorReportFileAndExit (const char *comment, const char *file, int line, const char *context)
 Save error report and exit.
GraphicsScenescene ()
 Scene container for the QImage and QGraphicsItems.
BackgroundImage selectOriginal (BackgroundImage backgroundImage)
 Make original background visible, for DigitizeStateColorPicker.
QString selectedGraphCurve () const
 Curve name that is currently selected in m_cmbCurve.
void sendGong ()
 Send signal to unit test framework indicating all commands have finished executing.
virtual void showEvent (QShowEvent *)
 Processing performed after gui becomes available.
void showTemporaryMessage (const QString &temporaryMessage)
 Show temporary message in status bar.
Transformation transformation () const
 Return read-only copy of transformation.
bool transformIsDefined () const
 Return true if all three axis points have been defined.
void updateAfterCommand ()
 See GraphicsScene::updateAfterCommand.
void updateAfterMouseRelease ()
 Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/release.
void updateCoordSystem (CoordSystemIndex coordSystemIndex)
 Select a different CoordSystem.
void updateDigitizeStateIfSoftwareTriggered (DigitizeState digitizeState)
 After software-triggered state transition, this method manually triggers the action as if user had clicked on digitize button.
void updateGraphicsLinesToMatchGraphicsPoints ()
 Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
void updateSettingsAxesChecker (const DocumentModelAxesChecker &modelAxesChecker)
 Update with new axes indicator properties.
void updateSettingsColorFilter (const DocumentModelColorFilter &modelColorFilter)
 Update with new color filter properties.
void updateSettingsCoords (const DocumentModelCoords &modelCoords)
 Update with new coordinate properties.
void updateSettingsCurveList (const CurvesGraphs &curvesGraphs)
 Update with new curves.
void updateSettingsCurveStyles (const CurveStyles &modelCurveStyles)
 Update with new curve styles.
void updateSettingsDigitizeCurve (const DocumentModelDigitizeCurve &modelDigitizeCurve)
 Update with new curve digitization styles.
void updateSettingsExportFormat (const DocumentModelExportFormat &modelExport)
 Update with new export properties.
void updateSettingsGeneral (const DocumentModelGeneral &modelGeneral)
 Update with new general properties.
void updateSettingsGridDisplay (const DocumentModelGridDisplay &modelGridDisplay)
 Update with new grid display properties.
void updateSettingsGridRemoval (const DocumentModelGridRemoval &modelGridRemoval)
 Update with new grid removal properties.
void updateSettingsGuideline (const DocumentModelGuideline &modelGuideline)
 Update with new guideline properties.
void updateSettingsMainWindow (const MainWindowModel &modelMainWindow)
 Update with new main window properties.
void updateSettingsPointMatch (const DocumentModelPointMatch &modelPointMatch)
 Update with new point match properties.
void updateSettingsSegments (const DocumentModelSegments &modelSegments)
 Update with new segments properties.
void updateViewsOfSettings (const QString &activeCurve)
 Update curve-specific view of settings. Private version gets active curve name from DigitizeStateContext.
GraphicsViewview ()
 View for the QImage and QGraphicsItems, without const.
const GraphicsViewview () const
 View for the QImage and QGraphicsItems, without const.

Friends

class CreateActions
 For simplifying this class by moving initialization to other classes.
class CreateCentralWidget
class CreateCommandStackShadow
class CreateDockableWidgets
class CreateFacade
class CreateHelpWindow
class CreateIcons
class CreateLoadImage
class CreateMenus
class CreateNetwork
class CreateScene
class CreateSettingsDialogs
class CreateStateContexts
class CreateStatusBar
class CreateToolBars
class CreateTutorial
class CreateZoomMaps
class TestExport
 For unit testing.
class TestGuidelines

Detailed Description

Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document Interface.

Definition at line 94 of file MainWindow.h.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( const QString & errorReportFile,
const QString & fileCmdScriptFile,
bool isDropRegression,
bool isRegressionTest,
bool isGnuplot,
bool isReset,
bool isExportOnly,
bool isExtractImageOnly,
const QString & extractImageOnlyExtension,
const QStringList & loadStartupFiles,
const QStringList & commandLineWithoutLoadStartupFiles,
QWidget * parent = nullptr )

Single constructor.

Parameters
errorReportFileOptional error report file to be read at startup. Empty if unused. Incompatible with fileCmdScript
fileCmdScriptFileOptional file command script file to be read at startup. Empty if unused. Incompatible with errorReportFile
isDropRegressionTrue if files loaded at startup are for drag and drop testing
isRegressionTestTrue if errorReportFile or fileCmdScript is for regression testing, in which case it is executed and the program exits
isGnuplotTrue if diagnostic gnuplot files are generated for math-intense sections of the code. Used for development and debugging
isResetTrue to reset all settings that would otherwise be restored from the previous execution of Engauge
isExportOnlyTrue to export the loaded startup file and then exit
isExtractImageOnlyTrue to extract the image from the loaded startup file and then exit
extractImageOnlyExtensionFile extension for extracted image for isExtractImageOnly
loadStartupFilesZero or more Engauge document files to load at startup. A separate instance of Engauge is created for each file
commandLineWithoutLoadStartupFilesCommand line arguments without load startup files. Used for spawning additional processes
parentOptional parent widget for this widget

Definition at line 144 of file MainWindow.cpp.

155 :
156 QMainWindow(parent),
157 m_originalFileWasImported (false),
158 m_isDocumentExported (false),
159 m_engaugeFile (EMPTY_FILENAME),
160 m_currentFile (EMPTY_FILENAME),
161 m_layout (nullptr),
162 m_scene (nullptr),
163 m_view (nullptr),
164 m_loadImageFromUrl (nullptr),
165 m_cmdMediator (nullptr),
166 m_digitizeStateContext (nullptr),
167 m_transformationStateContext (nullptr),
168 m_backgroundStateContext (nullptr),
169 m_networkClient (nullptr),
170 m_isGnuplot (isGnuplot),
171 m_timerLoadStartupFiles (nullptr),
172 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
173 m_ghosts (nullptr),
174 m_timerRegressionErrorReport(nullptr),
175 m_fileCmdScript (nullptr),
176 m_isErrorReportRegressionTest (isRegressionTest),
177 m_timerRegressionFileCmdScript(nullptr),
178 m_guidelines (*this),
179 m_fittingCurve (nullptr),
180 m_isExportOnly (isExportOnly),
181 m_isExtractImageOnly (isExtractImageOnly),
182 m_extractImageOnlyExtension (extractImageOnlyExtension),
183 m_timerChecklistGuideWizard (nullptr)
184{
185 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::MainWindow"
186 << " curDir=" << QDir::currentPath().toLatin1().data();
187
188#if defined(OSX_DEBUG) || defined(OSX_RELEASE)
189 qApp->setApplicationName ("Engauge Digitizer");
190 qApp->setOrganizationDomain ("Mark Mitchell");
191#endif
192
194
195 m_startupDirectory = QDir::currentPath();
196
197 setCurrentFile ("");
198
199 CreateFacade createFacade;
200 createFacade.create (*this);
201
202 updateControls ();
203
204 settingsRead (isReset); // This changes the current directory when not regression testing
205 setCurrentFile ("");
206 setUnifiedTitleAndToolBarOnMac(true);
207
208 installEventFilter(this);
209
210 // Start regression scripting if appropriate. Regression scripts assume current directory is the original
211 // current directory, so we temporarily reset the current directory
212 QString originalPath = QDir::currentPath();
213 QDir::setCurrent (m_startupDirectory);
214 if (isExportOnly) {
215 m_loadStartupFiles = loadStartupFiles;
216 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ()); // For regression test
217 slotLoadStartupFiles ();
218 slotFileExport (); // Export one file. QProcess::startDetached will be called for each remaining file
219 exit (0);
220 } else if (isExtractImageOnly) {
221 m_loadStartupFiles = loadStartupFiles;
222 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ()); // For regression test
223 slotLoadStartupFiles ();
224 handlerFileExtractImage (); // Extract one file. QProcess::startDetached will be called for each remaining file
225 exit (0);
226 } else if (!errorReportFile.isEmpty()) {
227 loadErrorReportFile(errorReportFile);
228 if (m_isErrorReportRegressionTest) {
229 startRegressionTestErrorReport(errorReportFile);
230 }
231 } else if (!fileCmdScriptFile.isEmpty()) {
232 m_fileCmdScript = new FileCmdScript (fileCmdScriptFile);
233 startRegressionTestFileCmdScript();
234 } else if (isDropRegression) {
235 m_fileCmdScript = new FileCmdScript (""); // Hack to keep dialogs from popping up
236 startRegressionDropTest (loadStartupFiles);
237 } else {
238
239 // Save file names for later, after gui becomes available. The file names are dropped if error report file is specified
240 // since only one of the two modes is available at any time, for simplicity
241 m_loadStartupFiles = loadStartupFiles;
242 }
243 QDir::setCurrent (originalPath);
244}
log4cpp::Category * mainCat
Definition Logger.cpp:14
const QString EMPTY_FILENAME("")
void create(MainWindow &mw)
Create QAction facade.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
bool isGnuplot() const
Get method for gnuplot flag.
friend class CreateFacade
Definition MainWindow.h:103
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ ~MainWindow()

MainWindow::~MainWindow ( )

Definition at line 246 of file MainWindow.cpp.

247{
248#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
249 delete m_helpWindow;
250#endif
251 delete m_tutorialDlg;
252 delete m_cmdMediator;
253 delete m_cmdStackShadow;
254 delete m_digitizeStateContext;
255 delete m_transformationStateContext;
256 delete m_backgroundStateContext;
257 delete m_dlgSettingsAxesChecker;
258 delete m_dlgSettingsColorFilter;
259 delete m_dlgSettingsCoords;
260 delete m_dlgSettingsCurveList;
261 delete m_dlgSettingsCurveProperties;
262 delete m_dlgSettingsDigitizeCurve;
263 delete m_dlgSettingsExportFormat;
264 delete m_dlgSettingsGeneral;
265 delete m_dlgSettingsGridDisplay;
266 delete m_dlgSettingsGridRemoval;
267 delete m_dlgSettingsGuideline;
268 delete m_dlgSettingsMainWindow;
269 delete m_dlgSettingsPointMatch;
270 delete m_dlgSettingsSegments;
271 delete m_fileCmdScript;
272 m_gridLines.clear ();
273 m_guidelines.clear ();
274}

Member Function Documentation

◆ cmdFileClose()

void MainWindow::cmdFileClose ( )

Close file. This is called from a file script command.

Definition at line 334 of file MainWindow.cpp.

335{
336 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileClose";
337
338 setWindowModified (false); // Prevent popup query asking if changes should be saved
339 slotFileClose();
340}

◆ cmdFileExport()

void MainWindow::cmdFileExport ( const QString & fileName)

Export file. This is called from a file script command.

Definition at line 342 of file MainWindow.cpp.

343{
344 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileExport";
345
346 ExportToFile exportStrategy;
347 fileExport(fileName,
348 exportStrategy);
349}

◆ cmdFileImport()

void MainWindow::cmdFileImport ( const QString & fileName)

Import file. This is called from a file script command.

Definition at line 351 of file MainWindow.cpp.

352{
353 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileImport";
354
355 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
356 fileImport (fileName,
357 IMPORT_TYPE_SIMPLE);
358}

◆ cmdFileOpen()

void MainWindow::cmdFileOpen ( const QString & fileName)

Open file. This is called from a file script command.

Definition at line 360 of file MainWindow.cpp.

361{
362 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileOpen";
363
364 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
365 loadDocumentFile(fileName);
366}

◆ cmdMediator()

CmdMediator * MainWindow::cmdMediator ( )

Accessor for commands to process the Document.

Definition at line 368 of file MainWindow.cpp.

369{
370 // We do not check m_cmdMediator with ENGAUGE_CHECK_PTR since calling code is expected to deal with null pointer at startup
371 return m_cmdMediator;
372}

◆ digitizeState()

DigitizeState MainWindow::digitizeState ( ) const

Get DigitizeState. This should only be used to populate arguments in CmdAbstract constructor!

Definition at line 390 of file MainWindow.cpp.

391{
392 return m_digitizeStateContext->digitizeState ();
393}

◆ eventFilter()

bool MainWindow::eventFilter ( QObject * target,
QEvent * event )
virtual

Catch secret keypresses.

Definition at line 395 of file MainWindow.cpp.

396{
397 if (event->type () == QEvent::KeyPress) {
398
399 QKeyEvent *eventKeyPress = static_cast<QKeyEvent *> (event);
400
401 // Special shortcuts. All of these are probably only useful for debugging and/or regression testing
402 if ((eventKeyPress->key() == Qt::Key_E) &&
403 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
404 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
405
406 saveErrorReportFileAndExit ("Shift+Control+E",
407 __FILE__,
408 __LINE__,
409 "userTriggered");
410
411 }
412 }
413
414 return QObject::eventFilter (target, event);
415}
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context)
Save error report and exit.

◆ guidelineAddXT()

void MainWindow::guidelineAddXT ( const QString & identifier,
double xT )

Add a X/T Guideline.

Definition at line 867 of file MainWindow.cpp.

869{
870 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::guidelineAddXT";
871
872 if (m_cmdMediator->document().modelCoords().coordsType() == COORDS_TYPE_CARTESIAN) {
873 m_guidelines.createGuidelineX (identifier,
874 xT);
875 } else {
876 m_guidelines.createGuidelineT (identifier,
877 xT);
878 }
879
880 DocumentModelGuideline modelGuidelineOld = cmdMediator()->document().modelGuideline();
881 DocumentModelGuideline modelGuidelineNew = m_guidelines.updateValues (modelGuidelineOld);
882 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
883}
@ COORDS_TYPE_CARTESIAN
Definition CoordsType.h:13
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
DocumentModelGuideline modelGuideline() const
Get method for DocumentModelGuideline.
Definition Document.cpp:756
CmdMediator * cmdMediator()
Accessor for commands to process the Document.

◆ guidelineAddYR()

void MainWindow::guidelineAddYR ( const QString & identifier,
double yR )

Add a Y/R Guideline.

Definition at line 894 of file MainWindow.cpp.

896{
897 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::guidelineAddYR";
898
899 if (m_cmdMediator->document().modelCoords().coordsType() == COORDS_TYPE_CARTESIAN) {
900 m_guidelines.createGuidelineY (identifier,
901 yR);
902 } else {
903 m_guidelines.createGuidelineR (identifier,
904 yR);
905 }
906
907 DocumentModelGuideline modelGuidelineOld = cmdMediator()->document().modelGuideline();
908 DocumentModelGuideline modelGuidelineNew = m_guidelines.updateValues (modelGuidelineOld);
909 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
910}

◆ guidelineMoveXT()

void MainWindow::guidelineMoveXT ( const QString & identifier,
double xTAfter )

Move a X/T Guideline.

Definition at line 921 of file MainWindow.cpp.

923{
924 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::guidelineMoveXT";
925
926 m_guidelines.moveGuidelineXT (identifier,
927 valueAfter);
928
929 DocumentModelGuideline modelGuidelineOld = cmdMediator()->document().modelGuideline();
930 DocumentModelGuideline modelGuidelineNew = m_guidelines.updateValues (modelGuidelineOld);
931 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
932}

◆ guidelineMoveYR()

void MainWindow::guidelineMoveYR ( const QString & identifier,
double yRAfter )

Move a Y/R Guideline.

Definition at line 934 of file MainWindow.cpp.

936{
937 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::guidelineMoveYR";
938
939 m_guidelines.moveGuidelineYR (identifier,
940 valueAfter);
941
942 DocumentModelGuideline modelGuidelineOld = cmdMediator()->document().modelGuideline();
943 DocumentModelGuideline modelGuidelineNew = m_guidelines.updateValues (modelGuidelineOld);
944 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);;
945}

◆ guidelineRemove()

void MainWindow::guidelineRemove ( const QString & identifier)

Remove a X/T or Y/R Guideline.

Definition at line 947 of file MainWindow.cpp.

948{
949 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::guidelineRemove";
950
951 m_guidelines.removeGuideline (identifier);
952
953 DocumentModelGuideline modelGuidelineOld = cmdMediator()->document().modelGuideline();
954 DocumentModelGuideline modelGuidelineNew = m_guidelines.updateValues (modelGuidelineOld);
955 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
956}

◆ guidelinesAreVisible()

bool MainWindow::guidelinesAreVisible ( ) const

True/false if guidelines are visible. Selectability is handled elsewhere.

Definition at line 963 of file MainWindow.cpp.

964{
965 return transformIsDefined();
966}
bool transformIsDefined() const
Return true if all three axis points have been defined.

◆ handleGuidelinesActiveChange()

void MainWindow::handleGuidelinesActiveChange ( bool active)

Handle Guidelines active status toggle.

Definition at line 968 of file MainWindow.cpp.

969{
970 m_guidelines.handleActiveChange (active);
971}

◆ imageFiltered()

QImage MainWindow::imageFiltered ( ) const

Background image that has been filtered for the current curve. This asserts if a curve-specific image is not being shown.

Definition at line 993 of file MainWindow.cpp.

994{
995 return m_backgroundStateContext->imageForCurveState();
996}

◆ isGnuplot()

bool MainWindow::isGnuplot ( ) const

Get method for gnuplot flag.

Definition at line 998 of file MainWindow.cpp.

999{
1000 return m_isGnuplot;
1001}

◆ modelMainWindow()

MainWindowModel MainWindow::modelMainWindow ( ) const

Get method for main window model.

Definition at line 1368 of file MainWindow.cpp.

1369{
1370 return m_modelMainWindow;
1371}

◆ modeMap()

bool MainWindow::modeMap ( ) const

True if document scale is set using a scale bar, otherwise using axis points.

Definition at line 1357 of file MainWindow.cpp.

1358{
1359 bool success = false;
1360
1361 if (m_cmdMediator != nullptr) {
1362 success = (m_cmdMediator->document().documentAxesPointsRequired() == DOCUMENT_AXES_POINTS_REQUIRED_2);
1363 }
1364
1365 return success;
1366}
@ DOCUMENT_AXES_POINTS_REQUIRED_2

◆ resizeEvent()

void MainWindow::resizeEvent ( QResizeEvent * event)

Intercept resize event so graphics scene can be appropriately resized when in Fill mode.

Definition at line 1391 of file MainWindow.cpp.

1392{
1393 LOG4CPP_DEBUG_S ((*mainCat)) << "MainWindow::resizeEvent";
1394
1395 if (m_actionZoomFill->isChecked ()) {
1396 slotViewZoomFactor (ZOOM_FILL);
1397 }
1398
1399 QMainWindow::resizeEvent(event);
1400}
@ ZOOM_FILL
Definition ZoomFactor.h:37
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ saveErrorReportFileAndExit()

void MainWindow::saveErrorReportFileAndExit ( const char * comment,
const char * file,
int line,
const char * context )

Save error report and exit.

Definition at line 1442 of file MainWindow.cpp.

1446{
1447 // Skip if currently performing a regression test - in which case the preferred behavior is to let the current test fail and
1448 // continue on to execute the remaining tests
1449 if ((m_cmdMediator != nullptr) && !m_isErrorReportRegressionTest) {
1450
1451 QString report = saveErrorReportFileAndExitXml (context,
1452 file,
1453 line,
1454 comment);
1455
1456 DlgErrorReportLocal dlg (report);
1457 if (dlg.exec() == QDialog::Accepted) {
1458 QFileDialog dlg;
1459
1460 QString fileName = dlg.getSaveFileName (this,
1461 tr("Save"),
1462 "error_report.xml");
1463 if (!fileName.isEmpty ()) {
1464 // Save the error report
1465 QFile fileError (fileName);
1466 QTextStream str (&fileError);
1467 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1468 str << report;
1469 fileError.close ();
1470 }
1471 }
1472
1473 exit (-1);
1474 }
1475}

◆ scene()

GraphicsScene & MainWindow::scene ( )

Scene container for the QImage and QGraphicsItems.

Definition at line 1597 of file MainWindow.cpp.

1598{
1599 ENGAUGE_CHECK_PTR (m_scene);
1600 return *m_scene;
1601}
#define ENGAUGE_CHECK_PTR(ptr)
Drop in replacement for Q_CHECK_PTR.

◆ selectedGraphCurve()

QString MainWindow::selectedGraphCurve ( ) const

Curve name that is currently selected in m_cmbCurve.

Definition at line 1617 of file MainWindow.cpp.

1618{
1619 return m_cmbCurve->currentText ();
1620}

◆ selectOriginal()

BackgroundImage MainWindow::selectOriginal ( BackgroundImage backgroundImage)

Make original background visible, for DigitizeStateColorPicker.

This returns the previous background state for restoring when state finishes

Definition at line 1603 of file MainWindow.cpp.

1604{
1605 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::selectBackgroundOriginal";
1606
1607 BackgroundImage previousBackground = static_cast<BackgroundImage> (m_cmbBackground->currentData().toInt());
1608
1609 int index = m_cmbBackground->findData (backgroundImage);
1610 ENGAUGE_ASSERT (index >= 0);
1611
1612 m_cmbBackground->setCurrentIndex(index);
1613
1614 return previousBackground;
1615}
BackgroundImage
Background selection.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.

◆ sendGong()

void MainWindow::sendGong ( )

Send signal to unit test framework indicating all commands have finished executing.

Definition at line 1622 of file MainWindow.cpp.

1623{
1624 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::sendGong";
1625
1626 emit signalGong ();
1627}
void signalGong()
Send wakeup signal to unit test framework when all other commands have finished executing.

◆ showEvent()

void MainWindow::showEvent ( QShowEvent * event)
virtual

Processing performed after gui becomes available.

Definition at line 2054 of file MainWindow.cpp.

2055{
2056 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::showEvent"
2057 << " files=" << m_loadStartupFiles.join (",").toLatin1().data();
2058
2059 QMainWindow::showEvent (event);
2060
2061 if (m_loadStartupFiles.count() > 0) {
2062
2063 delete m_timerLoadStartupFiles;
2064 m_timerLoadStartupFiles = new QTimer;
2065 m_timerLoadStartupFiles->setSingleShot (true);
2066 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()), this, SLOT (slotLoadStartupFiles ()));
2067 m_timerLoadStartupFiles->start (0); // Zero delay still waits until execution finishes and gui is available
2068
2069 }
2070}

◆ showTemporaryMessage()

void MainWindow::showTemporaryMessage ( const QString & temporaryMessage)

Show temporary message in status bar.

Definition at line 2072 of file MainWindow.cpp.

2073{
2074 m_statusBar->showTemporaryMessage (temporaryMessage);
2075}

◆ signalDropRegression

void MainWindow::signalDropRegression ( QString )
signal

Send drag and drop regression test url.

◆ signalGong

void MainWindow::signalGong ( )
signal

Send wakeup signal to unit test framework when all other commands have finished executing.

◆ signalZoom

void MainWindow::signalZoom ( int )
signal

Send zoom selection, picked from menu or keystroke, to StatusBar.

◆ transformation()

Transformation MainWindow::transformation ( ) const

Return read-only copy of transformation.

Definition at line 3484 of file MainWindow.cpp.

3485{
3486 return m_transformation;
3487}

◆ transformIsDefined()

bool MainWindow::transformIsDefined ( ) const

Return true if all three axis points have been defined.

Definition at line 3489 of file MainWindow.cpp.

3490{
3491 return m_transformation.transformIsDefined();
3492}

◆ updateAfterCommand()

void MainWindow::updateAfterCommand ( )

See GraphicsScene::updateAfterCommand.

Definition at line 3494 of file MainWindow.cpp.

3495{
3496 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateAfterCommand";
3497
3498 ENGAUGE_CHECK_PTR (m_cmdMediator);
3499
3500 // Update transformation stuff, including the graph coordinates of every point in the Document, so coordinates in
3501 // status bar are up to date. Point coordinates in Document are also updated
3502 updateAfterCommandStatusBarCoords ();
3503
3504 updateHighlightOpacity ();
3505
3506 // Update graphics. Effectively, these steps do very little (just needed for highlight opacity)
3507 m_digitizeStateContext->updateAfterPointAddition (); // May or may not be needed due to point addition
3508
3509 updateControls ();
3510 updateChecklistGuide ();
3511 updateFittingWindow ();
3512 updateGeometryWindow();
3513
3514 // Final actions at the end of a redo/undo are:
3515 // 1) checkpoint the Document and GraphicsScene to log files so proper state can be verified
3516 // 2) run sanity check on state
3517 writeCheckpointToLogFile ();
3518 DocumentScrub docScrub;
3519 docScrub.check (*this,
3520 m_cmdMediator->document ());
3521
3522 // Since focus may have drifted over to Geometry Window or some other control we se focus on the GraphicsView
3523 // so the cursor is appropriate for the current state (otherwise it often ends up as default arrow)
3524 m_view->setFocus ();
3525}
void check(MainWindow &mainWindow, const Document &document) const
Check document state.

◆ updateAfterMouseRelease()

void MainWindow::updateAfterMouseRelease ( )

Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/release.

Definition at line 3574 of file MainWindow.cpp.

3575{
3576 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateAfterMouseRelease";
3577
3578 updateControls ();
3579}

◆ updateCoordSystem()

void MainWindow::updateCoordSystem ( CoordSystemIndex coordSystemIndex)

Select a different CoordSystem.

Definition at line 3675 of file MainWindow.cpp.

3676{
3677 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateCoordSystem";
3678
3679 // If this is from undo/redo playback then combobox must be updated
3680 if ((CoordSystemIndex) m_cmbCoordSystem->currentIndex() != coordSystemIndex) {
3681 m_cmbCoordSystem->setCurrentIndex (coordSystemIndex);
3682 }
3683
3684 // Set current curve in the Document and in the MainWindow combobox together so they are in sync. Setting
3685 // the selected curve prevents a crash in updateTransformationAndItsDependencies
3686 m_cmdMediator->document().setCoordSystemIndex (coordSystemIndex);
3687 loadCurveListFromCmdMediator ();
3688
3689 updateTransformationAndItsDependencies(); // Transformation state may have changed
3690 updateSettingsAxesChecker(m_cmdMediator->document().modelAxesChecker()); // Axes checker dependes on transformation state
3691 loadGuidelinesFromCmdMediator();
3692
3693 // Nice trick for showing that a new coordinate system is in effect is to show the axes checker
3694 m_transformationStateContext->updateAxesChecker (*m_cmdMediator,
3695 m_transformation);
3696
3698}
unsigned int CoordSystemIndex
Zero-based index for identifying CoordSystem instantiations.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.

◆ updateDigitizeStateIfSoftwareTriggered()

void MainWindow::updateDigitizeStateIfSoftwareTriggered ( DigitizeState digitizeState)

After software-triggered state transition, this method manually triggers the action as if user had clicked on digitize button.

Definition at line 3700 of file MainWindow.cpp.

3701{
3702 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateDigitizeStateIfSoftwareTriggered";
3703
3704 switch (digitizeState) {
3706 m_actionDigitizeAxis->setChecked(true);
3707 slotDigitizeAxis(); // Call the slot that the setChecked call fails to trigger
3708 break;
3709
3711 m_actionDigitizeColorPicker->setChecked(true);
3712 slotDigitizeColorPicker(); // Call the slot that the setChecked call fails to trigger
3713 break;
3714
3716 m_actionDigitizeCurve->setChecked(true);
3717 slotDigitizeCurve(); // Call the slot that the setChecked call fails to trigger
3718 break;
3719
3721 break;
3722
3724 m_actionDigitizePointMatch->setChecked(true);
3725 slotDigitizePointMatch(); // Call the slot that the setChecked call fails to trigger
3726 break;
3727
3729 m_actionDigitizeScale->setChecked(true);
3730 slotDigitizeScale(); // Call the slot that the setChecked call fails to trigger
3731 break;
3732
3734 m_actionDigitizeSegment->setChecked(true);
3735 slotDigitizeSegment(); // Call the slot that the setChecked call fails to trigger
3736 break;
3737
3739 m_actionDigitizeSelect->setChecked(true);
3740 slotDigitizeSelect(); // Call the slot that the setChecked call fails to trigger
3741 break;
3742
3743 default:
3744 LOG4CPP_ERROR_S ((*mainCat)) << "MainWindow::updateDigitizeStateIfSoftwareTriggered";
3745 break;
3746 }
3747}
@ DIGITIZE_STATE_POINT_MATCH
@ DIGITIZE_STATE_SELECT
@ DIGITIZE_STATE_COLOR_PICKER
@ DIGITIZE_STATE_CURVE
@ DIGITIZE_STATE_SCALE
@ DIGITIZE_STATE_SEGMENT
@ DIGITIZE_STATE_AXIS
@ DIGITIZE_STATE_EMPTY
DigitizeState digitizeState() const
Get DigitizeState. This should only be used to populate arguments in CmdAbstract constructor!
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

◆ updateGraphicsLinesToMatchGraphicsPoints()

void MainWindow::updateGraphicsLinesToMatchGraphicsPoints ( )

Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.

The points in the Document may (and probably are) out of date with respect to the graphics points

Definition at line 3779 of file MainWindow.cpp.

3780{
3781 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
3782
3783 m_scene->updateGraphicsLinesToMatchGraphicsPoints(m_cmdMediator->document().modelCurveStyles(),
3784 m_transformation);
3785}

◆ updateSettingsAxesChecker()

void MainWindow::updateSettingsAxesChecker ( const DocumentModelAxesChecker & modelAxesChecker)

Update with new axes indicator properties.

Definition at line 3864 of file MainWindow.cpp.

3865{
3866 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsAxesChecker";
3867
3868 m_cmdMediator->document().setModelAxesChecker(modelAxesChecker);
3869 if (m_transformation.transformIsDefined()) {
3870 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3872 *m_cmdMediator,
3873 m_transformation,
3874 m_cmbCurve->currentText());
3875 } else {
3876 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3878 *m_cmdMediator,
3879 m_transformation,
3880 m_cmbCurve->currentText());
3881 }
3882}

◆ updateSettingsColorFilter()

void MainWindow::updateSettingsColorFilter ( const DocumentModelColorFilter & modelColorFilter)

Update with new color filter properties.

Definition at line 3884 of file MainWindow.cpp.

3885{
3886 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsColorFilter";
3887
3888 m_cmdMediator->document().setModelColorFilter(modelColorFilter);
3889 m_backgroundStateContext->updateColorFilter (m_isGnuplot,
3890 m_transformation,
3891 m_cmdMediator->document().modelGridRemoval(),
3892 modelColorFilter,
3893 m_cmbCurve->currentText());
3894 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
3896}
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...

◆ updateSettingsCoords()

void MainWindow::updateSettingsCoords ( const DocumentModelCoords & modelCoords)

Update with new coordinate properties.

Definition at line 3898 of file MainWindow.cpp.

3899{
3900 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCoords";
3901
3902 m_cmdMediator->document().setModelCoords(modelCoords);
3903}

◆ updateSettingsCurveList()

void MainWindow::updateSettingsCurveList ( const CurvesGraphs & curvesGraphs)

Update with new curves.

Definition at line 3905 of file MainWindow.cpp.

3906{
3907 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCurveList";
3908
3909 m_cmdMediator->document().setCurvesGraphs (curvesGraphs);
3910 loadCurveListFromCmdMediator();
3912}

◆ updateSettingsCurveStyles()

void MainWindow::updateSettingsCurveStyles ( const CurveStyles & modelCurveStyles)

Update with new curve styles.

Definition at line 3914 of file MainWindow.cpp.

3915{
3916 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCurveStyles";
3917
3918 m_scene->updateCurveStyles(modelCurveStyles);
3919 m_cmdMediator->document().setModelCurveStyles(modelCurveStyles);
3921}

◆ updateSettingsDigitizeCurve()

void MainWindow::updateSettingsDigitizeCurve ( const DocumentModelDigitizeCurve & modelDigitizeCurve)

Update with new curve digitization styles.

Definition at line 3923 of file MainWindow.cpp.

3924{
3925 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsDigitizeCurve";
3926
3927 m_cmdMediator->document().setModelDigitizeCurve(modelDigitizeCurve);
3928 m_digitizeStateContext->updateModelDigitizeCurve (m_cmdMediator,
3929 modelDigitizeCurve);
3930}

◆ updateSettingsExportFormat()

void MainWindow::updateSettingsExportFormat ( const DocumentModelExportFormat & modelExport)

Update with new export properties.

Definition at line 3932 of file MainWindow.cpp.

3933{
3934 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsExportFormat";
3935
3936 m_cmdMediator->document().setModelExport (modelExport);
3937}

◆ updateSettingsGeneral()

void MainWindow::updateSettingsGeneral ( const DocumentModelGeneral & modelGeneral)

Update with new general properties.

Definition at line 3939 of file MainWindow.cpp.

3940{
3941 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGeneral";
3942
3943 m_cmdMediator->document().setModelGeneral(modelGeneral);
3944}

◆ updateSettingsGridDisplay()

void MainWindow::updateSettingsGridDisplay ( const DocumentModelGridDisplay & modelGridDisplay)

Update with new grid display properties.

Definition at line 3946 of file MainWindow.cpp.

3947{
3948 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGridDisplay";
3949
3950 m_cmdMediator->document().setModelGridDisplay(modelGridDisplay);
3951 updateGridLines ();
3952}

◆ updateSettingsGridRemoval()

void MainWindow::updateSettingsGridRemoval ( const DocumentModelGridRemoval & modelGridRemoval)

Update with new grid removal properties.

Definition at line 3954 of file MainWindow.cpp.

3955{
3956 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGridRemoval";
3957
3958 m_cmdMediator->document().setModelGridRemoval(modelGridRemoval);
3959}

◆ updateSettingsGuideline()

void MainWindow::updateSettingsGuideline ( const DocumentModelGuideline & modelGuideline)

Update with new guideline properties.

Definition at line 3961 of file MainWindow.cpp.

3962{
3963 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGuideline";
3964
3965 m_cmdMediator->document().setModelGuideline (modelGuideline);
3966 loadGuidelinesFromCmdMediator();
3967}

◆ updateSettingsMainWindow()

void MainWindow::updateSettingsMainWindow ( const MainWindowModel & modelMainWindow)

Update with new main window properties.

Definition at line 3998 of file MainWindow.cpp.

3999{
4000 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsMainWindow";
4001
4002 m_modelMainWindow = modelMainWindow;
4004}
MainWindowModel modelMainWindow() const
Get method for main window model.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.

◆ updateSettingsPointMatch()

void MainWindow::updateSettingsPointMatch ( const DocumentModelPointMatch & modelPointMatch)

Update with new point match properties.

Definition at line 4006 of file MainWindow.cpp.

4007{
4008 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsPointMatch";
4009
4010 m_cmdMediator->document().setModelPointMatch(modelPointMatch);
4011}

◆ updateSettingsSegments()

void MainWindow::updateSettingsSegments ( const DocumentModelSegments & modelSegments)

Update with new segments properties.

Definition at line 4013 of file MainWindow.cpp.

4014{
4015 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsSegments";
4016
4017 m_digitizeStateContext->updateModelSegments(modelSegments);
4018 m_cmdMediator->document().setModelSegments(modelSegments);
4019 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
4020}

◆ updateViewsOfSettings()

void MainWindow::updateViewsOfSettings ( const QString & activeCurve)

Update curve-specific view of settings. Private version gets active curve name from DigitizeStateContext.

Definition at line 4091 of file MainWindow.cpp.

4092{
4093 if (activeCurve.isEmpty ()) {
4094
4095 m_viewPointStyle->unsetPointStyle ();
4096 m_viewSegmentFilter->unsetColorFilterSettings ();
4097
4098
4099 } else {
4100
4101 PointStyle pointStyle = m_cmdMediator->document().modelCurveStyles().curveStyle(activeCurve).pointStyle();
4102 m_viewPointStyle->setPointStyle (pointStyle);
4103
4104 ColorFilterSettings colorFilterSettings = m_cmdMediator->document().modelColorFilter().colorFilterSettings(activeCurve);
4105 m_viewSegmentFilter->setColorFilterSettings (colorFilterSettings,
4106 m_cmdMediator->pixmap ());
4107
4108 }
4109}

◆ view() [1/2]

GraphicsView & MainWindow::view ( )

View for the QImage and QGraphicsItems, without const.

Definition at line 4150 of file MainWindow.cpp.

4151{
4152 ENGAUGE_CHECK_PTR (m_view);
4153 return *m_view;
4154}

◆ view() [2/2]

const GraphicsView & MainWindow::view ( ) const

View for the QImage and QGraphicsItems, without const.

Definition at line 4156 of file MainWindow.cpp.

4157{
4158 ENGAUGE_CHECK_PTR (m_view);
4159 return *m_view;
4160}

◆ CreateActions

friend class CreateActions
friend

For simplifying this class by moving initialization to other classes.

Definition at line 99 of file MainWindow.h.

◆ CreateCentralWidget

friend class CreateCentralWidget
friend

Definition at line 100 of file MainWindow.h.

◆ CreateCommandStackShadow

friend class CreateCommandStackShadow
friend

Definition at line 101 of file MainWindow.h.

◆ CreateDockableWidgets

friend class CreateDockableWidgets
friend

Definition at line 102 of file MainWindow.h.

◆ CreateFacade

friend class CreateFacade
friend

Definition at line 103 of file MainWindow.h.

◆ CreateHelpWindow

friend class CreateHelpWindow
friend

Definition at line 104 of file MainWindow.h.

◆ CreateIcons

friend class CreateIcons
friend

Definition at line 105 of file MainWindow.h.

◆ CreateLoadImage

friend class CreateLoadImage
friend

Definition at line 106 of file MainWindow.h.

◆ CreateMenus

friend class CreateMenus
friend

Definition at line 107 of file MainWindow.h.

◆ CreateNetwork

friend class CreateNetwork
friend

Definition at line 108 of file MainWindow.h.

◆ CreateScene

friend class CreateScene
friend

Definition at line 109 of file MainWindow.h.

◆ CreateSettingsDialogs

friend class CreateSettingsDialogs
friend

Definition at line 110 of file MainWindow.h.

◆ CreateStateContexts

friend class CreateStateContexts
friend

Definition at line 111 of file MainWindow.h.

◆ CreateStatusBar

friend class CreateStatusBar
friend

Definition at line 112 of file MainWindow.h.

◆ CreateToolBars

friend class CreateToolBars
friend

Definition at line 113 of file MainWindow.h.

◆ CreateTutorial

friend class CreateTutorial
friend

Definition at line 114 of file MainWindow.h.

◆ CreateZoomMaps

friend class CreateZoomMaps
friend

Definition at line 115 of file MainWindow.h.

◆ TestExport

friend class TestExport
friend

For unit testing.

Definition at line 118 of file MainWindow.h.

◆ TestGuidelines

friend class TestGuidelines
friend

Definition at line 119 of file MainWindow.h.


The documentation for this class was generated from the following files: