MainAndSecondaryCamerasWnd.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #ifndef MAINANDSECONDARYCAMERASWND_H
  2. #define MAINANDSECONDARYCAMERASWND_H
  3. #include <QSlider>
  4. #include <QLineEdit>
  5. #include <QHBoxLayout>
  6. #include "CameraMaterialGroupWnd/MaterialWindow/MaterialBox.h"
  7. #include "CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h"
  8. #include <ICalibration.h>
  9. #include "JOriginalMainWnd.h"
  10. namespace Ui {
  11. class MainAndSecondaryCamerasWnd;
  12. }
  13. class MainAndSecondaryCamerasWnd : public JOriginalMainWnd
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit MainAndSecondaryCamerasWnd(QWidget *parent = nullptr);
  18. ~MainAndSecondaryCamerasWnd();
  19. void initFrom();
  20. void InitPage();
  21. /**绑定相机画面
  22. */
  23. void CameraConnectUpdateImageFun(int nIndex, Group* widget);
  24. /**初始化界面运动控制轴
  25. */
  26. void InitModulesShow();
  27. template<class T>
  28. void DeduplicationBox(QComboBox* pCom, const T& veTemp, int nIndex);
  29. public slots: // 确保这里声明了槽函数
  30. void handleDoubleClick();
  31. void CheckIs();
  32. protected:
  33. void wheelEvent(QWheelEvent* event) override;
  34. bool eventFilter(QObject* obj, QEvent* event) override;
  35. void loadSettings();
  36. void checkSettings();
  37. void loadGroupSettings(int Id, int Index);
  38. /**更新刷新
  39. */
  40. void UpdataGroupSettings(const QPixmap& imageData);
  41. void showEvent(QShowEvent *event) override;
  42. void hideEvent(QHideEvent *event) override;
  43. void clearLayout(int flag); // 清除大窗口上当前的布局
  44. void WaferWidget(int flag); // 圆晶
  45. void WaffleWidget(int flag); // 华夫盒
  46. void MaterialBoxWidget(int flag); // 料盒
  47. protected:
  48. void timerEvent(QTimerEvent* event) override;
  49. private slots:
  50. void on_LeftZoomUpButton_clicked();
  51. void on_RightZoomUpButton_clicked();
  52. void on_LeftZoomOutButton_clicked();
  53. void on_RightZoomOutButton_clicked();
  54. QPixmap getCurrentPixmap() const
  55. {
  56. return Right_currentPixmap;
  57. }
  58. void ResetIdleTimer(bool bStart = false);
  59. void GetCurrentSelectSlots(int groupId, int nIndex);
  60. void GetUpDataImageShowSignals0(const QPixmap& imageData);
  61. void GetUpDataImageShowSignals1(const QPixmap& imageData);
  62. void GetUpDataImageShowSignals4(const QPixmap& imageData);
  63. private:
  64. void InitMainCameraBind(CameraBind* pCameraBind) override;
  65. void UpdateCameraDisplay0(int iCameraId, JVision::ImageInfo imageData) override;
  66. void UpdateCameraDisplay1(int iCameraId, JVision::ImageInfo imageData) override;
  67. void UpdateCameraDisplay2(int iCameraId, JVision::ImageInfo imageData) override;
  68. void UpdateCameraDisplay3(int iCameraId, JVision::ImageInfo imageData) override;
  69. void UpdateCameraDisplay4(int iCameraId, JVision::ImageInfo imageData) override;
  70. signals:
  71. void UpDataImageShowSignals0(const QPixmap& imageData);
  72. void UpDataImageShowSignals1(const QPixmap& imageData);
  73. void UpDataImageShowSignals2(const QPixmap& imageData);
  74. void UpDataImageShowSignals3(const QPixmap& imageData);
  75. void UpDataImageShowSignals4(const QPixmap& imageData);
  76. private:
  77. void updateScale(double newScaleFactor, int flag); // 更新缩放比例
  78. void applyScale(int flag); // 应用缩放
  79. void HideLayout(QHBoxLayout* layout, bool isHide);
  80. /**更新灯光显示
  81. */
  82. void UpdataLightJoystickSwitchPage(Group* pGroup);
  83. private:
  84. Ui::MainAndSecondaryCamerasWnd *ui;
  85. QPixmap Left_currentPixmap;
  86. qreal Left_scaleFactor;
  87. QPixmap Right_currentPixmap;
  88. qreal Right_scaleFactor;
  89. int lastGroupId = -1;
  90. int lastIndex = -1;
  91. int lastLastGroupId = -1;
  92. int lastLastIndex = -1;
  93. QPixmap m_lastRightPixmap;
  94. QStringList lasttextList;
  95. QPixmap lastLastRightPixmap; // 用于存储上一次的 lastRightPixmap
  96. QStringList lastLasttextList;
  97. bool isUpdatingSettings;
  98. Wafer *wafer; // 声明Wafer指针
  99. Waffle *waffle; // 声明Waffle指针
  100. MaterialBox *materialbox; // 声明materialbox指针
  101. QMap<int, Wafer*> waferMap;
  102. /**当前选中的group
  103. */
  104. std::vector<ST_CURRENT_SELECT_GROUP> m_veCurrentSelectGroup = {};
  105. ST_CURRENT_SELECT_GROUP m_currentSelectGroup = {};
  106. int m_nIdex = 0;
  107. int m_nTimeShowPos = -1;
  108. /**用作定时使用,后面移动到整个类里面,目前先实现功能
  109. */
  110. int m_idleTimer = -1;
  111. QMap<int, Waffle*> waffleMap;
  112. QMap<int, MaterialBox*> materialBoxMap;
  113. OperateMode Left_currentMode = ModeImage;
  114. OperateMode Right_currentMode = ModeImage;
  115. QGraphicsView *Left_currentView = nullptr;
  116. QGraphicsView *Right_currentView = nullptr;
  117. QPoint mousePos;
  118. double Left_previousScaleFactor;
  119. double Right_previousScaleFactor;
  120. };
  121. #endif // MAINANDSECONDARYCAMERASWND_H