12 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on init";
18 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on connect";
25 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on disconnect";
31 ARMARX_INFO <<
"RobotTrajectoryDesigner: ExportDialogController on exit";
43 if (environment == NULL)
47 QFileDialog dialog(0);
48 dialog.setFileMode(QFileDialog::ExistingFiles);
49 dialog.setAcceptMode(QFileDialog::AcceptOpen);
50 dialog.setNameFilter(tr(
"XML (*.xml)"));
51 QStringList fileNames;
54 fileNames = dialog.selectedFiles();
56 if (fileNames.length() > 1)
58 QMessageBox* toManyFilesSelected =
new QMessageBox;
59 toManyFilesSelected->setWindowTitle(QString::fromStdString(
"Information"));
60 toManyFilesSelected->setText(QString::fromStdString(
61 "To many files selected.\nAs default the first file was taken."));
62 toManyFilesSelected->exec();
64 if (!fileNames.empty())
68 MMMImporterPtr mmmImporter = std::make_shared<MMMImporter>(environment);
69 std::vector<DesignerTrajectoryPtr> trajectories =
70 mmmImporter->importTrajectory(fileNames[0].toStdString());
71 if (!trajectories.empty())
75 emit
import(trajectory);
80 helpExceptionMessageBox(
"Import failed.");
83 catch (InvalidArgumentException e)
85 helpExceptionMessageBox(e.reason);
87 catch (std::exception e)
89 helpExceptionMessageBox(
"Could not import MMM file");
97 this->environment = environment;
101 ImportDialogController::helpExceptionMessageBox(std::string errorMessage)
103 QMessageBox* errorMessageBox =
new QMessageBox;
104 errorMessageBox->setWindowTitle(QString::fromStdString(
"Error Message"));
105 errorMessageBox->setText(QString::fromStdString(errorMessage));
106 errorMessageBox->exec();