Refactoring the new dialog manager module and fixed keyboard problem in Linux touch panel.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
typedef void(*error_cb)(const char* msg);
|
||||
// level:0 infomation,1 warning,2 error,3 sucessed
|
||||
typedef void(*message_callback)(const char* msg, unsigned int level);
|
||||
typedef void(*message_callback)(const char* aMessage,const unsigned int aInfoType);
|
||||
|
||||
int statusCountFlag = 0;
|
||||
error_cb innerCallback = NULL;
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef enum {
|
||||
|
||||
extern int InitLib(void(*)(const char *msg));
|
||||
|
||||
extern void SetMessageCallback(void(*)(const char* msg,unsigned int level));
|
||||
extern void SetMessageCallback(void(*)(const char* aMessage,const unsigned int aInfoType));
|
||||
|
||||
extern int ScanControl(ScanAction actionType);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "UsctApplication.h"
|
||||
#include "utilities/TouchScreenSignalSender.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
|
||||
UsctApplication::UsctApplication(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
@@ -17,6 +18,11 @@ bool UsctApplication::notify(QObject* aReceiver, QEvent* aEvent)
|
||||
{
|
||||
TouchScreenSignalSender::getInstance()->sendTouchScreenSignal();
|
||||
}
|
||||
else if (aEvent->type() == QEvent::TouchCancel)
|
||||
{
|
||||
DialogManager::Default()->setFocusToTopDialog();
|
||||
}
|
||||
|
||||
|
||||
return QApplication::notify(aReceiver, aEvent);
|
||||
}
|
||||
|
||||
@@ -51,12 +51,18 @@ void errorCallback(const char* msg)
|
||||
DeviceManager::Default()->emitErrorCallback(msg);
|
||||
}
|
||||
|
||||
void infoCallback(const char* msg,const unsigned int aInfoType)
|
||||
{
|
||||
DeviceManager::Default()->emitInfoCallback(msg,aInfoType);
|
||||
}
|
||||
|
||||
const char * getPhaseName(int phase){
|
||||
return names[phase-1];
|
||||
}
|
||||
|
||||
void DeviceManager::initDevice() {
|
||||
InitLib(errorCallback);
|
||||
SetMessageCallback(infoCallback);
|
||||
|
||||
mDeviceInfTimerID = startTimer(10000);
|
||||
|
||||
@@ -379,6 +385,11 @@ void DeviceManager::emitErrorCallback(const char *msg) {
|
||||
emit raiseGlobalError( m);
|
||||
}
|
||||
|
||||
void DeviceManager::emitInfoCallback(const char* aMessage,const unsigned int aInfoType)
|
||||
{
|
||||
emit raiseGlobalInfo(QPair<QString,unsigned int>(aMessage,aInfoType));
|
||||
}
|
||||
|
||||
QString DeviceManager::getSoftwareVersion() {
|
||||
return GetDeviceInfo(VERSION);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,12 @@ public:
|
||||
}
|
||||
|
||||
void emitErrorCallback(const char *msg);
|
||||
void emitInfoCallback(const char* aMessage,const unsigned int aInfoType);
|
||||
|
||||
signals:
|
||||
|
||||
void raiseGlobalError(QString msg);
|
||||
void raiseGlobalInfo(const QPair<QString,unsigned int>& aInfoData);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "db/SQLHelper.h"
|
||||
#include "models/User.h"
|
||||
#include "AlertDialog.h"
|
||||
#include "components/ULineEdit.h"
|
||||
#include "DialogManager.h"
|
||||
|
||||
@@ -70,25 +69,17 @@ void AccountFormDialog::addEndLine(QVBoxLayout* layout)
|
||||
|
||||
void AccountFormDialog::resetUserPassword()
|
||||
{
|
||||
AlertDialog dialog(this);
|
||||
dialog.setGeometry(geometry());
|
||||
dialog.setButtonMode(OkAndCancel);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setAlertMessage(tr("Reset password to \"123456\" ?"));
|
||||
if (dialog.exec() == Accepted)
|
||||
if (DialogManager::Default()->requestAlertMessage(tr("Reset password to \"123456\" ?"),DialogButtonMode::OkAndCancel) == Accepted)
|
||||
{
|
||||
User user;
|
||||
dialog.setButtonMode(OkOnly);
|
||||
if (!User::getUser(mUserID, user))
|
||||
{
|
||||
dialog.setAlertMessage(tr("Inner error, can't find reference user!"));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Inner error, can't find reference user!"), DialogButtonMode::OkAndCancel);
|
||||
return;
|
||||
}
|
||||
if (!user.resetPassword())
|
||||
{
|
||||
dialog.setAlertMessage(tr("Submit change to database fail!"));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Submit change to database fail!"), DialogButtonMode::OkAndCancel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "DialogManager.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
@@ -14,19 +12,32 @@
|
||||
#include "dialogs/ChangePasswordFormDialog.h"
|
||||
#include "dialogs/AccountFormDialog.h"
|
||||
#include "dialogs/MultyMessageDialogManager.h"
|
||||
#include "dialogs/EditPatientDialog.h"
|
||||
#include "dialogs/AlertDialog.h"
|
||||
#include "dialogs/DateSelectDialog.h"
|
||||
#include "dialogs/SelectDialog.h"
|
||||
|
||||
#include "network/DicomCfgDialog.h"
|
||||
#include "network/GetAdminPsw.h"
|
||||
#include "network/NetworkCfgDialog.h"
|
||||
#include "network/GetIPDialog.h"
|
||||
#include "network/GetRouteDialog.h"
|
||||
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include "windows/LoginDialog.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "shimlib/ShimLib.h"
|
||||
|
||||
void messageCallback(const char* aMessage,unsigned int aMessageLevel)
|
||||
namespace
|
||||
{
|
||||
DialogManager::Default()->raiseMultyMessageDialog(QString::fromLatin1(aMessage),MessageLevel(aMessageLevel));
|
||||
const int GUIMESSAGEDIALOG_OFFSET = 30;
|
||||
}
|
||||
|
||||
DialogManager::DialogManager()
|
||||
: QObject()
|
||||
, mFunctionDialog(nullptr)
|
||||
, mMessageDialog(nullptr)
|
||||
, mOperationMessageDialog(nullptr)
|
||||
, mSyncDialog(nullptr)
|
||||
, mTopWidget(nullptr)
|
||||
{
|
||||
|
||||
@@ -34,12 +45,13 @@ DialogManager::DialogManager()
|
||||
|
||||
void DialogManager::init(QWidget* aParent) {
|
||||
connect(EventCenter::Default(), &EventCenter::DeviceErrorRaise,this,&DialogManager::raiseDeviceError);
|
||||
connect(EventCenter::Default(), &EventCenter::DeviceInfoRaise,this,&DialogManager::raiseDeviceInfo);
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationStart,this,&DialogManager::invokeOperationStart);
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress,this,&DialogManager::invokeOperationProgress);
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationPending,this,&DialogManager::invokeOperationPending);
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd,this,&DialogManager::invokeOperationEnd);
|
||||
MultyMessageDialogManager::getInstance()->setDialogParent(aParent);
|
||||
SetMessageCallback(messageCallback);
|
||||
mTopWidget = aParent;
|
||||
}
|
||||
|
||||
//得考虑多线程的问题
|
||||
@@ -49,11 +61,7 @@ void DialogManager::setTopWidget(QWidget* widget) {
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!mTopWidget&& QApplication::activeWindow()){
|
||||
mTopWidget = QApplication::activeWindow();
|
||||
}
|
||||
qDebug()<<"last top:"<<mTopWidget->objectName()<<", new top:"<<widget->objectName();
|
||||
widget->setParent(mTopWidget,widget->windowFlags());
|
||||
qDebug()<<"last top:"<<mTopWidget<<", new top:"<<widget;
|
||||
mTopWidget = widget;
|
||||
++mDialogCount;
|
||||
}
|
||||
@@ -70,23 +78,22 @@ void DialogManager::releaseTopWidget(QWidget* expectedTopWidget) {
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::requestLogin()
|
||||
void DialogManager::requestLogin(QWidget* aParent)
|
||||
{
|
||||
//Login 直接最顶层模态
|
||||
if (!mFunctionDialog){
|
||||
mFunctionDialog = new LoginDialog;
|
||||
mFunctionDialog = new LoginDialog(aParent);
|
||||
}
|
||||
mFunctionDialog->setWindowModality(Qt::WindowModal);
|
||||
mFunctionDialog->exec();
|
||||
while (QDialog::Accepted != mFunctionDialog->result())
|
||||
{
|
||||
|
||||
mFunctionDialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
int DialogManager::requestAddAccount(QSqlTableModel* model) {
|
||||
AccountFormDialog dialog(nullptr, New);
|
||||
AccountFormDialog dialog(mTopWidget, New);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setReferenceModel(model);
|
||||
@@ -96,7 +103,7 @@ int DialogManager::requestAddAccount(QSqlTableModel* model) {
|
||||
}
|
||||
|
||||
int DialogManager::requestEditSelfAccount() {
|
||||
AccountFormDialog dialog(nullptr, Self);
|
||||
AccountFormDialog dialog(mTopWidget, Self);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
@@ -105,7 +112,7 @@ int DialogManager::requestEditSelfAccount() {
|
||||
}
|
||||
|
||||
int DialogManager::requestEditAdminAccount(const QMap<QString, QVariant>& values) {
|
||||
AccountFormDialog dialog(nullptr, Admin);
|
||||
AccountFormDialog dialog(mTopWidget, Admin);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setAccountInformation(values);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
@@ -115,7 +122,7 @@ int DialogManager::requestEditAdminAccount(const QMap<QString, QVariant>& values
|
||||
}
|
||||
|
||||
void DialogManager::requestChangePassword() {
|
||||
ChangePasswordFormDialog dialog;
|
||||
ChangePasswordFormDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setGeometry(dialog.parentWidget()->geometry());
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
@@ -123,10 +130,173 @@ void DialogManager::requestChangePassword() {
|
||||
releaseTopWidget(&dialog);
|
||||
}
|
||||
|
||||
int DialogManager::requestEditPatientInfo(PatientInformation* aPatientFrom, QSqlTableModel* aModel)
|
||||
{
|
||||
EditPatientDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setPatientInformation(aPatientFrom);
|
||||
dialog.setModel(aModel);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DialogManager::requestAlertMessage(const QString& aMessage, DialogButtonMode aButtonMode, const QString& aTitle)
|
||||
{
|
||||
AlertDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setAlertMessage(aMessage);
|
||||
if (!aTitle.isEmpty())
|
||||
{
|
||||
dialog.setTitle(aTitle);
|
||||
}
|
||||
dialog.setButtonMode(aButtonMode);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestSelectDate(const QString& aDate)
|
||||
{
|
||||
DateSelectDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setSelectedValue(aDate);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getSelectedValue());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestSelectLanguage()
|
||||
{
|
||||
SelectDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setValues(JsonObject::Instance()->language());
|
||||
dialog.setSelectedValue(JsonObject::Instance()->defaultLanguage());
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getSelectedValue());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestSelectProtocal()
|
||||
{
|
||||
SelectDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setValues(JsonObject::Instance()->protocals());
|
||||
dialog.setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getSelectedValue());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestSelectFilter()
|
||||
{
|
||||
SelectDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setValues(JsonObject::Instance()->worklistFilters());
|
||||
dialog.setSelectedValue(JsonObject::Instance()->defaultFilter());
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getSelectedValue());
|
||||
}
|
||||
|
||||
int DialogManager::requestEditDicomConfig()
|
||||
{
|
||||
DicomCfgDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DialogManager::requestInputAdminPasswd()
|
||||
{
|
||||
GetAdminPsw dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DialogManager::requestEditNetworkConfig()
|
||||
{
|
||||
NetworkCfgDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestEditIpAndNetMask()
|
||||
{
|
||||
GetIPDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getList());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestEditIpAndNetMask(const QStringList& aEditData)
|
||||
{
|
||||
GetIPDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setList(aEditData);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getList());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestEditRouteInfo()
|
||||
{
|
||||
GetRouteDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getList());
|
||||
}
|
||||
|
||||
DialogResult DialogManager::requestEditRouteInfo(const QStringList& aEditData)
|
||||
{
|
||||
GetRouteDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setList(aEditData);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return DialogResult(ret,dialog.getList());
|
||||
}
|
||||
|
||||
void DialogManager::raiseDeviceInfo(QObject* parent, QObject* aInfoData)
|
||||
{
|
||||
QPair<QString, unsigned int>* infoData = (QPair<QString, unsigned int>*)(aInfoData);
|
||||
raiseMultyMessageDialog(infoData->first,MessageLevel(infoData->second));
|
||||
}
|
||||
|
||||
//考虑以后使用另外的dialog显示错误
|
||||
void DialogManager::raiseDeviceError(QObject *parent, QObject *msg) {
|
||||
clearMessageDialog();
|
||||
auto dialog = new GUIMessageDialog;
|
||||
auto dialog = new GUIMessageDialog(mTopWidget);
|
||||
|
||||
if (nullptr != mTopWidget && mTopWidget->inherits("GUIMessageDialog"))
|
||||
{
|
||||
GUIMessageDialog* parent = qobject_cast<GUIMessageDialog*>(mTopWidget);
|
||||
if (parent->getDialogPos().y() + 320 + GUIMESSAGEDIALOG_OFFSET < 1080)
|
||||
{
|
||||
dialog->moveDialog(parent->getDialogPos() + QPoint(GUIMESSAGEDIALOG_OFFSET, GUIMESSAGEDIALOG_OFFSET));
|
||||
}
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
QString *str = (QString *) msg;
|
||||
@@ -137,7 +307,7 @@ void DialogManager::raiseDeviceError(QObject *parent, QObject *msg) {
|
||||
dialog->stopLoading();
|
||||
dialog->showExitButton();
|
||||
setTopWidget(dialog);
|
||||
dialog->setWindowModality(Qt::NonModal);
|
||||
dialog->setWindowModality(Qt::WindowModal);
|
||||
dialog->showFullScreen ();
|
||||
dialog->exec();
|
||||
releaseTopWidget(dialog);
|
||||
@@ -151,84 +321,88 @@ void DialogManager::invokeOperationStart(QObject *parent, QObject *msg) {
|
||||
//只能在最底层窗口上模态
|
||||
if (mDialogCount>0) return;
|
||||
clearMessageDialog();
|
||||
mMessageDialog = new GUIMessageDialog(QApplication::activeWindow());
|
||||
mOperationMessageDialog = new GUIMessageDialog(QApplication::activeWindow());
|
||||
if (msg)
|
||||
{
|
||||
QString* str = (QString*)msg;
|
||||
mMessageDialog->showMessage(*str);
|
||||
mOperationMessageDialog->showMessage(*str);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessageDialog->hideMessage();
|
||||
mOperationMessageDialog->hideMessage();
|
||||
}
|
||||
mMessageDialog->hideExitButton();
|
||||
mMessageDialog->startLoading();
|
||||
mOperationMessageDialog->hideExitButton();
|
||||
mOperationMessageDialog->startLoading();
|
||||
AppGlobalValues::setInProcessing(true);
|
||||
if (mMessageDialog->isHidden())
|
||||
if (mOperationMessageDialog->isHidden())
|
||||
{
|
||||
mMessageDialog->open();
|
||||
mOperationMessageDialog->showFullScreen();
|
||||
mOperationMessageDialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::invokeOperationProgress(QObject *parent, QObject *msg) {
|
||||
//窗口不存在,撤销操作
|
||||
if (!mMessageDialog) return;
|
||||
if (!mOperationMessageDialog) return;
|
||||
if (msg)
|
||||
{
|
||||
QVariant* var = (QVariant*)msg;
|
||||
if (mMessageDialog->Pending())
|
||||
if (mOperationMessageDialog->Pending())
|
||||
{
|
||||
mMessageDialog->stopPending();
|
||||
mOperationMessageDialog->stopPending();
|
||||
}
|
||||
mMessageDialog->showMessage(var->toString());
|
||||
mOperationMessageDialog->showMessage(var->toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessageDialog->hideMessage();
|
||||
mOperationMessageDialog->hideMessage();
|
||||
}
|
||||
if (mMessageDialog->isHidden())
|
||||
if (mOperationMessageDialog->isHidden())
|
||||
{
|
||||
mMessageDialog->show();
|
||||
mOperationMessageDialog->showFullScreen();
|
||||
mOperationMessageDialog->exec();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::invokeOperationPending(QObject *parent, QObject *msg) {
|
||||
//窗口不存在,撤销操作
|
||||
if (!mMessageDialog) return;
|
||||
if (!mMessageDialog->Pending())
|
||||
if (!mOperationMessageDialog) return;
|
||||
if (!mOperationMessageDialog->Pending())
|
||||
{
|
||||
mMessageDialog->startPending();
|
||||
mOperationMessageDialog->startPending();
|
||||
QVariant* var = (QVariant*)msg;
|
||||
mMessageDialog->showMessage(var->toString());
|
||||
mOperationMessageDialog->showMessage(var->toString());
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::invokeOperationEnd(QObject *parent, QObject *msg) {
|
||||
//窗口不存在,撤销操作
|
||||
if (!mMessageDialog) return;
|
||||
if (!mMessageDialog->isHidden())
|
||||
if (!mOperationMessageDialog) return;
|
||||
if (!mOperationMessageDialog->isHidden())
|
||||
{
|
||||
if (msg && ((QVariant*)msg)->toBool())
|
||||
{
|
||||
mMessageDialog->stopLoading();
|
||||
mMessageDialog->showMessage("Scan completed!");
|
||||
mMessageDialog->showExitButton();
|
||||
mMessageDialog->setWindowModality(Qt::WindowModal);
|
||||
mMessageDialog->exec();
|
||||
mOperationMessageDialog->stopLoading();
|
||||
mOperationMessageDialog->showMessage("Scan completed!");
|
||||
mOperationMessageDialog->showExitButton();
|
||||
mOperationMessageDialog->setWindowModality(Qt::WindowModal);
|
||||
mOperationMessageDialog->showFullScreen();
|
||||
mOperationMessageDialog->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessageDialog->accept();
|
||||
mOperationMessageDialog->accept();
|
||||
}
|
||||
delete mMessageDialog;
|
||||
delete mOperationMessageDialog;
|
||||
AppGlobalValues::setInProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::clearMessageDialog() {
|
||||
if (mMessageDialog){
|
||||
if (!mMessageDialog->isHidden()) mMessageDialog->hide();
|
||||
delete mMessageDialog;
|
||||
if (mOperationMessageDialog)
|
||||
{
|
||||
releaseTopWidget(mOperationMessageDialog);
|
||||
delete mOperationMessageDialog;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +410,38 @@ DialogManager::~DialogManager() {
|
||||
clearMessageDialog();
|
||||
}
|
||||
|
||||
void DialogManager::raiseMultyMessageDialog(const QString aMessage, MessageLevel aMessageLevel)
|
||||
void DialogManager::raiseMultyMessageDialog(const QString& aMessage, MessageLevel aMessageLevel)
|
||||
{
|
||||
MultyMessageDialogManager::getInstance()->raiseDialog(aMessage, aMessageLevel);
|
||||
}
|
||||
|
||||
void DialogManager::raiseSyncDialog(const QString& aMessage)
|
||||
{
|
||||
if (!mSyncDialog)
|
||||
{
|
||||
mSyncDialog = new GUIMessageDialog(mTopWidget);
|
||||
}
|
||||
mSyncDialog->showMessage(aMessage);
|
||||
setTopWidget(mSyncDialog);
|
||||
mSyncDialog->setWindowModality(Qt::WindowModal);
|
||||
mSyncDialog->showFullScreen ();
|
||||
mSyncDialog->exec();
|
||||
releaseTopWidget(mSyncDialog);
|
||||
delete mSyncDialog;
|
||||
}
|
||||
|
||||
void DialogManager::hideTopSyncDialog()
|
||||
{
|
||||
if (mSyncDialog)
|
||||
{
|
||||
mSyncDialog->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogManager::setFocusToTopDialog()
|
||||
{
|
||||
if (0 < mDialogCount && nullptr != mTopWidget)
|
||||
{
|
||||
mTopWidget->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,31 @@
|
||||
#ifndef GUI_DIALOGMANAGER_H
|
||||
#define GUI_DIALOGMANAGER_H
|
||||
|
||||
#include "GUIFormBaseDialog.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
#include <mutex>
|
||||
#include <QStack>
|
||||
#include <atomic>
|
||||
|
||||
class QWidget;
|
||||
class QDialog;
|
||||
class GUIMessageDialog;
|
||||
class QSqlTableModel;
|
||||
class PatientInformation;
|
||||
class LoginDialog;
|
||||
|
||||
enum MessageLevel:unsigned int;
|
||||
|
||||
struct DialogResult
|
||||
{
|
||||
DialogResult(int aResultCode, const QVariant& aResultData)
|
||||
{
|
||||
ResultCode = aResultCode;
|
||||
ResultData = aResultData;
|
||||
};
|
||||
int ResultCode;
|
||||
QVariant ResultData;
|
||||
};
|
||||
|
||||
class DialogManager:public QObject {
|
||||
public:
|
||||
static DialogManager *Default() {
|
||||
@@ -29,24 +42,44 @@ public:
|
||||
~DialogManager() override;
|
||||
|
||||
void init(QWidget* aParent);
|
||||
void setTopWidget(QWidget* widget);
|
||||
void releaseTopWidget(QWidget* expectedTopWidget);
|
||||
void requestLogin();
|
||||
void requestLogin(QWidget* aParent);
|
||||
int requestAddAccount(QSqlTableModel* model);
|
||||
int requestEditSelfAccount();
|
||||
int requestEditAdminAccount(const QMap<QString, QVariant>& values);
|
||||
int requestEditPatientInfo(PatientInformation* aPatientFrom, QSqlTableModel* aModel);
|
||||
int requestAlertMessage(const QString& aMessage, DialogButtonMode aButtonMode,const QString& aTitle = QString());
|
||||
DialogResult requestSelectDate(const QString& aDate);
|
||||
DialogResult requestSelectLanguage();
|
||||
DialogResult requestSelectProtocal();
|
||||
DialogResult requestSelectFilter();
|
||||
int requestEditDicomConfig();
|
||||
int requestInputAdminPasswd();
|
||||
int requestEditNetworkConfig();
|
||||
DialogResult requestEditIpAndNetMask();
|
||||
DialogResult requestEditIpAndNetMask(const QStringList& aEditData);
|
||||
DialogResult requestEditRouteInfo();
|
||||
DialogResult requestEditRouteInfo(const QStringList& aEditData);
|
||||
void requestChangePassword();
|
||||
void raiseDeviceError(QObject* parent, QObject* msg);
|
||||
void raiseMultyMessageDialog(const QString aMessage,MessageLevel aMessageLevel);
|
||||
void raiseDeviceInfo(QObject* parent, QObject* aInfoData);
|
||||
void raiseMultyMessageDialog(const QString& aMessage,MessageLevel aMessageLevel);
|
||||
void raiseSyncDialog(const QString& aMessage);
|
||||
void hideTopSyncDialog();
|
||||
void invokeOperationStart(QObject* parent, QObject* msg);
|
||||
void invokeOperationProgress(QObject* parent, QObject* msg);
|
||||
void invokeOperationPending(QObject* parent, QObject* msg);
|
||||
void invokeOperationEnd(QObject* parent, QObject* msg);
|
||||
void setFocusToTopDialog();
|
||||
|
||||
private:
|
||||
void clearMessageDialog();
|
||||
void setTopWidget(QWidget* widget);
|
||||
void releaseTopWidget(QWidget* expectedTopWidget);
|
||||
|
||||
QDialog* mFunctionDialog;
|
||||
QPointer<GUIMessageDialog> mMessageDialog;
|
||||
private:
|
||||
LoginDialog* mFunctionDialog;
|
||||
QPointer<GUIMessageDialog> mOperationMessageDialog;
|
||||
QPointer<GUIMessageDialog> mSyncDialog;
|
||||
QWidget* mTopWidget;
|
||||
std::mutex mMutex;
|
||||
int mDialogCount = 0;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <QUuid>
|
||||
|
||||
#include "dialogs/SelectDialog.h"
|
||||
#include "DateSelectDialog.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "components/ListBox.h"
|
||||
#include "components/ULineEdit.h"
|
||||
#include "components/UTextEdit.h"
|
||||
@@ -91,12 +91,10 @@ EditPatientDialog::EditPatientDialog(QWidget* parent, Qt::WindowFlags f) : GUIFo
|
||||
btnDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
btnDate->setText("1990-06-15");
|
||||
connect(btnDate, &QToolButton::clicked, [=]() {
|
||||
DateSelectDialog dialog(this);
|
||||
dialog.setSelectedValue(btnDate->text());
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestSelectDate(btnDate->text());
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
btnDate->setText(dialog.getSelectedValue());
|
||||
btnDate->setText(result.ResultData.toString());
|
||||
}
|
||||
});
|
||||
layout->addWidget(btnDate);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#ifndef GUI_GUIFORMBASEDIALOG_H
|
||||
#define GUI_GUIFORMBASEDIALOG_H
|
||||
enum DialogButtonMode
|
||||
enum DialogButtonMode:unsigned int
|
||||
{
|
||||
None,OkOnly,OkAndCancel
|
||||
};
|
||||
|
||||
@@ -20,7 +20,9 @@ GUIMessageDialog::GUIMessageDialog(QWidget *parent)
|
||||
this->setObjectName("MessageDialog");
|
||||
this->setWindowFlags (Qt :: FramelessWindowHint | Qt :: Dialog);
|
||||
initBaseLayout();
|
||||
this->setWindowOpacity(0.6);
|
||||
mUI->btnContainerWidget->setAttribute(Qt::WA_TranslucentBackground);
|
||||
mUI->widget->setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
initLoadingFrameString();
|
||||
}
|
||||
|
||||
@@ -150,3 +152,14 @@ void GUIMessageDialog::stopPending() {
|
||||
mBtnAppend->setVisible(false);
|
||||
mPending = false;
|
||||
}
|
||||
|
||||
void GUIMessageDialog::moveDialog(const QPoint& aPos)
|
||||
{
|
||||
mUI->innerWidget->move(aPos);
|
||||
}
|
||||
|
||||
QPoint GUIMessageDialog::getDialogPos()
|
||||
{
|
||||
return mUI->innerWidget->pos();
|
||||
}
|
||||
;
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
return mPending;
|
||||
}
|
||||
void setOpacity(double);
|
||||
void moveDialog(const QPoint& aPos);
|
||||
QPoint getDialogPos();
|
||||
protected:
|
||||
void timerEvent(QTimerEvent* event) override ;
|
||||
private:
|
||||
|
||||
@@ -19,21 +19,15 @@
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>680</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>380</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>680</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>380</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="innerWidget" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>680</x>
|
||||
<y>380</y>
|
||||
<width>560</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="btnContainerWidget" native="true">
|
||||
@@ -101,8 +95,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -39,7 +39,7 @@ void MultyMessageDialog::initializeAnimation()
|
||||
{
|
||||
mDisappearAnimation->setDuration(100);
|
||||
|
||||
mShowAnimation->setDuration(100);
|
||||
mShowAnimation->setDuration(150);
|
||||
|
||||
connect(mDisappearAnimation, &QPropertyAnimation::finished, this, &MultyMessageDialog::hideDialog);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ ADD_EVENT_VALUE(PromptDialogOpen)\
|
||||
ADD_EVENT_VALUE(GlobalBannerMessage)\
|
||||
ADD_EVENT_VALUE(ReloadLanguage)\
|
||||
ADD_EVENT_VALUE(WarnStateFlagChange)\
|
||||
ADD_EVENT_VALUE(GUIErrorRaise)
|
||||
ADD_EVENT_VALUE(GUIErrorRaise)\
|
||||
ADD_EVENT_VALUE(DeviceInfoRaise)
|
||||
|
||||
enum GUIEvents {
|
||||
#define ADD_EVENT_VALUE(val) val,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "dialogs/AlertDialog.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "components/VerticalTextToolButton.h"
|
||||
|
||||
@@ -113,18 +112,8 @@ void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
|
||||
|
||||
void SelectFormWidget::editPatient() {
|
||||
bool addFlag = sender() == mBtnAdd;
|
||||
EditPatientDialog dialog(this);
|
||||
if (addFlag){
|
||||
dialog.clearPatientInformation();
|
||||
}
|
||||
else{
|
||||
dialog.setPatientInformation(patientDetailForm->getPatientInformation());
|
||||
}
|
||||
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setModel(mModel);
|
||||
// accept change
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
if (DialogManager::Default()->requestEditPatientInfo(addFlag ? nullptr:patientDetailForm->getPatientInformation(),mModel) == QDialog::Accepted) {
|
||||
if (addFlag){
|
||||
mPatTable->selectRow(0);
|
||||
mModel->selectRow(0);
|
||||
@@ -140,23 +129,15 @@ void SelectFormWidget::editPatient() {
|
||||
|
||||
void SelectFormWidget::delPatient() {
|
||||
if (mPatTable->currentIndex().row() < 0) return;
|
||||
AlertDialog dialog(this);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString();
|
||||
// patient has been selected as the scan patient!
|
||||
if (selectedPatientUID == pUid){
|
||||
dialog.setButtonMode(OkOnly);
|
||||
dialog.setTitle(tr("Alert"));
|
||||
dialog.setAlertMessage(QString(tr("Can't delete selected Patient !")));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient !"),DialogButtonMode::OkOnly,tr("Alert"));
|
||||
return;
|
||||
}
|
||||
// not the selected one, confirm!
|
||||
dialog.setButtonMode(OkAndCancel);
|
||||
dialog.setTitle("Confirm");
|
||||
QString pat_name = mModel->index(mPatTable->currentIndex().row(), Name).data().toString();
|
||||
dialog.setAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name));
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
if (DialogManager::Default()->requestAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name),DialogButtonMode::OkAndCancel,tr("Confirm")) != QDialog::Accepted) return;
|
||||
// need delete clear edit panel detail
|
||||
patientDetailForm->clearPatientInformation();
|
||||
mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9);
|
||||
@@ -171,10 +152,7 @@ void SelectFormWidget::delPatient() {
|
||||
}
|
||||
} else {
|
||||
//TODO:error handle
|
||||
dialog.setButtonMode(OkOnly);
|
||||
dialog.setTitle(tr("Alert"));
|
||||
dialog.setAlertMessage(QString(tr("Can't delete selected Patient , db submit error!")));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient , db submit error!"),DialogButtonMode::OkOnly,tr("Alert"));
|
||||
}
|
||||
prepareButtons(false);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <QSqlRecord>
|
||||
|
||||
#include "components/AccountRoleComboDelegate.h"
|
||||
#include "dialogs/AlertDialog.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "db/SQLHelper.h"
|
||||
#include "models/User.h"
|
||||
@@ -127,18 +126,11 @@ AccountTableForm::AccountTableForm(QWidget* aParent)
|
||||
if (User::Current()->getUserID() == id)
|
||||
{
|
||||
//尝试删除自己
|
||||
AlertDialog dialog(this);
|
||||
dialog.setButtonMode(OkOnly);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.setAlertMessage(tr("Can't delete current log in account!"));
|
||||
dialog.exec();
|
||||
DialogManager::Default()->requestAlertMessage(tr("Can't delete current log in account!"), DialogButtonMode::OkOnly);
|
||||
return;
|
||||
}
|
||||
AlertDialog dialog(this);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
|
||||
dialog.setAlertMessage(QString(tr("Delete account with ID:\"%1\"!")).arg(id));
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
if ( DialogManager::Default()->requestAlertMessage(QString(tr("Delete account with ID:\"%1\"!")).arg(id), DialogButtonMode::OkAndCancel) != QDialog::Accepted) return;
|
||||
model->removeRow(mCurrentRow);
|
||||
model->select();
|
||||
table->selectRow(model->rowCount() > mCurrentRow + 1 ? mCurrentRow : mCurrentRow - 1);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "dialogs/SelectDialog.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "utilities/Locker.h"
|
||||
#include "utilities/LanguageSwitcher.h"
|
||||
#include "components/ULineEdit.h"
|
||||
@@ -19,11 +19,10 @@
|
||||
GeneralForm::GeneralForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
, mLayout(new QVBoxLayout(this))
|
||||
, mSelectDialog(new SelectDialog(this))
|
||||
{
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
QWidget* lanHeader = new QWidget(this);
|
||||
mLayout->addWidget(lanHeader);
|
||||
mSelectDialog->setWindowModality(Qt::WindowModal);
|
||||
|
||||
QHBoxLayout* lanHeaderLayout = new QHBoxLayout(lanHeader);
|
||||
QLabel* languageLabel = new QLabel(tr("Language"));
|
||||
@@ -94,11 +93,10 @@ GeneralForm::GeneralForm(QWidget* aParent)
|
||||
|
||||
connect(btnLan, &QPushButton::clicked, [=]()
|
||||
{
|
||||
mSelectDialog->setValues(JsonObject::Instance()->language());
|
||||
mSelectDialog->setSelectedValue(JsonObject::Instance()->defaultLanguage());
|
||||
if (mSelectDialog->exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestSelectLanguage();
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
QString language = mSelectDialog->getSelectedValue();
|
||||
QString language = result.ResultData.toString();
|
||||
|
||||
//take effect
|
||||
JsonObject::Instance()->setDefaultLanguage(language);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QWidget>
|
||||
|
||||
class QVBoxLayout;
|
||||
class SelectDialog;
|
||||
|
||||
class GeneralForm : public QWidget
|
||||
{
|
||||
@@ -15,7 +14,6 @@ public:
|
||||
|
||||
private:
|
||||
QVBoxLayout* mLayout;
|
||||
SelectDialog* mSelectDialog;
|
||||
};
|
||||
|
||||
#endif // GENERALFORM_H
|
||||
@@ -5,10 +5,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QGridLayout>
|
||||
|
||||
#include "dialogs/SelectDialog.h"
|
||||
#include "network/NetworkCfgDialog.h"
|
||||
#include "network/DicomCfgDialog.h"
|
||||
#include "network/GetAdminPsw.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "device/DeviceManager.h"
|
||||
@@ -18,8 +15,6 @@
|
||||
SystemSettingForm::SystemSettingForm(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, mUI(new Ui::SystemSettingForm)
|
||||
, mProtocalSelectDialog(new SelectDialog(this))
|
||||
, mFilterSelectDialog(new SelectDialog(this))
|
||||
, mDiskInfoCaller(nullptr)
|
||||
, mDiskSize(0)
|
||||
, mDiskUsedSize(0)
|
||||
@@ -27,8 +22,6 @@ SystemSettingForm::SystemSettingForm(QWidget* parent)
|
||||
, mDiskUsedSizeFlag(false)
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
mProtocalSelectDialog->setWindowModality(Qt::WindowModal);
|
||||
mFilterSelectDialog->setWindowModality(Qt::WindowModal);
|
||||
|
||||
mUI->lbl_size->setText(tr("Loading..."));
|
||||
mUI->lbl_used->setText(tr("Loading..."));
|
||||
@@ -100,31 +93,25 @@ SystemSettingForm::SystemSettingForm(QWidget* parent)
|
||||
JsonObject::Instance()->setCompleteNotify(scanCompleteButton->getChecked());
|
||||
});
|
||||
connect(mUI->btnNetwork, &QToolButton::clicked, [=]() {
|
||||
GetAdminPsw dialog(this);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
if (DialogManager::Default()->requestInputAdminPasswd() == QDialog::Accepted)
|
||||
{
|
||||
JsonObject::Instance()->setPassword(dialog.getPsw());
|
||||
NetworkCfgDialog dia(this);
|
||||
dia.setWindowModality(Qt::WindowModal);
|
||||
dia.exec();
|
||||
//JsonObject::Instance()->setPassword(dialog.getPsw());
|
||||
DialogManager::Default()->requestEditNetworkConfig();
|
||||
}
|
||||
});
|
||||
|
||||
connect(mUI->btnDICOM, &QToolButton::clicked, [=]() {
|
||||
DicomCfgDialog dia(this);
|
||||
dia.setWindowModality(Qt::WindowModal);
|
||||
dia.exec();
|
||||
DialogManager::Default()->requestEditDicomConfig();
|
||||
});
|
||||
|
||||
|
||||
|
||||
connect(mUI->btnPro, &QPushButton::clicked, [=]()
|
||||
{
|
||||
mProtocalSelectDialog->setValues(JsonObject::Instance()->protocals());
|
||||
mProtocalSelectDialog->setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
||||
if (mProtocalSelectDialog->exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestSelectProtocal();
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
QString pro = mProtocalSelectDialog->getSelectedValue();
|
||||
QString pro = result.ResultData.toString();
|
||||
//take effect
|
||||
JsonObject::Instance()->setDefaultProtocal(pro);
|
||||
mUI->btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
||||
@@ -133,11 +120,10 @@ SystemSettingForm::SystemSettingForm(QWidget* parent)
|
||||
|
||||
connect(mUI->btnFlt, &QPushButton::clicked, [=]()
|
||||
{
|
||||
mFilterSelectDialog->setValues(JsonObject::Instance()->worklistFilters());
|
||||
mFilterSelectDialog->setSelectedValue(JsonObject::Instance()->defaultFilter());
|
||||
if (mFilterSelectDialog->exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestSelectFilter();
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
QString flt = mFilterSelectDialog->getSelectedValue();
|
||||
QString flt = result.ResultData.toString();
|
||||
//take effect
|
||||
JsonObject::Instance()->setDefaultFilter(flt);
|
||||
mUI->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class SelectDialog;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SystemSettingForm;
|
||||
@@ -23,9 +21,6 @@ private:
|
||||
void updateStorageUsed();
|
||||
|
||||
Ui::SystemSettingForm* mUI;
|
||||
|
||||
SelectDialog* mProtocalSelectDialog;
|
||||
SelectDialog* mFilterSelectDialog;
|
||||
QThread* mDiskInfoCaller;
|
||||
|
||||
double mDiskSize;
|
||||
|
||||
@@ -127,6 +127,16 @@ void HandWriteWidget::mousePressEvent(QMouseEvent* aEvent)
|
||||
void HandWriteWidget::mouseMoveEvent(QMouseEvent* aEvent)
|
||||
{
|
||||
QPoint pos = aEvent->pos();
|
||||
if (pos.x() > HANDWRITEAREA_SIZE.width() || pos.y() > HANDWRITEAREA_SIZE.height())
|
||||
{
|
||||
if (!mVectorPoints.empty())
|
||||
{
|
||||
mVectorPointsList.push_back(mVectorPoints);
|
||||
mVectorPoints.clear();
|
||||
mTimer->start();
|
||||
}
|
||||
return QWidget::mouseMoveEvent(aEvent);;
|
||||
}
|
||||
mPainter->drawLine(mLastPosition, pos);
|
||||
mVectorPoints.push_back(pos);
|
||||
mLastPosition = pos;
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
#include "ui_NetworkCfgDialog.h"
|
||||
#include "device/networkmanager.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "NetCfgTableModel.h"
|
||||
#include "GetIPDialog.h"
|
||||
#include "GetRouteDialog.h"
|
||||
#include "src/dialogs/GUIMessageDialog.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -24,14 +22,12 @@ NetworkCfgDialog::NetworkCfgDialog(QWidget* parent)
|
||||
, mUi(new Ui::NetworkCfgDialog)
|
||||
, mModelAddress(new NetCfgTableModel(this))
|
||||
, mModelRoute(new NetCfgTableModel(this))
|
||||
, mMessageDialog(new GUIMessageDialog(this))
|
||||
|
||||
{
|
||||
mUi->setupUi(this);
|
||||
this->setObjectName("formDialog");
|
||||
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
|
||||
mMessageDialog->hide();
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
mUi->sw_dhcp->setChecked(true);
|
||||
//ui->sw_dhcp->setButtonStyle(ImageSwitch::ButtonStyle_1);
|
||||
@@ -74,11 +70,10 @@ NetworkCfgDialog::NetworkCfgDialog(QWidget* parent)
|
||||
|
||||
connect(mUi->btn_addr_add, &QPushButton::clicked, [=]()
|
||||
{
|
||||
//GetIPDialog* dialog = new GetIPDialog(this);
|
||||
GetIPDialog dialog(this);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestEditIpAndNetMask();
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
mModelAddress->addRow(dialog.getList());
|
||||
mModelAddress->addRow(result.ResultData.toStringList());
|
||||
//ui->tbl_addr->selectRow(0);
|
||||
}
|
||||
});
|
||||
@@ -92,14 +87,11 @@ NetworkCfgDialog::NetworkCfgDialog(QWidget* parent)
|
||||
if (!index.empty())
|
||||
{
|
||||
const QStringList ipdata = mModelAddress->rowData(index.at(0));
|
||||
|
||||
//GetIPDialog* dialog = new GetIPDialog(this);
|
||||
GetIPDialog dialog(this);
|
||||
dialog.setList(ipdata);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestEditIpAndNetMask(ipdata);
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
mModelAddress->removeRow(index.at(0).row());
|
||||
mModelAddress->insertRow(index.at(0).row(), dialog.getList());
|
||||
mModelAddress->insertRow(index.at(0).row(), result.ResultData.toStringList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,17 +114,15 @@ NetworkCfgDialog::NetworkCfgDialog(QWidget* parent)
|
||||
|
||||
connect(mUi->btn_route_add, &QPushButton::clicked, [=]()
|
||||
{
|
||||
//GetRouteDialog* dialog = new GetRouteDialog(this);
|
||||
GetRouteDialog dialog(this);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestEditRouteInfo();
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
mModelRoute->addRow(dialog.getList());
|
||||
mModelRoute->addRow(result.ResultData.toStringList());
|
||||
}
|
||||
|
||||
});
|
||||
connect(mUi->btn_route_edit, &QPushButton::clicked, [=]()
|
||||
{
|
||||
|
||||
QItemSelectionModel* select = mUi->tbl_route->selectionModel();
|
||||
if (select->hasSelection())
|
||||
{
|
||||
@@ -141,14 +131,11 @@ NetworkCfgDialog::NetworkCfgDialog(QWidget* parent)
|
||||
{
|
||||
const QStringList ipdata = mModelRoute->rowData(index.at(0));
|
||||
|
||||
//GetRouteDialog* dialog = new GetRouteDialog(this);
|
||||
GetRouteDialog dialog(this);
|
||||
dialog.setList(ipdata);
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
DialogResult result = DialogManager::Default()->requestEditRouteInfo(ipdata);;
|
||||
if (result.ResultCode == QDialog::Accepted)
|
||||
{
|
||||
mModelRoute->removeRow(index.at(0).row());
|
||||
mModelRoute->insertRow(index.at(0).row(), dialog.getList());
|
||||
|
||||
mModelRoute->insertRow(index.at(0).row(), result.ResultData.toStringList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -273,12 +260,11 @@ bool NetworkCfgDialog::isNetModified()
|
||||
|
||||
void NetworkCfgDialog::handleThreadStart()
|
||||
{
|
||||
mMessageDialog->showMessage("Saving Network Configuration...");
|
||||
mMessageDialog->show();
|
||||
DialogManager::Default()->raiseSyncDialog("Saving Network Configuration...");
|
||||
}
|
||||
void NetworkCfgDialog::handleThreadExit()
|
||||
{
|
||||
mMessageDialog->hide();
|
||||
DialogManager::Default()->hideTopSyncDialog();
|
||||
mUi->output->setPlainText(mError);
|
||||
if (0 != mThread)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Ui
|
||||
}
|
||||
|
||||
class NetCfgTableModel;
|
||||
class GUIMessageDialog;
|
||||
class QThread;
|
||||
|
||||
class NetworkCfgDialog : public QDialog
|
||||
@@ -38,7 +37,6 @@ private:
|
||||
Ui::NetworkCfgDialog* mUi;
|
||||
NetCfgTableModel* mModelAddress = nullptr;
|
||||
NetCfgTableModel* mModelRoute = nullptr;
|
||||
GUIMessageDialog* mMessageDialog = nullptr;
|
||||
QThread* mThread = nullptr;
|
||||
QString mError;
|
||||
QString mAdminPsw;
|
||||
|
||||
@@ -635,7 +635,7 @@ QWidget#innerWidget {
|
||||
border: 5px solid #0078d8;
|
||||
}
|
||||
|
||||
QDialog#MessageDialog QWidget QWidget {
|
||||
QDialog#MessageDialog QWidget#btnContainerWidget QWidget {
|
||||
background: transparent;
|
||||
color: #3078d8;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "models/User.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "dialogs/GUIMessageDialog.h"
|
||||
#include "components/ULineEdit.h"
|
||||
|
||||
LoginDialog::LoginDialog(QWidget* aParent)
|
||||
@@ -45,25 +44,6 @@ void LoginDialog::initializeAllWidget()
|
||||
initializeEdit();
|
||||
initializeLoginButton();
|
||||
initializeErrorMessage();
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::DeviceErrorRaise, [=](QObject* parent, QObject* msg) {
|
||||
if (!this->isVisible()) return;
|
||||
//默认旧模式
|
||||
GUIMessageDialog msgDialog(this);
|
||||
msgDialog.setOpacity(1.0);
|
||||
if (msg)
|
||||
{
|
||||
QString* str = (QString*)msg;
|
||||
msgDialog.showMessage(*str);
|
||||
}
|
||||
else
|
||||
{
|
||||
msgDialog.showMessage("Something went error!");
|
||||
}
|
||||
msgDialog.stopLoading();
|
||||
msgDialog.showExitButton();
|
||||
msgDialog.exec();
|
||||
});
|
||||
}
|
||||
|
||||
void LoginDialog::initializeLayout()
|
||||
@@ -94,10 +74,12 @@ void LoginDialog::initializeEdit()
|
||||
{
|
||||
mAccountEdit->setObjectName("combobox_UserName");
|
||||
mAccountEdit->setPlaceholderText(tr("Username"));
|
||||
mAccountEdit->setFocusPolicy(Qt::ClickFocus);
|
||||
mDialogContentsLayout->addWidget(mAccountEdit);
|
||||
mPasswordEdit->setObjectName("edt_Password");
|
||||
mPasswordEdit->setEchoMode(QLineEdit::Password);
|
||||
mPasswordEdit->setPlaceholderText(tr("Password"));
|
||||
mPasswordEdit->setFocusPolicy(Qt::ClickFocus);
|
||||
mDialogContentsLayout->addWidget(mPasswordEdit);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "forms/scan/ScanFormWidget.h"
|
||||
#include "forms/settings/SettingFormWidget.h"
|
||||
#include "forms/TopBarWidget.h"
|
||||
#include "dialogs/GUIMessageDialog.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "device/DeviceManager.h"
|
||||
#include "errorhandle/GUIErrorHandle.h"
|
||||
@@ -27,7 +26,6 @@ MainWindow::MainWindow(QWidget* aParent)
|
||||
: QMainWindow(aParent)
|
||||
, mUI(new Ui::MainWindow)
|
||||
, mDebugConsoleWidget(nullptr)
|
||||
, mMessageDialog(nullptr)
|
||||
, mDebugMessageConsole(nullptr)
|
||||
, mTabWidget(new QTabWidget(this))
|
||||
, mAdminTabIndex(-1)
|
||||
@@ -45,6 +43,7 @@ MainWindow::MainWindow(QWidget* aParent)
|
||||
connect(EventCenter::Default(), &EventCenter::RequestLogin, this,&MainWindow::requestLogin);
|
||||
connect(EventCenter::Default(), &EventCenter::LoginRoleChanged, this,&MainWindow::resetRoleLayout);
|
||||
connect(DeviceManager::Default(), &DeviceManager::raiseGlobalError, this, &MainWindow::triggerError);
|
||||
connect(DeviceManager::Default(), &DeviceManager::raiseGlobalInfo, this, &MainWindow::triggerInfo);
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this, &MainWindow::reloadLanguage);
|
||||
GUIErrorHandle::Default()->init();
|
||||
mThread = QThread::create([]() {
|
||||
@@ -138,6 +137,12 @@ void MainWindow::triggerError(const QString& aMessage)
|
||||
EventCenter::Default()->triggerEvent(GUIErrorRaise, nullptr, (QObject*)&message);
|
||||
}
|
||||
|
||||
void MainWindow::triggerInfo(const QPair<QString, unsigned int>& aInfoData)
|
||||
{
|
||||
QPair<QString, unsigned int> infoData = aInfoData;
|
||||
EventCenter::Default()->triggerEvent(DeviceInfoRaise, nullptr, (QObject*)&infoData);
|
||||
}
|
||||
|
||||
//------events-----------------------------------------------------------------
|
||||
|
||||
//! [event handler]
|
||||
@@ -267,7 +272,7 @@ void MainWindow::swipeTriggered(QSwipeGesture* aSwipeGesture)
|
||||
|
||||
void MainWindow::requestLogin()
|
||||
{
|
||||
DialogManager::Default()->requestLogin();
|
||||
DialogManager::Default()->requestLogin(this);
|
||||
QApplication::setActiveWindow(centralWidget());
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void triggerError(const QString&);
|
||||
void triggerInfo(const QPair<QString,unsigned int>&);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent* aEvent) override;
|
||||
@@ -55,7 +56,6 @@ private:
|
||||
private:
|
||||
Ui::MainWindow* mUI;
|
||||
QDockWidget* mDebugConsoleWidget;
|
||||
GUIMessageDialog* mMessageDialog;
|
||||
QTextEdit* mDebugMessageConsole;
|
||||
QTabWidget* mTabWidget;
|
||||
int mAdminTabIndex;
|
||||
|
||||
Reference in New Issue
Block a user