27 #include <itksys/SystemTools.hxx> 30 #include <qfiledialog.h> 31 #include <qmessagebox.h> 36 : QWidget(parent, f), m_Recorder(nullptr), m_RecordingActivated(false)
62 m_Controls =
new Ui::QmitkIGTLoggerWidgetControls;
93 QMessageBox::warning(
nullptr,
"Warning", QString(
"Please start tracking before recording!"));
98 QMessageBox::warning(
nullptr,
"Warning", QString(
"Please specify filename!"));
117 catch (std::exception& e)
119 QMessageBox::warning(
nullptr,
"IGT-Tracking Logger: Error", QString(
"Error while recording tracking data: %1").arg(e.what()));
122 m_Controls->m_pbStartRecording->setText(
"Stop recording");
123 m_Controls->m_leRecordingValue->setEnabled(
false);
124 m_Controls->m_cbRecordingType->setEnabled(
false);
128 if(
m_Controls->m_cbRecordingType->currentIndex()==0)
130 bool success =
false;
131 QString str_ms =
m_Controls->m_leRecordingValue->text();
132 int int_ms = str_ms.toInt(&success);
146 m_Controls->m_pbStartRecording->setChecked(
false);
156 m_Controls->m_pbStartRecording->setText(
"Start recording");
157 m_Controls->m_pbStartRecording->setChecked(
false);
158 m_Controls->m_leRecordingValue->setEnabled(
true);
159 m_Controls->m_cbRecordingType->setEnabled(
true);
167 catch(
const std::exception &e)
170 QMessageBox::warning(
nullptr,
"IGT-Tracking Logger: Error", QString(
"Error while writing tracking data: %1").arg(e.what()));
171 MITK_WARN <<
"File could not be written.";
179 static unsigned int sampleCounter = 0;
180 unsigned int int_samples =
m_Samples.toInt();
181 if(sampleCounter >= int_samples)
189 if (
m_Controls->m_cbRecordingType->currentIndex()==1)
197 m_CmpFilename = QFileDialog::getSaveFileName( QApplication::activeWindow()
198 ,
"Save tracking data",
"IGT_Tracking_Data.xml",
"XML files (*.xml)" );
214 QMessageBox::warning(
nullptr,
"Warning", QString(
"Please enter valid path! Using previous path again."));
229 if (
m_Controls->m_cbRecordingType->currentIndex()==0)
238 bool success =
false;
242 QMessageBox::warning(
nullptr,
"Warning", QString(
"Please enter a number!"));
247 else if(
m_Controls->m_cbRecordingType->currentIndex()==1)
256 bool success =
false;
260 QMessageBox::warning(
nullptr,
"Warning", QString(
"Please enter a number!"));
265 else if (
m_Controls->m_cbRecordingType->currentIndex()==2)
268 QString infinite(
"infinite");
269 m_Controls->m_leRecordingValue->setText(infinite);
277 m_Controls->m_leRecordingValue->setText(
"2000");
278 m_Controls->m_cbRecordingType->setCurrentIndex(0);
285 std::string tmpDir = itksys::SystemTools::GetCurrentWorkingDirectory();
286 QString dir = QString(tmpDir.c_str());
287 QString filename =
"IGT_Tracking_Data.xml";
292 QMessageBox::warning(
nullptr,
"Warning", QString(
"Could not load current working directory"));
295 if(dir.endsWith(
"/")||dir.endsWith(
"\\"))
Data management class that handles 'was created by' relations.
void DisplayText(const char *t)
Send a string to the applications StatusBar.
static StatusBar * GetInstance()
static method to get the GUI dependent StatusBar-instance so the methods DisplayText, etc. can be called No reference counting, cause of decentral static use!
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.