refactor: Scan process.
This commit is contained in:
182
src/components/CoordinateXYWidget.cpp
Normal file
182
src/components/CoordinateXYWidget.cpp
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
#include "CoordinateXYWidget.h"
|
||||||
|
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QRect>
|
||||||
|
|
||||||
|
#include "utilities/ScanProcessSequence.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const int BLINK_FREQUENCY = 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordinateXYWidget::CoordinateXYWidget(QWidget* aParent)
|
||||||
|
: QWidget (aParent)
|
||||||
|
, mAngle(0)
|
||||||
|
, mTimer(new QTimer(this))
|
||||||
|
, mBlinking(false)
|
||||||
|
, mBlinkFrequency(0)
|
||||||
|
, mBlinkPoint(QPointF())
|
||||||
|
, mStopGradientEnd(0.05)
|
||||||
|
{
|
||||||
|
setFixedSize(655,655);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::startAutoLocate, this, &CoordinateXYWidget::startFlash);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::stopAutoLocate, this, &CoordinateXYWidget::stopFlash);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::quitAutoLocate, this, &CoordinateXYWidget::quit);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::autoLocateXYUpdated, this, &CoordinateXYWidget::setBlinkPoint);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordinateXYWidget::~CoordinateXYWidget()
|
||||||
|
{
|
||||||
|
mTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
QPainter p(this);
|
||||||
|
|
||||||
|
int w = this->width()-5 ;
|
||||||
|
int h = this->height()-5 ;
|
||||||
|
QPoint center = this->rect().center();
|
||||||
|
QRect rect(center,QPoint(w,h));
|
||||||
|
p.setRenderHint(QPainter::Antialiasing,true);
|
||||||
|
|
||||||
|
|
||||||
|
QConicalGradient coniGrad(w/2,h/2,360-mAngle);
|
||||||
|
coniGrad.setColorAt(0,QColor(0,0,0,255));
|
||||||
|
coniGrad.setColorAt(0.05,QColor(0,170,255,255));
|
||||||
|
coniGrad.setColorAt(mStopGradientEnd,QColor(0,0,0,255));
|
||||||
|
coniGrad.setColorAt(1,QColor(0,0,0,255));
|
||||||
|
coniGrad.setSpread(QGradient::ReflectSpread);
|
||||||
|
p.setBrush(coniGrad);
|
||||||
|
|
||||||
|
QPen pen;
|
||||||
|
pen.setWidth(2);
|
||||||
|
pen.setColor(Qt::gray);
|
||||||
|
pen.setStyle(Qt::SolidLine);
|
||||||
|
p.setPen(pen);
|
||||||
|
|
||||||
|
p.drawEllipse(center,w/2,h/2);
|
||||||
|
p.drawEllipse(center,w/2 - 100,h/2 - 100);
|
||||||
|
pen.setColor(QColor(0, 224, 255, 255).lighter());
|
||||||
|
p.setPen(pen);
|
||||||
|
p.drawEllipse(center,w/2 - 200,h/2 - 200);
|
||||||
|
QRect r = this->rect();
|
||||||
|
int raidLength = 7;
|
||||||
|
QPointF coordinate = mBlinkPoint + center;
|
||||||
|
if (mBlinking)
|
||||||
|
{
|
||||||
|
QRadialGradient radialGradient(coordinate,raidLength, coordinate + QPointF(0,0));
|
||||||
|
radialGradient.setColorAt(0, QColor(0, 224, 255, 255));
|
||||||
|
radialGradient.setColorAt(0.2, QColor(0, 224, 255, 255));
|
||||||
|
radialGradient.setColorAt(1, QColor(0, 224, 255, 0));
|
||||||
|
p.setBrush(radialGradient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QRadialGradient radialGradient(coordinate,raidLength, coordinate + QPointF(0,0));
|
||||||
|
radialGradient.setColorAt(0, QColor(0, 224, 255, 100));
|
||||||
|
radialGradient.setColorAt(0.3, QColor(0, 224, 255, 100));
|
||||||
|
radialGradient.setColorAt(1, QColor(0, 224, 255, 0));
|
||||||
|
p.setBrush(radialGradient);
|
||||||
|
}
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.drawEllipse(coordinate, raidLength, raidLength);
|
||||||
|
|
||||||
|
p.translate(r.center());
|
||||||
|
pen.setColor(Qt::gray);
|
||||||
|
p.setPen(pen);
|
||||||
|
for(int i=1;i<=360;i++)
|
||||||
|
{
|
||||||
|
p.rotate(1);
|
||||||
|
p.drawLine(0,w/2,0,w/2 -5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=1;i<=72;i++)
|
||||||
|
{
|
||||||
|
p.rotate(5);
|
||||||
|
p.drawLine(0,w/2,0,w/2-8);
|
||||||
|
}
|
||||||
|
for(int i=1;i<=36;i++)
|
||||||
|
{
|
||||||
|
p.rotate(10);
|
||||||
|
p.drawLine(0,w/2,0,w/2-12);
|
||||||
|
}
|
||||||
|
for(int i=1;i<=4;i++)
|
||||||
|
{
|
||||||
|
p.rotate(90);
|
||||||
|
p.drawLine(0,w/2,0,w/2-60);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::setBlinkPoint(int aX, int aY)
|
||||||
|
{
|
||||||
|
mBlinkPoint.setX(aX);
|
||||||
|
mBlinkPoint.setY(aY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::updateFlash()
|
||||||
|
{
|
||||||
|
if(mAngle > 360)
|
||||||
|
{
|
||||||
|
mAngle = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAngle += 5;
|
||||||
|
}
|
||||||
|
mBlinkFrequency++;
|
||||||
|
if( mBlinkFrequency == BLINK_FREQUENCY)
|
||||||
|
{
|
||||||
|
mBlinking = !mBlinking;
|
||||||
|
mBlinkFrequency = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::updateStopFlash()
|
||||||
|
{
|
||||||
|
mBlinking = true;
|
||||||
|
if(mStopGradientEnd <=0.1)
|
||||||
|
{
|
||||||
|
mTimer->stop();
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateStopFlash);
|
||||||
|
mStopGradientEnd = 0.05;
|
||||||
|
this->update();
|
||||||
|
ScanProcessSequence::getInstance()->startFullScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mStopGradientEnd-=0.02;
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::startFlash()
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
connect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateFlash);
|
||||||
|
mStopGradientEnd = 1;
|
||||||
|
mTimer->start(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::stopFlash()
|
||||||
|
{
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateFlash);
|
||||||
|
connect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateStopFlash);
|
||||||
|
mTimer->stop();
|
||||||
|
mTimer->start(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateXYWidget::quit()
|
||||||
|
{
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateFlash);
|
||||||
|
mTimer->stop();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
37
src/components/CoordinateXYWidget.h
Normal file
37
src/components/CoordinateXYWidget.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#ifndef COORDINATEXYWIDGET_H
|
||||||
|
#define COORDINATEXYWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
|
class CoordinateXYWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CoordinateXYWidget(QWidget* aParent);
|
||||||
|
~CoordinateXYWidget();
|
||||||
|
void setBlinkPoint(int aX, int aY);
|
||||||
|
void stopFlash();
|
||||||
|
void startFlash();
|
||||||
|
void quit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent* aEvent);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateFlash();
|
||||||
|
void updateStopFlash();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int mAngle;
|
||||||
|
QTimer* mTimer;
|
||||||
|
bool mBlinking;
|
||||||
|
int mBlinkFrequency;
|
||||||
|
int mBlinkPointX;
|
||||||
|
QPointF mBlinkPoint;
|
||||||
|
|
||||||
|
double mStopGradientEnd;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COORDINATEXYWIDGET_H
|
||||||
181
src/components/CoordinateZWidget.cpp
Normal file
181
src/components/CoordinateZWidget.cpp
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
#include "CoordinateZWidget.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include "utilities/ScanProcessSequence.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const int ANIME_RECT_HEIGHT = 350;
|
||||||
|
const int ANIME_SPEED = 10;
|
||||||
|
const int BLINK_FREQUENCY = 18;
|
||||||
|
const int WIDGET_WIDTH = 630;
|
||||||
|
const int WIDGET_HEIGHT = 690;
|
||||||
|
const int TOP_POINT_Y = 170;
|
||||||
|
const int BOTTOM_POINT_Y = 515;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordinateZWidget::CoordinateZWidget(QWidget* aParent)
|
||||||
|
: QWidget(aParent)
|
||||||
|
, mTimer(new QTimer(this))
|
||||||
|
, mRenderStartPoint(WIDGET_HEIGHT - 50)
|
||||||
|
, mRenderEndPoint(mRenderStartPoint+ANIME_RECT_HEIGHT)
|
||||||
|
, mRenderDirectionUp(true)
|
||||||
|
, mRenderDirectionNumber(1)
|
||||||
|
, mBlinking(false)
|
||||||
|
, mBlinkFrequency(0)
|
||||||
|
, mBlinkPoint(QPointF())
|
||||||
|
, mStopGradientEnd(0.1)
|
||||||
|
{
|
||||||
|
setFixedSize(WIDGET_WIDTH,WIDGET_HEIGHT);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::startAutoLocate, this, &CoordinateZWidget::startFlash);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::stopAutoLocate, this, &CoordinateZWidget::stopFlash);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::quitAutoLocate, this, &CoordinateZWidget::quit);
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::autoLocateZUpdated, this, &CoordinateZWidget::setBlinkPoint);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::paintEvent(QPaintEvent* aEvent)
|
||||||
|
{
|
||||||
|
Q_UNUSED(aEvent);
|
||||||
|
QPainter p(this);
|
||||||
|
int w = this->width() - 10;
|
||||||
|
int h = this->height();
|
||||||
|
|
||||||
|
QRect rect(5,-175,w,h);
|
||||||
|
p.setRenderHint(QPainter::Antialiasing,true);
|
||||||
|
QLinearGradient lineGrad(QPointF(0, mRenderStartPoint), QPointF(0, mRenderEndPoint));
|
||||||
|
lineGrad.setColorAt(0,QColor(0,0,0,255));
|
||||||
|
lineGrad.setColorAt(0.1,QColor(0,170,255,255));
|
||||||
|
lineGrad.setColorAt(mStopGradientEnd,QColor(0,0,0,255));
|
||||||
|
lineGrad.setColorAt(1,QColor(0,0,0,255));
|
||||||
|
lineGrad.setSpread(QGradient::PadSpread);
|
||||||
|
p.setBrush(lineGrad);
|
||||||
|
//p.fillRect(0,0,w,h, lineGrad);
|
||||||
|
|
||||||
|
QPen pen;
|
||||||
|
pen.setWidth(3);
|
||||||
|
pen.setColor(Qt::gray);
|
||||||
|
pen.setStyle(Qt::SolidLine);
|
||||||
|
p.setPen(pen);
|
||||||
|
p.drawPie(rect, 180*16, 180 * 16);
|
||||||
|
|
||||||
|
QPointF coor = QPointF(this->rect().center().x() + 20, TOP_POINT_Y + mBlinkPoint.y());
|
||||||
|
int raidLength = 7;
|
||||||
|
if (mBlinking)
|
||||||
|
{
|
||||||
|
QRadialGradient radialGradient(coor,raidLength, coor + QPointF(0,0));
|
||||||
|
radialGradient.setColorAt(0, QColor(0, 224, 255, 255));
|
||||||
|
radialGradient.setColorAt(0.2, QColor(0, 224, 255, 255));
|
||||||
|
radialGradient.setColorAt(1, QColor(0, 224, 255, 0));
|
||||||
|
p.setBrush(radialGradient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QRadialGradient radialGradient(coor,raidLength, coor + QPointF(0,0));
|
||||||
|
radialGradient.setColorAt(0, QColor(0, 224, 255, 100));
|
||||||
|
radialGradient.setColorAt(0.3, QColor(0, 224, 255, 100));
|
||||||
|
radialGradient.setColorAt(1, QColor(0, 224, 255, 0));
|
||||||
|
p.setBrush(radialGradient);
|
||||||
|
}
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.drawEllipse(coor, raidLength, raidLength);
|
||||||
|
|
||||||
|
pen.setWidth(1);
|
||||||
|
p.setPen(pen);
|
||||||
|
p.drawLine(w/2,TOP_POINT_Y,w/2,BOTTOM_POINT_Y);
|
||||||
|
int samllLineWidth = 5;
|
||||||
|
for(int i=TOP_POINT_Y; i<BOTTOM_POINT_Y; i+=5)
|
||||||
|
{
|
||||||
|
if((i-TOP_POINT_Y)%25!=0)
|
||||||
|
p.drawLine(w/2,i,w/2+samllLineWidth,i);
|
||||||
|
}
|
||||||
|
|
||||||
|
samllLineWidth = 12;
|
||||||
|
for(int i=TOP_POINT_Y; i<BOTTOM_POINT_Y; i+=25)
|
||||||
|
{
|
||||||
|
p.drawLine(w/2,i,w/2+samllLineWidth,i);
|
||||||
|
}
|
||||||
|
|
||||||
|
pen.setWidth(2);
|
||||||
|
pen.setColor(QColor(0, 224, 255, 255).lighter());
|
||||||
|
pen.setStyle(Qt::SolidLine);
|
||||||
|
p.setPen(pen);
|
||||||
|
|
||||||
|
samllLineWidth = 25;
|
||||||
|
p.drawLine(w/2,TOP_POINT_Y + 25*6,w/2+samllLineWidth,TOP_POINT_Y + 25*6);
|
||||||
|
p.drawLine(w/2,TOP_POINT_Y + 25*9,w/2+samllLineWidth,TOP_POINT_Y + 25*9);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::setBlinkPoint(int aZ)
|
||||||
|
{
|
||||||
|
mBlinkPoint.setY(aZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::startFlash()
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
connect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateFlash);
|
||||||
|
mStopGradientEnd = 1;
|
||||||
|
mTimer->start(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::stopFlash()
|
||||||
|
{
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateFlash);
|
||||||
|
connect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateStopFlash);
|
||||||
|
mTimer->stop();
|
||||||
|
mTimer->start(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::updateFlash()
|
||||||
|
{
|
||||||
|
if(mRenderEndPoint <= TOP_POINT_Y && mRenderDirectionUp)
|
||||||
|
{
|
||||||
|
mRenderDirectionUp = false;
|
||||||
|
mRenderDirectionNumber *= -1;
|
||||||
|
mRenderStartPoint = mRenderDirectionNumber * ANIME_SPEED + TOP_POINT_Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mRenderEndPoint >= BOTTOM_POINT_Y && !mRenderDirectionUp)
|
||||||
|
{
|
||||||
|
mRenderDirectionUp = true;
|
||||||
|
mRenderDirectionNumber *= -1;
|
||||||
|
mRenderStartPoint = BOTTOM_POINT_Y - ANIME_SPEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
mRenderStartPoint -= mRenderDirectionNumber*ANIME_SPEED;
|
||||||
|
mRenderEndPoint = mRenderStartPoint + mRenderDirectionNumber*ANIME_RECT_HEIGHT;
|
||||||
|
mBlinkFrequency++;
|
||||||
|
if( mBlinkFrequency == BLINK_FREQUENCY)
|
||||||
|
{
|
||||||
|
mBlinking = !mBlinking;
|
||||||
|
mBlinkFrequency = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
void CoordinateZWidget::updateStopFlash()
|
||||||
|
{
|
||||||
|
mBlinking = true;
|
||||||
|
if(mStopGradientEnd <=0.2)
|
||||||
|
{
|
||||||
|
mTimer->stop();
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateStopFlash);
|
||||||
|
mStopGradientEnd = 0.1;
|
||||||
|
this->update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mStopGradientEnd-=0.02;
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoordinateZWidget::quit()
|
||||||
|
{
|
||||||
|
disconnect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateFlash);
|
||||||
|
mTimer->stop();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
39
src/components/CoordinateZWidget.h
Normal file
39
src/components/CoordinateZWidget.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef COORDINATEZWIDGET_H
|
||||||
|
#define COORDINATEZWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
|
class CoordinateZWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CoordinateZWidget(QWidget* aParent);
|
||||||
|
void setBlinkPoint(int aZ);
|
||||||
|
void stopFlash();
|
||||||
|
void startFlash();
|
||||||
|
|
||||||
|
void quit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent* aEvent);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateFlash();
|
||||||
|
void updateStopFlash();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer* mTimer;
|
||||||
|
int mRenderStartPoint;
|
||||||
|
int mRenderEndPoint;
|
||||||
|
bool mRenderDirectionUp;
|
||||||
|
int mRenderDirectionNumber;
|
||||||
|
bool mBlinking;
|
||||||
|
int mBlinkFrequency;
|
||||||
|
QPointF mBlinkPoint;
|
||||||
|
double mStopGradientEnd;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COORDINATEZWIDGET_H
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QtMath>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
|
||||||
#include "appvals/AppGlobalValues.h"
|
#include "appvals/AppGlobalValues.h"
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
#include "recon/ReconManager.h"
|
#include "recon/ReconManager.h"
|
||||||
#include "dialogs/MultyMessageDialog.h"
|
#include "dialogs/MultyMessageDialog.h"
|
||||||
#include "UsctStateManager.h"
|
#include "UsctStateManager.h"
|
||||||
|
#include "utilities/ScanProcessSequence.h"
|
||||||
|
|
||||||
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
||||||
|
|
||||||
@@ -36,6 +38,9 @@ namespace
|
|||||||
const int CHECK_RECON_CONNECTION_TIME = 30000;
|
const int CHECK_RECON_CONNECTION_TIME = 30000;
|
||||||
const int SHUT_DOWN_TIMEOUT = 180000;//3 minitues
|
const int SHUT_DOWN_TIMEOUT = 180000;//3 minitues
|
||||||
const int PUMP_TIMEOUT = 3000;//3 seconds
|
const int PUMP_TIMEOUT = 3000;//3 seconds
|
||||||
|
const int EFFECTIVE_POSITION_RADIUS = 125;
|
||||||
|
const int EFFECTIVE_POSITION_Z_START = 150;
|
||||||
|
const int EFFECTIVE_POSITION_Z_END = 225;
|
||||||
const QString DEFAULT_DMS_START_FAILED = "Dms start failed.";
|
const QString DEFAULT_DMS_START_FAILED = "Dms start failed.";
|
||||||
const QString RECON_TRANSFER_PATH = "/home/krad/TestStore";
|
const QString RECON_TRANSFER_PATH = "/home/krad/TestStore";
|
||||||
|
|
||||||
@@ -113,6 +118,9 @@ void DeviceManager::initDevice()
|
|||||||
{
|
{
|
||||||
controlDrainage(*(QString*)detail);
|
controlDrainage(*(QString*)detail);
|
||||||
});
|
});
|
||||||
|
//AutoLocate
|
||||||
|
connect(EventCenter::Default(), &EventCenter::StartScanProcess, this, &DeviceManager::startAutoLocate);
|
||||||
|
connect(EventCenter::Default(), &EventCenter::StopScanProcess, this, &DeviceManager::stopAutoLocate);
|
||||||
|
|
||||||
//Sync action
|
//Sync action
|
||||||
mGetDeviceStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STATUS, this, "responseGetDeviceStatus(const QString&)", this);
|
mGetDeviceStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STATUS, this, "responseGetDeviceStatus(const QString&)", this);
|
||||||
@@ -126,6 +134,9 @@ void DeviceManager::initDevice()
|
|||||||
mSetSimulatorModeAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_SIMULATOR, this, "responseSetSimulatorMode(const QString&)", this);
|
mSetSimulatorModeAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_SIMULATOR, this, "responseSetSimulatorMode(const QString&)", this);
|
||||||
mSetHeartBeatAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_HBCFG, this, "responseSetHeartBeat(const QString&)", this);
|
mSetHeartBeatAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_HBCFG, this, "responseSetHeartBeat(const QString&)", this);
|
||||||
mCheckInitStatusAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_INIT_STATUS, this, "responseCheckInitStatus(const QString&)", this);
|
mCheckInitStatusAction = new DmsSyncAction(USRV_INFOCFG, ACT_IFCFG_INIT_STATUS, this, "responseCheckInitStatus(const QString&)", this);
|
||||||
|
mStartAutoLocateAction = new DmsSyncAction(USRV_CONTROL, ACT_CTL_MOTION_START, this, "responseStartAutoLocate(const QString&)", this);
|
||||||
|
mStopAutoLocateAction = new DmsSyncAction(USRV_CONTROL, ACT_CTL_MOTION_STOP, this, "responseStopAutoLocate(const QString&)", this);
|
||||||
|
mCheckDataQualityAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_IMGQUALITI, this, "responseCheckDataQuality(const QString&)", this);
|
||||||
|
|
||||||
//Async action
|
//Async action
|
||||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||||
@@ -136,12 +147,24 @@ void DeviceManager::initDevice()
|
|||||||
mShutDownAction->setTimeoutInterval(SHUT_DOWN_TIMEOUT);
|
mShutDownAction->setTimeoutInterval(SHUT_DOWN_TIMEOUT);
|
||||||
mPumpControlAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_PUMP, this, "responsePumpControl(const QString&)", this);
|
mPumpControlAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_PUMP, this, "responsePumpControl(const QString&)", this);
|
||||||
mPumpControlAction->setTimeoutInterval(PUMP_TIMEOUT);
|
mPumpControlAction->setTimeoutInterval(PUMP_TIMEOUT);
|
||||||
connect(mPumpControlAction, &DmsAsyncAction::timeout, this, [this]()
|
mGetAutoLocatePositionAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_MOTION_POSITION, this, "responseGetAutoLocatePosition(const QString&)", this);
|
||||||
|
connect(mPumpControlAction, &DmsAsyncAction::timeout, [this]()
|
||||||
{
|
{
|
||||||
this->processPumpResult("{\"code\":-1}");
|
this->processPumpResult("{\"code\":-1}");
|
||||||
});
|
});
|
||||||
connect(mGetScanProgressAction, &DmsAsyncAction::timeout, this, &DeviceManager::scanTimeout);
|
connect(mGetScanProgressAction, &DmsAsyncAction::timeout, this, &DeviceManager::scanTimeout);
|
||||||
connect(mShutDownAction, &DmsAsyncAction::timeout, this, &DeviceManager::shutdownDmsFailed);
|
connect(mShutDownAction, &DmsAsyncAction::timeout, this, &DeviceManager::shutdownDmsFailed);
|
||||||
|
connect(mGetAutoLocatePositionAction, &DmsAsyncAction::timeout, [this]()
|
||||||
|
{
|
||||||
|
if(mGetAutoLocatePositionTimer != -1)
|
||||||
|
{
|
||||||
|
this->killTimer(mGetAutoLocatePositionTimer);
|
||||||
|
mGetAutoLocatePositionTimer = -1;
|
||||||
|
}
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
QString errorMessage = tr("DMS connection error");
|
||||||
|
THROW_ERROR(errorMessage)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//dmsInfoReceiverThread
|
//dmsInfoReceiverThread
|
||||||
@@ -200,7 +223,6 @@ void DeviceManager::initGUI(bool aIsInitSucceed)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UsctStateManager::getInstance()->setState(DmsState, false);
|
|
||||||
emit initializeProgress("33");
|
emit initializeProgress("33");
|
||||||
QThread::msleep(500);
|
QThread::msleep(500);
|
||||||
emit initializeProgress("66");
|
emit initializeProgress("66");
|
||||||
@@ -316,19 +338,26 @@ void DeviceManager::processScanProgress(const QString& aProgress)
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
QVariant var(QString("progress:%1%").arg(msg));
|
QVariant var(tr("progress:%1%").arg(msg));
|
||||||
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
QVariant var( (mIsEmptyScan ? QString("") : tr("Patient can leave.\n")) + QString("progress:%1%").arg(msg));
|
ScanProcessSequence::getInstance()->fullScanDataExport();
|
||||||
|
QVariant var( (mIsEmptyScan ? QString("") : tr("Patient can leave.\nprogress:%1%")).arg(msg));
|
||||||
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
prepareFinishScan(true);
|
{
|
||||||
|
QVariant var( tr("Data quality assessment in progress\nprogress:99%"));
|
||||||
|
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
checkDataQuality();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
prepareFinishScan(false, msg);
|
prepareFinishScan(false, msg);
|
||||||
break;
|
break;
|
||||||
@@ -356,6 +385,7 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
|||||||
if(!isNormalFinish)
|
if(!isNormalFinish)
|
||||||
{
|
{
|
||||||
TRIGGER_EVENT(InvokeOperationEnd, nullptr, var);
|
TRIGGER_EVENT(InvokeOperationEnd, nullptr, var);
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,6 +414,11 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
|||||||
{
|
{
|
||||||
TRIGGER_EVENT(EmptyScanFinished, nullptr, nullptr);
|
TRIGGER_EVENT(EmptyScanFinished, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScanProcessSequence::getInstance()->popPosition();
|
||||||
|
startAutoLocate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::prepareFinishInitialize()
|
void DeviceManager::prepareFinishInitialize()
|
||||||
@@ -435,12 +470,8 @@ void DeviceManager::stopPreviewScan()
|
|||||||
AppGlobalValues::setInProcessing(false);
|
AppGlobalValues::setInProcessing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::close() {
|
void DeviceManager::close()
|
||||||
// #ifdef _WIN32
|
{
|
||||||
// StopDevice();
|
|
||||||
// #endif
|
|
||||||
// mPreviewDataCaller->terminate();
|
|
||||||
// delete mPreviewDataCaller;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::processPreviewData(const QString& aPreviewData)
|
void DeviceManager::processPreviewData(const QString& aPreviewData)
|
||||||
@@ -547,23 +578,31 @@ void DeviceManager::checkInitStatus()
|
|||||||
|
|
||||||
void DeviceManager::timerEvent(QTimerEvent* event)
|
void DeviceManager::timerEvent(QTimerEvent* event)
|
||||||
{
|
{
|
||||||
if (event->timerId() == mTemperatureTimer)
|
|
||||||
{
|
|
||||||
getDeviceTemperature();
|
|
||||||
return QObject::timerEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(event->timerId() == mScanProgressTimer)
|
if(event->timerId() == mScanProgressTimer)
|
||||||
{
|
{
|
||||||
getScanProcess();
|
getScanProcess();
|
||||||
return QObject::timerEvent(event);
|
return QObject::timerEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event->timerId() == mGetAutoLocatePositionTimer)
|
||||||
|
{
|
||||||
|
getAutoLocatePosition();
|
||||||
|
return QObject::timerEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
if(event->timerId() == mCheckInitStatusTimer)
|
if(event->timerId() == mCheckInitStatusTimer)
|
||||||
{
|
{
|
||||||
checkInitStatus();
|
checkInitStatus();
|
||||||
return QObject::timerEvent(event);
|
return QObject::timerEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->timerId() == mTemperatureTimer)
|
||||||
|
{
|
||||||
|
getDeviceTemperature();
|
||||||
|
return QObject::timerEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::emitErrorCallback(const char *msg)
|
void DeviceManager::emitErrorCallback(const char *msg)
|
||||||
@@ -629,6 +668,8 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
|||||||
case ACT_SCAN_SIMULATOR:
|
case ACT_SCAN_SIMULATOR:
|
||||||
emit responseSetSimulatorMode(aContents);
|
emit responseSetSimulatorMode(aContents);
|
||||||
break;
|
break;
|
||||||
|
case ACT_SCAN_IMGQUALITI:
|
||||||
|
emit responseCheckDataQuality(aContents);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -686,6 +727,16 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
|||||||
emit responseShutDown(aContents);
|
emit responseShutDown(aContents);
|
||||||
processShutDownDms(aContents);
|
processShutDownDms(aContents);
|
||||||
break;
|
break;
|
||||||
|
case ACT_CTL_MOTION_START:
|
||||||
|
emit responseStartAutoLocate(aContents);
|
||||||
|
break;
|
||||||
|
case ACT_CTL_MOTION_STOP:
|
||||||
|
emit responseStopAutoLocate(aContents);
|
||||||
|
break;
|
||||||
|
case ACT_CTL_MOTION_POSITION:
|
||||||
|
emit responseGetAutoLocatePosition(aContents);
|
||||||
|
processAutoLocatePosition(aContents);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1202,3 +1253,108 @@ void DeviceManager::updateReconConnectionState(bool aIsConnected)
|
|||||||
{
|
{
|
||||||
EventCenter::Default()->triggerEvent(ReconConnectionUpdated, nullptr, (QObject*)&aIsConnected);
|
EventCenter::Default()->triggerEvent(ReconConnectionUpdated, nullptr, (QObject*)&aIsConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DeviceManager::startAutoLocate()
|
||||||
|
{
|
||||||
|
if(ScanProcessSequence::getInstance()->getScanPositionSize() == 0)
|
||||||
|
{
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto result = mStartAutoLocateAction->execute();
|
||||||
|
if(result.mIsSucessful)
|
||||||
|
{
|
||||||
|
mIsAutoLocating = true;
|
||||||
|
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||||
|
if(jsonObj["code"].toInt() == 0 )
|
||||||
|
{
|
||||||
|
emit startAutoLocateResult(true);
|
||||||
|
mGetAutoLocatePositionTimer = startTimer(1000);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stopAutoLocate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
QString errorMessage = tr("Start auto locate failed");
|
||||||
|
THROW_ERROR(errorMessage)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::stopAutoLocate()
|
||||||
|
{
|
||||||
|
if(mIsAutoLocating)
|
||||||
|
{
|
||||||
|
mStopAutoLocateAction->execute();
|
||||||
|
mIsAutoLocating = false;
|
||||||
|
}
|
||||||
|
if(mGetAutoLocatePositionTimer != -1)
|
||||||
|
{
|
||||||
|
killTimer(mGetAutoLocatePositionTimer);
|
||||||
|
mGetAutoLocatePositionTimer = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::getAutoLocatePosition()
|
||||||
|
{
|
||||||
|
mGetAutoLocatePositionAction->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::processAutoLocatePosition(const QString& aProgress)
|
||||||
|
{
|
||||||
|
QJsonObject jsonObj = toJsonObject(aProgress);
|
||||||
|
int code = jsonObj["code"].toInt();
|
||||||
|
int x = jsonObj["x"].toInt();
|
||||||
|
int y = jsonObj["y"].toInt();
|
||||||
|
int z = jsonObj["z"].toInt();
|
||||||
|
if(code == 0)
|
||||||
|
{
|
||||||
|
if(qSqrt(x*x + y*y)<EFFECTIVE_POSITION_RADIUS && z > EFFECTIVE_POSITION_Z_START && z< EFFECTIVE_POSITION_Z_END)
|
||||||
|
{
|
||||||
|
if(++mEffectivePositionCount >= 5)
|
||||||
|
{
|
||||||
|
mEffectivePositionCount = 0;
|
||||||
|
stopAutoLocate();
|
||||||
|
emit autolocatePositionEffective();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mEffectivePositionCount = 0;;
|
||||||
|
}
|
||||||
|
emit updateAutoLocatePosition(x, y, z);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
QString errorMessage = tr("Start auto locate failed");
|
||||||
|
THROW_ERROR(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::checkDataQuality()
|
||||||
|
{
|
||||||
|
auto result = mCheckDataQualityAction->execute();
|
||||||
|
if(result.mIsSucessful)
|
||||||
|
{
|
||||||
|
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||||
|
if(jsonObj["qualities"].toInt() == 1 )
|
||||||
|
{
|
||||||
|
prepareFinishScan(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString errorMessage = tr("The data quality is low, please restart the data scan.") + jsonObj["info"].toString();
|
||||||
|
prepareFinishScan(false, errorMessage);
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString errorMessage = tr("Dms connection error");
|
||||||
|
prepareFinishScan(false, errorMessage);
|
||||||
|
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|||||||
@@ -99,15 +99,20 @@ private:
|
|||||||
void stopPreviewScan();
|
void stopPreviewScan();
|
||||||
void getDeviceTemperature();
|
void getDeviceTemperature();
|
||||||
void getScanProcess();
|
void getScanProcess();
|
||||||
|
void getAutoLocatePosition();
|
||||||
bool getCEStatus();
|
bool getCEStatus();
|
||||||
bool startCEScan();
|
bool startCEScan();
|
||||||
void startTransfer();
|
void startTransfer();
|
||||||
void initEmptyScanMeasurementID();
|
void initEmptyScanMeasurementID();
|
||||||
void controlDrainage(const QString& aCode);
|
void controlDrainage(const QString& aCode);
|
||||||
void checkInitStatus();
|
void checkInitStatus();
|
||||||
|
bool startAutoLocate();
|
||||||
|
void stopAutoLocate();
|
||||||
void initGUI(bool aIsInitSucceed);
|
void initGUI(bool aIsInitSucceed);
|
||||||
|
void checkDataQuality();
|
||||||
|
|
||||||
void processScanProgress(const QString& aProgress);
|
void processScanProgress(const QString& aProgress);
|
||||||
|
void processAutoLocatePosition(const QString& aProgress);
|
||||||
void processInitializeProgress(const QString& aProgress);
|
void processInitializeProgress(const QString& aProgress);
|
||||||
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
||||||
void prepareFinishInitialize();
|
void prepareFinishInitialize();
|
||||||
@@ -155,6 +160,10 @@ signals:
|
|||||||
void responseStopTransfer(const QString& aResponse);
|
void responseStopTransfer(const QString& aResponse);
|
||||||
void responseShutDown(const QString& aResponse);
|
void responseShutDown(const QString& aResponse);
|
||||||
void responseCheckInitStatus(const QString& aResponse);
|
void responseCheckInitStatus(const QString& aResponse);
|
||||||
|
void responseStartAutoLocate(const QString& aResponse);
|
||||||
|
void responseStopAutoLocate(const QString& aResponse);
|
||||||
|
void responseGetAutoLocatePosition(const QString& aResponse);
|
||||||
|
void responseCheckDataQuality(const QString& aResponse);
|
||||||
//Recon
|
//Recon
|
||||||
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
||||||
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
||||||
@@ -166,6 +175,9 @@ signals:
|
|||||||
void transferStatusUpdated();
|
void transferStatusUpdated();
|
||||||
void startPreviewScanResult(bool aIsSucessful);
|
void startPreviewScanResult(bool aIsSucessful);
|
||||||
void startPumpControlResult(bool aIsSucessful);
|
void startPumpControlResult(bool aIsSucessful);
|
||||||
|
void startAutoLocateResult(bool aIsSucessful);
|
||||||
|
void updateAutoLocatePosition(int aX, int aY, int aZ);
|
||||||
|
void autolocatePositionEffective();
|
||||||
void shutdownDmsSended();
|
void shutdownDmsSended();
|
||||||
void shutdownDmsFailed();
|
void shutdownDmsFailed();
|
||||||
|
|
||||||
@@ -174,13 +186,16 @@ private:
|
|||||||
int mTemperatureTimer = -1;
|
int mTemperatureTimer = -1;
|
||||||
int mScanProgressTimer = -1;
|
int mScanProgressTimer = -1;
|
||||||
int mCheckInitStatusTimer = -1;
|
int mCheckInitStatusTimer = -1;
|
||||||
|
int mGetAutoLocatePositionTimer = -1;
|
||||||
int mTransferProgress = 0;
|
int mTransferProgress = 0;
|
||||||
|
int mEffectivePositionCount = 0;
|
||||||
bool mIsEmptyScan = false;
|
bool mIsEmptyScan = false;
|
||||||
bool mIsTransferEmptyScan = false;
|
bool mIsTransferEmptyScan = false;
|
||||||
bool mIsScanning = false;
|
bool mIsScanning = false;
|
||||||
bool mIsTransfering = false;
|
bool mIsTransfering = false;
|
||||||
bool mIsPreviewing = false;
|
bool mIsPreviewing = false;
|
||||||
bool mIsInitializing = false;
|
bool mIsInitializing = false;
|
||||||
|
bool mIsAutoLocating = false;
|
||||||
|
|
||||||
QString mCurrentScanMeasurementID = "";
|
QString mCurrentScanMeasurementID = "";
|
||||||
QString mCurrentEmptyMeasurementID = "";
|
QString mCurrentEmptyMeasurementID = "";
|
||||||
@@ -205,6 +220,9 @@ private:
|
|||||||
DmsSyncAction* mSetSimulatorModeAction = nullptr;
|
DmsSyncAction* mSetSimulatorModeAction = nullptr;
|
||||||
DmsSyncAction* mSetHeartBeatAction = nullptr;
|
DmsSyncAction* mSetHeartBeatAction = nullptr;
|
||||||
DmsSyncAction* mCheckInitStatusAction = nullptr;
|
DmsSyncAction* mCheckInitStatusAction = nullptr;
|
||||||
|
DmsSyncAction* mStartAutoLocateAction = nullptr;
|
||||||
|
DmsSyncAction* mStopAutoLocateAction = nullptr;
|
||||||
|
DmsSyncAction* mCheckDataQualityAction = nullptr;
|
||||||
|
|
||||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||||
@@ -212,6 +230,7 @@ private:
|
|||||||
DmsAsyncAction* mStopTransferAction = nullptr;
|
DmsAsyncAction* mStopTransferAction = nullptr;
|
||||||
DmsAsyncAction* mShutDownAction = nullptr;
|
DmsAsyncAction* mShutDownAction = nullptr;
|
||||||
DmsAsyncAction* mPumpControlAction = nullptr;
|
DmsAsyncAction* mPumpControlAction = nullptr;
|
||||||
|
DmsAsyncAction* mGetAutoLocatePositionAction = nullptr;
|
||||||
|
|
||||||
InfoReceiveWorker* mInfoReceiveWorker = nullptr;
|
InfoReceiveWorker* mInfoReceiveWorker = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ void InfoReceiveWorker::responsed(int aServerID, int aActionID)
|
|||||||
case ACT_SCAN_SIMULATOR:
|
case ACT_SCAN_SIMULATOR:
|
||||||
DeviceManager::Default()->mSetSimulatorModeAction->responsed();
|
DeviceManager::Default()->mSetSimulatorModeAction->responsed();
|
||||||
break;
|
break;
|
||||||
|
case ACT_SCAN_IMGQUALITI:
|
||||||
|
DeviceManager::Default()->mCheckDataQualityAction->responsed();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -110,6 +112,15 @@ void InfoReceiveWorker::responsed(int aServerID, int aActionID)
|
|||||||
case ACT_CTL_PWRDOWN:
|
case ACT_CTL_PWRDOWN:
|
||||||
DeviceManager::Default()->mShutDownAction->responsed();
|
DeviceManager::Default()->mShutDownAction->responsed();
|
||||||
break;
|
break;
|
||||||
|
case ACT_CTL_MOTION_START:
|
||||||
|
DeviceManager::Default()->mStartAutoLocateAction->responsed();
|
||||||
|
break;
|
||||||
|
case ACT_CTL_MOTION_STOP:
|
||||||
|
DeviceManager::Default()->mStopAutoLocateAction->responsed();
|
||||||
|
break;
|
||||||
|
case ACT_CTL_MOTION_POSITION:
|
||||||
|
DeviceManager::Default()->mGetAutoLocatePositionAction->responsed();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ enum{
|
|||||||
ACT_SCAN_PRERESP, //上位机处理完数据后的响应
|
ACT_SCAN_PRERESP, //上位机处理完数据后的响应
|
||||||
ACT_SCAN_CE_STATUS, //是否已经完成当天的扫查
|
ACT_SCAN_CE_STATUS, //是否已经完成当天的扫查
|
||||||
ACT_SCAN_DIAGNOSIS, //诊断扫查
|
ACT_SCAN_DIAGNOSIS, //诊断扫查
|
||||||
|
ACT_SCAN_IMGQUALITI, //图像质量判定结果
|
||||||
};
|
};
|
||||||
|
|
||||||
//数据传输服务
|
//数据传输服务
|
||||||
@@ -60,6 +61,7 @@ enum{
|
|||||||
ACT_IFCFG_HBCFG, //设置心跳频率
|
ACT_IFCFG_HBCFG, //设置心跳频率
|
||||||
ACT_IFCFG_DEFAULT, //将配置恢复到默认值(再次加载配置文件到结构体)
|
ACT_IFCFG_DEFAULT, //将配置恢复到默认值(再次加载配置文件到结构体)
|
||||||
ACT_IFCFG_INIT_STATUS, //查询设备是否完成初始化
|
ACT_IFCFG_INIT_STATUS, //查询设备是否完成初始化
|
||||||
|
ACT_IFCFG_ECB_STATUS, //查询电控板信息状态。
|
||||||
};
|
};
|
||||||
|
|
||||||
//杂类控制和调试服务
|
//杂类控制和调试服务
|
||||||
@@ -85,7 +87,12 @@ enum{
|
|||||||
ACT_CTL_FEB_RESET,
|
ACT_CTL_FEB_RESET,
|
||||||
ACT_CTL_PUMP, //水泵启停
|
ACT_CTL_PUMP, //水泵启停
|
||||||
ACT_CTL_PWRDOWN, //下电开关
|
ACT_CTL_PWRDOWN, //下电开关
|
||||||
|
ACT_CTL_MOTION_START, //启动自动定位功能
|
||||||
|
ACT_CTL_MOTION_STOP, //停止自动定位功能
|
||||||
|
ACT_CTL_MOTION_POSITION, //查询自动定位状态(位置)
|
||||||
ACT_CTL_DRIVER, //驱动控制(加载卸载驱动)
|
ACT_CTL_DRIVER, //驱动控制(加载卸载驱动)
|
||||||
|
ACT_CTL_EXIT, //退出程序和守护进程
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//设备升级
|
//设备升级
|
||||||
|
|||||||
@@ -41,10 +41,12 @@ ADD_EVENT_VALUE(WarningMessageRaise)\
|
|||||||
ADD_EVENT_VALUE(ErrorStateActive)\
|
ADD_EVENT_VALUE(ErrorStateActive)\
|
||||||
ADD_EVENT_VALUE(ErrorStateUnactive)\
|
ADD_EVENT_VALUE(ErrorStateUnactive)\
|
||||||
ADD_EVENT_VALUE(StartScanProcess)\
|
ADD_EVENT_VALUE(StartScanProcess)\
|
||||||
|
ADD_EVENT_VALUE(StopScanProcess)\
|
||||||
ADD_EVENT_VALUE(CurrentUserNameChanged)\
|
ADD_EVENT_VALUE(CurrentUserNameChanged)\
|
||||||
ADD_EVENT_VALUE(EmptyScanFinished)\
|
ADD_EVENT_VALUE(EmptyScanFinished)\
|
||||||
ADD_EVENT_VALUE(UserVerificationSuccess)\
|
ADD_EVENT_VALUE(UserVerificationSuccess)\
|
||||||
ADD_EVENT_VALUE(UsctStateUpdated)\
|
ADD_EVENT_VALUE(UsctStateUpdated)\
|
||||||
|
ADD_EVENT_VALUE(SetSelectedPatient)\
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,21 @@ QString PatientInformationForm::getPatientID()
|
|||||||
return mUI->mPatientID->text();
|
return mUI->mPatientID->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PatientInformationForm::setExecuteProtocol(bool aIsLeft)
|
||||||
|
{
|
||||||
|
mIsExecuteProtocolLeft = aIsLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PatientInformationForm::clear()
|
||||||
|
{
|
||||||
|
mUI->mPatientID->clear();
|
||||||
|
mUI->mPatientBirthday->clear();
|
||||||
|
mUI->mPatientName->clear();
|
||||||
|
mUI->mPatientGender->clear();
|
||||||
|
mUI->mPaitenAccessionNumber->clear();
|
||||||
|
mUI->mScanProtocol->clear();
|
||||||
|
}
|
||||||
|
|
||||||
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
|
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
|
||||||
{
|
{
|
||||||
cJSON* patientInfoObject = cJSON_CreateObject();
|
cJSON* patientInfoObject = cJSON_CreateObject();
|
||||||
@@ -81,7 +96,7 @@ const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
|
|||||||
cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mInfo->Sex.toStdString().data()));
|
cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mInfo->Sex.toStdString().data()));
|
||||||
cJSON_AddItemToObject(patientInfoObject, "PatientBirthDate",
|
cJSON_AddItemToObject(patientInfoObject, "PatientBirthDate",
|
||||||
cJSON_CreateString(mInfo->BirthDate.replace("/", "").replace("-", "").replace(' ', '.').toStdString().data()));
|
cJSON_CreateString(mInfo->BirthDate.replace("/", "").replace("-", "").replace(' ', '.').toStdString().data()));
|
||||||
cJSON_AddItemToObject(patientInfoObject, "Laterality", cJSON_CreateString(mCurrentProtocol ? "R" : "L"));
|
cJSON_AddItemToObject(patientInfoObject, "Laterality", cJSON_CreateString(mIsExecuteProtocolLeft ? "L" : "R"));
|
||||||
cJSON_AddItemToObject(patientInfoObject, "IsEmptyData", cJSON_CreateNumber(empty ? 1 : 0));
|
cJSON_AddItemToObject(patientInfoObject, "IsEmptyData", cJSON_CreateNumber(empty ? 1 : 0));
|
||||||
cJSON_AddItemToObject(patientInfoObject, "OperatorName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
cJSON_AddItemToObject(patientInfoObject, "OperatorName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
||||||
cJSON_AddItemToObject(patientInfoObject, "ReferringPhysicianName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
cJSON_AddItemToObject(patientInfoObject, "ReferringPhysicianName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public:
|
|||||||
PatientInformationPointer getPatientInformation();
|
PatientInformationPointer getPatientInformation();
|
||||||
int getProtocol();
|
int getProtocol();
|
||||||
QString getProtocolString(ScanProtocal aProtocal);
|
QString getProtocolString(ScanProtocal aProtocal);
|
||||||
|
void setExecuteProtocol(bool aIsLeft);
|
||||||
|
void clear();
|
||||||
|
|
||||||
const char * getCurrentPatientJsonString(bool emptyScan);
|
const char * getCurrentPatientJsonString(bool emptyScan);
|
||||||
QString getPatientID();
|
QString getPatientID();
|
||||||
@@ -30,6 +32,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Ui::PatientInformationForm *mUI;
|
Ui::PatientInformationForm *mUI;
|
||||||
PatientInformationPointer mInfo;
|
PatientInformationPointer mInfo;
|
||||||
|
bool mIsExecuteProtocolLeft = false;
|
||||||
ScanProtocal mCurrentProtocol = LSTAND;
|
ScanProtocal mCurrentProtocol = LSTAND;
|
||||||
char * mJsonStr = nullptr;
|
char * mJsonStr = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
#include "json/jsonobject.h"
|
#include "json/jsonobject.h"
|
||||||
#include "device/DeviceManager.h"
|
#include "device/DeviceManager.h"
|
||||||
#include "dicom/WorkListManager.h"
|
#include "dicom/WorkListManager.h"
|
||||||
|
#include "components/CoordinateXYWidget.h"
|
||||||
|
#include "components/CoordinateZWidget.h"
|
||||||
|
#include "utilities/ScanProcessSequence.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#else
|
#else
|
||||||
@@ -39,8 +42,8 @@ ScanFormWidget::ScanFormWidget(QWidget* parent)
|
|||||||
, mWorklistButton(new QToolButton(this))
|
, mWorklistButton(new QToolButton(this))
|
||||||
, mStartScanButton(new QToolButton(this))
|
, mStartScanButton(new QToolButton(this))
|
||||||
, mDrainageButton(new QToolButton(this))
|
, mDrainageButton(new QToolButton(this))
|
||||||
, mXYLabel(new QLabel(this))
|
, mXYLabel(new CoordinateXYWidget(this))
|
||||||
, mZLabel(new QLabel(this))
|
, mZLabel(new CoordinateZWidget(this))
|
||||||
, mScanProcessLabel(new QLabel(this))
|
, mScanProcessLabel(new QLabel(this))
|
||||||
, mDrainageTimer(new QTimer(this))
|
, mDrainageTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
@@ -78,6 +81,8 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
|
|||||||
mStartScanButton->setObjectName("btnScan");
|
mStartScanButton->setObjectName("btnScan");
|
||||||
mStartScanButton->setText(tr("Start Scan"));
|
mStartScanButton->setText(tr("Start Scan"));
|
||||||
layout->addWidget(mStartScanButton);
|
layout->addWidget(mStartScanButton);
|
||||||
|
mStartScanButton->setEnabled(false);
|
||||||
|
mStartScanButton->setCheckable(true);
|
||||||
|
|
||||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||||
addVerticalLine(layout);
|
addVerticalLine(layout);
|
||||||
@@ -151,14 +156,58 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
|
|||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &ScanFormWidget::updateDataByAnonymousMode);
|
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &ScanFormWidget::updateDataByAnonymousMode);
|
||||||
|
|
||||||
|
connect(mStartScanButton, &QToolButton::clicked, [this]()
|
||||||
|
{
|
||||||
|
if(mStartScanButton->isChecked())
|
||||||
|
{
|
||||||
|
EventCenter::Default()->triggerEvent(GUIEvents::StartScanProcess, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventCenter::Default()->triggerEvent(GUIEvents::StopScanProcess, nullptr, nullptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, [this]()
|
||||||
|
{
|
||||||
|
mWorklistButton->setEnabled(false);
|
||||||
|
mAccountButton->setEnabled(false);
|
||||||
|
mDrainageButton->setEnabled(false);
|
||||||
|
mShutdownButton->setEnabled(false);
|
||||||
|
mStartScanButton->setText(tr("Stop Scan Process"));
|
||||||
|
mScanProcessLabel->setText(getAutoLocateMessage());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(EventCenter::Default(), &EventCenter::RequestFullScanStop, EventCenter::Default(), &EventCenter::StopScanProcess);
|
||||||
|
connect(EventCenter::Default(), &EventCenter::StopScanProcess, [this]()
|
||||||
|
{
|
||||||
|
mWorklistButton->setEnabled(true);
|
||||||
|
mAccountButton->setEnabled(true);
|
||||||
|
mDrainageButton->setEnabled(true);
|
||||||
|
mShutdownButton->setEnabled(true);
|
||||||
|
mStartScanButton->setChecked(false);
|
||||||
|
mStartScanButton->setText(tr("Start Scan"));
|
||||||
|
if(ScanProcessSequence::getInstance()->getScanPositionSize() == 0)
|
||||||
|
{
|
||||||
|
mStartScanButton->setEnabled(false);
|
||||||
|
mPatInf->clear();
|
||||||
|
}
|
||||||
|
mScanProcessLabel->setText(tr("Please confirm checking patient information to start the process"));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(EventCenter::Default(), &EventCenter::RequestPatientScan, [this]()
|
||||||
|
{
|
||||||
|
mScanProcessLabel->setText(tr("Data scanning, please keep the current position and don't move."));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::fullScanDataExport, [this]()
|
||||||
|
{
|
||||||
|
mScanProcessLabel->setText(tr("Data exporting, patient can leave the holder"));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::startFullScan, this, &ScanFormWidget::prepareStartFullScan, Qt::QueuedConnection);
|
||||||
|
|
||||||
// auto group = new QButtonGroup(ui->commandWidget);
|
|
||||||
// mBtnLeft->setCheckable(true);
|
|
||||||
// mBtnLeft->setChecked(true);
|
|
||||||
// mBtnRight->setCheckable(true);
|
|
||||||
// group->addButton(mBtnRight, 1);
|
|
||||||
// group->addButton(mBtnLeft, 0);
|
|
||||||
// connect(group, SIGNAL(buttonClicked(int)), this, SLOT(protocolChanged(int)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScanFormWidget::initScanContent()
|
void ScanFormWidget::initScanContent()
|
||||||
@@ -212,13 +261,6 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout)
|
|||||||
// EventCenter::Default()->triggerEvent(RequestPreviewScan, nullptr, nullptr);
|
// EventCenter::Default()->triggerEvent(RequestPreviewScan, nullptr, nullptr);
|
||||||
|
|
||||||
// });
|
// });
|
||||||
connect(DeviceManager::Default(), &DeviceManager::startPreviewScanResult, [this](bool aIsSucessful)
|
|
||||||
{
|
|
||||||
if(!aIsSucessful)
|
|
||||||
{
|
|
||||||
setPreviewing(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// connect(mBtnScan, &QToolButton::clicked, [=]() {
|
// connect(mBtnScan, &QToolButton::clicked, [=]() {
|
||||||
@@ -248,6 +290,15 @@ void ScanFormWidget::protocolChanged(int type)
|
|||||||
LOG_USER_OPERATION(QString("Select Laterality %1").arg(type == 0 ? "Left" : "Right"));
|
LOG_USER_OPERATION(QString("Select Laterality %1").arg(type == 0 ? "Left" : "Right"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScanFormWidget::prepareStartFullScan()
|
||||||
|
{
|
||||||
|
ScanPosition position = ScanProcessSequence::getInstance()->topPosition();
|
||||||
|
mPatInf->setExecuteProtocol(position == ScanPosition::Left);
|
||||||
|
QString patientInf(mPatInf->getCurrentPatientJsonString(false));
|
||||||
|
LOG_USER_OPERATION(QString("Start Scan, ID: %1").arg(mPatInf->getPatientID()))
|
||||||
|
EventCenter::Default()->triggerEvent(RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
||||||
|
}
|
||||||
|
|
||||||
void ScanFormWidget::setPreviewing(bool val)
|
void ScanFormWidget::setPreviewing(bool val)
|
||||||
{
|
{
|
||||||
// mBtnPreview->setCheckable(val);
|
// mBtnPreview->setCheckable(val);
|
||||||
@@ -329,9 +380,13 @@ void ScanFormWidget::initEvents()
|
|||||||
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo);
|
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo);
|
||||||
if(result.ResultCode == QDialog::Accepted)
|
if(result.ResultCode == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
mPatInf->setPatientInformation(patientInfo->Copy(), static_cast<ScanProtocal>(result.ResultData.toInt()));
|
ScanProtocal protocal = static_cast<ScanProtocal>(result.ResultData.toInt());
|
||||||
|
mPatInf->setPatientInformation(patientInfo->Copy(), protocal);
|
||||||
|
setScanProtocal(protocal);
|
||||||
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientInfo->ID))
|
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientInfo->ID))
|
||||||
EventCenter::Default()->triggerEvent(StartScanProcess, nullptr, patientInfo);
|
mStartScanButton->setEnabled(true);
|
||||||
|
EventCenter::Default()->triggerEvent(SetSelectedPatient, nullptr, patientInfo);
|
||||||
|
mStartScanButton->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// mBtnScan->setEnabled(true);
|
// mBtnScan->setEnabled(true);
|
||||||
@@ -372,6 +427,44 @@ void ScanFormWidget::updateDataByAnonymousMode()
|
|||||||
mWorklistButton->setEnabled(!anonymousMode);
|
mWorklistButton->setEnabled(!anonymousMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ScanFormWidget::getAutoLocateMessage()
|
||||||
|
{
|
||||||
|
ScanPosition position = ScanProcessSequence::getInstance()->topPosition();
|
||||||
|
switch (position)
|
||||||
|
{
|
||||||
|
case ScanPosition::Left:
|
||||||
|
return tr("Left side scan initiated, auto positioning in progress.");
|
||||||
|
case ScanPosition::Right:
|
||||||
|
return tr("Right side scan initiated, auto positioning in progress.");
|
||||||
|
}
|
||||||
|
return QString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanFormWidget::setScanProtocal(int aProtocal)
|
||||||
|
{
|
||||||
|
ScanProcessSequence::getInstance()->clear();
|
||||||
|
switch (aProtocal)
|
||||||
|
{
|
||||||
|
case ScanProtocal::LSTAND:
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||||
|
return;
|
||||||
|
case ScanProtocal::RSTAND:
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||||
|
return;
|
||||||
|
case ScanProtocal::LONE:
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Left);
|
||||||
|
return;
|
||||||
|
case ScanProtocal::RONE:
|
||||||
|
ScanProcessSequence::getInstance()->pushPosition(ScanPosition::Right);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScanFormWidget::keyPressEvent(QKeyEvent* aEvent)
|
void ScanFormWidget::keyPressEvent(QKeyEvent* aEvent)
|
||||||
{
|
{
|
||||||
switch (aEvent->key())
|
switch (aEvent->key())
|
||||||
|
|||||||
@@ -4,9 +4,13 @@
|
|||||||
#include "src/forms/TabFormWidget.h"
|
#include "src/forms/TabFormWidget.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QStack>
|
||||||
|
|
||||||
class PatientInformationForm;
|
class PatientInformationForm;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
|
class CoordinateXYWidget;
|
||||||
|
class CoordinateZWidget;
|
||||||
|
|
||||||
class ScanFormWidget :public TabFormWidget {
|
class ScanFormWidget :public TabFormWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -26,19 +30,25 @@ private:
|
|||||||
QToolButton* mWorklistButton;
|
QToolButton* mWorklistButton;
|
||||||
QToolButton* mStartScanButton;
|
QToolButton* mStartScanButton;
|
||||||
QToolButton* mDrainageButton;
|
QToolButton* mDrainageButton;
|
||||||
QLabel* mXYLabel;
|
CoordinateXYWidget* mXYLabel;
|
||||||
QLabel* mZLabel;
|
CoordinateZWidget* mZLabel;
|
||||||
QLabel* mScanProcessLabel;
|
QLabel* mScanProcessLabel;
|
||||||
QTimer* mDrainageTimer;
|
QTimer* mDrainageTimer;
|
||||||
|
|
||||||
void initCommandWidget(QHBoxLayout *layout);
|
void initCommandWidget(QHBoxLayout *layout);
|
||||||
void initScanControlBar(QHBoxLayout *layout);
|
void initScanControlBar(QHBoxLayout *layout);
|
||||||
void initScanContent();
|
void initScanContent();
|
||||||
void renderLoading();
|
void renderLoading();
|
||||||
void renderPreviewData(const QObject* sender, const QObject *data);
|
void renderPreviewData(const QObject* sender, const QObject *data);
|
||||||
void reloadLanguage();
|
void reloadLanguage();
|
||||||
|
void setScanProtocal(int aProtocal);
|
||||||
|
QString getAutoLocateMessage();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void protocolChanged(int type);
|
void protocolChanged(int type);
|
||||||
void updateDataByAnonymousMode();
|
void updateDataByAnonymousMode();
|
||||||
|
void prepareStartFullScan();
|
||||||
|
//void updateScanProcessLabel(const QString& aText);
|
||||||
|
|
||||||
void initEvents();
|
void initEvents();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
|
|||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &SelectFormWidget::updateDataByAnonymousMode);
|
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &SelectFormWidget::updateDataByAnonymousMode);
|
||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::StartScanProcess, this, [=](QObject* sender, QObject* data)
|
connect(EventCenter::Default(), &EventCenter::SetSelectedPatient, this, [=](QObject* sender, QObject* data)
|
||||||
{
|
{
|
||||||
PatientInformation* patientInfo = (PatientInformation*)data;
|
PatientInformation* patientInfo = (PatientInformation*)data;
|
||||||
this->setSelectedPatient(patientInfo);
|
this->setSelectedPatient(patientInfo);
|
||||||
|
|||||||
52
src/utilities/ScanProcessSequence.cpp
Normal file
52
src/utilities/ScanProcessSequence.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#include "ScanProcessSequence.h"
|
||||||
|
|
||||||
|
#include "event/EventCenter.h"
|
||||||
|
#include "device/DeviceManager.h"
|
||||||
|
|
||||||
|
ScanProcessSequence* ScanProcessSequence::getInstance()
|
||||||
|
{
|
||||||
|
static ScanProcessSequence instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanProcessSequence::ScanProcessSequence(QObject* aParent)
|
||||||
|
: QObject(aParent)
|
||||||
|
, mScanProtocol()
|
||||||
|
{
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, this, &ScanProcessSequence::startAutoLocate);
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::updateAutoLocatePosition, this, &ScanProcessSequence::updateAutoLocatePosition);
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::autolocatePositionEffective, this, &ScanProcessSequence::stopAutoLocate);
|
||||||
|
connect(EventCenter::Default(), &EventCenter::StopScanProcess, this, &ScanProcessSequence::quitAutoLocate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanProcessSequence::updateAutoLocatePosition(int aX, int aY, int aZ)
|
||||||
|
{
|
||||||
|
emit autoLocateXYUpdated(aX, aY);
|
||||||
|
emit autoLocateZUpdated(aZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanProcessSequence::pushPosition(ScanPosition aPostion)
|
||||||
|
{
|
||||||
|
mScanProtocol.push(aPostion);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanPosition ScanProcessSequence::popPosition()
|
||||||
|
{
|
||||||
|
return mScanProtocol.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanPosition ScanProcessSequence::topPosition()
|
||||||
|
{
|
||||||
|
return mScanProtocol.top();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanProcessSequence::clear()
|
||||||
|
{
|
||||||
|
return mScanProtocol.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScanProcessSequence::getScanPositionSize()
|
||||||
|
{
|
||||||
|
return mScanProtocol.size();
|
||||||
|
}
|
||||||
|
|
||||||
41
src/utilities/ScanProcessSequence.h
Normal file
41
src/utilities/ScanProcessSequence.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef SCANPROCESSSEQUENCE_H
|
||||||
|
#define SCANPROCESSSEQUENCE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QStack>
|
||||||
|
|
||||||
|
enum ScanPosition
|
||||||
|
{
|
||||||
|
Left = 0, Right
|
||||||
|
};
|
||||||
|
|
||||||
|
class ScanProcessSequence : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static ScanProcessSequence* getInstance();
|
||||||
|
void pushPosition(ScanPosition aPosition);
|
||||||
|
ScanPosition popPosition();
|
||||||
|
ScanPosition topPosition();
|
||||||
|
int getScanPositionSize();
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void startAutoLocate();
|
||||||
|
void stopAutoLocate();
|
||||||
|
void quitAutoLocate();
|
||||||
|
void startFullScan();
|
||||||
|
void fullScanDataExport();
|
||||||
|
void autoLocateXYUpdated(int aX, int aY);
|
||||||
|
void autoLocateZUpdated(int aZ);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateAutoLocatePosition(int aX, int aY, int aZ);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ScanProcessSequence(QObject* aParent = nullptr);
|
||||||
|
QStack<ScanPosition> mScanProtocol;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SCANPROCESSSEQUENCE_H
|
||||||
@@ -36,7 +36,6 @@ MainWindow::MainWindow(QWidget* aParent)
|
|||||||
, mTabWidget(new QTabWidget(this))
|
, mTabWidget(new QTabWidget(this))
|
||||||
, mInitializWidget(new InitializeWidget(this))
|
, mInitializWidget(new InitializeWidget(this))
|
||||||
, mShutdownWidget(new ShutdownWidget(nullptr))
|
, mShutdownWidget(new ShutdownWidget(nullptr))
|
||||||
, mAdminTabIndex(-1)
|
|
||||||
, mTabInited(false)
|
, mTabInited(false)
|
||||||
{
|
{
|
||||||
mUI->setupUi(this);
|
mUI->setupUi(this);
|
||||||
@@ -56,27 +55,6 @@ MainWindow::MainWindow(QWidget* aParent)
|
|||||||
connect(DeviceManager::Default(), &DeviceManager::initializeProgress, mInitializWidget, &InitializeWidget::setMessage);
|
connect(DeviceManager::Default(), &DeviceManager::initializeProgress, mInitializWidget, &InitializeWidget::setMessage);
|
||||||
connect(DeviceManager::Default(), &DeviceManager::shutdownDmsSended, this, &MainWindow::showShutdownWidget);
|
connect(DeviceManager::Default(), &DeviceManager::shutdownDmsSended, this, &MainWindow::showShutdownWidget);
|
||||||
connect(DeviceManager::Default(), &DeviceManager::shutdownDmsFailed, this, &MainWindow::processShutdownDmsFailed);
|
connect(DeviceManager::Default(), &DeviceManager::shutdownDmsFailed, this, &MainWindow::processShutdownDmsFailed);
|
||||||
connect(DeviceManager::Default(), &DeviceManager::startPreviewScanResult, this, [this](bool aIsSucceed)
|
|
||||||
{
|
|
||||||
if(aIsSucceed)
|
|
||||||
{
|
|
||||||
for(int i=0; i<mTabWidget->count(); ++i)
|
|
||||||
{
|
|
||||||
if(i != mTabWidget->currentIndex())
|
|
||||||
{
|
|
||||||
mTabWidget->setTabEnabled(i, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestPreviewStop, this, [this]()
|
|
||||||
{
|
|
||||||
for(int i=0; i<mTabWidget->count(); ++i)
|
|
||||||
{
|
|
||||||
mTabWidget->setTabEnabled(i, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(EventCenter::Default(), &EventCenter::LoginSuccess, this, [this]()
|
connect(EventCenter::Default(), &EventCenter::LoginSuccess, this, [this]()
|
||||||
{
|
{
|
||||||
@@ -106,6 +84,31 @@ MainWindow::MainWindow(QWidget* aParent)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, [this](bool aIsSucceed)
|
||||||
|
{
|
||||||
|
if(aIsSucceed)
|
||||||
|
{
|
||||||
|
for(int i=0; i<mTabWidget->count(); ++i)
|
||||||
|
{
|
||||||
|
if(i != mTabWidget->currentIndex())
|
||||||
|
{
|
||||||
|
mTabWidget->setTabEnabled(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(EventCenter::Default(), &EventCenter::StopScanProcess, this, [this]()
|
||||||
|
{
|
||||||
|
for(int i=0; i<mTabWidget->count(); ++i)
|
||||||
|
{
|
||||||
|
if(i != mTabWidget->currentIndex())
|
||||||
|
{
|
||||||
|
mTabWidget->setTabEnabled(i, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
GUIErrorHandle::Default()->init();
|
GUIErrorHandle::Default()->init();
|
||||||
QApplication::setActiveWindow(centralWidget());
|
QApplication::setActiveWindow(centralWidget());
|
||||||
}
|
}
|
||||||
@@ -179,6 +182,8 @@ void MainWindow::initializeTabWidget()
|
|||||||
{
|
{
|
||||||
mTabWidget->setTabPosition(QTabWidget::South);
|
mTabWidget->setTabPosition(QTabWidget::South);
|
||||||
mTabWidget->setContentsMargins(0, 0, 0, 0);
|
mTabWidget->setContentsMargins(0, 0, 0, 0);
|
||||||
|
auto* systemForm = new SettingFormWidget(this);
|
||||||
|
mTabWidget->insertTab(0 ,systemForm, tr("Settings"));
|
||||||
auto verifyForm = new ReconFormWidget(this);
|
auto verifyForm = new ReconFormWidget(this);
|
||||||
mTabWidget->insertTab(0,verifyForm, tr("Recon"));
|
mTabWidget->insertTab(0,verifyForm, tr("Recon"));
|
||||||
auto selectForm = new SelectFormWidget(this);
|
auto selectForm = new SelectFormWidget(this);
|
||||||
@@ -186,7 +191,6 @@ void MainWindow::initializeTabWidget()
|
|||||||
auto scanForm = new ScanFormWidget(this);
|
auto scanForm = new ScanFormWidget(this);
|
||||||
mTabWidget->insertTab(0,scanForm, tr("Scan"));
|
mTabWidget->insertTab(0,scanForm, tr("Scan"));
|
||||||
|
|
||||||
mAdminTabIndex+=3;
|
|
||||||
mTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
mTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
|
||||||
@@ -345,23 +349,19 @@ void MainWindow::requestScreenSaver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::resetRoleLayout() {
|
void MainWindow::resetRoleLayout() {
|
||||||
|
SettingFormWidget* settingWidget = dynamic_cast<SettingFormWidget*>(mTabWidget->widget(3));
|
||||||
|
if(settingWidget == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (User::Current()->isAdmin())
|
if (User::Current()->isAdmin())
|
||||||
{
|
{
|
||||||
if (mAdminTabIndex == -1)
|
settingWidget->showAdminArea();
|
||||||
{
|
|
||||||
SettingFormWidget* form = new SettingFormWidget(this);
|
|
||||||
mAdminTabIndex = mTabWidget->addTab(form, tr("Settings"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mAdminTabIndex != -1)
|
settingWidget->hideAdminArea();
|
||||||
{
|
|
||||||
mTabWidget->removeTab(mAdminTabIndex);
|
|
||||||
mAdminTabIndex = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
qApp->processEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enableAllTabWidget()
|
void MainWindow::enableAllTabWidget()
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ private:
|
|||||||
InitializeWidget* mInitializWidget;
|
InitializeWidget* mInitializWidget;
|
||||||
ShutdownWidget* mShutdownWidget;
|
ShutdownWidget* mShutdownWidget;
|
||||||
|
|
||||||
int mAdminTabIndex;
|
|
||||||
bool mTabInited;
|
bool mTabInited;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user