diff --git a/3part/tadpole/include/tpBase/lpbengine.h b/3part/tadpole/include/tpBase/lpbengine.h index 87ec912..59f5f9f 100644 Binary files a/3part/tadpole/include/tpBase/lpbengine.h and b/3part/tadpole/include/tpBase/lpbengine.h differ diff --git a/runner17/algorithmLib/caliCenter.dll b/runner17/algorithmLib/caliCenter.dll index 180b891..516634e 100644 Binary files a/runner17/algorithmLib/caliCenter.dll and b/runner17/algorithmLib/caliCenter.dll differ diff --git a/runner17/algorithmLib/caliValve.dll b/runner17/algorithmLib/caliValve.dll index 1f88056..a471165 100644 Binary files a/runner17/algorithmLib/caliValve.dll and b/runner17/algorithmLib/caliValve.dll differ diff --git a/runner17/algorithmLib/valveDetector.dll b/runner17/algorithmLib/valveDetector.dll index cba7cbe..72c0434 100644 Binary files a/runner17/algorithmLib/valveDetector.dll and b/runner17/algorithmLib/valveDetector.dll differ diff --git a/src/lpbdesigner/AlgorithmParamMgrDlg.ui b/src/lpbdesigner/AlgorithmParamMgrDlg.ui index f2a88b7..657132b 100644 --- a/src/lpbdesigner/AlgorithmParamMgrDlg.ui +++ b/src/lpbdesigner/AlgorithmParamMgrDlg.ui @@ -18,16 +18,16 @@ - 2 + 5 - 2 + 5 - 2 + 5 - 2 + 5 diff --git a/src/lpbdesigner/CDetectorUI.cpp b/src/lpbdesigner/CDetectorUI.cpp index b2f4185..c9f8bff 100644 --- a/src/lpbdesigner/CDetectorUI.cpp +++ b/src/lpbdesigner/CDetectorUI.cpp @@ -1,5 +1,5 @@ #include "CDetectorUI.h" - +#define WINDOW_ICON ":/resource/app.png" CDetectorUI::CDetectorUI() { m_pMainFrame = new CMainFrame; @@ -39,7 +39,7 @@ bool CDetectorUI::ShowMainFrame(class QWidget* parent) m_pMainFrame->setParent(parent); m_pMainFrame->setWindowFlags(Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); - m_pMainFrame->setWindowIcon(QIcon(":/image/leaper")); + m_pMainFrame->setWindowIcon(QIcon(WINDOW_ICON)); m_pMainFrame->setWindowModality(Qt::ApplicationModal); m_pMainFrame->setAttribute(Qt::WA_ShowModal, true); diff --git a/src/lpbdesigner/DsgAlgorithmParamMgr.cpp b/src/lpbdesigner/DsgAlgorithmParamMgr.cpp index 70147eb..677dc76 100644 --- a/src/lpbdesigner/DsgAlgorithmParamMgr.cpp +++ b/src/lpbdesigner/DsgAlgorithmParamMgr.cpp @@ -2,6 +2,7 @@ #include "ui_AlgorithmParamMgrDlg.h" #include #pragma execution_character_set("utf-8") +#define WINDOW_ICON ":/resource/app.png" CDsgAlgorithmParamMgrDlg::CDsgAlgorithmParamMgrDlg(QWidget *parent) : QDialog(parent) { m_pTask = NULL; @@ -9,7 +10,7 @@ CDsgAlgorithmParamMgrDlg::CDsgAlgorithmParamMgrDlg(QWidget *parent) : QDialog(pa ui = new Ui::AlgorithmParamMgrDialog; ui->setupUi(this); m_type = PARAM_IN; - setWindowIcon(QIcon(":/img/resource/app.png")); + setWindowIcon(QIcon(WINDOW_ICON)); connect(ui->pushButton_6, SIGNAL(clicked()), this, SLOT(accept())); connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(OnAddParam())); connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(OnEditParam())); @@ -114,7 +115,6 @@ bool CDsgAlgorithmParamMgrDlg::InitGraphView() nIndex++; } delete[] lppParam; - } return true; @@ -192,10 +192,6 @@ QString CDsgAlgorithmParamMgrDlg::showVariant(const AlgoParamType type, const QV { QString strResult = "(%1,%2,%3,%4)"; strResult = strResult.arg(item.second.at(0)).arg(item.second.at(1)).arg(item.second.at(2)).arg(item.second.at(3)); - // itemJson.insert("roi_item_value1", item.second.at(0)); - // itemJson.insert("roi_item_value2", item.second.at(1)); - // itemJson.insert("roi_item_value3", item.second.at(2)); - // itemJson.insert("roi_item_value4", item.second.at(3)); return strResult; break; } @@ -204,9 +200,6 @@ QString CDsgAlgorithmParamMgrDlg::showVariant(const AlgoParamType type, const QV QString strResult = "(%1,%2,%3)"; strResult = strResult.arg(item.second.at(0)).arg(item.second.at(1)).arg(item.second.at(2)); return strResult; - // itemJson.insert("roi_item_value1", item.second.at(0)); - // itemJson.insert("roi_item_value2", item.second.at(1)); - // itemJson.insert("roi_item_value3", item.second.at(2)); break; } case POLY: @@ -228,18 +221,14 @@ QString CDsgAlgorithmParamMgrDlg::showVariant(const AlgoParamType type, const QV return var.toString(); } - bool CDsgAlgorithmParamMgrDlg::OnAddParam() { if (!m_tParamDlg.InitGraphView()) return false; - PLP_ALGORITHM_PARAM pParam = m_tParamDlg.ShowParamDlg(NULL); - if (pParam) { int nRowCount = ui->tableWidget->rowCount(); - ui->tableWidget->setRowCount(nRowCount + 1); ui->tableWidget->setItem(nRowCount, 0, new QTableWidgetItem(QString::number(pParam->nID))); ui->tableWidget->setItem(nRowCount, 1, new QTableWidgetItem(pParam->strName)); @@ -263,7 +252,6 @@ bool CDsgAlgorithmParamMgrDlg::OnDeleteParam() QTableWidgetItem*item = items.at(0); if (item) { - QMessageBox msgBox(QMessageBox::Warning, QObject::tr("提示"), QObject::tr("确认删除?"), 0, this); msgBox.addButton(QObject::tr("是"), QMessageBox::AcceptRole); msgBox.addButton(QObject::tr("否"), QMessageBox::RejectRole); @@ -278,15 +266,8 @@ bool CDsgAlgorithmParamMgrDlg::OnDeleteParam() ui->tableWidget->removeRow(nRowIndex); return true; } - else - { - } - - } - } - return false; } @@ -302,18 +283,15 @@ bool CDsgAlgorithmParamMgrDlg::OnEditParam() if (item) { QString strParaName = item->text(); - //int nCurrentID = item->text().toInt(); AlgoParamType type; PLP_ALGORITHM_PARAM pParam = NULL; if (m_type == PARAM_IN) { pParam = m_pAlgo->GetParamByName(strParaName); - //pParam = m_pAlgo->GetParam(nCurrentID); } else if (m_type == PARAM_OUT) { pParam = m_pAlgo->GetOutParamByName(strParaName); - //pParam = m_pAlgo->GetOutParam(nCurrentID); } if (pParam) @@ -330,12 +308,10 @@ bool CDsgAlgorithmParamMgrDlg::OnEditParam() return true; } } - } return false; } - bool CDsgAlgorithmParamMgrDlg::OnPopMenu(const QPoint&) { QMenu menu; @@ -346,22 +322,6 @@ bool CDsgAlgorithmParamMgrDlg::OnPopMenu(const QPoint&) if (selectedAction == insertParamAction) { OnEditParam(); - /*if (!m_tParamDlg.InitGraphView()) - return false; - - PLP_ALGORITHM_PARAM pParam = m_tParamDlg.ShowParamDlg(NULL); - if (pParam) - { - int nRowIndex = ui->tableWidget->currentRow(); - if (m_pAlgo->InsertParamOrder(pParam->nID, ui->tableWidget->currentRow())) - { - - } - - InitGraphView(); - ui->tableWidget->setCurrentItem(ui->tableWidget->item(nRowIndex, 0)); - }*/ - } menu.clear(); @@ -403,9 +363,7 @@ bool CDsgAlgorithmParamMgrDlg::OnUpMove() m_pAlgo->SwapParamOrder(nCurrentID, nSwapID); SystemStateInfo::bParamStateFlag = true; return true; - } - } } return false; @@ -458,14 +416,6 @@ bool CDsgAlgorithmParamMgrDlg::OnDownMove() PLP_ALGORITHM_PARAM CDsgAlgorithmParamMgrDlg::ShowParamMgrDlg(IDetectorAlgorithm* lpAlgo) { -// if (this->exec() == QDialog::Accepted) -// { -//// return GetCurrentDevice(); -//// m_pSink->OnSetParam(m_pTask); -// return NULL; -// } - - //open(); show(); return NULL; } diff --git a/src/lpbdesigner/DsgParamDlg.cpp b/src/lpbdesigner/DsgParamDlg.cpp index 3b4aaad..d154cff 100644 --- a/src/lpbdesigner/DsgParamDlg.cpp +++ b/src/lpbdesigner/DsgParamDlg.cpp @@ -1,6 +1,6 @@ #include "DsgParamDlg.h" #include "ui_ParamDlg.h" - +#define WINDOW_ICON ":/resource/app.png" CDsgParamDlg::CDsgParamDlg(QWidget *parent) : QDialog(parent), m_valueCombox(this), m_tRoiDlg(this)/*, m_roiButton(this)*/ { ui = new Ui::ParamDlg; @@ -9,7 +9,7 @@ CDsgParamDlg::CDsgParamDlg(QWidget *parent) : QDialog(parent), m_valueCombox(thi m_type = PARAM_IN; ui->setupUi(this); - setWindowIcon(QIcon(":/img/resource/app.png")); + setWindowIcon(QIcon(WINDOW_ICON)); ui->pushButton->setShortcut(QKeySequence::InsertParagraphSeparator); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(OnOk())); connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(OnCancel())); @@ -19,7 +19,6 @@ CDsgParamDlg::CDsgParamDlg(QWidget *parent) : QDialog(parent), m_valueCombox(thi connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeParamType())); connect(ui->comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeAlgo())); - connect(ui->m_pbROISet, SIGNAL(clicked()), this, SLOT(OnShowRoiDlg())); } @@ -132,7 +131,6 @@ bool CDsgParamDlg::OnChangeAlgo() nComBoxIndex++; } } - } } } @@ -142,56 +140,23 @@ bool CDsgParamDlg::OnChangeAlgo() bool CDsgParamDlg::OnShowRoiDlg() { + if (m_pTask->GetTaskInfo()->templateImg.data == NULL) + { + QMessageBox infobox(QMessageBox::Critical, tr("提示"), tr("请设置标定图再进行ROI标定!"), QMessageBox::Yes, this); + infobox.setWindowIcon(QIcon(WINDOW_ICON)); + infobox.setButtonText(QMessageBox::Yes, tr("确认")); + infobox.exec(); + return false; + } if (!m_tRoiDlg.Initialize(m_pDE, m_pAlgo, m_pTask)) return false; m_tRoiData.img = m_pTask->GetTaskInfo()->templateImg; + m_tRoiDlg.setParent(this); + m_tRoiDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + m_tRoiDlg.setWindowIcon(QIcon(WINDOW_ICON)); + m_tRoiDlg.setWindowModality(Qt::ApplicationModal); + m_tRoiDlg.setAttribute(Qt::WA_ShowModal, true); m_tRoiData = m_tRoiDlg.ShowRoiDlg(m_tRoiData); - - - /*///ROI Test - QVariant value; - QByteArray byteArray; - - int nRecordCount = pROI->EnumRecord(NULL, 0); - - if (nRecordCount > 0) - { - IDetectorRecord** lppRecord = new IDetectorRecord*[nRecordCount]; - nRecordCount = pROI->EnumRecord(lppRecord, nRecordCount); - - QMap mapRecord; - for (int i = 0; i < nRecordCount; i++) - { - - int nItemCount = lppRecord[i]->EnumItem(NULL, 0); - if (nItemCount > 0) - { - PLP_DETECTOR_ROI_RECORD_ITEM* lppItem = new PLP_DETECTOR_ROI_RECORD_ITEM[nItemCount]; - nItemCount = lppRecord[i]->EnumItem(lppItem, nItemCount); - - QList listItem; - - for (int j = 0; j < nItemCount; j++) - { - QList listPoint; - - listItem.push_back(listPoint); - } - - mapRecord.insert(QString::number(lppRecord[i]->GetID()), listItem); - - } - } - - value = mapRecord; - }*/ - - //cv::Mat a = value.value(); - - //QMap record = value.toMap(); - - /// - return true; } @@ -218,7 +183,6 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) ui->comboBox_3->setCurrentIndex(srcParmID > 0 ? srcParmID : 0); if (pParam->type == LP_ROI) m_tRoiData = pParam->value.value(); - } else { @@ -238,8 +202,7 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) QDesktopWidget* desktop = QApplication::desktop();// move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2); - if (this->exec() == QDialog::Accepted) - { + if (this->exec() == QDialog::Accepted) { SystemStateInfo::bParamStateFlag = true; LP_ALGORITHM_PARAM tParam; tParam.strName = ui->lineEdit->text(); @@ -251,9 +214,7 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) tParam.bIsSave = ui->checkBox->isChecked(); tParam.bIsLock = ui->checkBox_2->isChecked(); - - if (pParam) - { + if (pParam) { pParam->strName = tParam.strName; pParam->type = tParam.type; pParam->nSrcAlgoID = tParam.nSrcAlgoID; @@ -271,107 +232,16 @@ PLP_ALGORITHM_PARAM CDsgParamDlg::ShowParamDlg(PLP_ALGORITHM_PARAM pParam) else if (m_type == PARAM_OUT) pNewParam = m_pAlgo->AddOutParam(&tParam); - if (pNewParam) - { + if (pNewParam) { return pNewParam; } - } - return NULL; } int CDsgParamDlg::GetTypeIndex(AlgoParamType type) { return type; - - int nIndex; - switch (type) - { - case LP_INT: - { - nIndex = 0; - break; - } - case LP_BOOLEAN: - { - nIndex = 1; - break; - } - case LP_STRING: - { - nIndex = 2; - break; - } - case LP_DOUBLE: - { - nIndex = 3; - break; - } - case LP_IMAGE: - { - nIndex = 4; - break; - } - case LP_POINT: - { - nIndex = 5; - break; - } - case LP_POINTF: - { - nIndex = 6; - break; - } - case LP_RECT: - { - nIndex = 7; - break; - } - case LP_RECTF: - { - nIndex = 8; - break; - } - case LP_ROI: - { - nIndex = 9; - break; - } - case LP_MAT: - { - nIndex = 10; - break; - } - case LP_LIST_INT: - { - nIndex = 11; - break; - } - case LP_LIST_BOOLEAN: - { - nIndex = 12; - break; - } - case LP_LIST_STRING: - { - nIndex = 13; - break; - } - case LP_LIST_DOUBLE: - { - nIndex = 14; - } - case LP_USER: - { - nIndex = 15; - } - - default: - break; - } - - return nIndex; } void CDsgParamDlg::CleanUp() @@ -410,12 +280,6 @@ void CDsgParamDlg::InitValueCtrl(AlgoParamType type, PLP_ALGORITHM_PARAM pParam) break; } case LP_STRING: - //{ - // ui->lineEdit_2->setHidden(false); - // m_valueCombox.setHidden(true); - // m_roiButton.setHidden(true); - // break; - //} case LP_DOUBLE: { ui->label_2->setHidden(false); @@ -464,37 +328,6 @@ void CDsgParamDlg::InitValueCtrl(AlgoParamType type, PLP_ALGORITHM_PARAM pParam) { break; } - //case LP_ALGO: - //{ - // ui->lineEdit_2->setHidden(true); - // m_valueCombox.setHidden(false); - // m_valueCombox.clear(); - // int nCurrentIndex = 0; - // int nAlgoCount = m_pTask->EnumAlgorithm(NULL, 0); - // if (nAlgoCount > 0) - // { - // IDetectorAlgorithm** lppAlgo = new IDetectorAlgorithm*[nAlgoCount]; - // nAlgoCount = m_pTask->EnumAlgorithm(lppAlgo, nAlgoCount); - // for (int i = 0; i < nAlgoCount; i++) - // { - // if (lppAlgo[i]) - // { - // m_valueCombox.insertItem(i, lppAlgo[i]->GetAlgorithmInfo()->strName, lppAlgo[i]->GetID()); - - // if (pParam && lppAlgo[i]->GetID() == pParam->value.toInt()) - // { - // nCurrentIndex = i; - // } - // } - - // } - // } - - // if (pParam) - // m_valueCombox.setCurrentIndex(nCurrentIndex); - - // break; - //} default: break; } @@ -551,10 +384,6 @@ QVariant CDsgParamDlg::GetCtrlValue(AlgoParamType type) { } - //case LP_ALGO: - //{ - // return m_valueCombox.itemData(m_valueCombox.currentIndex()).toInt(); - //} default: break; } diff --git a/src/lpbdesigner/DsgRoiDlg.cpp b/src/lpbdesigner/DsgRoiDlg.cpp index 67d6cec..96a45b2 100644 --- a/src/lpbdesigner/DsgRoiDlg.cpp +++ b/src/lpbdesigner/DsgRoiDlg.cpp @@ -3,12 +3,7 @@ #include "colossusbase.h" #include "QPalette" #pragma execution_character_set("utf-8") -/* -RECTANGLE = 0, -CIRCLE, -ELLIPSE, -POLY -*/ + bool subDevListSort(const Item_List &info1, const Item_List &info2) { if (info1.size() < 0 || info2.size() < 0) @@ -45,9 +40,7 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) SystemStateInfo::rgb = QColor(255, 0, 0).rgb(); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(OnOk())); connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(OnCancel())); - //connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(OnRectangle())); connect(ui->pushButton_7, SIGNAL(clicked()), this, SLOT(OnCircle())); - //connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(OnEllipse())); connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(OnShowColorDlg())); ui->pushButton_8->setAutoDefault(false); @@ -55,14 +48,9 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) connect(ui->m_pbLeft, SIGNAL(clicked()), this, SLOT(OnMove())); connect(ui->m_pbRight, SIGNAL(clicked()), this, SLOT(OnMove())); connect(ui->m_pbDown, SIGNAL(clicked()), this, SLOT(OnMove())); - - //connect(ui->pushButton_14, SIGNAL(clicked()), this, SLOT(OnSelectImage())); - //connect(ui->pushButton_15, SIGNAL(clicked()), this, SLOT(OnSnapCameraImage())); connect(ui->pushButton_16, SIGNAL(clicked()), this, SLOT(OnZoomOut())); connect(ui->pushButton_17, SIGNAL(clicked()), this, SLOT(OnZoomIn())); - connect(this, SIGNAL(sgShowCameraImage(QImage)), this, SLOT(OnShowCameraImage(QImage))); - connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnShowTenFlag())); ui->pushButton_5->setText(QObject::tr("显示定位线")); m_pRoiScene = new RoiScene(this); @@ -89,7 +77,6 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) int slide = SystemStateInfo::setIni.value("sliderValue", 1).toInt(); ui->horizontalSlider->setValue(slide); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderChange(int))); - } CDsgRoiDlg::~CDsgRoiDlg() @@ -202,7 +189,6 @@ void CDsgRoiDlg::OnShowCameraImage(QImage img) m_tempRoiData.img = ColossusBase::QImage2cvMat(img).clone(); m_pRoiScene->Initialize(m_tempRoiData); m_pRoiScene->DisableMenu(false); - //m_pRoiScene->updateTenItem(true); } void CDsgRoiDlg::OnShowTenFlag() @@ -242,10 +228,7 @@ void CDsgRoiDlg::OnSelectImage() if (strFileName.length() > 0) { std::string strpath = strFileName.toLocal8Bit().toStdString(); - m_tempRoiData.img = cv::imread(strpath/*strFileName.toLocal8Bit().data()*/, CV_LOAD_IMAGE_UNCHANGED); -// m_tempRoiData.img = cv::imread(strFileName.toLatin1().data()); -// m_pRoiScene->InitShowImage(m_tempRoiData.img); - + m_tempRoiData.img = cv::imread(strpath, CV_LOAD_IMAGE_UNCHANGED); m_pRoiScene->Initialize(m_tempRoiData); m_pRoiScene->DisableMenu(false); } @@ -460,11 +443,7 @@ bool CDsgRoiDlg::FillRoi(LP_DETECTOR_ROI_DATA& roiData) } record.push_back(tItem); } - records.push_back(record); - - - //delete[] lppItem; delete item; } } @@ -502,14 +481,12 @@ void CDsgRoiDlg::OnMove() { m_pRoiScene->MoveSelectedItem(DOWN, step); } - } void CDsgRoiDlg::showEvent(QShowEvent *evt) { m_pRoiScene->Initialize(m_tempRoiData); m_pRoiScene->DisableMenu(false); - } void CDsgRoiDlg::OnZoomIn() diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index 9fc6719..8291909 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -6,6 +6,8 @@ typedef QMap TaskMap; typedef QMap TaskMapStr; +#define WINDOW_ICON ":/resource/app.png" + QString showVariant(const AlgoParamType type, const QVariant &var) { switch (type) { @@ -120,7 +122,7 @@ CMainFrame::CMainFrame(QWidget *parent) ui = new Ui::MainFrame; ui->setupUi(this); setContextMenuPolicy(Qt::NoContextMenu); - setWindowIcon(QIcon(":/img/resource/app.png")); + setWindowIcon(QIcon(WINDOW_ICON)); connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(OnTreeItemClick())); ui->treeWidget->setStyleSheet("QTreeWidget::item{height:30px}"); @@ -705,10 +707,10 @@ bool CMainFrame::OnParamPopMenu(const QPoint& points) // addAlgoAction->setObjectName("addAlgoAction"); // menu.addSeparator(); - QAction *selectAlgoAction = menu.addAction(QObject::tr("选择算法")); - selectAlgoAction->setObjectName("selectAlgoAction"); - QAction *editAction = menu.addAction(QObject::tr("编辑")); - editAction->setObjectName("editAction"); +// QAction *selectAlgoAction = menu.addAction(QObject::tr("选择算法")); +// selectAlgoAction->setObjectName("selectAlgoAction"); +// QAction *editAction = menu.addAction(QObject::tr("编辑")); +// editAction->setObjectName("editAction"); // QAction *deleteAction = menu.addAction(QStringLiteral("删除")); // deleteAction->setObjectName("deleteAction"); // menu.addSeparator(); @@ -821,7 +823,6 @@ bool CMainFrame::OnAddAlgo() bool CMainFrame::OnEditAlgo() { - //return false; if (!currentTask()) return false; @@ -905,16 +906,17 @@ bool CMainFrame::OnSetAlgo() IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID); if (!pAlgo) return false; - //CDsgAlgorithmParamMgrDlg m_tParamMgrDlg; + if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_IN)) return false; - + m_tParamMgrDlg.setParent(this); + m_tParamMgrDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + m_tParamMgrDlg.setWindowIcon(QIcon(WINDOW_ICON)); + m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); + m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); - //m_tParamMgrDlg.exec(); } - } - return true; } @@ -934,10 +936,13 @@ bool CMainFrame::OnSetOutParam() IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID); if (!pAlgo) return false; - //CDsgAlgorithmParamMgrDlg m_tParamMgrDlg; if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_OUT)) return false; - + m_tParamMgrDlg.setParent(this); + m_tParamMgrDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + m_tParamMgrDlg.setWindowIcon(QIcon(WINDOW_ICON)); + m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); + m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); } } @@ -962,18 +967,6 @@ bool CMainFrame::OnRunAlgo() if (!pAlgo) return false; m_pCurrentTask->GetTaskInfo()->detectImg = m_pCurrentTask->GetTaskInfo()->templateImg; - //QString strHeader = ""; - //strHeader += ""; - //strHeader += pAlgo->GetAlgorithmInfo()->strName; - - //if (pCurrentTask->GetTaskInfo()->strImageName.size() > 0) - //{ - // strHeader += "->"; - // strHeader += pCurrentTask->GetTaskInfo()->strImageName; - //} - //strHeader += ":"; - //ui->textEdit->append(strHeader); - if (pAlgo->Exec()) { int nCount = pAlgo->EnumOutParam(NULL, 0); @@ -1029,12 +1022,12 @@ bool CMainFrame::OnRunAlgo() } case LP_BOOLEAN: { - strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value);// lppOutParam[i]->value.toString(); + strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value); break; } case LP_STRING: { - strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value); //lppOutParam[i]->value.toString(); + strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value); break; } case LP_DOUBLE: @@ -1225,17 +1218,8 @@ bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&) { m_TaskChangeList.append(strName); } -// QString fileName = QFileDialog::getSaveFileName(this, tr("save image"), qApp->applicationDirPath(), tr("Image (*.bmp)")); -// -// if (!fileName.isNull()) -// { -// std::string strpath = fileName.toLocal8Bit().toStdString(); -// if (!cv::imwrite(strpath, m_pCurrentTask->GetTaskInfo()->img)) -// return false; -// } } - menu.clear(); return true; } @@ -1328,23 +1312,8 @@ bool CMainFrame::OnInitCurrentAlgoParam() ui->tableWidget->setItem(nIndex, 1, new QTableWidgetItem((*its)->strName)); ui->tableWidget->setItem(nIndex, 2, new QTableWidgetItem(GetParamTypeStr((*its)->type))); ui->tableWidget->setItem(nIndex, 3, new QTableWidgetItem(showVariant((*its)->type, (*its)->value))); - //ui->tableWidget->setItem(nIndex, 4, new QTableWidgetItem((*its)->strDescription)); nIndex++; } - - -// for (int i = 0; i < nCount; i++) -// { -// if (lppParam[i]) -// { -// ui->tableWidget->setRowCount(i + 1); -// ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(lppParam[i]->nID))); -// ui->tableWidget->setItem(i, 1, new QTableWidgetItem(lppParam[i]->strName)); -// ui->tableWidget->setItem(i, 2, new QTableWidgetItem(GetParamTypeStr(lppParam[i]->type))); -// ui->tableWidget->setItem(i, 3, new QTableWidgetItem(showVariant(lppParam[i]->type, lppParam[i]->value))); -// ui->tableWidget->setItem(i, 4, new QTableWidgetItem(lppParam[i]->strDescription)); -// } -// } delete[] lppParam; } } @@ -1399,20 +1368,22 @@ bool CMainFrame::OnAddParam() if (!m_tParamDlg.InitGraphView()) return false; - + m_tParamDlg.setParent(this); + m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + m_tParamDlg.setWindowIcon(QIcon(WINDOW_ICON)); + m_tParamDlg.setWindowModality(Qt::ApplicationModal); + m_tParamDlg.setAttribute(Qt::WA_ShowModal, true); PLP_ALGORITHM_PARAM pParam = m_tParamDlg.ShowParamDlg(NULL); if (pParam) { int nRowCount = ui->tableWidget->rowCount(); - ui->tableWidget->setRowCount(nRowCount + 1); ui->tableWidget->setItem(nRowCount, 0, new QTableWidgetItem(QString::number(pParam->nID))); ui->tableWidget->setItem(nRowCount, 1, new QTableWidgetItem(pParam->strName)); ui->tableWidget->setItem(nRowCount, 2, new QTableWidgetItem(GetParamTypeStr(pParam->type))); ui->tableWidget->setItem(nRowCount, 3, new QTableWidgetItem(showVariant(pParam->type, pParam->value))); - - ui->tableWidget->setItem(nRowCount, 4, new QTableWidgetItem(pParam->strDescription)); - + QString str = QString("%1").arg(pParam->strDescription); + ui->tableWidget->setItem(nRowCount, 4, new QTableWidgetItem(str)); return true; } @@ -1475,13 +1446,16 @@ bool CMainFrame::OnEditParam() if (!m_tParamDlg.InitGraphView()) return false; -// m_tParamDlg.show(); - + m_tParamDlg.setParent(this); + m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + m_tParamDlg.setWindowIcon(QIcon(WINDOW_ICON)); + m_tParamDlg.setWindowModality(Qt::ApplicationModal); + m_tParamDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamDlg.ShowParamDlg(pParam); // items.at(1)->setText(pParam->strName); // items.at(2)->setText(GetParamTypeStr(pParam->type)); // items.at(3)->setText(showVariant(pParam->type,pParam->value)); - //items.at(4)->setText(pParam->strDescription); +// items.at(4)->setText(pParam->strDescription); QString st = _pOldTask->GetTaskInfo()->strName; if (!m_TaskChangeList.contains(st)) { @@ -1783,30 +1757,24 @@ void CMainFrame::OnCellClicked(int row, int column) IDetectorSolution * CMainFrame::currentSolution() { if (!m_pCurrentSolution) { - //emit sgShowStatus("current solution not exist"); return NULL; } - //emit sgShowStatus("current solution exist"); return m_pCurrentSolution; } IDetectorTask * CMainFrame::currentTask() { if (!m_pCurrentTask) { - //emit sgShowStatus("current task not exist"); return NULL; } - //emit sgShowStatus("current task exist"); return m_pCurrentTask; } IDetectorAlgorithm * CMainFrame::currentAlgorithm() { if (!m_pCurrentAlgo) { - //emit sgShowStatus("current algo not exist"); return NULL; } - //emit sgShowStatus("current algo exist"); return m_pCurrentAlgo; } @@ -1816,16 +1784,11 @@ void CMainFrame::OnShowStatus(QString strMess) p->showMessage(strMess); } -QString CMainFrame::genInfo() -{ - //GetTaskInfo()->templateImg = oldMat; diff --git a/src/lpbdesigner/MainFrame.h b/src/lpbdesigner/MainFrame.h index 6c3c5a4..b7fd001 100644 --- a/src/lpbdesigner/MainFrame.h +++ b/src/lpbdesigner/MainFrame.h @@ -39,9 +39,6 @@ public: IDetectorTask * currentTask(); IDetectorAlgorithm * currentAlgorithm(); - QString genInfo(); - - Q_SLOT void onButtonClicked(); QString GetParamTypeStr(AlgoParamType type); signals: diff --git a/src/lpbdesigner/ParamDlg.ui b/src/lpbdesigner/ParamDlg.ui index e7699e5..1dfe865 100644 --- a/src/lpbdesigner/ParamDlg.ui +++ b/src/lpbdesigner/ParamDlg.ui @@ -9,8 +9,8 @@ 0 0 - 279 - 298 + 331 + 328 @@ -26,19 +26,31 @@ - 2 + 5 - 2 + 5 - 2 + 5 - 2 + 5 + + 5 + + + 5 + + + 5 + + + 5 + @@ -273,6 +285,16 @@ 设置ROI + + + :/resource/img.png:/resource/img.png + + + + 32 + 32 + + @@ -347,6 +369,8 @@ - + + + diff --git a/tpvs17/lpMain/QDeviceMgrUI.ui b/tpvs17/lpMain/QDeviceMgrUI.ui index 7b1952b..75da7c2 100644 --- a/tpvs17/lpMain/QDeviceMgrUI.ui +++ b/tpvs17/lpMain/QDeviceMgrUI.ui @@ -7,7 +7,7 @@ 0 0 470 - 274 + 280 @@ -34,7 +34,7 @@ - 11 + 12 @@ -43,7 +43,7 @@ - 11 + 12 @@ -58,7 +58,7 @@ - 11 + 12 @@ -73,7 +73,7 @@ - 11 + 12 @@ -139,7 +139,7 @@ - 11 + 12 @@ -151,7 +151,7 @@ - 11 + 12 @@ -163,7 +163,7 @@ - 11 + 12 @@ -175,7 +175,7 @@ - 11 + 12 @@ -207,7 +207,7 @@ - 11 + 12 @@ -221,7 +221,7 @@ - 11 + 12 @@ -236,7 +236,7 @@ - 11 + 12 @@ -258,7 +258,7 @@ - 11 + 12 @@ -273,7 +273,7 @@ - 11 + 12 @@ -293,7 +293,7 @@ - 11 + 12 diff --git a/tpvs17/lpMain/QModelMangerUI.ui b/tpvs17/lpMain/QModelMangerUI.ui index 8ce9121..be423c0 100644 --- a/tpvs17/lpMain/QModelMangerUI.ui +++ b/tpvs17/lpMain/QModelMangerUI.ui @@ -39,12 +39,6 @@ 44444 - - - 微软雅黑 - 10 - - QTabWidget::North