Refactor dialog package.

This commit is contained in:
Krad
2022-06-13 11:21:44 +08:00
parent 9a233251dc
commit 69a506ff94
27 changed files with 870 additions and 828 deletions

View File

@@ -7,18 +7,24 @@
#include <QObject>
#include <QThread>
class DeviceManager :public QObject {
Q_OBJECT
class DeviceManager : public QObject {
Q_OBJECT
public:
static DeviceManager* Default(){
static DeviceManager *Default() {
static DeviceManager manager;
return &manager;
}
DeviceManager() = default;
~DeviceManager() override = default ;
DeviceManager(const DeviceManager&) = delete;
DeviceManager operator=(const DeviceManager&) = delete;
~DeviceManager() override = default;
DeviceManager(const DeviceManager &) = delete;
DeviceManager operator=(const DeviceManager &) = delete;
/**
* init device, include Shimlib and it's error call back,
* deviceInfTimer to get temperature of water, and the
@@ -29,32 +35,36 @@ public:
/**
* close and release the device reference resource.
*/
void close();
void close();
/**
* Get Firm ware version
* @return Firm ware version
*/
QString getSoftwareVersion();
static QString getSoftwareVersion();
/**
* Get Scan data output path
* @return Scan data output path
*/
QString getScanOutputPath();
static QString getScanOutputPath();
void setErrorOccurred(bool v){
errorOccurred = v;
void setErrorOccurred(bool v) {
mErrorOccurred = v;
}
bool getErrorOccurred(){
return errorOccurred;
bool getErrorOccurred() {
return mErrorOccurred;
}
void emitErrorCallback(const char * msg);
signals:
void emitErrorCallback(const char *msg);
signals:
void raiseGlobalError(QString msg);
protected:
void timerEvent(QTimerEvent* event) override;
void timerEvent(QTimerEvent *event) override;
private:
/**
@@ -62,11 +72,11 @@ private:
* @param json The patient information json string
* @param empty Empty scan flag
*/
void startScan(const char* json, bool empty = false);
void startScan(const char *json, bool empty = false);
/**
* Post Scan start command to Shimlib
*/
/**
* Post Scan start command to Shimlib
*/
void postScanCommand();
/**
@@ -89,16 +99,24 @@ private:
* Process scan progress change
* @param Scan progress
*/
void scanProcess(int progress);
void scanProcess(int aProgress);
void initPreviewThread();
void stopScan();
void startPreview();
int mScanPhase = 1;
volatile int mTimerID = -1;
int mDeviceInfTimerID = -1;
int mLastStatus = -1;
bool mPreviewing = false;
volatile bool mEndLoop = false;
volatile bool mErrorOccurred = false;
QThread *mPreviewDataCaller = nullptr;
int scanPhase = 1;
volatile int timerID = -1;
int deviceInfTimerID = -1;
int lastStatus = -1;
bool previewing = false;
volatile bool endLoop = false;
volatile bool errorOccurred = false;
QThread* previewDataCaller = nullptr;
};