Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ac282c2d0 | ||
|
|
5d02c34fba | ||
|
|
37b67b99da | ||
|
|
aecc6d6943 | ||
|
|
86ab0c5c06 | ||
|
|
305c934858 |
@@ -3,7 +3,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QAbstractListModel>
|
||||
#include <QScrollBar>
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "log/LogFileTableModel.h"
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "src/dialogs/SelectDialog.h"
|
||||
#include "windows/MainWindow.h"
|
||||
#include "event/EventCenter.h"
|
||||
|
||||
QString fileNameToDate(QString fileName)
|
||||
{
|
||||
return fileName.split("log/UserOperationLog/")[1].replace("-op.log", "");
|
||||
@@ -25,51 +26,51 @@ QString dateToFileName(QString date)
|
||||
UserOperationLogForm::UserOperationLogForm(QWidget* parent)
|
||||
: QWidget (parent)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
mLayout = new QVBoxLayout(this);
|
||||
QWidget* header = new QWidget(this);
|
||||
QHBoxLayout* headerLayout = new QHBoxLayout(header);
|
||||
QLabel* logdate = new QLabel(tr("Log Date:"));
|
||||
headerLayout->addWidget(logdate);
|
||||
btn = new QPushButton(header);
|
||||
headerLayout->addWidget(btn, 0, Qt::AlignLeft);
|
||||
mDateButton = new QPushButton(header);
|
||||
headerLayout->addWidget(mDateButton, 0, Qt::AlignLeft);
|
||||
headerLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
|
||||
model = new LogFileTableModel(this);
|
||||
model->setHeader(QStringList()<< tr("Operation Date") << tr("Operation Time") << tr("User") << tr("Operation"));
|
||||
mModel = new LogFileTableModel(this);
|
||||
mModel->setHeader(QStringList()<< tr("Operation Date") << tr("Operation Time") << tr("User") << tr("Operation"));
|
||||
loadUserOperationLog();
|
||||
table = new SlideTableView(this);
|
||||
layout->addWidget(header);
|
||||
layout->addWidget(table);
|
||||
table->setModel(model);
|
||||
table->setAlternatingRowColors(true);
|
||||
table->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
table->verticalHeader()->setDefaultSectionSize(38);
|
||||
table->horizontalHeader()->setStretchLastSection(true);
|
||||
table->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||
table->setColumnWidth(0, 250);
|
||||
table->setColumnWidth(1, 250);
|
||||
table->setColumnWidth(2, 200);
|
||||
table->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");;
|
||||
mLogTable = new SlideTableView(this);
|
||||
mLayout->addWidget(header);
|
||||
mLayout->addWidget(mLogTable);
|
||||
mLogTable->setModel(mModel);
|
||||
mLogTable->setAlternatingRowColors(true);
|
||||
mLogTable->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
mLogTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
mLogTable->verticalHeader()->setDefaultSectionSize(38);
|
||||
mLogTable->horizontalHeader()->setStretchLastSection(true);
|
||||
mLogTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||
mLogTable->setColumnWidth(0, 250);
|
||||
mLogTable->setColumnWidth(1, 250);
|
||||
mLogTable->setColumnWidth(2, 200);
|
||||
mLogTable->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");;
|
||||
|
||||
//暂时先放构造函数,之后需要移除,等需要时再调用
|
||||
|
||||
connect(btn, &QPushButton::clicked, [=]() {
|
||||
connect(mDateButton, &QPushButton::clicked, [=]() {
|
||||
auto files = UserOperationLog::getHistoryLogFiles();
|
||||
QStringList dates;
|
||||
for (auto f : files)
|
||||
{
|
||||
dates << fileNameToDate(f);
|
||||
}
|
||||
if (!dialog) {
|
||||
dialog = new SelectDialog(this);
|
||||
dialog->setWindowModality(Qt::WindowModal);
|
||||
if (!mSelectDateDialog) {
|
||||
mSelectDateDialog = new SelectDialog(this);
|
||||
mSelectDateDialog->setWindowModality(Qt::WindowModal);
|
||||
}
|
||||
dialog->setValues(dates);
|
||||
if (!selectedDateStr.isEmpty()) dialog->setSelectedValue(selectedDateStr);
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
mSelectDateDialog->setValues(dates);
|
||||
if (!mSelectedDateStr.isEmpty()) mSelectDateDialog->setSelectedValue(mSelectedDateStr);
|
||||
if (mSelectDateDialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
QString date = dialog->getSelectedValue();
|
||||
QString date = mSelectDateDialog->getSelectedValue();
|
||||
QString f = dateToFileName(date);
|
||||
this->loadUserOperationLog(f, date);
|
||||
}
|
||||
@@ -77,32 +78,32 @@ UserOperationLogForm::UserOperationLogForm(QWidget* parent)
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
logdate->setText(tr("Log Date:"));
|
||||
model->setHeader(QStringList()<< tr("Operation Date") << tr("Operation Time") << tr("User") << tr("Operation"));
|
||||
mModel->setHeader(QStringList()<< tr("Operation Date") << tr("Operation Time") << tr("User") << tr("Operation"));
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
UserOperationLogForm::~UserOperationLogForm() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UserOperationLogForm::loadUserOperationLog() {
|
||||
|
||||
QString filePath = UserOperationLog::Default()->currentLogFile();
|
||||
btn->setText(fileNameToDate(filePath));
|
||||
void UserOperationLogForm::loadUserOperationLog()
|
||||
{
|
||||
QString filePath = LogManager::getInstance()->getCurrentUserOperationLogFile();
|
||||
mDateButton->setText(fileNameToDate(filePath));
|
||||
loadUserOperationLog(filePath, fileNameToDate(filePath));
|
||||
selectedDateStr = fileNameToDate(filePath);
|
||||
mSelectedDateStr = fileNameToDate(filePath);
|
||||
}
|
||||
|
||||
void UserOperationLogForm::loadUserOperationLog(const QString& fileName, const QString& date) {
|
||||
selectedDateStr = date;
|
||||
model->setFileName(dateToFileName(date));
|
||||
btn->setText(date);
|
||||
mSelectedDateStr = date;
|
||||
mModel->setFileName(dateToFileName(date));
|
||||
mDateButton->setText(date);
|
||||
}
|
||||
|
||||
void UserOperationLogForm::showEvent(QShowEvent *aEvent)
|
||||
{
|
||||
loadUserOperationLog("", selectedDateStr);
|
||||
loadUserOperationLog("", mSelectedDateStr);
|
||||
QWidget::showEvent(aEvent);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ protected:
|
||||
void showEvent(QShowEvent *aEvent) override;
|
||||
|
||||
private:
|
||||
QTableView* table = nullptr;
|
||||
QPushButton* btn = nullptr;
|
||||
LogFileTableModel* model = nullptr;
|
||||
SelectDialog* dialog = nullptr;
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QString selectedDateStr;
|
||||
QTableView* mLogTable = nullptr;
|
||||
QPushButton* mDateButton = nullptr;
|
||||
LogFileTableModel* mModel = nullptr;
|
||||
SelectDialog* mSelectDateDialog = nullptr;
|
||||
QVBoxLayout* mLayout = nullptr;
|
||||
QString mSelectedDateStr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -194,9 +194,9 @@ void CoordinateXYWidget::updateStopFlash()
|
||||
void CoordinateXYWidget::startFlash()
|
||||
{
|
||||
show();
|
||||
connect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateFlash);
|
||||
mStopGradientEnd = 1;
|
||||
mTimer->start(20);
|
||||
// connect(mTimer,&QTimer::timeout,this, &CoordinateXYWidget::updateFlash);
|
||||
// mStopGradientEnd = 1;
|
||||
// mTimer->start(20);
|
||||
}
|
||||
|
||||
void CoordinateXYWidget::stopFlash()
|
||||
|
||||
@@ -34,6 +34,7 @@ CoordinateZWidget::CoordinateZWidget(QWidget* aParent)
|
||||
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::quitAutoLocate, this, &CoordinateZWidget::quit);
|
||||
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::autoLocateZUpdated, this, &CoordinateZWidget::setBlinkPoint);
|
||||
hide();
|
||||
mBlinkPoint.setY(204);
|
||||
}
|
||||
|
||||
void CoordinateZWidget::paintEvent(QPaintEvent* aEvent)
|
||||
@@ -116,9 +117,9 @@ void CoordinateZWidget::setBlinkPoint(int aZ)
|
||||
void CoordinateZWidget::startFlash()
|
||||
{
|
||||
show();
|
||||
connect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateFlash);
|
||||
mStopGradientEnd = 1;
|
||||
mTimer->start(20);
|
||||
// connect(mTimer,&QTimer::timeout,this, &CoordinateZWidget::updateFlash);
|
||||
// mStopGradientEnd = 1;
|
||||
// mTimer->start(20);
|
||||
}
|
||||
|
||||
void CoordinateZWidget::stopFlash()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "dialogs/MultyMessageDialog.h"
|
||||
#include "UsctStateManager.h"
|
||||
#include "utilities/ScanProcessSequence.h"
|
||||
#include "log/SystemOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
||||
|
||||
@@ -211,11 +211,7 @@ void DeviceManager::initDevice()
|
||||
mSetSimulatorModeAction->setSendData("{ \"code\":0, \"info\":\"1\"}");
|
||||
mSetSimulatorModeAction->execute();
|
||||
}
|
||||
|
||||
mSetHeartBeatAction->setSendData("{ \"code\":0, \"info\":\"0\"}");
|
||||
mSetHeartBeatAction->execute();
|
||||
mSoftwareVersion = "DMS Version Loading";
|
||||
mGetSoftwareVersionAction->execute();
|
||||
|
||||
mCheckInitStatusTimer = startTimer(500);
|
||||
}
|
||||
@@ -229,6 +225,10 @@ void DeviceManager::initGUI(bool aIsInitSucceed)
|
||||
return;
|
||||
}
|
||||
|
||||
mSetHeartBeatAction->setSendData("{ \"code\":0, \"info\":\"0\"}");
|
||||
mSetHeartBeatAction->execute();
|
||||
mGetSoftwareVersionAction->execute();
|
||||
|
||||
if(aIsInitSucceed)
|
||||
{
|
||||
if(getDeviceStatus() != DeviceStatus::Rready)
|
||||
@@ -428,7 +428,8 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
||||
|
||||
if(isCompleteNotify)
|
||||
{
|
||||
QString msg = tr("Scan completed!");
|
||||
QString msg = ScanProcessSequence::getInstance()->getScanPositionSize() == 2 ? tr("Scan completed! Please prepare for the next scan. \n"
|
||||
"Click the confirm button after lying down.") : tr("Scan completed!") ;
|
||||
TRIGGER_EVENT(InvokeOperationEnd, nullptr, (QObject *)&msg);
|
||||
}
|
||||
else
|
||||
@@ -468,6 +469,7 @@ void DeviceManager::stopFullScan()
|
||||
if(!result.mIsSucessful)
|
||||
{
|
||||
THROW_ERROR(result.mData);
|
||||
prepareFinishScan(false, "");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -646,6 +648,7 @@ QString DeviceManager::getSoftwareVersion()
|
||||
void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, const QString& aContents)
|
||||
{
|
||||
qDebug()<<"processReceiveDMSInfoResult " <<aServerID << aActionID << aContents;
|
||||
LOG_SYS_OPERATION(QString("DMS -> GUI : %1-%2, Message:%3").arg(aServerID).arg(aActionID).arg(aContents));
|
||||
switch(aServerID)
|
||||
{
|
||||
case USRV_SCAN :
|
||||
@@ -772,7 +775,6 @@ void DeviceManager::processAlarm(const QString& aAlarm)
|
||||
int alarmCode = jsonObj["code"].toInt();
|
||||
QString alarm = tr("Error: ") + QString::number(alarmCode);
|
||||
qDebug()<<"processAlarm : "<<alarmCode;
|
||||
LOG_SYS_OPERATION("Dms alarm reported. code: " + alarm)
|
||||
if(alarmCode >= 400 && alarmCode < 500)
|
||||
{
|
||||
if(mIsScanning)
|
||||
@@ -807,7 +809,7 @@ void DeviceManager::processGetSoftwareVersion(const QString& aSoftwareVersion)
|
||||
|
||||
void DeviceManager::scanTimeout()
|
||||
{
|
||||
prepareFinishScan(false, "Dms connection timeout!");
|
||||
prepareFinishScan(false, tr("DMS connection error"));
|
||||
}
|
||||
|
||||
DeviceStatus DeviceManager::getDeviceStatus()
|
||||
@@ -860,7 +862,6 @@ bool DeviceManager::startFullScan(const QString& aPatientInfo)
|
||||
return false;
|
||||
}
|
||||
mCurrentScanMeasurementID = jsonObj["measurement id"].toString();
|
||||
//LOG_SYS_OPERATION("Start full scan succeed.")
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1321,7 +1322,7 @@ void DeviceManager::stopScanProcess()
|
||||
AppGlobalValues::setInProcessing(false);
|
||||
mIsScanning = false;
|
||||
LOG_SYS_OPERATION("Stop scan process.")
|
||||
stopAutoLocate();
|
||||
//stopAutoLocate();
|
||||
}
|
||||
|
||||
bool DeviceManager::startAutoLocate()
|
||||
@@ -1331,25 +1332,27 @@ bool DeviceManager::startAutoLocate()
|
||||
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);
|
||||
mEffectivePositionCount = 0;
|
||||
mGetAutoLocatePositionTimer = startTimer(1000);
|
||||
//LOG_SYS_OPERATION("Start auto locate succeed.")
|
||||
emit autolocatePositionEffective();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||
QString errorMessage = tr("Start auto locate failed");
|
||||
THROW_ERROR(errorMessage)
|
||||
LOG_SYS_OPERATION("Start auto locate failed.")
|
||||
return false;
|
||||
// auto result = mStartAutoLocateAction->execute();
|
||||
// if(result.mIsSucessful)
|
||||
// {
|
||||
// mIsAutoLocating = true;
|
||||
// QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
// if(jsonObj["code"].toInt() == 0 )
|
||||
// {
|
||||
// emit startAutoLocateResult(true);
|
||||
// mEffectivePositionCount = 0;
|
||||
// mGetAutoLocatePositionTimer = startTimer(1000);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
|
||||
// QString errorMessage = tr("Start auto locate failed");
|
||||
// THROW_ERROR(errorMessage)
|
||||
// LOG_SYS_OPERATION("Start auto locate failed.")
|
||||
// return false;
|
||||
}
|
||||
|
||||
void DeviceManager::stopAutoLocate()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "DmsAsyncAction.h"
|
||||
#include "dms_mq.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
@@ -45,6 +46,7 @@ bool DmsAsyncAction::execute()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
LOG_SYS_OPERATION(QString("GUI -> DMS : %1-%2, Message:%3").arg(mServerId).arg(mActionId).arg(mSendData));
|
||||
mTimer->start();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "DmsSyncAction.h"
|
||||
#include "dms_mq.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
@@ -45,8 +46,10 @@ DmsSyncActionResult DmsSyncAction::execute()
|
||||
DmsSyncActionResult result(false, "mq error");
|
||||
return result;
|
||||
}
|
||||
LOG_SYS_OPERATION(QString("GUI -> DMS : %1-%2, Message:%3").arg(mServerId).arg(mActionId).arg(mSendData));
|
||||
if(!waitUntilSignalReceived())
|
||||
{
|
||||
LOG_SYS_OPERATION(QString("GUI -> DMS : %1-%2, Time out.").arg(mServerId).arg(mActionId));
|
||||
DmsSyncActionResult result(false, "time out");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "UsctStateManager.h"
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
#include "log/SystemOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
|
||||
UsctStateManager* UsctStateManager::getInstance()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <QRegExpValidator>
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "db/SQLHelper.h"
|
||||
#include "models/User.h"
|
||||
#include "components/ULineEdit.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "components/ULineEdit.h"
|
||||
#include "models/User.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
ChangePasswordFormDialog::ChangePasswordFormDialog(QWidget* parent, Qt::WindowFlags f)
|
||||
: GUIFormBaseDialog(parent, f)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QToolButton>
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
GUIMessageDialog::GUIMessageDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "components/ULineEdit.h"
|
||||
#include "action/GetWorkListAction.h"
|
||||
#include "action/ActionCreator.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "event/EventCenter.h"
|
||||
|
||||
GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTableView, QWidget* aParent, Qt::WindowFlags aFlags)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "utilities/InputFormatValidator.h"
|
||||
#include "device/networkmanager.h"
|
||||
#include "DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "components/ErrorLabel.h"
|
||||
#include "dialogs/DicomSettingsArea.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "PacsSettingsDialog.h"
|
||||
#include "dialogs/DicomSettingsArea.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "components/ErrorLabel.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "dialogs/DicomSettingsArea.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "recon/ReconManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "components/ErrorLabel.h"
|
||||
#include "dialogs/DicomSettingsArea.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "forms/scan/PatientInformationForm.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "device/DeviceManager.h"
|
||||
#include "dicom/WorkListManager.h"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "components/VerticalTextToolButton.h"
|
||||
#include "PatientAddDateDelegate.h"
|
||||
#include "dicom/WorkListManager.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "models/User.h"
|
||||
#include "components/SlideTableView.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
AccountTableForm::AccountTableForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "components/ListBox.h"
|
||||
#include "components/ImageSwitch.h"
|
||||
#include "components/BatteryWidget.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "utilities/DiskInfoWorker.h"
|
||||
#include "utilities/GetLockScreenTimeHelper.h"
|
||||
#include "utilities/GetProtocalHelper.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
@@ -24,7 +24,7 @@ JsonObject::JsonObject()
|
||||
|
||||
JsonObject::~JsonObject()
|
||||
{
|
||||
savecfg();
|
||||
//savecfg();
|
||||
}
|
||||
|
||||
void JsonObject::init()
|
||||
|
||||
47
src/log/LogManager.cpp
Normal file
47
src/log/LogManager.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "LogManager.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
LogManager* LogManager::getInstance()
|
||||
{
|
||||
static LogManager instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
LogManager::LogManager()
|
||||
: QObject()
|
||||
, mThread(new QThread())
|
||||
, mSysLog(new SystemOperationLog())
|
||||
, mUserLog(new UserOperationLog())
|
||||
{
|
||||
mSysLog->moveToThread(mThread);
|
||||
mUserLog->moveToThread(mThread);
|
||||
connect(this, &LogManager::doWriteSystemOperationLog, mSysLog, &SystemOperationLog::log);
|
||||
connect(this, &LogManager::doWriteUserOperationLog, mUserLog, &UserOperationLog::log);
|
||||
mThread->start();
|
||||
}
|
||||
|
||||
LogManager::~LogManager()
|
||||
{
|
||||
mThread->quit();
|
||||
mThread->wait();
|
||||
|
||||
delete mUserLog;
|
||||
delete mSysLog;
|
||||
mThread->deleteLater();
|
||||
}
|
||||
|
||||
void LogManager::writeSystemOperationLog(const QString& aMessage)
|
||||
{
|
||||
emit doWriteSystemOperationLog(aMessage, QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
void LogManager::writeUserOperationLog(const QString& aMessage)
|
||||
{
|
||||
emit doWriteUserOperationLog(aMessage);
|
||||
}
|
||||
|
||||
QString LogManager::getCurrentUserOperationLogFile()
|
||||
{
|
||||
return mUserLog->currentLogFile();
|
||||
}
|
||||
41
src/log/LogManager.h
Normal file
41
src/log/LogManager.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef LOGMANAGER_H
|
||||
#define LOGMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "SystemOperationLog.h"
|
||||
#include "UserOperationLog.h"
|
||||
|
||||
class QThread;
|
||||
|
||||
#define LOG_SYS_OPERATION(...)\
|
||||
LogManager::getInstance()->writeSystemOperationLog(__VA_ARGS__);
|
||||
|
||||
|
||||
#define LOG_USER_OPERATION(...)\
|
||||
LogManager::getInstance()->writeUserOperationLog(__VA_ARGS__);
|
||||
|
||||
class LogManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static LogManager* getInstance();
|
||||
void writeSystemOperationLog(const QString& aMessage);
|
||||
void writeUserOperationLog(const QString& aMessage);
|
||||
QString getCurrentUserOperationLogFile();
|
||||
|
||||
signals:
|
||||
void doWriteSystemOperationLog(const QString& aMessage, const QDateTime& aOperationDate);
|
||||
void doWriteUserOperationLog(const QString& aMessage);
|
||||
|
||||
private:
|
||||
LogManager();
|
||||
~LogManager();
|
||||
|
||||
private:
|
||||
QThread* mThread;
|
||||
SystemOperationLog* mSysLog;
|
||||
UserOperationLog* mUserLog;
|
||||
};
|
||||
|
||||
#endif // LOGMANAGER_H
|
||||
@@ -10,15 +10,9 @@ namespace
|
||||
const QString SYS_LOG_SUFFIX = "-sys.log";
|
||||
}
|
||||
|
||||
SystemOperationLog* SystemOperationLog::getInstance()
|
||||
{
|
||||
static SystemOperationLog instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
|
||||
SystemOperationLog::SystemOperationLog()
|
||||
: mCurrentFileName()
|
||||
: QObject()
|
||||
, mCurrentFileName()
|
||||
, mLogFile()
|
||||
, mStreamOut()
|
||||
{
|
||||
@@ -50,7 +44,7 @@ SystemOperationLog::~SystemOperationLog()
|
||||
void SystemOperationLog::reloadFile()
|
||||
{
|
||||
QString newFileName = LOG_DIR + QDate::currentDate().toString("/yyyy-MM-dd") + SYS_LOG_SUFFIX;
|
||||
if (newFileName == mCurrentFileName && !AppGlobalValues::InProcessing().toBool()) return;
|
||||
if (newFileName == mCurrentFileName) return;
|
||||
mLogFile.close();
|
||||
mLogFile.setFileName(newFileName);
|
||||
if (mLogFile.exists())
|
||||
@@ -64,9 +58,8 @@ void SystemOperationLog::reloadFile()
|
||||
mStreamOut.setDevice(&mLogFile);
|
||||
}
|
||||
|
||||
void SystemOperationLog::log(const QString &aOperationText)
|
||||
void SystemOperationLog::log(const QString &aOperationText, const QDateTime& aOperationDate)
|
||||
{
|
||||
reloadFile();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
mStreamOut << now.toString(Qt::DateFormat::ISODateWithMs).replace("T","\t")<<"\t"<<aOperationText<<endl;
|
||||
mStreamOut << aOperationDate.toString(Qt::DateFormat::ISODateWithMs).replace("T","\t")<<"\t"<<aOperationText<<endl;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
#ifndef SYSTEMOPERATIONLOG_H
|
||||
#define SYSTEMOPERATIONLOG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#define LOG_SYS_OPERATION(...)\
|
||||
SystemOperationLog::getInstance()->log(__VA_ARGS__);
|
||||
|
||||
class SystemOperationLog
|
||||
class SystemOperationLog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static SystemOperationLog* getInstance();
|
||||
void log(const QString& aOperationText);
|
||||
void reloadFile();
|
||||
|
||||
private:
|
||||
SystemOperationLog();
|
||||
~SystemOperationLog();
|
||||
void reloadFile();
|
||||
|
||||
public slots:
|
||||
void log(const QString& aOperationText, const QDateTime& aOperationDate);
|
||||
|
||||
private:
|
||||
QString mCurrentFileName;
|
||||
|
||||
@@ -12,6 +12,24 @@ namespace
|
||||
const QString logDir = "./log/UserOperationLog";
|
||||
}
|
||||
|
||||
UserOperationLog::UserOperationLog()
|
||||
: QObject()
|
||||
, currentFileName()
|
||||
, logFile()
|
||||
, out()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
UserOperationLog::~UserOperationLog()
|
||||
{
|
||||
if (logFile.isOpen())
|
||||
{
|
||||
logFile.flush();
|
||||
logFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void UserOperationLog::init() {
|
||||
QDir log_dir("./");
|
||||
if (!log_dir.exists("log")) log_dir.mkdir("log");
|
||||
@@ -44,33 +62,20 @@ QString addSpace(const char* str)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
QString getOperationName(UserOperation operation)
|
||||
{
|
||||
switch (operation) {
|
||||
#define ADD_OPERATION(name)\
|
||||
case name: return addSpace(#name);
|
||||
USER_OPERATIONS()
|
||||
#undef ADD_OPERATION
|
||||
default:
|
||||
return "unknow error";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UserOperationLog::log(const QString& aOperationText)
|
||||
{
|
||||
reloadFile();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
AppGlobalValues::setLastOperationTime(now);
|
||||
QString UserName = (!User::Current() || User::Current()->getUserCode().isEmpty())?"anonymous":User::Current()->getUserCode();
|
||||
out << now.toString(Qt::DateFormat::ISODateWithMs).replace("T","\t")<<"\t"<<UserName<<"\t"<<aOperationText<<endl;
|
||||
QString operationText = aOperationText;
|
||||
out << now.toString(Qt::DateFormat::ISODateWithMs).replace("T","\t")<<"\t"<<UserName<<"\t"<<operationText.replace("\n","\\n")<<endl;
|
||||
}
|
||||
|
||||
void UserOperationLog::reloadFile() {
|
||||
QString newFileName = logDir + QDate::currentDate().toString("/yyyy-MM-dd")+QString("-op.log");
|
||||
//inprocessing 暂时没有使用
|
||||
if (newFileName == currentFileName && !AppGlobalValues::InProcessing().toBool()) return;
|
||||
if (newFileName == currentFileName) return;
|
||||
logFile.close();
|
||||
logFile.setFileName(newFileName);
|
||||
if (logFile.exists())
|
||||
|
||||
@@ -1,53 +1,18 @@
|
||||
#ifndef GUI_USEROPERATIONLOG_H
|
||||
#define GUI_USEROPERATIONLOG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#define USER_OPERATIONS()\
|
||||
ADD_OPERATION(Login)\
|
||||
ADD_OPERATION(Logout)\
|
||||
ADD_OPERATION(ChangePassword)\
|
||||
ADD_OPERATION(ChangeUserName)\
|
||||
ADD_OPERATION(AddPatient)\
|
||||
ADD_OPERATION(ChangePatientInfo)\
|
||||
ADD_OPERATION(DeletePatient)\
|
||||
ADD_OPERATION(SelectPatient)\
|
||||
ADD_OPERATION(StartRefresh)\
|
||||
ADD_OPERATION(StopScan)\
|
||||
ADD_OPERATION(StopPreview)\
|
||||
ADD_OPERATION(StartPreview)\
|
||||
ADD_OPERATION(StartScan)\
|
||||
ADD_OPERATION(ConfirmError)\
|
||||
ADD_OPERATION(AdminChangeAcountInformation)
|
||||
|
||||
#define LOG_USER_OPERATION(...)\
|
||||
UserOperationLog::Default()->log(__VA_ARGS__);
|
||||
|
||||
|
||||
enum UserOperation{
|
||||
#define ADD_OPERATION(name) name,\
|
||||
|
||||
USER_OPERATIONS()
|
||||
#undef ADD_OPERATION
|
||||
};
|
||||
class UserOperationLog {
|
||||
class UserOperationLog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UserOperationLog(){}
|
||||
~UserOperationLog(){
|
||||
if (logFile.isOpen())
|
||||
{
|
||||
logFile.flush();
|
||||
logFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
UserOperationLog();
|
||||
~UserOperationLog();
|
||||
void init();
|
||||
static UserOperationLog* Default(){
|
||||
static UserOperationLog d;
|
||||
return &d;
|
||||
}
|
||||
static void cleanHistoryLog();
|
||||
|
||||
static QStringList getHistoryLogFiles();
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include "log/UserOperationLog.h"
|
||||
#include <QTranslator>
|
||||
#include <src/device/DeviceManager.h>
|
||||
#include "dialogs/DialogManager.h"
|
||||
@@ -20,7 +18,7 @@
|
||||
#include "utilities/TouchScreenSignalSender.h"
|
||||
#include "keyboard/KeyboardManager.h"
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include "log/SystemOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
QString loadFontFromFile(QString path)
|
||||
@@ -95,9 +93,8 @@ int main(int argc, char* argv[])
|
||||
AppGlobalValues::setDBconnected(false);
|
||||
MainWindow w;
|
||||
DialogManager::Default()->init(&w);
|
||||
UserOperationLog::Default()->init();
|
||||
LogManager::getInstance();
|
||||
LOG_USER_OPERATION("GUI Started");
|
||||
SystemOperationLog::getInstance();
|
||||
|
||||
QObject::connect(TouchScreenSignalSender::getInstance(), SIGNAL(touchScreen()), Locker::getInstance(), SLOT(refreshTimer()));
|
||||
// QList<Qt::GestureType> gestures;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ReconManager.h"
|
||||
#include "ReconClient.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "log/SystemOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include "QDebug"
|
||||
|
||||
@@ -370,6 +370,11 @@ progress:99%</source>
|
||||
<source>Error: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scan completed! Please prepare for the next scan.
|
||||
Click the confirm button after lying down.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DicomCfgDialog</name>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "models/User.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "log/LogManager.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "components/ULineEdit.h"
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
|
||||
Reference in New Issue
Block a user