10 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on init";
15 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on connect";
21 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on disconnect";
26 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on exit";
37 if (environment == NULL)
41 QFileDialog dialog(0);
42 dialog.setFileMode(QFileDialog::ExistingFiles);
43 dialog.setAcceptMode(QFileDialog::AcceptOpen);
44 dialog.setNameFilter(tr(
"XML (*.xml)"));
45 QStringList fileNames;
48 fileNames = dialog.selectedFiles();
50 if (fileNames.length() > 1)
52 QMessageBox* toManyFilesSelected =
new QMessageBox;
53 toManyFilesSelected->setWindowTitle(QString::fromStdString(
"Information"));
54 toManyFilesSelected->setText(QString::fromStdString(
"To many files selected.\nAs default the first file was taken."));
55 toManyFilesSelected->exec();
57 if (!fileNames.empty())
61 MMMImporterPtr mmmImporter = std::make_shared<MMMImporter>(environment);
62 std::vector<DesignerTrajectoryPtr> trajectories = mmmImporter->importTrajectory(fileNames[0].toStdString());
63 if (!trajectories.empty())
67 emit
import(trajectory);
72 helpExceptionMessageBox(
"Import failed.");
75 catch (InvalidArgumentException e)
77 helpExceptionMessageBox(e.reason);
79 catch (std::exception e)
81 helpExceptionMessageBox(
"Could not import MMM file");
88 this->environment = environment;
91 void ImportDialogController::helpExceptionMessageBox(std::string errorMessage)
93 QMessageBox* errorMessageBox =
new QMessageBox;
94 errorMessageBox->setWindowTitle(QString::fromStdString(
"Error Message"));
95 errorMessageBox->setText(QString::fromStdString(errorMessage));
96 errorMessageBox->exec();