diff --git a/Doc/AOI检测软件SOP-1.0.pptx b/Doc/AOI检测软件SOP-2024-7-3.pptx similarity index 98% rename from Doc/AOI检测软件SOP-1.0.pptx rename to Doc/AOI检测软件SOP-2024-7-3.pptx index 9eb3e1e1..aae1dc48 100644 Binary files a/Doc/AOI检测软件SOP-1.0.pptx and b/Doc/AOI检测软件SOP-2024-7-3.pptx differ diff --git a/HanddleAI/HandleAiUi-new/CMakeLists.txt b/HanddleAI/HandleAiUi-new/CMakeLists.txt index 60138d60..32db73e1 100644 --- a/HanddleAI/HandleAiUi-new/CMakeLists.txt +++ b/HanddleAI/HandleAiUi-new/CMakeLists.txt @@ -68,7 +68,6 @@ FILE(GLOB UI_FILES "./*.ui") INCLUDE_DIRECTORIES(${CMAEK_CURRENT_BINARY_DIR}) - if(ANDROID) add_library(${CURRENT_FOLDER} SHARED ${HEAD_FILES} @@ -95,6 +94,8 @@ if(ANDROID) ) else() if(CMAKE_BUILD_TYPE MATCHES "Debug") + message( "/////////////DEBUG///////////////") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g") add_executable( ${CURRENT_FOLDER} ${HEAD_FILES} ${SRC_FILES} @@ -118,6 +119,8 @@ else() ${ALGO_SRC_FILES} ${UI_FILES} "ff.rc" "icon.qrc") else() + message( "/////////////RELEASE///////////////") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG") add_executable( ${CURRENT_FOLDER} diff --git a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h index 03f74266..c5dac05a 100644 --- a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h +++ b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h @@ -222,7 +222,7 @@ void ALGO_Inspection(std::shared_ptr data, handleAiModelManager* _hand if (detResult.size() == 0) { return; - } + } //¹ýÂ˽á¹û£¬»ñÈ¡ÓÃÓÚhandleAi/HALCON¼ì²âµÄrect std::vector pinPos = getpinHandleAiEvaluateRect(data,src, detResult); diff --git a/HanddleAI/HandleAiUi-new/appConfig/appConfig.hpp b/HanddleAI/HandleAiUi-new/appConfig/appConfig.hpp index 8ba9cdfc..3bac4974 100644 --- a/HanddleAI/HandleAiUi-new/appConfig/appConfig.hpp +++ b/HanddleAI/HandleAiUi-new/appConfig/appConfig.hpp @@ -12,9 +12,12 @@ struct productDataStruct { std::string name; + std::string customerPartNumber; + std::string foxconnPartNumber; int indexOfArm = -1; cv::Vec3d basePos; cv::Vec3d baseRad; + std::string imgPosPath; int halconAlgoIndex = -1; //intΪ²½ÖèÊý std::stringΪָÁî std::unordered_map >cameraSetting; @@ -79,10 +82,13 @@ public: { productDataStruct productData; productData.name = res["productName"]; + productData.customerPartNumber = res["customerPartNumber"]; + productData.foxconnPartNumber = res["foxconnPartNumber"]; productData.indexOfArm = res["productIndex"]; productData.basePos = { res["baseX"],res["baseY"],res["baseZ"] }; productData.baseRad = { res["baseRx"],res["baseRy"],res["baseRz"] }; productData.halconAlgoIndex = res["halconAlgoIndex"]; + productData.imgPosPath = res["imgPosPath"]; productData.disableHandleAiConfig = res["disableHandleAiConfig"]; productData.enableCodedAlgo = res["enableCodedAlgo"]; productData.codedAlgoIndex = res["codedAlgoIndex"]; @@ -105,7 +111,7 @@ public: detResultHandleStruct detResultHandle; detResultHandle.detResultIndex = std::vector(data["detResultIndex"].begin(), data["detResultIndex"].end()); detResultHandle.segModelName = data["segModelName"]; - detResultHandle.segNgIndex = std::vector(data["segNgIndex"].begin(), data["segNgIndex"].end()); + detResultHandle.segNgIndex = std::vector( data["segNgIndex"].begin(), data["segNgIndex"].end()); detResultHandle.segGpuIndex = data["segGpuIndex"]; detResultHandle.clsModelName = data["clsModelName"]; @@ -115,7 +121,7 @@ public: { std::vector result = split(it.value(), ','); if (result.size() != 4) - { + { fancyWarnWindow* warn = new fancyWarnWindow (fancyWarnWindow::Warning, QString("ÔÚ%1ÖеÄclsResultHandle·¢ÏÖ¸ñʽ´íÎó").arg(QString::fromStdString(fileManager::getFileName(file))), QString("%1").arg(QString::fromStdString(it.value()))); diff --git a/HanddleAI/HandleAiUi-new/appConfig/json/generalJsonParsing.hpp b/HanddleAI/HandleAiUi-new/appConfig/json/generalJsonParsing.hpp index 53597b0c..d7a3b88b 100644 --- a/HanddleAI/HandleAiUi-new/appConfig/json/generalJsonParsing.hpp +++ b/HanddleAI/HandleAiUi-new/appConfig/json/generalJsonParsing.hpp @@ -21,7 +21,26 @@ static nlohmann::json readJsonFromPath(std::string path) inputFile.close(); return jsonObj; } +static bool saveJsonFromPath(std::string path, nlohmann::json& json) +{ + std::ofstream saveFile(path); + if (!saveFile.is_open()) { + std::cerr << "Could not open the file - " << path << std::endl; + return false; + } + try { + saveFile << json.dump(4); + } + catch (nlohmann::json::parse_error& e) { + std::cerr << "JSON parse error: " << e.what() << std::endl; + return false; + } + + // ¹Ø±ÕÎļþ + saveFile.close(); + return true; +} static void printNlohmannJson(nlohmann::json input, int depth = 0) { std::string indent_str(depth, ' '); diff --git a/HanddleAI/HandleAiUi-new/appConfig/jsonParsing.cpp b/HanddleAI/HandleAiUi-new/appConfig/jsonParsing.cpp index ebd30a1a..4c834e5c 100644 --- a/HanddleAI/HandleAiUi-new/appConfig/jsonParsing.cpp +++ b/HanddleAI/HandleAiUi-new/appConfig/jsonParsing.cpp @@ -21,7 +21,7 @@ int jsonConfiguration::reParsing() QJsonObject jsonObj = jsonDoc.object(); imgSavePath = jsonObj.value("imgSavePath").toString(); - stationName = jsonObj.value("stationName").toString(); + stationName = jsonObj.value("stationName").toString( ); ////////////////////TABLE//LIST///////////////////// QJsonArray tableListArray = jsonObj["tablelist"].toArray(); for (const QJsonValue& tableListValue : tableListArray) { diff --git a/HanddleAI/HandleAiUi-new/back/backEndManager.cpp b/HanddleAI/HandleAiUi-new/back/backEndManager.cpp index a549e89a..046c6d4c 100644 --- a/HanddleAI/HandleAiUi-new/back/backEndManager.cpp +++ b/HanddleAI/HandleAiUi-new/back/backEndManager.cpp @@ -88,12 +88,13 @@ void backEndManager::startManualDetSlot(std::string path, int index) _manualDetThread->startDet(path, index); } -void backEndManager::writeArmStartSignal(int productTypeIn) +void backEndManager::writeArmStartSignal(int productTypeIn,QString SN) { _appConfig->productDatasMutex.lock(); productTypeStr = _appConfig->productDatas[productTypeIn].name; _appConfig->productDatasMutex.unlock(); productType = productTypeIn; + currentSn = SN.toStdString(); _triggerManager->sendFinsMsg("write_short_350_"+QString::number(_appConfig->productDatas[productTypeIn].indexOfArm)); _triggerManager->sendFinsMsg("write_short_351_1"); } \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/back/backEndManager.h b/HanddleAI/HandleAiUi-new/back/backEndManager.h index af097707..64903358 100644 --- a/HanddleAI/HandleAiUi-new/back/backEndManager.h +++ b/HanddleAI/HandleAiUi-new/back/backEndManager.h @@ -36,6 +36,7 @@ public: manualDetThread* _manualDetThread = nullptr; // std::string productTypeStr; + std::string currentSn; int productType = -1; int indexOfArm = -1; backEndManager(appConfig*); @@ -47,7 +48,7 @@ public slots: this->start(); } void startManualDetSlot(std::string path, int index); - void writeArmStartSignal(int productType); + void writeArmStartSignal(int productType,QString SN); private: void run(); signals: @@ -55,7 +56,7 @@ signals: void sendPixmapImageWidget(showImgPack*); void sendInitFinished(int); void sendInitString(QString);//³õʼ»¯ÈÕÖ¾ - void addHistoryDataSignal(bool isOK, QString path, QPixmap img); + void addHistoryDataSignal(bool isOK, historyPack); void addDashBoardData(int index, bool value);//Ôö¼ÓÒ»¸öOK/NGÊý¾Ýµ½dashboard void resetDashBoard();//reset dashBoard void switchStartBtnStatusSignal(int); diff --git a/HanddleAI/HandleAiUi-new/back/detData.h b/HanddleAI/HandleAiUi-new/back/detData.h index 1f5c1394..04b3bf7f 100644 --- a/HanddleAI/HandleAiUi-new/back/detData.h +++ b/HanddleAI/HandleAiUi-new/back/detData.h @@ -35,6 +35,7 @@ public: int oriShowIndex = -1;//ԭͼÔÚµÚ¼¸¸ö¿òչʾ int resShowIndex = -1;//½á¹ûͼÔÚµÚ¼¸¸ö¿òչʾ + std::vector > resImgSavePath; std::string snErrorsnError = std::string("snErrNoSn"); std::vector writeBackData; void writeBack(QString type, int pos, QString value) diff --git a/HanddleAI/HandleAiUi-new/back/imgSaveThreadManager.h b/HanddleAI/HandleAiUi-new/back/imgSaveThreadManager.h index f62cfadc..0193a15a 100644 --- a/HanddleAI/HandleAiUi-new/back/imgSaveThreadManager.h +++ b/HanddleAI/HandleAiUi-new/back/imgSaveThreadManager.h @@ -145,7 +145,11 @@ public: //½á¹ûͼ±£´æ std::vectorresFileNames = genFileNmaes(data, resImg); for (int index = 0; index < resFileNames.size(); index++) + { saveThread.addData(fileSavePath + resFileNames[index], data->resultImgs[index]); + if (data->resImgSavePath.size() > index) + *data->resImgSavePath[index] = fileSavePath + resFileNames[index]; + } //seg std::vectorsegFileNames = genFileNmaes(data, segImg); diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp index e9f7b33a..98def0d2 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp +++ b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp @@ -105,7 +105,12 @@ void threadManager::resultHandle(std::shared_ptr data) pack->type = imgWidgetRes; pack->index = data->resShowIndex+ cnt; emit _backEndManager->sendPixmapImageWidget(pack); - emit _backEndManager->addHistoryDataSignal((data->aiDetOK == true && data->halconOK == true), "", pixmap); + + historyPack _historyPack; + _historyPack.img = pixmap; + _historyPack.filePath = std::shared_ptr(new std::string); + data->resImgSavePath.push_back(_historyPack.filePath); + emit _backEndManager->addHistoryDataSignal((data->aiDetOK == true && data->halconOK == true),_historyPack); cnt++; } } @@ -124,7 +129,7 @@ void threadManager::resultHandle(std::shared_ptr data) emit _backEndManager->addCtData(1, aiCt.count()); if (halconCt.count() > 0) emit _backEndManager->addCtData(2, halconCt.count()); - //std::cout << "ct1" << totalCt.count() << "ct2" << aiCt.count() << "ct3" << halconCt.count() << std::endl; + //SQL std::vector sqlDatas; for (auto sqlData : data->sqlVec) diff --git a/HanddleAI/HandleAiUi-new/front/pages/configSettingWidget.h b/HanddleAI/HandleAiUi-new/front/pages/configSettingWidget.h index 8fff5d1d..63b2ad67 100644 --- a/HanddleAI/HandleAiUi-new/front/pages/configSettingWidget.h +++ b/HanddleAI/HandleAiUi-new/front/pages/configSettingWidget.h @@ -16,6 +16,7 @@ #include #include #include +#include /**************¸ñʽ****************/ //... @@ -42,15 +43,33 @@ public: bhdPath, IP, number, - boolType + boolType, + path }; struct aLineData { - QString showName; - QString valueName; - QVariant value; - QString formatPolicyStr; + int acessLevel; + std::string showName; + std::string valueName; + std::string value; + std::string formatPolicyStr; formatPolicy _formatPolicy; + QWidget* userInputWidget; + std::string getValueFromQwidget() + { + switch (_formatPolicy) + { + case boolType: + if (((QCheckBox*)userInputWidget)->isChecked() == true) + return "true"; + else + return "flase"; + break; + default: + return ((QLineEdit*)userInputWidget)->text().toStdString(); + } + return "error"; + } }; QVBoxLayout* Layout; QHBoxLayout* btnLayout; @@ -89,7 +108,7 @@ public: Layout->addLayout(btnLayout); - addConfigWidget(u8"ͨÓÃÉèÖÃ",".//config//modelConfig.json"); + addConfigWidget(u8"ͨÓÃÉèÖÃ",".//config//basicSetting.json"); addConfigWidget(u8"¼ì²âÉèÖÃ",""); addConfigWidget(u8"ͨѶÉèÖÃ",".//config//communicateConfig"); addConfigWidget(u8"Ëã·¨ÉèÖÃ",""); @@ -104,6 +123,14 @@ public: { switch (_formatPolicy) { + case path: + if (!isNumeric(compareStr)) + { + textOut = u8"¸ñʽ´íÎ󣬷ÇÊý×Ö"; + colorOut = "red"; + return true; + } + break; case number: if (!isNumeric(compareStr)) { @@ -193,7 +220,6 @@ public: jsonWidget->setMaximumSize(9999 , 9999); QGridLayout* jsonLayout = new QGridLayout(jsonWidget); jsonLayout->setAlignment(Qt::AlignTop); - jsonLayout->setContentsMargins(0, 0, 0, 0); scrollArea->setWidget(jsonWidget); jsonLayouts.push_back(jsonLayout); @@ -205,9 +231,10 @@ public: QWidget* tempWidget = new QWidget(); QVBoxLayout* tempVLayout = new QVBoxLayout(tempWidget); tempVLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop); + tempWidget->setContentsMargins(0, 0, 0, 0); tempVLayout->setContentsMargins(0, 0, 0, 0); - QLabel* showLabel = new QLabel(data.showName); + QLabel* showLabel = new QLabel(QString::fromStdString(data.showName)); showLabel->setFont(font); showLabel->setPalette(palette); showLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); @@ -221,19 +248,43 @@ public: QCheckBox* checkBox = new QCheckBox(); checkBox->setFont(font); checkBox->setPalette(palette); - checkBox->setFixedWidth(500); + //checkBox->setFixedSize(QSize(50,50)); QHBoxLayout* tempLayout = new QHBoxLayout(); - tempLayout->addWidget(showLabel); tempLayout->addWidget(checkBox); tempVLayout->addLayout(tempLayout); tempVLayout->addWidget(warningLabel); - } + if (!data.value.compare("true")) + checkBox->setChecked(true); + data.userInputWidget = checkBox; + //ÐÞ¸Äʱ¾¯¸æ + connect(checkBox, &QCheckBox::stateChanged, [=]() + { + if (checkBox->isChecked()==true && data.value =="false")//Ð޸ĺóµÄÖµ²»Æ¥Åä + { + warningLabel->setText("´ËÏî±»ÐÞ¸Ä!"); + warningLabel->setStyleSheet("color:yellow"); + checkBox->setStyleSheet("border: 2px solid yellow;"); + } + else if (checkBox->isChecked() == false && data.value == "true")//Ð޸ĺóµÄÖµ²»Æ¥Åä + { + warningLabel->setText("´ËÏî±»ÐÞ¸Ä!"); + warningLabel->setStyleSheet("color:yellow"); + checkBox->setStyleSheet("border: 2px solid yellow;"); + } + else + { + warningLabel->setText(""); + checkBox->setStyleSheet(""); + warningLabel->setText(""); + } + }); + } else { - QLineEdit* lineEdit = new QLineEdit(data.value.toString()); + QLineEdit* lineEdit = new QLineEdit(QString::fromStdString(data.value)); lineEdit->setFont(font); lineEdit->setPalette(palette); lineEdit->setFixedWidth(500); @@ -241,10 +292,11 @@ public: tempVLayout->addWidget(showLabel); tempVLayout->addWidget(lineEdit); tempVLayout->addWidget(warningLabel); + data.userInputWidget = lineEdit; //ÐÞ¸Äʱ¾¯¸æ connect(lineEdit, &QLineEdit::textChanged, [=]() { - if (lineEdit->text().compare(data.value.toString()))//Ð޸ĺóµÄÖµ²»Æ¥Åä + if (lineEdit->text().toStdString().compare(data.value))//Ð޸ĺóµÄÖµ²»Æ¥Åä { QString text, color; if (formatPolicyCompare(data._formatPolicy, lineEdit->text(), text, color)) @@ -273,6 +325,7 @@ public: jsonLayout->addWidget(tempWidget); } privateWidgets.push_back(widgets); + privateJsondatas.push_back(jsonData); //±£´æ°´Å¥ fancyButtonText* saveBtn = new fancyButtonText(160, 50, u8"±£´æ", u8"±£´æµ±Ç°ÅäÖÃÎļþ"); connect(saveBtn, &QPushButton::clicked, this, [=]() {saveJson(jsonPath); }); @@ -291,30 +344,33 @@ public: std::vector< aLineData> loadJson(const QString& fileName) { std::vector< aLineData> returnData; nlohmann::json json = readJsonFromPath(fileName.toStdString()); - for (auto data : json) + try { - aLineData lineData; - std::string policyStr = data["policy"]; - std::string showName = data["showName"]; - std::string value = data["value"]; - std::string valueName = data["valueName"]; - formatPolicy _formatPolicy = formatPolicy::none; - if (!policyStr.compare("filepath")) - _formatPolicy = filePath; - else if (!policyStr.compare("bhdpath")) - _formatPolicy = bhdPath; - else if (!policyStr.compare("ip")) - _formatPolicy = IP; - else if (!policyStr.compare("number")) - _formatPolicy = number; - else if (!policyStr.compare("bool")) - _formatPolicy = boolType; + for (auto data : json) + { + aLineData lineData; + lineData.acessLevel = data["level"]; + lineData.showName = data["showName"]; + lineData.formatPolicyStr = data["policy"]; + lineData.value = data["value"]; + lineData.valueName = data["valueName"]; + if (!lineData.formatPolicyStr.compare("filepath")) + lineData._formatPolicy = filePath; + else if (!lineData.formatPolicyStr.compare("bhdpath")) + lineData._formatPolicy = bhdPath; + else if (!lineData.formatPolicyStr.compare("ip")) + lineData._formatPolicy = IP; + else if (!lineData.formatPolicyStr.compare("number")) + lineData._formatPolicy = number; + else if (!lineData.formatPolicyStr.compare("bool")) + lineData._formatPolicy = boolType; - lineData.showName = QString::fromStdString(showName); - lineData._formatPolicy = _formatPolicy; - lineData.value = QString::fromStdString(value); - lineData.valueName = QString::fromStdString(valueName); - returnData.push_back(lineData); + returnData.push_back(lineData); + } + } + catch (...) + { + qDebug() << "read json failure" << fileName; } return returnData; } @@ -349,57 +405,20 @@ public: } void saveJson(QString path) { - // ¹¹½¨ JSON ¶ÔÏó - //QJsonArray jsonArray; - //for (auto& classData : privateJsondatas) - //{ - // for(auto& jsonData: classData) - // for (auto& data : jsonData.second) - // { - // QJsonObject obj1; - // obj1["className"] = data.className; - // obj1["showName"] = data.showName; - // obj1["valueName"] = data.valueName; - - // switch (data.value.type()) { - // case QVariant::Bool: - // obj1["value"] = data.value.toBool(); - // break; - // case QVariant::Int: - // obj1["value"] = data.value.toInt(); - // break; - // case QVariant::Double: - // obj1["value"] = data.value.toDouble(); - // break; - // case QVariant::String: - // obj1["value"] = data.value.toString(); - // break; - // default: - // obj1["value"] = "error"; - // break; - // } - - // obj1["policy"] = data.formatPolicyStr; - // jsonArray.append(obj1); - // } - //} - //std::string sss = path.toStdString(); - - //QJsonDocument jsonDocument(jsonArray); - - //// ±£´æ JSON Îĵµµ½Îļþ - //QFile file(path); - //if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { - // QTextStream out(&file); - // out.setCodec("UTF-8"); - // out << jsonDocument.toJson(); - // file.close(); - // QMessageBox::information(this, "³É¹¦", ""); - // qDebug() << "JSON Îļþ±£´æ³É¹¦"; - //} - //else { - // qDebug() << "ÎÞ·¨±£´æ JSON Îļþ"; - //} + // + nlohmann::json json; + for (auto& data : privateJsondatas[currentPageIndex]) + { + nlohmann::json eachJson; + eachJson["level"] = data.acessLevel; + eachJson["showName"] = data.showName; + eachJson["valueName"] = data.showName; + eachJson["value"] = data.getValueFromQwidget(); + eachJson["policy"] = data.formatPolicyStr; + json.push_back(eachJson); + } + std::string sss = path.toStdString(); + saveJsonFromPath(sss, json); } protected: void resizeEvent(QResizeEvent* event) override { diff --git a/HanddleAI/HandleAiUi-new/front/pages/historyWidget.h b/HanddleAI/HandleAiUi-new/front/pages/historyWidget.h index 6bff9e5d..2df70450 100644 --- a/HanddleAI/HandleAiUi-new/front/pages/historyWidget.h +++ b/HanddleAI/HandleAiUi-new/front/pages/historyWidget.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include class historyWidget :public QWidget { @@ -23,7 +25,9 @@ public: ImageWidget imageWidget; menuListWidget dirListWidget; historyShowListWidget _historyShowListWidget; - historyWidget() + QLabel* imgPosTip = new QLabel(); + std::unordered_map namePairPixmap;//ÐͺŶÔӦͼƬ; + historyWidget() { QPalette palette; palette.setColor(QPalette::WindowText, Qt::white); @@ -53,28 +57,81 @@ public: Layout->addLayout(btnLayout); mainWigetInit(); + loadProductNamePairPixmap(); Layout->addWidget(widgets); QObject::connect(&_historyShowListWidget._historyShowListSubThread, &historyShowListSubThread::readImgSignal, &imageWidget, &ImageWidget::showImgOnGraphicsView); } void mainWigetInit() { imageWidget.setTitle("ͼƬ²é¿´"); - mainWidgetLayout->addWidget(&imageWidget , 0, 0); - mainWidgetLayout->setColumnStretch(0, 5); + mainWidgetLayout->addWidget(&imageWidget , 0, 0,10,10); - mainWidgetLayout->addWidget(&dirListWidget, 0, 1); - mainWidgetLayout->addWidget(&_historyShowListWidget, 0, 2); - mainWidgetLayout->setColumnStretch(1, 1); - mainWidgetLayout->setColumnStretch(2, 2); + mainWidgetLayout->addWidget(&dirListWidget, 0, 10,10,2); + + mainWidgetLayout->addWidget(imgPosTip, 0, 12, 2, 4); + mainWidgetLayout->addWidget(&_historyShowListWidget, 2, 12,8,4); dirListWidget.setStyleSheet("background: transparent;"); QObject::connect(&dirListWidget, &menuListWidget::switchPathSignal, &_historyShowListWidget, &historyShowListWidget::addImgFromPath); + QObject::connect(&dirListWidget, &menuListWidget::switchPathSignal, this, &historyWidget::switchPathProcessSlot); + } + void loadProductNamePairPixmap() + { + namePairPixmap.insert(std::make_pair("Manual", QPixmap("./imgPosTip/Test.jpg"))); + for (auto data : bridge._appConfig->productDatas) + { + namePairPixmap.insert(std::make_pair(data.name,QPixmap(data.imgPosPath.c_str()))); + } + } + bool showProductNamePairPixmap(std::string productName) + { + auto it = namePairPixmap.find(productName); + if (it != namePairPixmap.end()) + { + imgPosTip->setPixmap(it->second); + return true; + } + return false; } public slots: + void switchPathProcessSlot(QString path) + { + //´ÓÎļþ¼ÐÃûÕÒÐͺŠ+ { + QString fileName = fileManager::getFileName(path); + QStringList fileNameList = fileName.split("_"); + if (fileNameList.size() > 1) + { + std::string productName = fileNameList[0].toStdString(); + if(showProductNamePairPixmap(productName) == true); + return; + } + } + //´ÓÎļþÃûÕÒÐͺŠ+ { + std::vectorfiles; + fileManager::getAllFiles(path.toStdString(), files, "",1); + for (auto filePath : files) + { + filePath = fileManager::normalizePathStr(filePath); + QString fileName = fileManager::normalizePathStr(fileManager::getFileName(QString::fromStdString(filePath))); + std::string fileNameStr = fileName.toStdString(); + QStringList fileNameList = fileName.split("_"); + if (fileNameList.size() > 1) + { + std::string productName = fileNameList[0].toStdString(); + if (showProductNamePairPixmap(productName) == true); + return; + } + } + } + + } void widgetJumpWithPath(QString path) { dirListWidget.jumpWithPath(path); _historyShowListWidget._historyShowListSubThread.asyncReadImg(path.toStdString()); + } }; -#pragma once \ No newline at end of file +#pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/front/pages/manualDetWidget.h b/HanddleAI/HandleAiUi-new/front/pages/manualDetWidget.h index 539679e5..75e804ab 100644 --- a/HanddleAI/HandleAiUi-new/front/pages/manualDetWidget.h +++ b/HanddleAI/HandleAiUi-new/front/pages/manualDetWidget.h @@ -110,7 +110,7 @@ public: leftMainLayout->setAlignment(Qt::AlignTop); mainLayout->addLayout(rightMainLayout); - connect(startEvaluateBtn, &QPushButton::clicked, this, [=]() {emit startManualDetSignal(imgPathEdit->text().toStdString(), algoSelect->currentIndex()); }); + connect(startEvaluateBtn, &QPushButton::clicked, this, [=]() {if (imgPathEdit->text().toStdString().compare("")) { emit startManualDetSignal(imgPathEdit->text().toStdString(), algoSelect->currentIndex()); } }); connect(startEvaluateBtn, &QPushButton::clicked, this, [=]() {startEvaluateBtn->setDisabled(true); }); //connect(_manualDetThread, &manualDetThread::finishImgReadSignal,this, &manualDetWidget::finishImgReadSlot); } diff --git a/HanddleAI/HandleAiUi-new/globalStruct.h b/HanddleAI/HandleAiUi-new/globalStruct.h index f00fb967..90e2bad3 100644 --- a/HanddleAI/HandleAiUi-new/globalStruct.h +++ b/HanddleAI/HandleAiUi-new/globalStruct.h @@ -2,6 +2,8 @@ #include #include #include +#include + #pragma execution_character_set("utf-8") #define sColor_blue "51, 56, 69" #define sColor_blueWithWhite "64, 68, 81" @@ -17,8 +19,8 @@ #define sColor_Black "22, 22, 22" #define sColor_BlackWithWhite "45, 45, 45" -#define enableHandleAiModel 1 -#define disableBackEndCheck 0 +#define enableHandleAiModel 0 +#define disableBackEndCheck 1 #define disableeAlgo 0 //窗å�£è®¾ç½® @@ -50,6 +52,11 @@ struct showImgPack int index = -1; QString name = ""; }; +struct historyPack +{ + QPixmap img; + std::shared_ptrfilePath; +}; static QImage cvMatToQImage(cv::Mat& src) { if (src.channels() == 1) { // if grayscale image @@ -105,4 +112,5 @@ Q_DECLARE_METATYPE(imgWidgetShowType) Q_DECLARE_METATYPE(cv::Mat*) Q_DECLARE_METATYPE(cv::Mat) Q_DECLARE_METATYPE(std::string) +Q_DECLARE_METATYPE(historyPack) #pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/main.cpp b/HanddleAI/HandleAiUi-new/main.cpp index b3542f03..c3183693 100644 --- a/HanddleAI/HandleAiUi-new/main.cpp +++ b/HanddleAI/HandleAiUi-new/main.cpp @@ -7,15 +7,17 @@ #include #include #include -#include +#include + #include #include #include #include #include #include -#include #include +#include + void connectSignalAndSlots(MainWindow* front, backEndManager* back) { QObject::connect(back, &backEndManager::sendPixmapImageWidget, front, &MainWindow::recvPixmapImageWidget); @@ -49,7 +51,6 @@ int main(int argc, char* argv[]) sema.release(); //程åº�直接退出 exit(0); - } sema.release(); ////////// @@ -58,6 +59,8 @@ int main(int argc, char* argv[]) qRegisterMetaType("matPtr"); qRegisterMetaType("mat"); qRegisterMetaType("stdString"); + qRegisterMetaType("historyPack"); + appConfig _appConfig; MainWindow w(&_appConfig); w.show(); diff --git a/HanddleAI/HandleAiUi-new/mainwindow.h b/HanddleAI/HandleAiUi-new/mainwindow.h index b55ec71c..ede41115 100644 --- a/HanddleAI/HandleAiUi-new/mainwindow.h +++ b/HanddleAI/HandleAiUi-new/mainwindow.h @@ -228,9 +228,9 @@ public slots: _loadingWidget.initLog->append(strIn); } } - void addDetHistoryData(bool isOK, QString path, QPixmap img) + void addDetHistoryData(bool isOK, historyPack _historyPack) { - _displayWidget->historyImgs->addData(isOK, path, img); + _displayWidget->historyImgs->addData(isOK, _historyPack); } void addDashBoardData(int index, bool value)//增加一个OK/NGæ•°æ�®åˆ°dashboard { diff --git a/HanddleAI/HandleAiUi-new/simpleTools/fileManager.h b/HanddleAI/HandleAiUi-new/simpleTools/fileManager.h index 44992bbe..41a6bfae 100644 --- a/HanddleAI/HandleAiUi-new/simpleTools/fileManager.h +++ b/HanddleAI/HandleAiUi-new/simpleTools/fileManager.h @@ -284,6 +284,26 @@ public: return path.mid(lastSlashIndex + 1, lastDotIndex - lastSlashIndex - 1); } } + //ͳһµØÖ··Ö¸ô·û + static QString normalizePathStr(const QString& address, QChar targetSeparator = '/') { + QString normalizedAddress = address; + for (int i = 0; i < normalizedAddress.size(); ++i) { + if (normalizedAddress[i] == '\\' || normalizedAddress[i] == '/') { + normalizedAddress[i] = targetSeparator; + } + } + return normalizedAddress; + } + //ͳһµØÖ··Ö¸ô·û + static std::string normalizePathStr(const std::string& address, char targetSeparator = '/') { + std::string normalizedAddress = address; + for (char& ch : normalizedAddress) { + if (ch == '\\' || ch == '/') { + ch = targetSeparator; + } + } + return normalizedAddress; + } }; /// /// ×Ô¶¯É¾³ýÎļþ¼Ð£¬Ö§³Ö°´ÈÕÆÚɾ³ý£¬°´´ÅÅÌÊ£ÓàÈÝÁ¿É¾³ý£¬»òÕßÁ½Õß¶¼ÊÇ£¬ÇëÔÚÖ÷Ïß³ÌÉùÃ÷qtimer diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_historyListWidget.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_historyListWidget.h index 7811ec53..0e03ead6 100644 --- a/HanddleAI/HandleAiUi-new/uiModule/uiModule_historyListWidget.h +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_historyListWidget.h @@ -15,38 +15,35 @@ class historyItemWidget : public QWidget { public: QGridLayout* layout = new QGridLayout(this); - + historyPack _historyPack; QLabel* resultLabel = new QLabel(this); QLabel* fileNameLabel = new QLabel(this); - QLabel* filePathHide = new QLabel(this); QLabel* imgShow = new QLabel(); - historyItemWidget(QString title,std::string filePath,QPixmap img , QSize parentSize) + historyItemWidget(QString title, QSize parentSize, historyPack historyPackIn) { - if (img.isNull()) + if (historyPackIn.img.isNull()) return; + _historyPack = historyPackIn; QFont font("΢ÈíÑźÚ", 12, QFont::Bold); + this->setObjectName("historyItemWidget"); resultLabel->setText(title); resultLabel->setFont(font); resultLabel->setStyleSheet("QLabel { color: white; }"); layout->addWidget(resultLabel,0,0); - filePathHide->setText(QString::fromStdString(filePath)); - filePathHide->hide(); - filePathHide->setObjectName("path"); - - fileNameLabel->setText(QString::fromStdString(fileManager::getFileName(filePath))); + fileNameLabel->setText(QString::fromStdString(fileManager::getFileName(*historyPackIn.filePath))); fileNameLabel->setFont(font); fileNameLabel->setStyleSheet("QLabel { color: white; }"); layout->addWidget(fileNameLabel, 1, 0); - int iHeight = img.size().height(); + int iHeight = historyPackIn.img.size().height(); int pHeight = (parentSize.height() / 5); double widthScale = iHeight / pHeight; - img = img.scaled(img.size().width() * widthScale, parentSize.height() / 5, Qt::KeepAspectRatio, Qt::SmoothTransformation); - imgShow->setPixmap(img); + historyPackIn.img = historyPackIn.img.scaled(historyPackIn.img.size().width() * widthScale, parentSize.height() / 5, Qt::KeepAspectRatio, Qt::SmoothTransformation); + imgShow->setPixmap(historyPackIn.img); layout->addWidget(imgShow,0,1); layout->setContentsMargins(0, 0, 0, 0); } @@ -72,7 +69,10 @@ private: continue; QPixmap map; cvMatToQPixMap(mat, map); - addDataSignal((data.second.find("OK") != std::string::npos), QString::fromStdString(data.second), map); + historyPack _historyPack; + _historyPack.filePath = std::shared_ptr(new std::string(data.second)); + _historyPack.img = map; + addDataSignal((data.second.find("OK") != std::string::npos), _historyPack); } else if (data.first == 1) { @@ -105,7 +105,7 @@ public slots: this->start(); } signals: - void addDataSignal(bool isOk,QString, QPixmap img); + void addDataSignal(bool isOk, historyPack _historyPack); void readImgSignal(QPixmap img); }; class historyShowListWidget : public QWidget @@ -148,14 +148,14 @@ public slots: emit asyncReadIconsSignal(files); } - void addData(bool isOk, QString path, QPixmap img) + void addData(bool isOk, historyPack _historyPack) { QString title; if (isOk == true) title = "OK"; else title = "NG"; - QWidget* widget = new historyItemWidget(title, path.toStdString(), img, size()); + QWidget* widget = new historyItemWidget(title,size(), _historyPack); QListWidgetItem* item = new QListWidgetItem(); showDataListWidget->addItem(item); showDataListWidget->setItemWidget(item, widget); @@ -169,17 +169,11 @@ public slots: private slots: void itemClick(QListWidgetItem* item) { - QWidget* widget = showDataListWidget->itemWidget(item); - const QList labels = widget->findChildren(); - for (const QLabel* label : labels) - { - if (label->objectName() == "path") - { - QString path = label->text(); - emit asyncReadImgSignal(path.toStdString()); - emit itemClickSignal(path); - } - } + historyItemWidget* widget = (historyItemWidget*)showDataListWidget->itemWidget(item); + std::string path = *widget->_historyPack.filePath; + QString pathQ = QString::fromStdString(path); + emit asyncReadImgSignal(path); + emit itemClickSignal(pathQ); } signals: void asyncReadImgSignal(std::string); diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageDoubleCheckQdialog.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageDoubleCheckQdialog.h new file mode 100644 index 00000000..d55daff9 --- /dev/null +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageDoubleCheckQdialog.h @@ -0,0 +1,176 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class imageDoubleCheckQdialog :public QDialog +{ + Q_OBJECT +public: + ImageWidgetManager* _ImageWidgetManager = new ImageWidgetManager(); + QWidget* menuBarWidget = new QWidget(); + QPushButton* closeBtn = new QPushButton(this); + fancyButtonText* okBtn = new fancyButtonText(120, 40, "OK", "¼ÌÐø"); + fancyButtonText* ngBtn = new fancyButtonText(120, 40, "NG", "¼ÌÐø"); + imageDoubleCheckQdialog(QPixmap img) + { + QPalette paletteWhite, paletteRed, paletteGreen; + paletteWhite.setColor(QPalette::WindowText, Qt::white); + paletteRed.setColor(QPalette::WindowText, Qt::red); + paletteGreen.setColor(QPalette::WindowText, Qt::green); + QFont font("΢ÈíÑźÚ", 16, QFont::Bold); + QFont font2("΢ÈíÑźÚ", 18, QFont::Bold); + QFont font3("΢ÈíÑźÚ", 12, QFont::Bold); + + this->setObjectName("warnDialog"); + this->setStyleSheet(QString("QDialog#warnDialog {" + "background-color: rgb(%1);" + "border: 1px solid black;" + "border-radius: 1px;}").arg(sColor_blue)); + this->setWindowFlags(Qt::FramelessWindowHint); // ÉèÖÃÎޱ߿òµÄÑùʽ + this->setFixedSize(QSize(minWidth, minHeight)); + + QGridLayout* layout = new QGridLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + + menuBarWidget->setStyleSheet(QString("QWidget { background-color: black;" + "border: 0px solid red;" // ÏÔʽÉèÖñ߿ò + "border-radius: 0px;" // ÉèÖñ߿ò°ë¾¶Îª0£¬È·±£Ã»ÓÐÔ²½Ç + "}")); + menuBarWidget->setFixedHeight(35); + menuBarWidget->setFixedWidth(minWidth); + + QHBoxLayout* menuBarLayout = new QHBoxLayout(menuBarWidget); + menuBarLayout->setContentsMargins(0, 0, 0, 0); + + QHBoxLayout* menuBarLayoutLeft = new QHBoxLayout(); + menuBarLayoutLeft->setContentsMargins(0, 0, 0, 0); + menuBarLayoutLeft->setAlignment(Qt::AlignLeft); + + QHBoxLayout* menuBarLayoutRight = new QHBoxLayout(); + menuBarLayoutRight->setContentsMargins(0, 0, 0, 0); + menuBarLayoutRight->setAlignment(Qt::AlignRight); + + menuBarLayout->addLayout(menuBarLayoutLeft); + menuBarLayout->addLayout(menuBarLayoutRight); + + QLabel* warnLabel = new QLabel(); + warnLabel->setAlignment(Qt::AlignLeft); + warnLabel->setFont(font); + warnLabel->setText("ÇëÈ·ÈÏÊÇ·ñNG"); + warnLabel->setPalette(paletteWhite); + menuBarLayoutLeft->addWidget(warnLabel); + + closeBtn->setIcon(QPixmap(":/topBar/icon/close.png")); // ÉèÖÃͼ±ê + closeBtn->setFixedHeight(35); + closeBtn->setStyleSheet(QString("QPushButton { background-color: transparent;" + "border: 0px solid red;" // ÏÔʽÉèÖñ߿ò + "border-radius: 0px;" // ÉèÖñ߿ò°ë¾¶Îª0£¬È·±£Ã»ÓÐÔ²½Ç + "}" + "QPushButton:focus {" + " outline: none;" + "}" + "QPushButton:hover { background-color: rgb(%1); }").arg(sColor_Red)); // ÉèÖÃ͸Ã÷±³¾°ºÍÐüͣʱµÄ±³¾°É« + closeBtn->setFixedHeight(35); + closeBtn->setFixedWidth(50); + menuBarLayoutRight->addWidget(closeBtn); + + QObject::connect(closeBtn, &QPushButton::clicked, this, &QDialog::close); + + QHBoxLayout* imageViewLayout = new QHBoxLayout(); + imageViewLayout->addWidget(_ImageWidgetManager); + + _ImageWidgetManager->createViewer(""); + _ImageWidgetManager->disableAllSwitchBtn(); + _ImageWidgetManager->showImg(img, imgWidgetShowType::imgWidgetOri, 0); + QHBoxLayout* okngBtnLayout = new QHBoxLayout(); + okngBtnLayout->addWidget(okBtn); + okngBtnLayout->addWidget(ngBtn); + + QObject::connect(okBtn, &QPushButton::clicked, this, &QDialog::close); + QObject::connect(ngBtn, &QPushButton::clicked, this, &QDialog::close); + QObject::connect(okBtn, &QPushButton::clicked, this, [=]() {emit okSignal(); }); + QObject::connect(ngBtn, &QPushButton::clicked, this, [=]() {emit ngSignal(); }); + + layout->addWidget(menuBarWidget, 0, 0); + layout->addLayout(imageViewLayout, 1, 0); + layout->addLayout(okngBtnLayout, 2, 0); + this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); + this->show(); + } +signals: + void okSignal(); + void ngSignal(); +private: + bool isMoving = false; + bool isResizing = false; + int minWidth = 720, minHeight = 480; + QSize originalSize; + //´°¿ÚÒÆ¶¯ +#pragma region ´°¿ÚÒÆ¶¯±äÁ¿ + QPoint startPos; + QRect startFrameGeometry; + QTime lastWindowMoveTime; + int freshDelay = 1000 / windowMoveFreshRate; + bool setNormalAndMove = false;//ÅжÏÊÇ·ñ´Ó×î´ó»¯¿ªÊ¼Òƶ¯ +#pragma endregion +protected: + void mousePressEvent(QMouseEvent* event) override { + QPoint pos = event->pos(); + std::cout << "y" << pos.y() << " x" << pos.x() << std::endl; + if (pos.y() < 35)//±êÌâÀ¸ + { + if (event->button() == Qt::LeftButton) { + startPos = event->globalPos(); + startFrameGeometry = frameGeometry(); + isMoving = true; + lastWindowMoveTime.start(); // °´ÏÂʱ¿ªÊ¼¼ÆÊ± + } + } + else if (pos.x() < 10 || //×ó±ß¿ò + pos.x() > this->size().width()-10 || //ϱ߿ò + pos.y() > this->size().height() - 10)//Óұ߿ò + { + if (event->button() == Qt::LeftButton) { + isResizing = true; + startPos = event->globalPos(); + originalSize = size(); + } + } + QDialog::mousePressEvent(event); + } + void mouseMoveEvent(QMouseEvent* event) override { + if (event->buttons() == Qt::LeftButton) + { + if (isMoving) { + QPoint pos = event->globalPos(); + if (std::max(std::abs(pos.x() - startPos.x()), std::abs(pos.y() - startPos.y())) > 10) + if (lastWindowMoveTime.elapsed() > freshDelay)//ÿÃëË¢ÐÂ100´Î + { + lastWindowMoveTime.restart(); + move(startFrameGeometry.topLeft() + (event->globalPos() - startPos)); + } + } + if (isResizing) { + QPoint delta = event->globalPos() - startPos; + QSize newSize = originalSize + QSize(delta.x(), delta.y()); + setFixedSize(std::max(minWidth ,newSize.width()), std::max(minHeight, newSize.height())); + menuBarWidget->setFixedWidth(std::max(minWidth, newSize.width())); + } + } + QDialog::mouseMoveEvent(event); + } + void mouseReleaseEvent(QMouseEvent* event) override { + if (event->button() == Qt::LeftButton) { + isMoving = false; + isResizing = false; + } + QDialog::mouseReleaseEvent(event); + } +}; +#pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageView.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageView.h index 2eecfee2..ea75a756 100644 --- a/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageView.h +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_imageView.h @@ -175,6 +175,7 @@ private: class ImageWidget : public QWidget { Q_OBJECT public: + fancyButton* switchBtn; ImageWidget(QWidget* parent = nullptr) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(5, 5, 5, 5); @@ -201,7 +202,7 @@ public: hLayout->addWidget(label); hLayout->addWidget(label2); hLayout->setContentsMargins(0, 0, 0, 0); - fancyButton* switchBtn = new fancyButton( + switchBtn = new fancyButton( 30, 30, QIcon(":/topBar/icon/switch.png"), @@ -352,6 +353,11 @@ public: QMutex mutex; QList< ImageWidget*>ImageWidgetList; std::unordered_mapmap; + void disableAllSwitchBtn() + { + for (auto widget : ImageWidgetList) + widget->switchBtn->hide(); + } bool showImg(QPixmap img, imgWidgetShowType _type, int index) { diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_menuListWdiget.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_menuListWdiget.h index 0c3b91a1..b51a2fbd 100644 --- a/HanddleAI/HandleAiUi-new/uiModule/uiModule_menuListWdiget.h +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_menuListWdiget.h @@ -47,6 +47,7 @@ public: pathList.append(basePath); refreshListWidget(); targetDepth = pathList.size(); + depth = targetDepth; _toolItemWidget->returnBtn->setDisabled(true); _toolItemWidget->homeBtn->setDisabled(true); QObject::connect(this, &QListWidget::itemClicked, this, &menuListWidget::itemClick); @@ -97,7 +98,7 @@ public: } void toMenu() { - jumpWithPath(basePath); + jumpWithPath(basePath+"\\"); } void jumpWithPath(QString path) { @@ -110,10 +111,10 @@ public: return; //дÈë - std::string fileName = fileManager::getFileName(path.toStdString()); + //std::string fileName = fileManager::getFileName(path.toStdString()); pathList.clear(); for (auto str : list) - if (str.contains(QString::fromStdString(fileName)) == false) + //if (str.contains(QString::fromStdString(fileName)) == false) pathList.append(str); depth = pathList.size() - 1; diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h index 812e6b8c..8fa54bf3 100644 --- a/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h @@ -15,6 +15,7 @@ #include #include #include +#include class switchProductWidget : public QWidget { @@ -26,12 +27,16 @@ public: int* currentProductIndexPtr; // std::string fileDir = "./config/productConfig"; - QLabel* staticLabel = new QLabel(this); QVBoxLayout* layout = new QVBoxLayout(this); fancyButtonText* switchBtn = new fancyButtonText(100, 60, "ÐÞ¸Ä", "Ð޸ĵ±Ç°»úÐÍ"); + QLabel* armHeartBeatSign = new QLabel(); fancyButtonText* startBtn; + QLineEdit* snIntputLine = new QLineEdit(); + //ÁϺÅÏÔʾ QComboBox* productSelect = new QComboBox(this); QLabel* currentProduct = new QLabel(this); + //ÁϺÅÀàÐÍ + QComboBox* productNameTypeSwitch = new QComboBox(this); switchProductWidget() { currentProductIndexPtr = &bridge.currentProductIndex; @@ -41,10 +46,14 @@ public: this->setLayout(layout); { QHBoxLayout* switchLayout = new QHBoxLayout(); - staticLabel->setText("µ±Ç°ÐͺÅ:"); - staticLabel->setFont(font); - staticLabel->setPalette(palette); - switchLayout->addWidget(staticLabel); + productNameTypeSwitch->addItem("ÐͺÅ:"); + productNameTypeSwitch->addItem("¿Í»§ÁϺÅ:"); + productNameTypeSwitch->addItem("¸»Ê¿¿µÁϺÅ:"); + + productNameTypeSwitch->setPalette(palette); + productNameTypeSwitch->setFont(font); + productNameTypeSwitch->setFixedWidth(150); + switchLayout->addWidget(productNameTypeSwitch); productSelect->setPalette(palette); productSelect->setFont(font); @@ -60,18 +69,27 @@ public: layout->addLayout(switchLayout); } - startBtn = new fancyButtonText(300, 60, "ÔËÐÐ", "ÔËÐмì²â³ÌÐò"); - layout->addWidget(startBtn); - fresh(); + snIntputLine->setFixedHeight(50); + snIntputLine->setFont(font); + + QHBoxLayout* hBtnLayout = new QHBoxLayout(); + startBtn = new fancyButtonText(80, -1, "ÔËÐÐ", "ÔËÐмì²â³ÌÐò"); + hBtnLayout->addWidget(snIntputLine); + hBtnLayout->addWidget(startBtn); + + layout->addLayout(hBtnLayout); + productSelectFresh(0); connect(startBtn, &QPushButton::clicked, this, [=]() { - emit startArmProgramSignal(productSelect->currentIndex()); + emit startArmProgramSignal(productSelect->currentIndex(), snIntputLine->text()); }); connect(switchBtn, &QPushButton::clicked, this, &switchProductWidget::startSwitch); connect(productSelect, &QComboBox::currentTextChanged, this, &switchProductWidget::currentProductSwitch); + connect(productNameTypeSwitch, &QComboBox::currentTextChanged, this, [=]() {productSelectFresh(productNameTypeSwitch->currentIndex()); }); } - void fresh() + void productSelectFresh(int index) { + int indexTemp = std::max(productSelect->currentIndex(), 0); productSelect->clear(); if (bridge._appConfig->productDatas.size() == 0) { @@ -80,26 +98,48 @@ public: QString("Çë²é¿´%1ÖÐÊÇ·ñÕýÈ·´æ·ÅÅäÖÃÎļþ").arg(QString::fromStdString(fileDir))); return; } - for (auto data : bridge._appConfig->productDatas) - productSelect->addItem(QString::fromStdString(data.name)); - currentProduct->setText(QString::fromStdString(bridge._appConfig->productDatas[0].name)); + switch(index) + { + case 0: + for (auto data : bridge._appConfig->productDatas) + productSelect->addItem(QString::fromStdString(data.name)); + currentProduct->setText(QString::fromStdString(bridge._appConfig->productDatas[indexTemp].name)); + break; + case 1: + for (auto data : bridge._appConfig->productDatas) + productSelect->addItem(QString::fromStdString(data.customerPartNumber)); + currentProduct->setText(QString::fromStdString(bridge._appConfig->productDatas[indexTemp].customerPartNumber)); + break; + case 2: + for (auto data : bridge._appConfig->productDatas) + productSelect->addItem(QString::fromStdString(data.foxconnPartNumber)); + currentProduct->setText(QString::fromStdString(bridge._appConfig->productDatas[indexTemp].foxconnPartNumber)); + break; + } + productSelect->setCurrentIndex(indexTemp); } public slots: + void setHeatBeat() + { + + } void switchStartBtnStatus(bool status) { if (status == true) { startBtn->toDefault(); startBtn->setText("ÔËÐÐ"); + snIntputLine->setDisabled(false); } else { startBtn->toRed(); startBtn->setText("¼±Í£"); + snIntputLine->setDisabled(true); } } signals: - void startArmProgramSignal(int); + void startArmProgramSignal(int,QString); private: int siwtchBtnState = 0; private slots: @@ -129,7 +169,8 @@ private slots: *currentProductIndexPtr = index; currentProduct->setText(input); - + if (siwtchBtnState == 1) + return; startSwitch(); } }; diff --git a/lib/Hd_3DCameraLMI_module_PointLazer.exp b/lib/Hd_3DCameraLMI_module_PointLazer.exp index 88c61749..b70953a7 100644 Binary files a/lib/Hd_3DCameraLMI_module_PointLazer.exp and b/lib/Hd_3DCameraLMI_module_PointLazer.exp differ diff --git a/lib/Hd_3DCameraLMI_module_PointLazer.lib b/lib/Hd_3DCameraLMI_module_PointLazer.lib index 36c75b14..b506c2ad 100644 Binary files a/lib/Hd_3DCameraLMI_module_PointLazer.lib and b/lib/Hd_3DCameraLMI_module_PointLazer.lib differ diff --git a/lib/Hd_DalsaCamera_module.exp b/lib/Hd_DalsaCamera_module.exp index db9cc928..9c60276f 100644 Binary files a/lib/Hd_DalsaCamera_module.exp and b/lib/Hd_DalsaCamera_module.exp differ diff --git a/lib/Hd_DalsaCamera_module.lib b/lib/Hd_DalsaCamera_module.lib index cc2d36e5..c271a24e 100644 Binary files a/lib/Hd_DalsaCamera_module.lib and b/lib/Hd_DalsaCamera_module.lib differ diff --git a/lib/Hd_FinsTcp_module.exp b/lib/Hd_FinsTcp_module.exp index a1b15cae..2ba9e5fa 100644 Binary files a/lib/Hd_FinsTcp_module.exp and b/lib/Hd_FinsTcp_module.exp differ diff --git a/lib/Hd_FinsTcp_module.lib b/lib/Hd_FinsTcp_module.lib index a50e177e..e7784b3e 100644 Binary files a/lib/Hd_FinsTcp_module.lib and b/lib/Hd_FinsTcp_module.lib differ diff --git a/lib/Hd_MvCamera_module_GENTL.exp b/lib/Hd_MvCamera_module_GENTL.exp index 607e07c8..5b9c4dde 100644 Binary files a/lib/Hd_MvCamera_module_GENTL.exp and b/lib/Hd_MvCamera_module_GENTL.exp differ diff --git a/lib/Hd_MvCamera_module_GENTL.lib b/lib/Hd_MvCamera_module_GENTL.lib index a65c613a..4010f0a3 100644 Binary files a/lib/Hd_MvCamera_module_GENTL.lib and b/lib/Hd_MvCamera_module_GENTL.lib differ diff --git a/lib/Hd_MvCamera_module_GIGE.exp b/lib/Hd_MvCamera_module_GIGE.exp index 5c609989..f1841164 100644 Binary files a/lib/Hd_MvCamera_module_GIGE.exp and b/lib/Hd_MvCamera_module_GIGE.exp differ diff --git a/lib/Hd_MvCamera_module_GIGE.lib b/lib/Hd_MvCamera_module_GIGE.lib index b1396b9b..110ae8d7 100644 Binary files a/lib/Hd_MvCamera_module_GIGE.lib and b/lib/Hd_MvCamera_module_GIGE.lib differ diff --git a/lib/Hd_ResultsSummary_module.exp b/lib/Hd_ResultsSummary_module.exp index 0f57bb66..4426c915 100644 Binary files a/lib/Hd_ResultsSummary_module.exp and b/lib/Hd_ResultsSummary_module.exp differ diff --git a/lib/Hd_ResultsSummary_module.lib b/lib/Hd_ResultsSummary_module.lib index a61fbd40..8baafc1c 100644 Binary files a/lib/Hd_ResultsSummary_module.lib and b/lib/Hd_ResultsSummary_module.lib differ diff --git a/lib/Hd_SocketModule_ModbusTcp.exp b/lib/Hd_SocketModule_ModbusTcp.exp index 4e86b6bb..e9596cc0 100644 Binary files a/lib/Hd_SocketModule_ModbusTcp.exp and b/lib/Hd_SocketModule_ModbusTcp.exp differ diff --git a/lib/Hd_SocketModule_ModbusTcp.lib b/lib/Hd_SocketModule_ModbusTcp.lib index 5ec47732..b3ff8f19 100644 Binary files a/lib/Hd_SocketModule_ModbusTcp.lib and b/lib/Hd_SocketModule_ModbusTcp.lib differ