main.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #include "ADCIntelligentVehicle.h"
  2. #include <QApplication>
  3. #include "ivversion.h"
  4. #include "ivbacktrace.h"
  5. #include "ivlog.h"
  6. iv::Ivlog * gIvlog;
  7. #include "xmlparam.h"
  8. #include "ivexit.h"
  9. #include <thread>
  10. #include <QTranslator>
  11. QApplication * gApp;
  12. std::string gstrmemgps;
  13. std::string gstrmemradar;
  14. std::string gstrmemdecition;
  15. std::string gstrmembrainstate;
  16. std::string gstrmemchassis;
  17. std::string gstrvehtype;
  18. void ExitFunc()
  19. {
  20. gApp->quit();
  21. std::this_thread::sleep_for(std::chrono::milliseconds(900));
  22. }
  23. int main(int argc, char *argv[])
  24. {
  25. RegisterIVBackTrace();
  26. showversion("ui_ads_hmi");
  27. QApplication a(argc, argv);
  28. QTranslator ts;
  29. if(ts.load("./ui_ads_hmi_language.qm"))
  30. {
  31. a.installTranslator(&ts);
  32. }
  33. gApp = &a;
  34. QString strpath = QCoreApplication::applicationDirPath();
  35. if(argc < 2)
  36. strpath = strpath + "/ui_ads_hmi.xml";
  37. else
  38. strpath = argv[1];
  39. std::cout<<strpath.toStdString()<<std::endl;
  40. iv::xmlparam::Xmlparam xp(strpath.toStdString());
  41. // givlog->info("brain.");
  42. gstrmemradar = xp.GetParam("radar","radar");
  43. gstrmemgps = xp.GetParam("gps","hcp2_gpsimu");
  44. gstrmemdecition = xp.GetParam("dection","deciton");
  45. gstrmembrainstate = xp.GetParam("brainstate","brainstate");
  46. gstrmemchassis = xp.GetParam("chassismsgname","chassis");
  47. gstrvehtype = xp.GetParam("VehType","ShenLan");
  48. #if (QT_VERSION <= QT_VERSION_CHECK(5,0,0)) //apollo_fu 20200413 添加对QT4版本的中文字体支持
  49. //QT5版本以上默认就是采用UTF-8编码
  50. QTextCodec *codec = QTextCodec::codecForName("UTF-8");
  51. QTextCodec::setCodecForLocale(codec);
  52. QTextCodec::setCodecForCStrings(codec);
  53. QTextCodec::setCodecForTr(codec);
  54. #endif
  55. gIvlog = new iv::Ivlog("ui_ads_hmi");
  56. gIvlog->info("ui_ads_hmi start");
  57. ADCIntelligentVehicle w;
  58. //w.show();
  59. //w.showMaximized(); //apollo_fu 20200409
  60. w.setWindowTitle("ADS-UI-Ver2.0 ");
  61. // w.showMinimized(); //apollo_fu 20200413
  62. w.showMaximized();
  63. iv::ivexit::RegIVExitCall(ExitFunc);
  64. return a.exec();
  65. }