Browse Source

继续同步pc

yun 5 days ago
parent
commit
1c77467d56

+ 8 - 337
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -267,347 +267,18 @@ void MainAndSecondaryCamerasWnd::loadSettings()
     int index = settings.value("Index", 0).toInt();
 
     //TODO: 这个地方目前暂停使用
-    //loadGroupSettings(groupId, index);
+    UpdataGroupSettings(groupId, index);
 }
-#if 0
-void MainAndSecondaryCamerasWnd::loadGroupSettings(int Id, int Index) {
-    // isUpdatingSettings = true;
-    QSettings settings("YourOrganization", "YourApplication");
-    settings.beginGroup(QString::number(Id));
-    QString imagePath1 = settings.value("ImagePath1").toString();
-    int materialWndType = settings.value("MaterialWndType").toInt();
-    QStringList textList = settings.value("TextList").toStringList();
-    settings.endGroup();
-    QSettings Last_settings("YourOrganization", "YourApplication");
-    settings.beginGroup(QString::number(lastGroupId));
-    QString Last_imagePath1 = settings.value("ImagePath1").toString();
-    int Last_materialWndType = settings.value("MaterialWndType").toInt();
-    QStringList Last_textList = settings.value("TextList").toStringList();
-    settings.endGroup();
-    QString lastRightImage = settings.value("LastRightImage").toString();
-
-    QSize size_left = ui->LeftOperatewidget->size();
-    QSize size_right = ui->RightOperatewidget->size();
 
-    QPixmap newPixmap;
-	QPixmap Last_newPixmap;
-
-    if (Index == 1) {
-        //newPixmap = QPixmap(imagePath1);
-        clearLayout(1);
-        newPixmap = QPixmap(imagePath1);
-        QPixmap scaledPixmap = newPixmap.scaled(size_right, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-        Right_currentMode = ModeImage;
-        Right_currentPixmap = scaledPixmap;
-        Right_scaleFactor = 1.0;
-        Right_previousScaleFactor = 1.0;
-        ui->RightOperatewidget->setPixmap(scaledPixmap);
-        double percentage = Right_scaleFactor * 100;
-        QString percentageStr = QString::number((int)percentage);
-        ui->Rightlabel_Percentage->setText(QString("%1%").arg(percentageStr));
-
-        if (lastIndex == 1) {
-            clearLayout(0);
-            Last_newPixmap = QPixmap(Last_imagePath1);
-            QPixmap scaledPixmap = Last_newPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-            Left_currentMode = ModeImage;
-            Left_currentPixmap = scaledPixmap;
-            Left_scaleFactor = 1.0;
-            Left_previousScaleFactor = 1.0;
-            ui->LeftOperatewidget->setPixmap(scaledPixmap);
-            double percentage = Left_scaleFactor * 100;
-            QString percentageStr = QString::number((int)percentage);
-            ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
-        }
-        else if (lastIndex == 2) {
-
-            clearLayout(0);
-            if (Last_materialWndType == 1) {
-                ui->LeftOperatewidget->clearPixmap();
-                QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                waferMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                layout->setContentsMargins(0, 0, 0, 0);
-                layout->addWidget(waferMap.value(lastGroupId)->view);
-                ui->LeftOperatewidget->setLayout(layout);
-                Left_currentMode = ModeView;
-                Left_currentView = waferMap.value(lastGroupId)->view;
-                Left_scaleFactor = 1.0;
-                applyScale(0);
-            }
-            else if (Last_materialWndType == 2) {
-                ui->LeftOperatewidget->clearPixmap();
-                QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                waffleMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                layout->setContentsMargins(0, 0, 0, 0);
-                layout->addWidget(waffleMap.value(lastGroupId)->view);
-                ui->LeftOperatewidget->setLayout(layout);
-                Left_currentMode = ModeView;
-                Left_currentView = waffleMap.value(lastGroupId)->view;
-                Left_scaleFactor = 1.0;
-                applyScale(0);
-            }
-            else if (Last_materialWndType == 3) {
-                ui->LeftOperatewidget->clearPixmap();
-                QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                materialBoxMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-                layout->setContentsMargins(0, 0, 0, 0);
-                layout->addWidget(materialBoxMap.value(lastGroupId)->view);
-                ui->LeftOperatewidget->setLayout(layout);
-                Left_currentMode = ModeView;
-                Left_currentView = materialBoxMap.value(lastGroupId)->view;
-                Left_scaleFactor = 1.0;
-                applyScale(0);
-            }
-        }
-    } else if (Index == 2) {
-        clearLayout(1);
-        clearLayout(0);
-
-        if (lastIndex == 1) {
-        }
-
-        if (materialWndType == 1) {
-		
-            if (lastIndex == 1) {
-                Last_newPixmap = QPixmap(Last_imagePath1);
-                QPixmap scaledPixmap = Last_newPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-                Left_currentMode = ModeImage;
-                Left_currentPixmap = scaledPixmap;
-                Left_scaleFactor = 1.0;
-                Left_previousScaleFactor = 1.0;
-                ui->LeftOperatewidget->setPixmap(scaledPixmap);
-                double percentage = Left_scaleFactor * 100;
-                QString percentageStr = QString::number((int)percentage);
-                ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
-            } else if (lastIndex == 2) {
-                if (Last_materialWndType == 1) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout *layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waferMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waferMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waferMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 2) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waffleMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waffleMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waffleMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 3) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    materialBoxMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(materialBoxMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = materialBoxMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                }
-            }
-            ui->RightOperatewidget->clearPixmap();
-            QVBoxLayout *layout = new QVBoxLayout(ui->RightOperatewidget);
-            waferMap.value(Id)->initFrom(ui->RightOperatewidget);
-
-            layout->setContentsMargins(0, 0, 0, 0);
-            layout->addWidget(waferMap.value(Id)->view);
-            ui->RightOperatewidget->setLayout(layout);
-            Right_currentMode = ModeView;
-            Right_currentView = waferMap.value(Id)->view;
-            Right_scaleFactor = 1.0;
-            applyScale(1);
-        } else if (materialWndType == 2) {
-            if (lastIndex == 1) {
-                Last_newPixmap = QPixmap(Last_imagePath1);
-                QPixmap scaledPixmap = Last_newPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-                Left_currentMode = ModeImage;
-                Left_currentPixmap = scaledPixmap;
-                Left_scaleFactor = 1.0;
-                Left_previousScaleFactor = 1.0;
-                ui->LeftOperatewidget->setPixmap(scaledPixmap);
-                double percentage = Left_scaleFactor * 100;
-                QString percentageStr = QString::number((int)percentage);
-                ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
-            } else if (lastIndex == 2) {
-                if (Last_materialWndType == 1) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout *layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waferMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waferMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waferMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 2) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waffleMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waffleMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waffleMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 3) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    materialBoxMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(materialBoxMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = materialBoxMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                }
-            }
-            
-            ui->RightOperatewidget->clearPixmap();
-            QVBoxLayout* layout = new QVBoxLayout(ui->RightOperatewidget);
-            waffleMap.value(Id)->initFrom(ui->RightOperatewidget);
-
-            layout->setContentsMargins(0, 0, 0, 0);
-            layout->addWidget(waffleMap.value(Id)->view);
-            ui->RightOperatewidget->setLayout(layout);
-            Right_currentMode = ModeView;
-            Right_currentView = waffleMap.value(Id)->view;
-            Right_scaleFactor = 1.0;
-        } else if (materialWndType == 3) {
-            if (lastIndex == 1) {
-                Last_newPixmap = QPixmap(Last_imagePath1);
-                QPixmap scaledPixmap = Last_newPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-                Left_currentMode = ModeImage;
-                Left_currentPixmap = scaledPixmap;
-                Left_scaleFactor = 1.0;
-                Left_previousScaleFactor = 1.0;
-                ui->LeftOperatewidget->setPixmap(scaledPixmap);
-                double percentage = Left_scaleFactor * 100;
-                QString percentageStr = QString::number((int)percentage);
-                ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
-            } else if (lastIndex == 2) {
-                if (Last_materialWndType == 1) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout *layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waferMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waferMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waferMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 2) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    waffleMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(waffleMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = waffleMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                } else if (Last_materialWndType == 3) {
-                    ui->LeftOperatewidget->clearPixmap();
-                    QVBoxLayout* layout = new QVBoxLayout(ui->LeftOperatewidget);
-                    materialBoxMap.value(lastGroupId)->initFrom(ui->LeftOperatewidget);
-                    layout->setContentsMargins(0, 0, 0, 0);
-                    layout->addWidget(materialBoxMap.value(lastGroupId)->view);
-                    ui->LeftOperatewidget->setLayout(layout);
-                    Left_currentMode = ModeView;
-                    Left_currentView = materialBoxMap.value(lastGroupId)->view;
-                    Left_scaleFactor = 1.0;
-                    applyScale(0);
-                }
-            }
-            
-            ui->RightOperatewidget->clearPixmap();
-            QVBoxLayout* layout = new QVBoxLayout(ui->RightOperatewidget);
-            materialBoxMap.value(Id)->initFrom(ui->RightOperatewidget);
-            layout->setContentsMargins(0, 0, 0, 0);
-            layout->addWidget(materialBoxMap.value(Id)->view);
-            ui->RightOperatewidget->setLayout(layout);
-            Left_currentMode = ModeView;
-            Left_currentView = materialBoxMap.value(Id)->view;
-            Left_scaleFactor = 1.0;
-            applyScale(0);
-        }
-    }
-
-    QSettings settings2("YourOrganization", "YourApplication_lastWndType");
-    settings2.setValue("LastWndType", lastIndex);
-    settings2.setValue("LastGroup", lastGroupId);
-
-    QPixmap scaledPixmap_right = newPixmap.scaled(size_right, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-    ui->RightOperatewidget->setPixmap(scaledPixmap_right);
-
-    QPixmap scaledPixmap_left = m_lastRightPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-    ui->LeftOperatewidget->setPixmap(scaledPixmap_left);
-
-    // 更新当前图片的成员变量
-    // Left_currentPixmap = scaledPixmap_left;
-    // Left_scaleFactor = 1.0;
-    // Right_currentPixmap = scaledPixmap_right;
-    // Right_scaleFactor = 1.0;
-    // ui->Leftlabel_Percentage->setText("100%");
-    // ui->Rightlabel_Percentage->setText("100%");
-
-    // ui->LeftDataSources->clear();
-    // ui->LeftDataSources->addItems(lasttextList);
-    // ui->RightDataSources->clear();
-    // ui->RightDataSources->addItems(textList);
-
-    // 保存到 QSettings
-    // settings.beginGroup("LastSettings");
-    // settings.setValue("LastRightPixmap", lastRightPixmap);
-    // settings.setValue("LasttextList", lasttextList);
-    // settings.setValue("LastLastRightPixmap", lastLastRightPixmap);
-    // settings.setValue("LastLasttextList", lastLasttextList);
-    // settings.setValue("LastLastIndex", lastLastIndex);
-    // settings.setValue("LastLastGroupId", lastLastGroupId);
-    // settings.endGroup();
-
-    if (isUpdatingSettings) {
-        lastLastRightPixmap = m_lastRightPixmap;
-        lastLasttextList = lasttextList;
-        m_lastRightPixmap = scaledPixmap_right;
-        lasttextList = textList;
-        lastLastIndex = lastIndex;
-        lastLastGroupId = lastGroupId;
-    }
-}
-#endif
-void MainAndSecondaryCamerasWnd::UpdataGroupSettings(const QPixmap& imageData)
+void MainAndSecondaryCamerasWnd::UpdataGroupSettings(int Id, int Index)
 {
-    int  Id = m_currentSelectGroup.nGroupId;
-    int Index = m_currentSelectGroup.nSelectLeft1;
+    //int  Id = m_currentSelectGroup.nGroupId;
+    //int Index = m_currentSelectGroup.nSelectLeft1;
 
     // isUpdatingSettings = true;
     QSettings settings("YourOrganization", "YourApplication");
     settings.beginGroup(QString::number(Id));
-    QString imagePath1 = settings.value("ImagePath1").toString();
+    QString imagePath = settings.value("ImagePath1").toString();
     int materialWndType = settings.value("MaterialWndType").toInt();
     QStringList textList = settings.value("TextList").toStringList();
     settings.endGroup();
@@ -627,14 +298,14 @@ void MainAndSecondaryCamerasWnd::UpdataGroupSettings(const QPixmap& imageData)
 
 
 
-        newPixmap = QPixmap(imageData);
+        newPixmap = QPixmap(imagePath);
         QStringList test = { "1","2" };
         ui->viewwidgetgroup_R->updateOperateWidget(newPixmap, test);
     }
 
         if (lastIndex == 1) {
             
-            Last_newPixmap = QPixmap(imageData);
+            Last_newPixmap = QPixmap(imagePath);
             QStringList test = { "1","2" };
             ui->viewwidgetgroup_L->updateOperateWidget(Last_newPixmap, test);
         }
@@ -933,7 +604,7 @@ void MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals0(const QPixmap& image
 void MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals1(const QPixmap& imageData)
 {
    // lastIndex = 2;
-    UpdataGroupSettings(imageData);
+    //UpdataGroupSettings(imageData);
 }
 
 void MainAndSecondaryCamerasWnd::GetUpDataImageShowSignals4(const QPixmap& imageData)

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

@@ -52,7 +52,7 @@ protected:
     // void loadGroupSettings(int Id, int Index);
     /**更新刷新
      */
-    void UpdataGroupSettings(const QPixmap& imageData);
+    void UpdataGroupSettings(int Id, int Index);
 
     void showEvent(QShowEvent *event) override;