Browse Source

主要相机窗口切换

yun 1 week ago
parent
commit
9884f65dcf

+ 1 - 0
View/die-bonder-ui/OriginalWnd/JOriginalMainWnd.h

@@ -54,6 +54,7 @@ struct ST_CURRENT_SELECT_GROUP
     /**°ó¶¨´ÎÊý
      */
     int               nBindNumber;
+    bool              isInitialed;
 };
 
 class JOriginalMainWnd: public QMainWindow

+ 117 - 30
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -36,6 +36,10 @@ MainAndSecondaryCamerasWnd::MainAndSecondaryCamerasWnd(QWidget *parent)
     ui->control_L->HideOrShowPage(false);
     ui->viewwidgetgroup_L->setBlueBord();
     qApp->installEventFilter(this);
+    m_veCurrentSelectGroup_R.isInitialed = false;
+    m_veCurrentSelectGroup_L.isInitialed = false;
+    m_veCurrentSelectGroup_R.isBond = false;
+    m_veCurrentSelectGroup_L.isBond = false;
 }
 
 MainAndSecondaryCamerasWnd::~MainAndSecondaryCamerasWnd()
@@ -82,15 +86,13 @@ void MainAndSecondaryCamerasWnd::initFrom()
 
 
 
-    if (lastIndex == 1) 
-    {
-        GetCurrentSelectSlots(lastGroupId, lastIndex);
-    }
+    GetCurrentSelectSlots(lastLastGroupId, lastLastIndex);
+    GetCurrentSelectSlots(lastGroupId, lastIndex);
+
+
+
+    
 
-    if(lastLastIndex == 1)
-    {
-        GetCurrentSelectSlots(lastLastGroupId, lastLastIndex);
-    }
 
 }
 
@@ -164,23 +166,23 @@ void MainAndSecondaryCamerasWnd::InitPage()
         ui->scrollArea->resize(1062, 177);
 
 
-        // 只有一个相机的情况,直接绑定
-        if (numbers.size() == 1)
-        {
-            Group* pGroup = m_allGroup[0];
-            connect(pGroup, &Group::SetUpDataImageShowSig,
-                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
+        //// 只有一个相机的情况,直接绑定
+        //if (numbers.size() == 1)
+        //{
+        //    Group* pGroup = m_allGroup[0];
+        //    connect(pGroup, &Group::SetUpDataImageShowSig,
+        //        this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
 
-            ST_CURRENT_SELECT_GROUP _curr;
-            _curr.isBond = true;
-            _curr.pSelectGroup = pGroup;
-            _curr.nCurrentCameraId = pGroup->m_nGroupId;
-            _curr.nSelectLeft1 = 1;
+        //    ST_CURRENT_SELECT_GROUP _curr;
+        //    _curr.isBond = true;
+        //    _curr.pSelectGroup = pGroup;
+        //    _curr.nCurrentCameraId = pGroup->m_nGroupId;
+        //    _curr.nSelectLeft1 = 1;
 
-            m_veCurrentSelectGroup.push_back(_curr);
+        //    m_veCurrentSelectGroup.push_back(_curr);
 
-            UpdataLightJoystickSwitchPage();
-        }
+        //    UpdataLightJoystickSwitchPage();
+        //}
     } 
 }
 
@@ -410,7 +412,7 @@ void MainAndSecondaryCamerasWnd::HideLayout(QHBoxLayout* layout, bool isHide)
     }
 }
 
-void MainAndSecondaryCamerasWnd::UpdataLightJoystickSwitchPage()
+void MainAndSecondaryCamerasWnd::UpdataLightJoystickSwitchPage(int groupId, int index, bool isShow)
 {
     auto Fun = [&](Group* pGroup,LightJoystickSwitchPage* p, ControlOperationPage* pContPage, bool bShow)
     {
@@ -422,8 +424,17 @@ void MainAndSecondaryCamerasWnd::UpdataLightJoystickSwitchPage()
             pContPage->UpDateCameraBind(m_pMainCameraBind);
         }
     };
+    
+    if (index == 1) {
+        Group* currGroup = m_allGroup.at(groupId);
+        Fun(currGroup, ui->control_L, ui->viewwidgetgroup_L, isShow);
+    }
+    else if(index == 2){
+        Group* currGroup = m_allGroup.at(groupId);
+        Fun(currGroup, ui->control_r, ui->viewwidgetgroup_R, isShow);
+    }
 
-    for (int i = 0; i < m_veCurrentSelectGroup.size(); i++)
+ /*   for (int i = 0; i < m_veCurrentSelectGroup.size(); i++)
     {
         if (i == 0)
         {
@@ -446,7 +457,7 @@ void MainAndSecondaryCamerasWnd::UpdataLightJoystickSwitchPage()
             Fun(m_veCurrentSelectGroup[1].pSelectGroup,ui->control_r, ui->viewwidgetgroup_R, bShow);
 
         }
-    }
+    }*/
 
 
 }
@@ -455,7 +466,83 @@ void MainAndSecondaryCamerasWnd::timerEvent(QTimerEvent* event)
 {
     int nID = event->timerId();
 }
+void MainAndSecondaryCamerasWnd::GetCurrentSelectSlots(int groupId, int nIndex) {
+    int nOnClickGroupId = groupId - 1; // 这里new 有些是0,有些是1 暂时选择
+    if (m_pMainCameraBind == nullptr || m_allGroup.size() < nOnClickGroupId)
+    {
+        return;
+    }
+    if (nIndex == 2) {
+        if (m_veCurrentSelectGroup_R.isBond == true) {
+            m_veCurrentSelectGroup_R.isBond = false;
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_R.pSelectGroup->m_nGroupId, 2, false);
+            m_veCurrentSelectGroup_L = m_veCurrentSelectGroup_R;
+            m_veCurrentSelectGroup_L.isBond = true;
+            //解绑
+            disconnect(m_veCurrentSelectGroup_R.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
+            m_veCurrentSelectGroup_L = m_veCurrentSelectGroup_R;
+            //换绑
+            connect(m_veCurrentSelectGroup_L.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_L.pSelectGroup->m_nGroupId, 1, true);
+        }
+        else {
+            if (m_veCurrentSelectGroup_R.isInitialed == true) {
+                m_veCurrentSelectGroup_L = m_veCurrentSelectGroup_R;
+                m_veCurrentSelectGroup_L.isBond = false;
+                UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_L.pSelectGroup->m_nGroupId, 1, false);
+            }
+            Group* pGroup = m_allGroup.at(nOnClickGroupId);
+            m_veCurrentSelectGroup_R.isInitialed = true;
+            m_veCurrentSelectGroup_R.pSelectGroup = pGroup;
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_R.pSelectGroup->m_nGroupId, 2, false);
+
+
+
+        }
+    }
+    else {
+        if (m_veCurrentSelectGroup_R.isBond == true) {
+            //解绑
+            disconnect(m_veCurrentSelectGroup_R.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
+            m_veCurrentSelectGroup_L = m_veCurrentSelectGroup_R;
+            //换绑
+            connect(m_veCurrentSelectGroup_L.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_L.pSelectGroup->m_nGroupId, 1, true);
+            Group* pGroup = m_allGroup.at(nOnClickGroupId);
+            m_veCurrentSelectGroup_R.pSelectGroup = pGroup;
+            m_veCurrentSelectGroup_R.isBond = true;
+            m_veCurrentSelectGroup_R.isInitialed = true;
+            connect(m_veCurrentSelectGroup_R.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_R.pSelectGroup->m_nGroupId, 2, true);
+
+        }else {
+            if (m_veCurrentSelectGroup_R.isInitialed == true) {
+                m_veCurrentSelectGroup_L = m_veCurrentSelectGroup_R;
+                UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_L.pSelectGroup->m_nGroupId, 1, false);
+            }
+            
 
+
+            Group* pGroup = m_allGroup.at(nOnClickGroupId);
+            m_veCurrentSelectGroup_R.pSelectGroup = pGroup;
+            m_veCurrentSelectGroup_R.isBond = true;
+            m_veCurrentSelectGroup_R.isInitialed = true;
+            connect(m_veCurrentSelectGroup_R.pSelectGroup, &Group::SetUpDataImageShowSig,
+                this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
+            UpdataLightJoystickSwitchPage(m_veCurrentSelectGroup_R.pSelectGroup->m_nGroupId, 2, true);
+            
+
+
+        }
+
+    }
+}
+#if 0
 void MainAndSecondaryCamerasWnd::GetCurrentSelectSlots(int groupId, int nIndex)
 {
 
@@ -537,13 +624,13 @@ void MainAndSecondaryCamerasWnd::GetCurrentSelectSlots(int groupId, int nIndex)
             {
                 if (m_veCurrentSelectGroup.size() == 1)
                 {
-                    connect(pGroup, &Group::SetUpDataImageShowSig,
-                        this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
+                   connect(pGroup, &Group::SetUpDataImageShowSig,
+                       this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4);
                 }
                 else
                 {
-                    connect(pGroup, &Group::SetUpDataImageShowSig,
-                        this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
+                   connect(pGroup, &Group::SetUpDataImageShowSig,
+                       this, &MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0);
                 }
                 m_veCurrentSelectGroup.push_back(_curr);
                 
@@ -580,7 +667,7 @@ void MainAndSecondaryCamerasWnd::GetCurrentSelectSlots(int groupId, int nIndex)
         
     }
 }
-
+#endif
 void MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0(const QPixmap& imageData)
 {
     //lastIndex = 1;

+ 4 - 1
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.h

@@ -95,7 +95,7 @@ private:
 
     /**更新灯光显示
      */
-    void UpdataLightJoystickSwitchPage();
+    void UpdataLightJoystickSwitchPage(int groupId, int index,bool isShow);
 
 private:
     Ui::MainAndSecondaryCamerasWnd *ui;
@@ -142,6 +142,9 @@ private:
      */
     std::vector<ST_CURRENT_SELECT_GROUP> m_veCurrentSelectGroup;
 
+    ST_CURRENT_SELECT_GROUP m_veCurrentSelectGroup_L;
+    ST_CURRENT_SELECT_GROUP m_veCurrentSelectGroup_R;
+
     /**保存所有的后续使用
     */
     QStack<Group*> m_allGroup;