78 QMessageBox::StandardButton reply;
79 reply = QMessageBox::question(
82 "If you change the robot all trajectories are lost.\nDo you want to change?",
83 QMessageBox::Yes | QMessageBox::No);
84 if (reply == QMessageBox::No)
88 QFileDialog dialog(0);
89 dialog.setFileMode(QFileDialog::ExistingFiles);
90 dialog.setAcceptMode(QFileDialog::AcceptOpen);
91 dialog.setNameFilter(tr(
"XML (*.xml)"));
92 QStringList fileNames;
96 fileNames = dialog.selectedFiles();
98 if (fileNames.length() > 1)
100 QMessageBox* toManyFilesSelected =
new QMessageBox;
101 toManyFilesSelected->setWindowTitle(QString::fromStdString(
"Information"));
102 toManyFilesSelected->setText(QString::fromStdString(
103 "To many files selected.\nAs default the first file was taken."));
104 toManyFilesSelected->exec();
106 if (!fileNames.empty())
111 VirtualRobot::RobotIO::loadRobot(fileNames[0].toStdString());
112 environment->setRobot(robot);
117 catch (std::exception& e)
119 QMessageBox* selectRobotFailed =
new QMessageBox;
120 selectRobotFailed->setWindowTitle(QString::fromStdString(
"Error Message"));
121 selectRobotFailed->setText(
122 QString::fromStdString(
"The selected file is not a robot xml file."));
123 selectRobotFailed->exec();