widget.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include "widget.h"
  2. #include "ui_widget.h"
  3. #include "LHQLogAPI.h"
  4. #include "common/StyleManager/lhstylemanager.h"
  5. Widget::Widget(QWidget *parent) :
  6. QWidget(parent),
  7. ui(new Ui::Widget)
  8. {
  9. ui->setupUi(this);
  10. /* 设置暗色 */
  11. // LHStyleMgr->SetSkinStyle("Dark");
  12. m_tSwitch = new TransmitterSwitch();
  13. /* 设置一个布局 */
  14. m_layout = new QVBoxLayout(ui->widget_content);
  15. m_layout->addWidget(m_tSwitch);
  16. ui->widget_content->setLayout(m_layout);
  17. /* 设置边距为0 */
  18. m_layout->setMargin(20);
  19. m_layout->setSpacing(0);
  20. /* 设置参数 */
  21. m_tSwitch->setQSS(":/QSS/QSS/TransmitterSwitch_dark.qss");
  22. /* 初始化WebAPI */
  23. m_tSwitch->setWebAPIInfo("http://192.1.3.133:31000/v6/", "2e36b53ccd2a433b9a803b98d683ed91", "TMS");
  24. }
  25. Widget::~Widget()
  26. {
  27. if(m_tSwitch != nullptr)
  28. {
  29. delete m_tSwitch;
  30. m_tSwitch = nullptr;
  31. }
  32. if(m_layout != nullptr)
  33. {
  34. delete m_layout;
  35. m_layout = nullptr;
  36. }
  37. delete ui;
  38. }
  39. /* 导入数据按钮 */
  40. void Widget::on_pBtn_getData_clicked()
  41. {
  42. if(m_tSwitch == nullptr)
  43. {
  44. LH_WRITE_ERROR("TransmitterSwitch is nullptr");
  45. return;
  46. }
  47. m_tSwitch->getExecPlanFromEQM();
  48. }
  49. /* 导出数据按钮 */
  50. void Widget::on_pBtn_saveData_clicked()
  51. {
  52. if(m_tSwitch == nullptr)
  53. {
  54. LH_WRITE_ERROR("TransmitterSwitch is nullptr");
  55. return;
  56. }
  57. m_tSwitch->saveExecPlanToEQM();
  58. }