31 #include <itksys/SystemTools.hxx>
34 #include <qfiledialog.h>
35 #include <qmessagebox.h>
40 : QWidget(parent, f), m_Recorder(NULL), m_RecordingActivated(false)
66 m_Controls =
new Ui::QmitkIGTLoggerWidgetControls;
97 QMessageBox::warning(NULL,
"Warning", QString(
"Please start tracking before recording!"));
102 QMessageBox::warning(NULL,
"Warning", QString(
"Please specify filename!"));
121 catch (std::exception& e)
123 QMessageBox::warning(NULL,
"IGT-Tracking Logger: Error", QString(
"Error while recording tracking data: %1").arg(e.what()));
126 m_Controls->m_pbStartRecording->setText(
"Stop recording");
127 m_Controls->m_leRecordingValue->setEnabled(
false);
128 m_Controls->m_cbRecordingType->setEnabled(
false);
132 if(
m_Controls->m_cbRecordingType->currentIndex()==0)
134 bool success =
false;
135 QString str_ms =
m_Controls->m_leRecordingValue->text();
136 int int_ms = str_ms.toInt(&success);
150 m_Controls->m_pbStartRecording->setChecked(
false);
160 m_Controls->m_pbStartRecording->setText(
"Start recording");
161 m_Controls->m_pbStartRecording->setChecked(
false);
162 m_Controls->m_leRecordingValue->setEnabled(
true);
163 m_Controls->m_cbRecordingType->setEnabled(
true);
171 catch(
const std::exception &e)
174 QMessageBox::warning(NULL,
"IGT-Tracking Logger: Error", QString(
"Error while writing tracking data: %1").arg(e.what()));
175 MITK_WARN <<
"File could not be written.";
183 static unsigned int sampleCounter = 0;
184 unsigned int int_samples =
m_Samples.toInt();
185 if(sampleCounter >= int_samples)
193 if (
m_Controls->m_cbRecordingType->currentIndex()==1)
201 m_CmpFilename = QFileDialog::getSaveFileName( QApplication::activeWindow()
202 ,
"Save tracking data",
"IGT_Tracking_Data.xml",
"XML files (*.xml)" );
218 QMessageBox::warning(NULL,
"Warning", QString(
"Please enter valid path! Using previous path again."));
233 if (
m_Controls->m_cbRecordingType->currentIndex()==0)
242 bool success =
false;
246 QMessageBox::warning(NULL,
"Warning", QString(
"Please enter a number!"));
251 else if(
m_Controls->m_cbRecordingType->currentIndex()==1)
260 bool success =
false;
264 QMessageBox::warning(NULL,
"Warning", QString(
"Please enter a number!"));
269 else if (
m_Controls->m_cbRecordingType->currentIndex()==2)
272 QString infinite(
"infinite");
273 m_Controls->m_leRecordingValue->setText(infinite);
281 m_Controls->m_leRecordingValue->setText(
"2000");
282 m_Controls->m_cbRecordingType->setCurrentIndex(0);
289 std::string tmpDir = itksys::SystemTools::GetCurrentWorkingDirectory();
290 QString dir = QString(tmpDir.c_str());
291 QString
filename =
"IGT_Tracking_Data.xml";
296 QMessageBox::warning(NULL,
"Warning", QString(
"Could not load current working directory"));
299 if(dir.endsWith(
"/")||dir.endsWith(
"\\"))
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
static bool SaveBaseData(mitk::BaseData *data, const std::string &path)
SaveBaseData Convenience method to save arbitrary baseData.
void DisplayText(const char *t)
Send a string to the applications StatusBar.
static const std::string filename
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!