mainwindow.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QFileDialog>
  4. MainWindow::MainWindow(QWidget *parent)
  5. : QMainWindow(parent)
  6. , ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9. setWindowTitle("Convert xodr map to Apollo HDMAP");
  10. }
  11. MainWindow::~MainWindow()
  12. {
  13. delete ui;
  14. }
  15. void MainWindow::on_pushButton_convert_clicked()
  16. {
  17. QString strlastpath = QString(ServiceIni.Getlastpath().data());
  18. QString strxodrpath = QFileDialog::getOpenFileName(this,"Select OpenDrive File",strlastpath,"*.xodr");
  19. if(strxodrpath.isEmpty())return;
  20. int indexsplash = strxodrpath.lastIndexOf('/');
  21. QString lastPath = strxodrpath.left(indexsplash);
  22. if(lastPath != strlastpath)
  23. {
  24. strlastpath = lastPath;
  25. ServiceIni.Setlastpath(strlastpath.toStdString());
  26. }
  27. QString strhdmappath = QFileDialog::getSaveFileName(this,"Select HDMAP File",".","*.xml");
  28. if(strhdmappath.isEmpty())return;
  29. indexsplash = strxodrpath.lastIndexOf('/');
  30. lastPath = strxodrpath.left(indexsplash);
  31. if(lastPath != strlastpath)
  32. {
  33. strlastpath = lastPath;
  34. ServiceIni.Setlastpath(strlastpath.toStdString());
  35. }
  36. }