diff --git a/3part/tadpole/include/tpBase/lpdesigner.h b/3part/tadpole/include/tpBase/lpdesigner.h index f445d97..39b9dcd 100644 --- a/3part/tadpole/include/tpBase/lpdesigner.h +++ b/3part/tadpole/include/tpBase/lpdesigner.h @@ -19,10 +19,10 @@ public: class IDetectorUI { public: - virtual bool ShowDeviceMgrDlg() = 0; - virtual bool ShowSolutionMgrDlg() = 0; - virtual bool ShowMainFrame() = 0; - virtual bool ShowReportView(QMap statInfo) = 0; + virtual bool Initialize(IDetectorEngine* lpDE) = 0; + virtual bool ShowMainFrame(class QWidget* parent = nullptr) = 0; + virtual void HideMainFrame() = 0; + virtual bool IsMainFrameHidden() = 0; }; @@ -32,10 +32,8 @@ public: # define LPDESIGNER_EXPORT extern "C" __declspec(dllimport) #endif -typedef void(*FnLpDesignerNewInstance)(IDetectorUI **lppDetectorUI, IDetectorEngine *lpDE, IDetectorUISink* lpSink); +LPDESIGNER_EXPORT IDetectorUI * Lib_Designer_Init(void); -LPDESIGNER_EXPORT void LpDesignerNewInstance(IDetectorUI **lppDetectorUI, IDetectorEngine *lpDE, IDetectorUISink* lpSink); - -LPDESIGNER_EXPORT bool LpDesignerDeleteInstance(); +LPDESIGNER_EXPORT void Lib_Designer_Free(IDetectorUI *ptr); #endif // LPDESIGNER_H diff --git a/runner17/TaskInfo.ini b/runner17/TaskInfo.ini index addc94f..abf2ac4 100644 --- a/runner17/TaskInfo.ini +++ b/runner17/TaskInfo.ini @@ -1,4 +1,4 @@ [General] StationNum=2 -Station_1=1111 -Station_2=3D9H +Station_1=82072D +Station_2=82071E diff --git a/runner17/algorithmLib/caliCenter.dll b/runner17/algorithmLib/caliCenter.dll index 181fda3..180b891 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 6c43583..1f88056 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 8b6380e..cba7cbe 100644 Binary files a/runner17/algorithmLib/valveDetector.dll and b/runner17/algorithmLib/valveDetector.dll differ diff --git a/runner17/config/camera.json b/runner17/config/camera.json index cd50345..bd5a10f 100644 --- a/runner17/config/camera.json +++ b/runner17/config/camera.json @@ -5,7 +5,7 @@ "board_num": 0, "board_type": 0, "exposure": 26000, - "folder": ".\\testimg\\", + "folder": "F:\\ValueProject\\Valve\\runner17\\testimg\\", "format": "GRAY8", "gain": 8, "height": 1944, @@ -15,7 +15,7 @@ "save": 0, "save_img_suffix": ".BMP", "showname": "工位2", - "type": 120, + "type": 100, "width": 2592, "zoom": 1 }, @@ -24,7 +24,7 @@ "board_num": 0, "board_type": 0, "exposure": 160000, - "folder": "G:\\重庆捷力\\NG\\2\\PA131Q\\", + "folder": "F:\\ValueProject\\Valve\\runner17\\testimg\\", "format": "GRAY8", "gain": 8, "height": 960, @@ -34,7 +34,7 @@ "save": 0, "save_img_suffix": ".BMP", "showname": "工位1", - "type": 140, + "type": 100, "width": 1280, "zoom": 1 } diff --git a/runner17/lpbengined.dll b/runner17/lpbengined.dll index a41575a..6d547b0 100644 Binary files a/runner17/lpbengined.dll and b/runner17/lpbengined.dll differ diff --git a/runner17/lpdesignerd.dll b/runner17/lpdesignerd.dll index 94c8999..dd18269 100644 Binary files a/runner17/lpdesignerd.dll and b/runner17/lpdesignerd.dll differ diff --git a/runner17/tpCam_100d.dll b/runner17/tpCam_100d.dll index de5f172..0979fb4 100644 Binary files a/runner17/tpCam_100d.dll and b/runner17/tpCam_100d.dll differ diff --git a/runner17/tpCam_140d.dll b/runner17/tpCam_140d.dll index db9be14..65409d6 100644 Binary files a/runner17/tpCam_140d.dll and b/runner17/tpCam_140d.dll differ diff --git a/runner17/tpCam_160d.dll b/runner17/tpCam_160d.dll index 43ff798..0dbd09b 100644 Binary files a/runner17/tpCam_160d.dll and b/runner17/tpCam_160d.dll differ diff --git a/runner17/user/systemConfig.ini b/runner17/user/systemConfig.ini index a7a1fcd..e072ce9 100644 --- a/runner17/user/systemConfig.ini +++ b/runner17/user/systemConfig.ini @@ -10,6 +10,14 @@ days=7 days_dir=30 Enable=false spacesize=10 +Enable_RltImg=false +Enable_SrcImg=false [TrigDetector] FilterTime=10 + +[Image] +SrcImgSave_st1=false +SrcImgSave_st2=false +RltImgSave_st1=false +RltImgSave_st2=false diff --git a/src/lpMain/CoreCtrl/CDllDesigner.cpp b/src/lpMain/CoreCtrl/CDllDesigner.cpp new file mode 100644 index 0000000..5576900 --- /dev/null +++ b/src/lpMain/CoreCtrl/CDllDesigner.cpp @@ -0,0 +1,45 @@ +#include "CDllDesigner.h" +#include "DllLoader.h" + +CDllDesigner::CDllDesigner() +{ + m_pLibDesigner = new CDllLoaderM("lpdesigner", "Lib_Designer_Init", "Lib_Designer_Free", QStringList()); + if (nullptr != m_pLibDesigner) + { + m_pDesigner = (IDetectorUI *)m_pLibDesigner->ModuleInit(nullptr); + if (m_pDesigner) { + + } + else { + tpDebugOut("failed to get instance from tpCoreCtrl.dll"); + } + } +} + +CDllDesigner::~CDllDesigner() +{ + +} + +bool CDllDesigner::Initialize(IDetectorEngine* lpDE) +{ + if (!lpDE) + return false; + if (m_pDesigner) + { + m_pDesigner->Initialize(lpDE); + } + + return true; +} + +IDetectorUI* CDllDesigner::GetDesignerInterface() const +{ + return m_pDesigner; +} + +void CDllDesigner::OnManualTrigger() +{ + emit sgCloseWindow(); +} + diff --git a/src/lpMain/CoreCtrl/CDllDesigner.h b/src/lpMain/CoreCtrl/CDllDesigner.h new file mode 100644 index 0000000..87271c2 --- /dev/null +++ b/src/lpMain/CoreCtrl/CDllDesigner.h @@ -0,0 +1,26 @@ +#ifndef QDETECTORDESIGNERMGR_H +#define QDETECTORDESIGNERMGR_H + +#include ".\lpbengine.h" +#include ".\lpdesigner.h" +#include + +class CDllDesigner : public QObject +{ + Q_OBJECT +public: + CDllDesigner(); + virtual ~CDllDesigner(); + bool Initialize(IDetectorEngine* lpDE); + + IDetectorUI * GetDesignerInterface() const; + virtual void OnManualTrigger(); + +signals: + void sgCloseWindow(); +private: + class CDllLoaderM* m_pLibDesigner{ nullptr }; + IDetectorUI *m_pDesigner{ nullptr }; +}; + +#endif // QDETECTORDESIGNERMGR_H \ No newline at end of file diff --git a/src/lpMain/CoreCtrl/QDetectorDesignerMgr.cpp b/src/lpMain/CoreCtrl/QDetectorDesignerMgr.cpp deleted file mode 100644 index 9f7f0fe..0000000 --- a/src/lpMain/CoreCtrl/QDetectorDesignerMgr.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "QDetectorDesignerMgr.h" - -QDetectorDesignerMgr::QDetectorDesignerMgr() -{ - m_pDesigner = NULL; - m_pDE = NULL; -} - -QDetectorDesignerMgr::~QDetectorDesignerMgr() -{ - Quit(); -} - -bool QDetectorDesignerMgr::Initialize(IDetectorEngine* lpDE) -{ - if (!lpDE) - return false; - m_pDE = lpDE; - -#ifdef _DEBUG - m_lib.setFileName("lpdesignerd.dll"); -#else - m_lib.setFileName("lpdesigner.dll"); -#endif - if (!m_lib.load()) { - qDebug() << "lpdesigner lib load failed"; - return false; - } - qDebug() << "lib load ok"; - FnLpDesignerNewInstance pfnLpNewInstance = (FnLpDesignerNewInstance)m_lib.resolve("LpDesignerNewInstance"); - if (pfnLpNewInstance) - pfnLpNewInstance(&m_pDesigner, m_pDE, nullptr); - - if (!m_pDesigner) - return false; - - return true; -} - -IDetectorUI* QDetectorDesignerMgr::GetDesignerInterface() const -{ - return m_pDesigner; -} - -void QDetectorDesignerMgr::Quit() -{ - - if (m_pDesigner) - { - delete m_pDesigner; - m_pDesigner = NULL; - } - if (m_lib.isLoaded()) - m_lib.unload(); -} - -void QDetectorDesignerMgr::OnManualTrigger() -{ - emit sgCloseWindow(); -} - -void QDetectorDesignerMgr::OnSetParam(IDetectorTask* pTask) -{ - //return m_pApp->SetParam(pTask); -} diff --git a/src/lpMain/CoreCtrl/QDetectorDesignerMgr.h b/src/lpMain/CoreCtrl/QDetectorDesignerMgr.h deleted file mode 100644 index 60c7ada..0000000 --- a/src/lpMain/CoreCtrl/QDetectorDesignerMgr.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef QDETECTORDESIGNERMGR_H -#define QDETECTORDESIGNERMGR_H - -#include ".\lpbengine.h" -#include ".\lpdesigner.h" -#include "qobject.h" - -class QDetectorDesignerMgr : public QObject -{ - Q_OBJECT -public: - QDetectorDesignerMgr(); - virtual ~QDetectorDesignerMgr(); - bool Initialize(IDetectorEngine* lpDE); - void Quit(); - IDetectorUI * GetDesignerInterface() const; - virtual void OnManualTrigger(); - virtual void ResetItem(QPoint pos, QRect size){} - virtual void OnSetParam(IDetectorTask* pTask); - -signals: - void sgCloseWindow(); -private: - -private: - QLibrary m_lib; - IDetectorUI *m_pDesigner; - IDetectorEngine *m_pDE; -}; - -#endif // QDETECTORDESIGNERMGR_H \ No newline at end of file diff --git a/src/lpbdesigner/AlgoDlg.ui b/src/lpbdesigner/AlgoDlg.ui index 1886976..8cb112c 100644 --- a/src/lpbdesigner/AlgoDlg.ui +++ b/src/lpbdesigner/AlgoDlg.ui @@ -24,26 +24,53 @@ + + + 12 + + 名称: - + + + + 12 + + + + + + 12 + + 算法库: - + + + + 12 + + + + + + 12 + + 请选择 @@ -51,16 +78,32 @@ + + + 12 + + ROI: - + + + + 12 + + + + + + 12 + + 请选择 @@ -68,16 +111,32 @@ + + + 12 + + 描述: - + + + + 12 + + + + + + 12 + + 确定 @@ -85,6 +144,11 @@ + + + 12 + + 取消 diff --git a/src/lpbdesigner/AlgorithmParamMgrDlg.ui b/src/lpbdesigner/AlgorithmParamMgrDlg.ui index 1fdedc5..f2a88b7 100644 --- a/src/lpbdesigner/AlgorithmParamMgrDlg.ui +++ b/src/lpbdesigner/AlgorithmParamMgrDlg.ui @@ -33,7 +33,8 @@ - 10 + Arial + 12 @@ -75,7 +76,7 @@ - 10 + 12 @@ -87,7 +88,7 @@ - 10 + 12 @@ -99,7 +100,7 @@ - 10 + 12 @@ -111,7 +112,7 @@ - 10 + 12 @@ -123,7 +124,7 @@ - 10 + 12 @@ -135,7 +136,7 @@ - 10 + 12 diff --git a/src/lpbdesigner/CDetectorUI.cpp b/src/lpbdesigner/CDetectorUI.cpp new file mode 100644 index 0000000..b2f4185 --- /dev/null +++ b/src/lpbdesigner/CDetectorUI.cpp @@ -0,0 +1,60 @@ +#include "CDetectorUI.h" + +CDetectorUI::CDetectorUI() +{ + m_pMainFrame = new CMainFrame; +} + +CDetectorUI::~CDetectorUI() +{ + if (m_pMainFrame) + { + delete m_pMainFrame; + m_pMainFrame = nullptr; + } + if (m_pDE) + { + m_pDE = NULL; + } +} + +bool CDetectorUI::Initialize(IDetectorEngine* lpDE) +{ + if (!lpDE) + return false; + + m_pDE = lpDE; + + return true; +} + + +bool CDetectorUI::ShowMainFrame(class QWidget* parent) +{ + if (!m_pMainFrame->Initialize(m_pDE)) + return false; + + if (!m_pMainFrame->InitGraphView()) + return false; + + m_pMainFrame->setParent(parent); + m_pMainFrame->setWindowFlags(Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); + m_pMainFrame->setWindowIcon(QIcon(":/image/leaper")); + m_pMainFrame->setWindowModality(Qt::ApplicationModal); + m_pMainFrame->setAttribute(Qt::WA_ShowModal, true); + + m_pMainFrame->show(); + return true; +} + +void CDetectorUI::HideMainFrame() +{ + m_pMainFrame->hide(); +} + +bool CDetectorUI::IsMainFrameHidden() +{ + return m_pMainFrame->isHidden(); +} + + diff --git a/src/lpbdesigner/LPDsg.h b/src/lpbdesigner/CDetectorUI.h similarity index 63% rename from src/lpbdesigner/LPDsg.h rename to src/lpbdesigner/CDetectorUI.h index b18bab0..303f788 100644 --- a/src/lpbdesigner/LPDsg.h +++ b/src/lpbdesigner/CDetectorUI.h @@ -9,11 +9,9 @@ public: CDetectorUI(); virtual ~CDetectorUI(); bool Initialize(IDetectorEngine* lpDE); - virtual bool ShowDeviceMgrDlg(); - virtual bool ShowSolutionMgrDlg(); - virtual bool ShowMainFrame(); - virtual bool ShowReportView(QMap statInfo); - + virtual bool ShowMainFrame(class QWidget* parent = nullptr); + virtual void HideMainFrame(); + virtual bool IsMainFrameHidden(); private: CMainFrame* m_pMainFrame{ nullptr }; IDetectorEngine* m_pDE{ nullptr }; diff --git a/src/lpbdesigner/DeviceDlg.ui b/src/lpbdesigner/DeviceDlg.ui index 9c3c494..6581916 100644 --- a/src/lpbdesigner/DeviceDlg.ui +++ b/src/lpbdesigner/DeviceDlg.ui @@ -7,7 +7,7 @@ 0 0 280 - 181 + 128 @@ -18,33 +18,66 @@ + + + 12 + + 名称: - + + + + 12 + + + + + + 12 + + 描述: - + + + + 12 + + + + + + 12 + + 类型: - + + + + 12 + + + @@ -63,6 +96,11 @@ + + + 12 + + 确定 @@ -70,6 +108,11 @@ + + + 12 + + 取消 diff --git a/src/lpbdesigner/DeviceListDlg.ui b/src/lpbdesigner/DeviceListDlg.ui index 6bb7fb3..3c50873 100644 --- a/src/lpbdesigner/DeviceListDlg.ui +++ b/src/lpbdesigner/DeviceListDlg.ui @@ -18,16 +18,32 @@ + + + 12 + + 设备: - + + + + 12 + + + + + + 12 + + 搜索 @@ -50,6 +66,12 @@ + + + Arial + 12 + + 编号 @@ -89,6 +111,11 @@ + + + 12 + + 确定 @@ -96,6 +123,11 @@ + + + 12 + + 关闭 diff --git a/src/lpbdesigner/DeviceMgrDlg.ui b/src/lpbdesigner/DeviceMgrDlg.ui index 0b813b2..0ed5320 100644 --- a/src/lpbdesigner/DeviceMgrDlg.ui +++ b/src/lpbdesigner/DeviceMgrDlg.ui @@ -18,16 +18,32 @@ + + + 12 + + 设备: - + + + + 12 + + + + + + 12 + + 搜索 @@ -35,6 +51,11 @@ + + + 12 + + 应用 @@ -44,6 +65,12 @@ + + + Arial + 12 + + 编号 @@ -83,6 +110,11 @@ + + + 12 + + 新增 @@ -90,6 +122,11 @@ + + + 12 + + 编辑 @@ -97,6 +134,11 @@ + + + 12 + + 删除 @@ -104,6 +146,11 @@ + + + 12 + + 关闭 diff --git a/src/lpbdesigner/DrawTool.cpp b/src/lpbdesigner/DrawTool.cpp index 22604f5..d670c40 100644 --- a/src/lpbdesigner/DrawTool.cpp +++ b/src/lpbdesigner/DrawTool.cpp @@ -42,7 +42,7 @@ static void setCursor(QGraphicsScene * scene, const QCursor & cursor) for (int i = 0; i < views.count(); i++) { QGraphicsView * view = views.at(i); - if (view && (int)view->userData(0) == 1) + if (view) view->setCursor(cursor); } } diff --git a/src/lpbdesigner/DsgAlgorithmParamMgr.cpp b/src/lpbdesigner/DsgAlgorithmParamMgr.cpp index 8022c55..70147eb 100644 --- a/src/lpbdesigner/DsgAlgorithmParamMgr.cpp +++ b/src/lpbdesigner/DsgAlgorithmParamMgr.cpp @@ -20,15 +20,9 @@ CDsgAlgorithmParamMgrDlg::CDsgAlgorithmParamMgrDlg(QWidget *parent) : QDialog(pa ui->pushButton_5->setVisible(false); ui->pushButton_2->setVisible(false); ui->pushButton_7->setVisible(false); - //ui->pushButton_6->setVisible(false); ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnPopMenu(const QPoint&))); connect(ui->tableWidget, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(OnEditParam())); -// Qt::WindowFlags flags = Qt::Dialog; -// flags |= Qt::WindowMinMaxButtonsHint; -// flags |= Qt::WindowCloseButtonHint; -// setWindowFlags(flags); - //m_tParamDlg.setParent(this); } CDsgAlgorithmParamMgrDlg::~CDsgAlgorithmParamMgrDlg() diff --git a/src/lpbdesigner/DsgParamDlg.cpp b/src/lpbdesigner/DsgParamDlg.cpp index fe0ccdb..3b4aaad 100644 --- a/src/lpbdesigner/DsgParamDlg.cpp +++ b/src/lpbdesigner/DsgParamDlg.cpp @@ -21,11 +21,6 @@ CDsgParamDlg::CDsgParamDlg(QWidget *parent) : QDialog(parent), m_valueCombox(thi connect(ui->comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeAlgo())); connect(ui->m_pbROISet, SIGNAL(clicked()), this, SLOT(OnShowRoiDlg())); - //Qt::WindowFlags flags = Qt::Dialog; - //flags |= Qt::WindowMinMaxButtonsHint; - //flags |= Qt::WindowCloseButtonHint; - //setWindowFlags(flags); - } CDsgParamDlg::~CDsgParamDlg() diff --git a/src/lpbdesigner/DsgRoiDlg.cpp b/src/lpbdesigner/DsgRoiDlg.cpp index 9a8afb3..67d6cec 100644 --- a/src/lpbdesigner/DsgRoiDlg.cpp +++ b/src/lpbdesigner/DsgRoiDlg.cpp @@ -51,15 +51,13 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(OnShowColorDlg())); ui->pushButton_8->setAutoDefault(false); - connect(ui->pushButton_9, SIGNAL(clicked()), this, SLOT(OnSetItem())); + connect(ui->m_pbUp, SIGNAL(clicked()), this, SLOT(OnMove())); + 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_10, SIGNAL(clicked()), this, SLOT(OnMove())); - connect(ui->pushButton_11, SIGNAL(clicked()), this, SLOT(OnMove())); - connect(ui->pushButton_12, SIGNAL(clicked()), this, SLOT(OnMove())); - connect(ui->pushButton_13, 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_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())); @@ -68,13 +66,30 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnShowTenFlag())); ui->pushButton_5->setText(QObject::tr("显示定位线")); m_pRoiScene = new RoiScene(this); - //m_pRoiScene->SetRoiDlg(this); m_pRoiScene->SetGraphicsView(ui->graphicsView); m_pRoiScene->SetInfoLable(ui->label_pixel_info); -// Qt::WindowFlags flags = Qt::Dialog; -// flags |= Qt::WindowMinMaxButtonsHint; -// flags |= Qt::WindowCloseButtonHint; -// setWindowFlags(flags); + + /*开启按钮长按功能*/ + ui->m_pbUp->setAutoRepeat(true); + ui->m_pbUp->setAutoRepeatDelay(400); + ui->m_pbUp->setAutoRepeatInterval(50); + + ui->m_pbLeft->setAutoRepeat(true); + ui->m_pbLeft->setAutoRepeatDelay(400); + ui->m_pbLeft->setAutoRepeatInterval(50); + + ui->m_pbRight->setAutoRepeat(true); + ui->m_pbRight->setAutoRepeatDelay(400); + ui->m_pbRight->setAutoRepeatInterval(50); + + ui->m_pbDown->setAutoRepeat(true); + ui->m_pbDown->setAutoRepeatDelay(400); + ui->m_pbDown->setAutoRepeatInterval(50); + + int slide = SystemStateInfo::setIni.value("sliderValue", 1).toInt(); + ui->horizontalSlider->setValue(slide); + connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderChange(int))); + } CDsgRoiDlg::~CDsgRoiDlg() @@ -176,10 +191,8 @@ void CDsgRoiDlg::OnShowColorDlg() QColor color = QColorDialog::getColor(Qt::black,this,QString("select color")); if (color.rgb() == QColor(0, 0, 0).rgb()) return ; - QString strRGB = QString("(%1,%2,%3)").arg(QString::number(color.red()), QString::number(color.green()), QString::number(color.blue())); - ui->lineEdit_3->setText(strRGB); QString strStyle = QString("background-color:rgba(%1,%2,%3,255);").arg(color.red()).arg(color.green()).arg(color.blue()); - ui->lineEdit_3->setStyleSheet(strStyle); + ui->labelColor->setStyleSheet(strStyle); SystemStateInfo::rgb = color.rgb(); return; } @@ -246,11 +259,9 @@ LP_DETECTOR_ROI_DATA CDsgRoiDlg::ShowRoiDlg(LP_DETECTOR_ROI_DATA roiData) if (SystemStateInfo::rgb == 0) SystemStateInfo::rgb = QColor(255, 0, 0).rgb(); QColor color(SystemStateInfo::rgb); - QString strRGB = QString("(%1,%2,%3)").arg(QString::number(color.red()), QString::number(color.green()), QString::number(color.blue())); - ui->lineEdit_3->setText(strRGB); QString strStyle = QString("background-color:rgba(%1,%2,%3,255);").arg(color.red()).arg(color.green()).arg(color.blue()); - ui->lineEdit_3->setStyleSheet(strStyle); + ui->labelColor->setStyleSheet(strStyle); QDesktopWidget* desktop = QApplication::desktop();// move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2); @@ -474,99 +485,31 @@ void CDsgRoiDlg::OnMove() { if (!m_pRoiScene) return; - - if (sender()->objectName() == "pushButton_10") + int step = ui->horizontalSlider->value(); + if (sender()->objectName() == "m_pbLeft") { - m_pRoiScene->MoveSelectedItem(LEFT); + m_pRoiScene->MoveSelectedItem(LEFT, step); } - else if (sender()->objectName() == "pushButton_11") + else if (sender()->objectName() == "m_pbUp") { - m_pRoiScene->MoveSelectedItem(UP); + m_pRoiScene->MoveSelectedItem(UP, step); } - else if (sender()->objectName() == "pushButton_12") + else if (sender()->objectName() == "m_pbRight") { - m_pRoiScene->MoveSelectedItem(RIGHT); + m_pRoiScene->MoveSelectedItem(RIGHT, step); } - else if (sender()->objectName() == "pushButton_13") + else if (sender()->objectName() == "m_pbDown") { - m_pRoiScene->MoveSelectedItem(DOWN); + m_pRoiScene->MoveSelectedItem(DOWN, step); } } -void CDsgRoiDlg::OnSetItem() -{ - //QList items = m_pTaskScene->items(); - - //GraphicsItem *item1; - //GraphicsItem *item2; - - //int nSize = items.size(); - //for (int i = 0; i < nSize; i++) - //{ - // GraphicsItem *item = qgraphicsitem_cast(items.at(i)); - // if (item && item->GetType() == GraphicsRect) - // { - // - // item1 = item; - // } - - // if (item && item->GetType() == GraphicsCircle) - // { - // item2 = item; - // } - - //} - - //QList temp1 = item1->collidingItems(Qt::ContainsItemShape); - // int b = temp1.size(); - - //for (int k = 0; k < b; k++) - //{ - // int aa = temp1.at(k)->type(); - // int bb = temp1.at(k)->Type; - //} - - //QList temp2 = item2->collidingItems(Qt::ContainsItemShape); - //int c = temp2.size(); - - //bool bRet1 = item1->collidesWithItem(item2, Qt::ContainsItemShape); - //bool bRet2 = item2->collidesWithItem(item1, Qt::ContainsItemShape); - //QPointF pos1 = item1->pos(); - //QPointF pos2 = item2->pos(); - //int a = 0; - QPoint pos; - QRect size; - pos.setX(ui->lineEdit_4->text().toInt() - m_pRoiScene->GetOffSet().x()); - pos.setY(ui->lineEdit_5->text().toInt() - m_pRoiScene->GetOffSet().y()); - size.setWidth(ui->lineEdit_6->text().toInt()); - size.setHeight(ui->lineEdit_7->text().toInt()); - m_pRoiScene->SetSelectedItem(pos, size); -} - -void CDsgRoiDlg::ResetItem(QPoint pos, QRect size) -{ - ui->lineEdit_4->clear(); - ui->lineEdit_5->clear(); - ui->lineEdit_6->clear(); - ui->lineEdit_7->clear(); - - ui->lineEdit_4->setText(QString::number(pos.x())); - ui->lineEdit_5->setText(QString::number(pos.y())); - - ui->lineEdit_6->setText(QString::number(size.width())); - ui->lineEdit_7->setText(QString::number(size.height())); -} - void CDsgRoiDlg::showEvent(QShowEvent *evt) { m_pRoiScene->Initialize(m_tempRoiData); m_pRoiScene->DisableMenu(false); - ui->lineEdit_4->clear(); - ui->lineEdit_5->clear(); - ui->lineEdit_6->clear(); - ui->lineEdit_7->clear(); } void CDsgRoiDlg::OnZoomIn() @@ -578,3 +521,17 @@ void CDsgRoiDlg::OnZoomOut() { m_pRoiScene->zoomImage(false); } + +Q_SLOT void CDsgRoiDlg::onSliderChange(int value) +{ + SystemStateInfo::setIni.setValue(QStringLiteral("sliderValue"), value); +} + +void CDsgRoiDlg::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } +} + diff --git a/src/lpbdesigner/DsgRoiDlg.h b/src/lpbdesigner/DsgRoiDlg.h index 73243ad..71ab332 100644 --- a/src/lpbdesigner/DsgRoiDlg.h +++ b/src/lpbdesigner/DsgRoiDlg.h @@ -20,14 +20,10 @@ public: bool InitGraphView(); LP_DETECTOR_ROI_DATA ShowRoiDlg(LP_DETECTOR_ROI_DATA roiData); void CleanUp(); - bool FillRoi(LP_DETECTOR_ROI_DATA& roiData); - - virtual void ResetItem(QPoint pos, QRect size); virtual void OnManualTrigger(){} virtual void OnSetParam(IDetectorTask* pTask){} - virtual void showEvent(QShowEvent *evt); - + Q_SLOT void onSliderChange(int value); signals: void sgShowCameraImage(QImage); public slots : @@ -38,16 +34,15 @@ public slots : void OnCircle(); void OnShowColorDlg(); void OnMove(); - void OnSetItem(); void OnZoomIn(); void OnZoomOut(); - void OnSelectImage(); void OnSnapCameraImage(); - void OnShowCameraImage(QImage img); - void OnShowTenFlag(); +protected: + virtual void showEvent(QShowEvent *evt); + virtual void changeEvent(QEvent *event); private: Ui::RoiDlg *ui; diff --git a/src/lpbdesigner/LPDsg.cpp b/src/lpbdesigner/LPDsg.cpp deleted file mode 100644 index cf41190..0000000 --- a/src/lpbdesigner/LPDsg.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "LPDsg.h" - -CDetectorUI::CDetectorUI() -{ - m_pMainFrame = new CMainFrame; -} - -CDetectorUI::~CDetectorUI() -{ - if (m_pMainFrame) - { - delete m_pMainFrame; - m_pMainFrame = nullptr; - } - if (m_pDE) - { - m_pDE = NULL; - } -} - -bool CDetectorUI::Initialize(IDetectorEngine* lpDE) -{ - if (!lpDE) - return false; - - m_pDE = lpDE; - - return true; -} - -bool CDetectorUI::ShowDeviceMgrDlg() -{ - return true; -} - -bool CDetectorUI::ShowSolutionMgrDlg() -{ - return true; -} - -bool CDetectorUI::ShowMainFrame() -{ - if (!m_pMainFrame->Initialize(m_pDE)) - return false; - - if (!m_pMainFrame->InitGraphView()) - return false; - - m_pMainFrame->show(); - return true; -} - -bool CDetectorUI::ShowReportView(QMap statInfo) -{ - return true; -} \ No newline at end of file diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index e73e7d9..9fc6719 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -145,7 +145,7 @@ CMainFrame::CMainFrame(QWidget *parent) connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnClearResult())); connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(OnSnapImage())); - + connect(ui->m_pbLoadImage, SIGNAL(clicked()), this, SLOT(onButtonClicked())); //connect(ui->menubar, SIGNAL(triggered(QAction *)), this, SLOT(OnMainMenuTrigger(QAction*))); connect(ui->m_pbSaveBtn, SIGNAL(clicked()), this, SLOT(OnTrigger())); connect(this, SIGNAL(sgShowStatus(QString)), this, SLOT(OnShowStatus(QString))); @@ -165,10 +165,6 @@ CMainFrame::CMainFrame(QWidget *parent) ui->statusBar->addWidget(m_plablStatus); _pSaveStatus = ui->label_SaveStatus; -// m_tParamMgrDlg.setParent(this); -// m_tParamMgrDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); - //m_tParamDlg.setParent(parent); - //m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); } CMainFrame::~CMainFrame() @@ -201,11 +197,9 @@ bool CMainFrame::OnMainMenuTrigger(QAction* pAction) m_TaskChangeList.clear(); return true; } - return false; } } - return false; } @@ -482,7 +476,15 @@ bool CMainFrame::InitCurrentTask() std::string strPath = strImageName.toLocal8Bit().toStdString(); m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strPath, CV_LOAD_IMAGE_GRAYSCALE); } - ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input); + if (m_pCurrentTask->GetTaskInfo()->templateImg.data == NULL) + { + QImage img(":/resource/no-img.png"); + ui->gv_input->setImg(img); + } + else + { + ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input); + } } return true; @@ -510,27 +512,6 @@ bool CMainFrame::InitCurrentSolution(QTreeWidgetItem* pItem, IDetectorSolution* } } -// int nTaskCount = pSolution->EnumTask(NULL, 0); -// if (nTaskCount > 0) -// { -// IDetectorTask** lppTask = new IDetectorTask*[nTaskCount]; -// nTaskCount = pSolution->EnumTask(lppTask, nTaskCount); -// for (int i = 0; i < nTaskCount; i++) -// { -// if (lppTask[i]) -// { -// PLP_DETECTOR_TASK pTaskInfo = lppTask[i]->GetTaskInfo(); -// -// QTreeWidgetItem *TaskItem = new QTreeWidgetItem(pItem, QStringList(pTaskInfo->strName)); -// TaskItem->setData(0, Qt::UserRole, lppTask[i]->GetID()); -// TaskItem->setData(1, Qt::UserRole, Task); -// -// pItem->addChild(TaskItem); -// } -// } -// -// delete[] lppTask; -// } return true; } @@ -593,17 +574,12 @@ bool CMainFrame::OnBatchLoadImage(bool bReLoad) return false; } - { - - } - ui->listWidget->clear(); ui->listWidget->setSpacing(12); ui->listWidget->setMovement(QListView::Static); ui->listWidget->setViewMode(QListView::IconMode); ui->listWidget->setWrapping(false); ui->listWidget->setFlow(QListView::LeftToRight); -// ui->listWidget->setIconSize(QSize(75, 75)); for (int i = 0; i < strFileNamesList.size(); i++) { @@ -615,7 +591,6 @@ bool CMainFrame::OnBatchLoadImage(bool bReLoad) QString strFileName = strFileNamesList[0]; std::string strpath = strFileName.toLocal8Bit().toStdString();//中文路径支持 - //cv::Mat m_img = cv::imread(strpath, CV_LOAD_IMAGE_UNCHANGED); m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strpath, CV_LOAD_IMAGE_GRAYSCALE); oldMat = m_pCurrentTask->GetTaskInfo()->templateImg; if (ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input)) @@ -750,8 +725,6 @@ bool CMainFrame::OnParamPopMenu(const QPoint& points) QAction *updateRelyOnAlgoAciton = menu.addAction(QObject::tr("更新关联算法参数")); updateRelyOnAlgoAciton->setObjectName("updateRelyOnAlgoAciton"); - - QAction *selectedAction = menu.exec(QCursor::pos()); if (!selectedAction) { @@ -966,7 +939,6 @@ bool CMainFrame::OnSetOutParam() return false; m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); - //m_tParamMgrDlg.exec(); } } @@ -1301,10 +1273,8 @@ void CMainFrame::OnClearResult() ui->textEdit->clear(); } - bool CMainFrame::OnInitCurrentAlgoParam() { - if (!ui->tableWidget) return false; @@ -1880,3 +1850,20 @@ void CMainFrame::closeEvent(QCloseEvent *event) //OnManualTrigger(); QMainWindow::closeEvent(event); } + +void CMainFrame::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } +} + +Q_SLOT void CMainFrame::onButtonClicked() +{ + QString strObj = sender()->objectName(); + if (strObj == "m_pbLoadImage") + { + OnBatchLoadImage(); + } +} diff --git a/src/lpbdesigner/MainFrame.h b/src/lpbdesigner/MainFrame.h index a0f08af..6c3c5a4 100644 --- a/src/lpbdesigner/MainFrame.h +++ b/src/lpbdesigner/MainFrame.h @@ -41,7 +41,8 @@ public: QString genInfo(); - virtual void closeEvent(QCloseEvent *event); + + Q_SLOT void onButtonClicked(); QString GetParamTypeStr(AlgoParamType type); signals: void sgShowStatus(QString); @@ -94,6 +95,9 @@ public slots: void OnShowCameraImage(QImage img); +protected: + virtual void closeEvent(QCloseEvent *event); + virtual void changeEvent(QEvent *event); private: Ui::MainFrame *ui{ nullptr }; CDsgAlgoDlg m_tAlgoDlg; diff --git a/src/lpbdesigner/MainFrame.ui b/src/lpbdesigner/MainFrame.ui index 476b5e2..4094813 100644 --- a/src/lpbdesigner/MainFrame.ui +++ b/src/lpbdesigner/MainFrame.ui @@ -9,8 +9,8 @@ 0 0 - 963 - 664 + 1011 + 712 @@ -39,20 +39,20 @@ - 11 + 12 保存 - - :/img/resource/save.png:/img/resource/save.png + + :/resource/save.png:/resource/save.png - 20 - 20 + 32 + 32 @@ -84,14 +84,26 @@ + + + 0 + 8 + + Qt::Horizontal + + + 3 + 0 + + - Consolas - 11 + Arial + 12 @@ -101,6 +113,12 @@ + + + 7 + 0 + + Qt::Vertical @@ -142,6 +160,11 @@ 200 + + + 12 + + Qt::ScrollBarAlwaysOff @@ -161,6 +184,11 @@ 200 + + + 12 + + Qt::ScrollBarAlwaysOff @@ -181,6 +209,11 @@ + + + 12 + + 导入图片: @@ -215,9 +248,29 @@ + + + 12 + + 拍摄 + + + :/resource/video-on.png:/resource/video-on.png + + + + + + + 加载标定图 + + + + :/resource/img.png:/resource/img.png + @@ -235,15 +288,30 @@ + + + 12 + + - > + + + + + :/resource/right_more.png:/resource/right_more.png - + + + + 12 + + + @@ -252,6 +320,11 @@ + + + 12 + + 输出结果: @@ -269,7 +342,13 @@ 2 - + + + + 12 + + + @@ -288,6 +367,11 @@ + + + 12 + + 清空结果 @@ -304,6 +388,11 @@ + + + 12 + + Pixel info: ... @@ -356,8 +445,8 @@ - Consolas - 11 + Arial + 12 @@ -402,8 +491,8 @@ - Consolas - 11 + Arial + 12 @@ -441,7 +530,7 @@ - + :/img/resource/save.png:/img/resource/save.png @@ -462,7 +551,7 @@ - + diff --git a/src/lpbdesigner/ParamDlg.ui b/src/lpbdesigner/ParamDlg.ui index ecc8fb3..e7699e5 100644 --- a/src/lpbdesigner/ParamDlg.ui +++ b/src/lpbdesigner/ParamDlg.ui @@ -10,7 +10,7 @@ 0 0 279 - 294 + 298 @@ -44,6 +44,7 @@ Arial + 12 @@ -59,6 +60,7 @@ Arial + 12 @@ -74,6 +76,7 @@ Arial + 12 @@ -88,6 +91,7 @@ Arial + 12 @@ -109,6 +113,7 @@ Arial + 12 @@ -118,6 +123,7 @@ Arial + 12 @@ -133,6 +139,7 @@ Arial + 12 @@ -142,6 +149,7 @@ Arial + 12 @@ -163,6 +171,7 @@ Arial + 12 @@ -172,6 +181,7 @@ Arial + 12 @@ -187,6 +197,7 @@ Arial + 12 @@ -196,6 +207,7 @@ Arial + 12 @@ -211,6 +223,7 @@ Arial + 12 @@ -223,6 +236,7 @@ Arial + 12 @@ -253,6 +267,7 @@ Arial + 12 @@ -288,6 +303,7 @@ Arial + 12 @@ -306,6 +322,7 @@ Arial + 12 diff --git a/src/lpbdesigner/RoiDlg.ui b/src/lpbdesigner/RoiDlg.ui index 2dce40d..f6ab6ba 100644 --- a/src/lpbdesigner/RoiDlg.ui +++ b/src/lpbdesigner/RoiDlg.ui @@ -9,8 +9,8 @@ 0 0 - 816 - 590 + 891 + 574 @@ -21,449 +21,396 @@ ROI检测区域配置 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - Qt::Horizontal + + + + + + 12 + - - - 649 - 27 - - - - - - - - - 0 - 30 - - - - 确定 + + 绘图区域: + + + 2 + + + 2 + + + 2 + + + 2 + + + + + QGraphicsView::AnchorUnderMouse + + + QGraphicsView::AnchorUnderMouse + + + + + + + + Arial + 12 + 50 + false + + + + Pixel info: + + + + - - - + + + - 0 - 30 + 140 + 16777215 - - 取消 + + + 12 + - - - - - - Qt::Horizontal + + 工具 - - - - 140 - 16777215 - + + + 2 - - - 10 - + + 2 - - 工具 + + 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - - 80 - 16777215 - - - - 颜色 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 30 - - - - - 130 - 16777215 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 30 - - - - 十字标定线 - - - - - - - - - 10 - + + 2 - - 绘图区域: - - - - 2 + + + + + + + 50 + 0 + + + + + + + + + + + + 80 + 16777215 + + + + 颜色 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 30 + + + + + 130 + 16777215 + + + + + + + + + + + + 0 + 30 + + + + 十字标定线 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 步长 + + + + + + + 1 + + + 10 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + 1 + + + + + + + + + 0 + + + + + ... + + + + :/resource/caret-up.png:/resource/caret-up.png + + + + 32 + 32 + + + + true + + + + + + + ... + + + + :/resource/caret-left.png:/resource/caret-left.png + + + + 32 + 32 + + + + true + + + + + + + ... + + + + :/resource/caret-right.png:/resource/caret-right.png + + + + 32 + 32 + + + + true + + + + + + + ... + + + + :/resource/caret-down.png:/resource/caret-down.png + + + + 32 + 32 + + + + true + + + + + + + false + + + ... + + + + :/resource/btn-close.png:/resource/btn-close.png + + + + 32 + 32 + + + + true + + + + + + + + + + + 放大 + + + + + + + 缩小 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Horizontal - - 2 + + + 649 + 27 + - - 2 + + + + + + + 0 + 30 + - - 2 + + 确定 - - 2 + + + + + + + 0 + 30 + - - - - - Arial - 8 - 50 - false - - - - Pixel info: - - - - - - - QGraphicsView::AnchorUnderMouse - - - QGraphicsView::AnchorUnderMouse - - - - - - - 控制台: - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - - X: - - - - - - - - - - 宽: - - - - - - - - - - Y: - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - 1 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 25 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - 确认 - - - - - - - - - - - - - - Qt::Horizontal - - - - 58 - 13 - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 30 - - - - 设置图片 - - - - - - - - 0 - 30 - - - - 从相机获取图片 - - - - - - - - - + + 取消 + + + + - + + + diff --git a/src/lpbdesigner/RoiScene.cpp b/src/lpbdesigner/RoiScene.cpp index 06bc707..f92359e 100644 --- a/src/lpbdesigner/RoiScene.cpp +++ b/src/lpbdesigner/RoiScene.cpp @@ -270,7 +270,6 @@ void RoiScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) if (item != 0 && !item->GetCheckState()) { - //m_pRoiDlg->ResetItem(maptoImgPos(item->scenePos()), item->boundingRect().toRect()); emit sgResetItem(maptoImgPos(item->scenePos()), item->boundingRect().toRect()); m_graphItemMapStruct[item].rectf = maptoImgNewPos(item); } @@ -287,7 +286,6 @@ void RoiScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) void RoiScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) { - { if (DrawTool::c_drawShape == selection) { @@ -321,7 +319,6 @@ void RoiScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) void RoiScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) { - { DrawTool * tool = DrawTool::findTool(DrawTool::c_drawShape); if (tool) @@ -335,9 +332,7 @@ void RoiScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) if (item != 0) { - //m_pRoiDlg->ResetItem(maptoImgPos(mouseEvent->scenePos()), item->boundingRect().toRect()); emit sgResetItem(maptoImgPos(mouseEvent->scenePos()), item->boundingRect().toRect()); - m_graphItemMapStruct[item].rectf = maptoImgNewPos(item); DrawTool::c_drawShape = selection; QGraphicsScene::mouseReleaseEvent(mouseEvent); @@ -345,7 +340,7 @@ void RoiScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) } } -void RoiScene::MoveSelectedItem(DirType type) +void RoiScene::MoveSelectedItem(DirType type,int step) { QList items = this->selectedItems(); GraphicsItem *item = 0; @@ -359,28 +354,26 @@ void RoiScene::MoveSelectedItem(DirType type) { case LEFT: { - item->moveBy(-1, 0); + item->moveBy(-step, 0); break; } case RIGHT: { - item->moveBy(1, 0); + item->moveBy(step, 0); break; } case UP: { - item->moveBy(0, -1); + item->moveBy(0, -step); break; } case DOWN: { - item->moveBy(0, 1); + item->moveBy(0, step); break; } } emit sgResetItem(maptoImgPos(item->scenePos()),item->boundingRect().toRect()); - //m_pRoiDlg->ResetItem(maptoImgPos(item->scenePos()),item->boundingRect().toRect()); - m_graphItemMapStruct[item].rectf = maptoImgNewPos(item); } } diff --git a/src/lpbdesigner/RoiScene.h b/src/lpbdesigner/RoiScene.h index d94ba7c..6aaec48 100644 --- a/src/lpbdesigner/RoiScene.h +++ b/src/lpbdesigner/RoiScene.h @@ -56,8 +56,7 @@ public: void DisableMenu(bool bRet){ m_bDisableMenu = bRet; } - - void MoveSelectedItem(DirType type)/*{}*/; + void MoveSelectedItem(DirType type, int step = 1); void SetSelectedItem(QPoint pos, QRect size)/*{}*/; //void SetRoiDlg(IDetectorUISink* lpRoiDlg){ m_pRoiDlg = lpRoiDlg; } void SetGraphicsView(QGraphicsView* ipGV){ mpGraphicsView = ipGV; } diff --git a/src/lpbdesigner/image.qrc b/src/lpbdesigner/image.qrc index d31d58d..d4b1994 100644 --- a/src/lpbdesigner/image.qrc +++ b/src/lpbdesigner/image.qrc @@ -2,5 +2,26 @@ resource/app.png resource/save.png + resource/btn-close.png + resource/caret-down.png + resource/caret-left.png + resource/caret-right.png + resource/caret-up.png + resource/down.png + resource/ellipsis.png + resource/eye.png + resource/hide.png + resource/img.png + resource/interlines.png + resource/left_more.png + resource/lock.png + resource/lock-open.png + resource/lock-open_green.png + resource/no-img.png + resource/right_more.png + resource/save-all.png + resource/thumbtack.png + resource/up.png + resource/video-on.png diff --git a/src/lpbdesigner/lpdesigner.cpp b/src/lpbdesigner/lpdesigner.cpp index b460c87..146131c 100644 --- a/src/lpbdesigner/lpdesigner.cpp +++ b/src/lpbdesigner/lpdesigner.cpp @@ -1,19 +1,17 @@ #include "lpdesigner.h" -#include "LPDsg.h" +#include "CDetectorUI.h" -void LpDesignerNewInstance(IDetectorUI **lppDetectorUI, IDetectorEngine *lpDE, IDetectorUISink* lpSink) +LPDESIGNER_EXPORT IDetectorUI* Lib_Designer_Init(void) { - CDetectorUI *g_pDetectUI = new CDetectorUI; - if (g_pDetectUI) - { - if(!g_pDetectUI->Initialize(lpDE)) - return; - } - - *lppDetectorUI = (IDetectorUI *)g_pDetectUI; + CDetectorUI *g_pDetectUI = new CDetectorUI(); + return (IDetectorUI*)g_pDetectUI; } -bool LpDesignerDeleteInstance() +LPDESIGNER_EXPORT void Lib_Designer_Free(IDetectorUI *ptr) { - return true; + if (ptr) + { + delete ptr; + ptr = nullptr; + } } diff --git a/src/lpbdesigner/resource/btn-close.png b/src/lpbdesigner/resource/btn-close.png new file mode 100644 index 0000000..6b3753e Binary files /dev/null and b/src/lpbdesigner/resource/btn-close.png differ diff --git a/src/lpbdesigner/resource/caret-down.png b/src/lpbdesigner/resource/caret-down.png new file mode 100644 index 0000000..9181a38 Binary files /dev/null and b/src/lpbdesigner/resource/caret-down.png differ diff --git a/src/lpbdesigner/resource/caret-left.png b/src/lpbdesigner/resource/caret-left.png new file mode 100644 index 0000000..5ee7421 Binary files /dev/null and b/src/lpbdesigner/resource/caret-left.png differ diff --git a/src/lpbdesigner/resource/caret-right.png b/src/lpbdesigner/resource/caret-right.png new file mode 100644 index 0000000..6a60867 Binary files /dev/null and b/src/lpbdesigner/resource/caret-right.png differ diff --git a/src/lpbdesigner/resource/caret-up.png b/src/lpbdesigner/resource/caret-up.png new file mode 100644 index 0000000..86ab43d Binary files /dev/null and b/src/lpbdesigner/resource/caret-up.png differ diff --git a/src/lpbdesigner/resource/down.png b/src/lpbdesigner/resource/down.png new file mode 100644 index 0000000..2f5dcbc Binary files /dev/null and b/src/lpbdesigner/resource/down.png differ diff --git a/src/lpbdesigner/resource/ellipsis.png b/src/lpbdesigner/resource/ellipsis.png new file mode 100644 index 0000000..6e71c7c Binary files /dev/null and b/src/lpbdesigner/resource/ellipsis.png differ diff --git a/src/lpbdesigner/resource/eye.png b/src/lpbdesigner/resource/eye.png new file mode 100644 index 0000000..b2c0961 Binary files /dev/null and b/src/lpbdesigner/resource/eye.png differ diff --git a/src/lpbdesigner/resource/hide.png b/src/lpbdesigner/resource/hide.png new file mode 100644 index 0000000..5dbcd49 Binary files /dev/null and b/src/lpbdesigner/resource/hide.png differ diff --git a/src/lpbdesigner/resource/img.png b/src/lpbdesigner/resource/img.png new file mode 100644 index 0000000..ec4316a Binary files /dev/null and b/src/lpbdesigner/resource/img.png differ diff --git a/src/lpbdesigner/resource/interlines.png b/src/lpbdesigner/resource/interlines.png new file mode 100644 index 0000000..39edf5f Binary files /dev/null and b/src/lpbdesigner/resource/interlines.png differ diff --git a/src/lpbdesigner/resource/left_more.png b/src/lpbdesigner/resource/left_more.png new file mode 100644 index 0000000..255d50e Binary files /dev/null and b/src/lpbdesigner/resource/left_more.png differ diff --git a/src/lpbdesigner/resource/lock-open.png b/src/lpbdesigner/resource/lock-open.png new file mode 100644 index 0000000..c0a18bb Binary files /dev/null and b/src/lpbdesigner/resource/lock-open.png differ diff --git a/src/lpbdesigner/resource/lock-open_green.png b/src/lpbdesigner/resource/lock-open_green.png new file mode 100644 index 0000000..82e9299 Binary files /dev/null and b/src/lpbdesigner/resource/lock-open_green.png differ diff --git a/src/lpbdesigner/resource/lock.png b/src/lpbdesigner/resource/lock.png new file mode 100644 index 0000000..cafeeae Binary files /dev/null and b/src/lpbdesigner/resource/lock.png differ diff --git a/src/lpbdesigner/resource/no-img.png b/src/lpbdesigner/resource/no-img.png new file mode 100644 index 0000000..9d06a0d Binary files /dev/null and b/src/lpbdesigner/resource/no-img.png differ diff --git a/src/lpbdesigner/resource/right_more.png b/src/lpbdesigner/resource/right_more.png new file mode 100644 index 0000000..bfe5ed9 Binary files /dev/null and b/src/lpbdesigner/resource/right_more.png differ diff --git a/src/lpbdesigner/resource/save-all.png b/src/lpbdesigner/resource/save-all.png new file mode 100644 index 0000000..e3f43c4 Binary files /dev/null and b/src/lpbdesigner/resource/save-all.png differ diff --git a/src/lpbdesigner/resource/save.png b/src/lpbdesigner/resource/save.png index ce706e4..e67d6d4 100644 Binary files a/src/lpbdesigner/resource/save.png and b/src/lpbdesigner/resource/save.png differ diff --git a/src/lpbdesigner/resource/thumbtack.png b/src/lpbdesigner/resource/thumbtack.png new file mode 100644 index 0000000..24e09d8 Binary files /dev/null and b/src/lpbdesigner/resource/thumbtack.png differ diff --git a/src/lpbdesigner/resource/up.png b/src/lpbdesigner/resource/up.png new file mode 100644 index 0000000..01d2633 Binary files /dev/null and b/src/lpbdesigner/resource/up.png differ diff --git a/src/lpbdesigner/resource/video-on.png b/src/lpbdesigner/resource/video-on.png new file mode 100644 index 0000000..34f06f2 Binary files /dev/null and b/src/lpbdesigner/resource/video-on.png differ diff --git a/src/lpbengine/Algorithm.cpp b/src/lpbengine/Algorithm.cpp index cc9f0f0..e9b13bc 100644 --- a/src/lpbengine/Algorithm.cpp +++ b/src/lpbengine/Algorithm.cpp @@ -162,28 +162,6 @@ PLP_ALGORITHM_PARAM CDetectorAlgorithm::AddParam(const PLP_ALGORITHM_PARAM pPara m_mapParams[pParam->strName] = (*its); return (*its); } - - - //else - { -// LP_ALGORITHM_PARAM* p = new LP_ALGORITHM_PARAM; -// -// p->nID = ++m_nParamBaseID; -// p->nTaskID = pParam->nTaskID; -// p->nSrcAlgoID = pParam->nSrcAlgoID; -// p->nSrcParamID = pParam->nSrcParamID; -// p->strName = pParam->strName; -// p->type = pParam->type; -// p->value = pParam->value; -// p->strDescription = pParam->strDescription; -// p->bIsSave = pParam->bIsSave; -// p->bIsLock = pParam->bIsLock; -// -// //m_vecParams.push_back(p); -// m_mapParams.insert(p->strName, p); -// m_vecParams[p->strName] = p; -// return p; - } } return NULL; } @@ -204,7 +182,6 @@ bool CDetectorAlgorithm::DeleteParam(int nParamID) delete *iter; return true; } - } } @@ -222,7 +199,6 @@ PLP_ALGORITHM_PARAM CDetectorAlgorithm::GetParam(int nParamID) if (p->nID == nParamID) return p; } - } return NULL; @@ -284,23 +260,6 @@ PLP_ALGORITHM_PARAM CDetectorAlgorithm::AddOutParam(const PLP_ALGORITHM_PARAM pP m_mapOutParams[pParam->strName] = (*its); return (*its); } -// else -// { -// PLP_ALGORITHM_PARAM p = new LP_ALGORITHM_PARAM; -// -// p->nID = ++m_nOutParamBaseID; -// p->nTaskID = pParam->nTaskID; -// p->nSrcAlgoID = pParam->nSrcAlgoID; -// p->nSrcParamID = pParam->nSrcParamID; -// p->strName = pParam->strName; -// p->type = pParam->type; -// p->value = pParam->value; -// p->strDescription = pParam->strDescription; -// p->bIsSave = pParam->bIsSave; -// -// m_vecOutParams[p->strName] = p; -// m_mapOutParams.insert(p->strName, p); -// } } return NULL; } @@ -1232,8 +1191,13 @@ bool CDetectorAlgorithm::Load(QString dllPath) m_lib.unload(); } +#ifdef _DEBUG + QString strDll = dllPath + "d.dll"; + QString strFileName = dllPath.mid(dllPath.lastIndexOf("/") + 1) + "d.dll"; +#else QString strDll = dllPath + ".dll"; QString strFileName = dllPath.mid(dllPath.lastIndexOf("/") + 1) + ".dll"; +#endif QFile file(strDll); if (file.exists()) diff --git a/tpvs17/caliCenter/caliCenter.vcxproj b/tpvs17/caliCenter/caliCenter.vcxproj index cbbd534..60a5bca 100644 --- a/tpvs17/caliCenter/caliCenter.vcxproj +++ b/tpvs17/caliCenter/caliCenter.vcxproj @@ -52,7 +52,7 @@ $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName) + $(ProjectName)d $(SolutionDir)$(Platform)\$(Configuration)\ diff --git a/tpvs17/caliValve/caliValve.vcxproj b/tpvs17/caliValve/caliValve.vcxproj index 7f945af..27e5d9f 100644 --- a/tpvs17/caliValve/caliValve.vcxproj +++ b/tpvs17/caliValve/caliValve.vcxproj @@ -52,7 +52,7 @@ $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName) + $(ProjectName)d $(SolutionDir)$(Platform)\$(Configuration)\ diff --git a/tpvs17/lpMain/CMainWin.cpp b/tpvs17/lpMain/CMainWin.cpp index acd546e..8283e6b 100644 --- a/tpvs17/lpMain/CMainWin.cpp +++ b/tpvs17/lpMain/CMainWin.cpp @@ -48,7 +48,7 @@ CMainWin::CMainWin(QWidget *parent) onInitStatus(); connect(&m_devMgrWid, SIGNAL(sgChangeLanguage(QString)), this, SLOT(onLanguageChange(QString))); - connect(m_pDesignerMgr, SIGNAL(sgCloseWindow()), this, SLOT(onMainFrameClose())); + //connect(m_pDesignerMgr, SIGNAL(sgCloseWindow()), this, SLOT(onMainFrameClose())); connect(&m_testWid, SIGNAL(sgTestMode(int)), this, SLOT(onTestMode(int))); m_pColossus = new WfColossus(m_pDetectorEngine); @@ -161,11 +161,16 @@ CMainWin::~CMainWin() delete m_pSerialPort; m_pSerialPort = NULL; } -// if (m_pDesignerMgr) -// { -// delete m_pDesignerMgr; -// m_pDesignerMgr = nullptr; -// } + if (m_pDesigner) + { + delete m_pDesigner; + m_pDesigner = nullptr; + } + if (m_pDllDesigner) + { + delete m_pDllDesigner; + m_pDllDesigner = nullptr; + } if (m_pDllDetectorEngine) { delete m_pDllDetectorEngine; @@ -552,9 +557,8 @@ Q_SLOT void CMainWin::onActionClicked() { QString strObj = sender()->objectName(); if ("actionSetting" == strObj) {//标定 - IDetectorUI* pDetectorUI = GetDesignerInterface(); - if (pDetectorUI) { - pDetectorUI->ShowMainFrame(); + if (m_pDesigner) { + m_pDesigner->ShowMainFrame(this); } } else if ("actionManage" == strObj) {//模板管理 @@ -728,6 +732,14 @@ bool CMainWin::onInitCoreCtrl() return false; } m_pDetectorEngine = m_pDllDetectorEngine->m_pDE; + if (m_pDetectorEngine == nullptr) + { + QMessageBox infobox(QMessageBox::Critical, tr("提示"), tr("lpbengine模块加载失败,请检查!"), QMessageBox::Yes, this); + infobox.setWindowIcon(QIcon(":/image/leaper")); + infobox.setButtonText(QMessageBox::Yes, tr("确认")); + infobox.exec(); + exit(0); + } } //load coretrl if (NULL == m_pDllCoreCtrl) @@ -752,11 +764,23 @@ bool CMainWin::onInitCoreCtrl() } m_pDllDetectorEngine->Initialize(m_pCoreCtrl); - if (NULL == m_pDesignerMgr) + if (m_pDllDesigner == nullptr) { - m_pDesignerMgr = new QDetectorDesignerMgr(); - if (!m_pDesignerMgr->Initialize(m_pDetectorEngine)) { - qWarning() << "Initialize is false"; + m_pDllDesigner = new CDllDesigner(); + if (m_pDllDesigner != nullptr) + { + m_pDesigner = m_pDllDesigner->GetDesignerInterface(); + if (m_pDesigner && m_pDetectorEngine) + { + m_pDesigner->Initialize(m_pDetectorEngine); + } + else { + QMessageBox infobox(QMessageBox::Critical, tr("提示"), tr("lpdesigner模块加载失败,请检查!"), QMessageBox::Yes, this); + infobox.setWindowIcon(QIcon(":/image/leaper")); + infobox.setButtonText(QMessageBox::Yes, tr("确认")); + infobox.exec(); + exit(0); + } } } return true; @@ -867,14 +891,6 @@ void CMainWin::writeConfig() // QSettings setting("language.ini", QSettings::IniFormat); // setting.setValue("language", m_strCurLanguage); } -//======翻译 - -IDetectorUI* CMainWin::GetDesignerInterface() const -{ - if (m_pDesignerMgr) - return m_pDesignerMgr->GetDesignerInterface(); - return nullptr; -} void CMainWin::saveSolution() { diff --git a/tpvs17/lpMain/CMainWin.h b/tpvs17/lpMain/CMainWin.h index 9979268..70cccd7 100644 --- a/tpvs17/lpMain/CMainWin.h +++ b/tpvs17/lpMain/CMainWin.h @@ -13,7 +13,6 @@ #include "IWfCtrl.h" #include "WfColossus.h" #include "AutoTrigger.h" -#include "QDetectorDesignerMgr.h" #include "QTestModeWid.h" #include "iCoreCtrl.h" #include "QModelMangerUI.h" @@ -21,6 +20,8 @@ #include "QDeviceMgrUI.h" #include "QCamSetDlg.h" #include "QCameraMgrUI.h" +#include "lpdesigner.h" +#include "CDllDesigner.h" struct StationInfo { @@ -74,9 +75,7 @@ private:// void rmTranslator(); void readConfig(); void writeConfig(); - private: - IDetectorUI* GetDesignerInterface() const; void saveSolution(); int lastNum(QString str); Q_SLOT void onMainFrameClose(); @@ -114,7 +113,8 @@ private: private: CDllCoreCtrl* m_pDllCoreCtrl{nullptr}; CDllDetectorEngine* m_pDllDetectorEngine{nullptr}; - QDetectorDesignerMgr* m_pDesignerMgr{nullptr}; + CDllDesigner* m_pDllDesigner{ nullptr }; + IDetectorUI* m_pDesigner{ nullptr }; ICoreCtrl* m_pCoreCtrl{nullptr}; IDetectorEngine* m_pDetectorEngine{nullptr}; diff --git a/tpvs17/lpMain/lpMain.vcxproj b/tpvs17/lpMain/lpMain.vcxproj index 63fb1f4..40f4987 100644 --- a/tpvs17/lpMain/lpMain.vcxproj +++ b/tpvs17/lpMain/lpMain.vcxproj @@ -121,7 +121,7 @@ - + @@ -218,7 +218,10 @@ - + + .\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSql;.\GeneratedFiles\$(ConfigurationName);.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\3part\tadpole\include\tpBase;.\..\..\src\lpMain\view + .\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSql;.\GeneratedFiles\$(ConfigurationName);.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\3part\tadpole\include\tpBase;.\..\..\src\lpMain\view + diff --git a/tpvs17/lpMain/lpMain.vcxproj.filters b/tpvs17/lpMain/lpMain.vcxproj.filters index 2934b0a..81d5c9b 100644 --- a/tpvs17/lpMain/lpMain.vcxproj.filters +++ b/tpvs17/lpMain/lpMain.vcxproj.filters @@ -66,9 +66,6 @@ Source Files - - CoreCtrl - lpMain\algela @@ -162,6 +159,9 @@ Source Files + + CoreCtrl + @@ -173,9 +173,6 @@ Header Files - - CoreCtrl - lpMain\algela @@ -266,6 +263,9 @@ Header Files + + CoreCtrl + diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj b/tpvs17/lpdesigner/lpdesigner.vcxproj index 897f416..93fedd4 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj @@ -78,8 +78,6 @@ - - $(QTDIR)\bin\moc.exe;%(FullPath) @@ -163,7 +161,7 @@ .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" - + $(QTDIR)\bin\moc.exe;%(FullPath) @@ -240,7 +238,7 @@ true - + diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters index 2d0bd66..2aa8ddf 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters @@ -43,18 +43,9 @@ - - Header Files - - - Header Files - Header Files - - Header Files - Header Files @@ -94,6 +85,9 @@ Header Files + + Header Files + @@ -167,9 +161,6 @@ Source Files - - Source Files - Source Files @@ -251,6 +242,9 @@ Source Files + + Source Files + diff --git a/tpvs17/valveDetector/valveDetector.vcxproj b/tpvs17/valveDetector/valveDetector.vcxproj index 6a6dba0..74b7ebd 100644 --- a/tpvs17/valveDetector/valveDetector.vcxproj +++ b/tpvs17/valveDetector/valveDetector.vcxproj @@ -82,7 +82,7 @@ $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName) + $(ProjectName)d $(SolutionDir)$(Platform)\$(Configuration)\