11#include " ControllerDataExporter.h"
2+ #include " Controller/ControllerCommands.h"
3+ #include " Controller/ControllerTrackedComponentCore.h"
24#include " Model/DataExporters/DataExporterCSV.h"
35#include " Model/DataExporters/DataExporterSerialize.h"
46#include " Model/DataExporters/DataExporterJson.h"
@@ -22,6 +24,18 @@ void ControllerDataExporter::cleanup() {
2224}
2325
2426void ControllerDataExporter::connectControllerToController () {
27+ // connect to controller commands
28+ IController* ictrcmd = m_BioTrackerContext->requestController (ENUMS ::CONTROLLERTYPE ::COMMANDS );
29+ ControllerCommands *ctrcmd = static_cast <ControllerCommands*>(ictrcmd);
30+
31+ QObject::connect (this , &ControllerDataExporter::emitResetUndoStack, ctrcmd, &ControllerCommands::receiveClear, Qt::DirectConnection);
32+
33+ // connect to view controller
34+ IController* ctr = m_BioTrackerContext->requestController (ENUMS ::CONTROLLERTYPE ::TRACKEDCOMPONENTCORE
35+ );
36+ ControllerTrackedComponentCore *tccController = dynamic_cast <ControllerTrackedComponentCore*>(ctr);
37+
38+ QObject::connect (this , &ControllerDataExporter::emitViewUpdate, tccController, &ControllerTrackedComponentCore::receiveUpdateView, Qt::DirectConnection);
2539}
2640
2741void ControllerDataExporter::createModel () {
@@ -89,14 +103,18 @@ void ControllerDataExporter::receiveTrackingDone(uint frame) {
89103
90104void ControllerDataExporter::receiveFinalizeExperiment () {
91105 if (getModel ()) {
106+ emitResetUndoStack ();
92107 dynamic_cast <IModelDataExporter*>(getModel ())->finalizeAndReInit ();
108+ emitViewUpdate ();
93109 }
94110}
95111
96112void ControllerDataExporter::receiveReset () {
97113 if (getModel ()) {
114+ emitResetUndoStack ();
98115 dynamic_cast <IModelDataExporter*>(getModel ())->finalizeAndReInit ();
99116 dynamic_cast <IModelDataExporter*>(getModel ())->close ();
117+ emitViewUpdate ();
100118 }
101119
102120 createModel ();
0 commit comments