main.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "mainwindow.h"
  2. #include "qmessagebox.h"
  3. #include <QApplication>
  4. #include "Process.h"
  5. bool ReadProtoParam(std::string path, ::google::protobuf::Message& param)
  6. {
  7. int fd = open(path.c_str(), O_RDONLY);
  8. if (fd == -1) return false;
  9. FileInputStream* input = new FileInputStream(fd);
  10. bool success = google::protobuf::TextFormat::Parse(input, &param);
  11. delete input;
  12. close(fd);
  13. return success;
  14. }
  15. Automatic::stCalibParam m_laser_calib_param;
  16. CProcess* m_pProcess=0;
  17. int main(int argc, char *argv[])
  18. {
  19. QApplication a(argc, argv);
  20. MainWindow w;
  21. w.show();
  22. char buf[255]={0};
  23. getcwd(buf,255);
  24. sprintf(buf,"%s/setting/calib.prototxt",buf);
  25. if(!ReadProtoParam(buf,m_laser_calib_param))
  26. {
  27. QMessageBox::about(NULL, "Error", "Read proto failed...");
  28. }
  29. m_pProcess=new CProcess(m_laser_calib_param,&w);
  30. if(m_pProcess->Init()==false)
  31. {
  32. QMessageBox::about(NULL, "Error", m_pProcess->LastError().c_str());
  33. }
  34. return a.exec();
  35. }