2021-10-09 16:38:34 +08:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
#include <qtabwidget.h>
|
|
|
|
|
#include <QSizePolicy>
|
|
|
|
|
#include <QHBoxLayout>
|
2021-10-12 17:42:09 +08:00
|
|
|
#include <src/event/EventCenter.h>
|
2021-10-09 16:38:34 +08:00
|
|
|
#include "tabformwidget.h"
|
|
|
|
|
#include "SelectFormWidget.h"
|
|
|
|
|
#include "ScanFormWidget.h"
|
2021-10-13 17:40:21 +08:00
|
|
|
#include "guimessagedialog.h"
|
|
|
|
|
#include "device/DeviceManager.h"
|
2021-10-09 16:38:34 +08:00
|
|
|
|
2021-10-25 15:00:09 +08:00
|
|
|
MainWindow::MainWindow(QWidget* parent) :
|
|
|
|
|
QMainWindow(parent),
|
|
|
|
|
ui(new Ui::MainWindow)
|
2021-10-09 16:38:34 +08:00
|
|
|
{
|
2021-10-25 15:00:09 +08:00
|
|
|
const QString style = "*{background-color:#3c3c3c; color:white;margin:0;font-size:16px;}"
|
|
|
|
|
"QTabBar::tab {\n"
|
|
|
|
|
"height:60px;"
|
|
|
|
|
"width:300px;"
|
|
|
|
|
"font-size: 25px;"
|
|
|
|
|
"background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\"\n"
|
|
|
|
|
"stop: 0 #333333, stop: 1.0 #555555);"
|
|
|
|
|
"border: 2px solid #505050;\n"
|
|
|
|
|
"border-bottom-left-radius: 50%;\n"
|
|
|
|
|
"border-bottom-right-radius: 50%;\n"
|
|
|
|
|
"min-width: 8ex;\n"
|
|
|
|
|
"padding: 2px;\n"
|
|
|
|
|
"}"
|
|
|
|
|
"QTabBar::tab:selected, QTabBar::tab:hover {"
|
|
|
|
|
"border-top:5px solid #4a88c7;\n"
|
|
|
|
|
"background: #505050;}"
|
|
|
|
|
"QTabWidget::pane{margin:0}"
|
|
|
|
|
"QLineEdit{min-height:36px;max-height:36px; border:1px solid silver}"
|
|
|
|
|
"QLineEdit:enabled{background-color: #515151}"
|
|
|
|
|
"QDateEdit{min-height:36px;max-height:36px; border:1px solid silver}"
|
|
|
|
|
"QDateEdit:enabled{background-color: #515151}"
|
|
|
|
|
"QTextEdit{border:1px solid silver}"
|
|
|
|
|
"QTextEdit:enabled{background-color: #515151}"
|
|
|
|
|
"QComboBox{text-align:center;min-height:36px;max-height:36px; border:1px solid silver}"
|
|
|
|
|
"QComboBox:enabled{background-color: #515151}"
|
|
|
|
|
"QComboBox::drop-down{width:20px}"
|
|
|
|
|
"QComboBox QAbstractItemView{min-width:120px;}"
|
|
|
|
|
"QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;}"
|
|
|
|
|
"QScrollBar:vertical {min-width: 50px;}"
|
|
|
|
|
"QLabel{color:white; font-weight:bold; font-size:16px;}\n"
|
|
|
|
|
"QWidget#topbarWidget{min-height:36px;max-height:36px;}\n"
|
|
|
|
|
"QWidget#contentWidget{border-top:1px solid #515151;}\n"
|
|
|
|
|
"QWidget#commandWidget{min-height:123px;max-height:123px;border-top:1px solid #515151; border-bottom:1px solid #323232;}\n"
|
|
|
|
|
"QLabel#logo{min-width:30px;max-width:30px}\n"
|
|
|
|
|
"QLabel#company{min-width:150px;max-width:150px; }\n"
|
2021-11-12 14:32:22 +08:00
|
|
|
"QLabel#systemMsgBar{min-width:500px;}"
|
|
|
|
|
"QLabel#warn{color:#CCCC00;background:transparent;font-size:20px;}"
|
2021-10-25 15:00:09 +08:00
|
|
|
"QWidget QWidget#statusBarWidget{min-width:300px;}\n"
|
|
|
|
|
"QWidget QToolButton{border:none;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}\n"
|
|
|
|
|
"QToolButton#btn_main{border:2px solid #0078d8;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}\n"
|
|
|
|
|
"QWidget QToolButton:disabled{color:#606060 }\n"
|
|
|
|
|
"QWidget QToolButton:hover{background:#505050;}\n"
|
|
|
|
|
"QWidget QToolButton:checked{border:5px solid darkorange;padding:0px;}"
|
|
|
|
|
"QWidget#editcmdWidget{min-height:83px;max-height:83px;}"
|
|
|
|
|
"QWidget#verSpaceLine{ border-right:1px solid #0078d8;}"
|
|
|
|
|
//蒙版Dialog
|
|
|
|
|
"QDialog QWidget#innerWidget{ background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
|
|
|
|
|
"stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);"
|
|
|
|
|
"border-radius:20px;border:5px solid #0078d8; }"
|
2021-11-11 14:12:00 +08:00
|
|
|
"QDialog#MessageDialog QWidget QWidget{ background:transparent;color:#3078d8}"
|
|
|
|
|
"QDialog#MessageDialog QWidget QWidget QLabel{ font-size:30px}"
|
|
|
|
|
"#spacer_1, #spacer_2{min-width:2px;max-width:2px;margin-top:6px;margin-bottom:6px;border-right:1px solid #0078d8;}"
|
|
|
|
|
//FormDialog
|
|
|
|
|
"QPushButton{border:1px solid silver ;padding-left:50px;padding-right:50px; border-radius:5px; min-height:28px; max-height:28px; background:#4c5052}"
|
|
|
|
|
"QPushButton#btnOK{background:#365880; font-weight:bold}"
|
|
|
|
|
"QDialog#formDialog{border:3px solid silver; border-radius:8px}"
|
|
|
|
|
"QWidget#formWidget QLabel#endline{border-bottom:1px solid silver}"
|
|
|
|
|
"QWidget#formWidget QLabel#title{font-size:30px; }"
|
2021-10-25 15:00:09 +08:00
|
|
|
;
|
|
|
|
|
this->setStyleSheet(style);
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
QTabWidget* tab = new QTabWidget(this);
|
|
|
|
|
tab->setTabPosition(QTabWidget::South);
|
|
|
|
|
tab->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::PatientSelected, [=](QObject* sender, QObject* data) {
|
|
|
|
|
tab->setCurrentIndex(1);
|
|
|
|
|
});
|
|
|
|
|
SelectFormWidget* select_form = new SelectFormWidget(this);
|
|
|
|
|
tab->addTab(select_form, "Select");
|
|
|
|
|
ScanFormWidget* scan_form = new ScanFormWidget(this);
|
|
|
|
|
tab->addTab(scan_form, "Scan");
|
|
|
|
|
TabFormWidget* verify_form = new TabFormWidget(this);
|
|
|
|
|
tab->addTab(verify_form, "Verify");
|
|
|
|
|
tab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
|
QHBoxLayout* layout = new QHBoxLayout();
|
|
|
|
|
layout->setMargin(0);
|
|
|
|
|
layout->addWidget(tab);
|
|
|
|
|
ui->centralWidget->setLayout(layout);
|
|
|
|
|
this->setWindowFlags(Qt::Window);
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::GUIErrorRaise, [=](QObject*, QObject* msg) {
|
2021-11-02 10:31:04 +08:00
|
|
|
|
|
|
|
|
if (!msgDialog){
|
|
|
|
|
msgDialog = new GUIMessageDialog;
|
|
|
|
|
msgDialog->setStyleSheet(style);
|
|
|
|
|
}
|
2021-10-25 15:00:09 +08:00
|
|
|
if (msg)
|
|
|
|
|
{
|
|
|
|
|
QString* str = (QString*)msg;
|
|
|
|
|
msgDialog->showMessage(*str);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
msgDialog->showMessage("Something went error!");
|
|
|
|
|
}
|
|
|
|
|
msgDialog->stopLoading();
|
2021-10-27 16:03:10 +08:00
|
|
|
msgDialog->showExitButton();
|
2021-10-27 10:39:34 +08:00
|
|
|
// msgDialog->showFullScreen();
|
2021-10-27 16:03:10 +08:00
|
|
|
if (msgDialog->isHidden())msgDialog->show();
|
2021-10-25 15:00:09 +08:00
|
|
|
});
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::InvokeOperationStart, [=](QObject*, QObject* msg) {
|
2021-10-27 16:03:10 +08:00
|
|
|
if (msgDialog){
|
|
|
|
|
msgDialog->hide();
|
|
|
|
|
delete msgDialog;
|
|
|
|
|
}
|
|
|
|
|
msgDialog = new GUIMessageDialog(this);
|
2021-10-25 15:00:09 +08:00
|
|
|
if (msg)
|
|
|
|
|
{
|
|
|
|
|
QString* str = (QString*)msg;
|
|
|
|
|
msgDialog->showMessage(*str);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
msgDialog->hideMessage();
|
|
|
|
|
}
|
|
|
|
|
msgDialog->hideExitButton();
|
|
|
|
|
msgDialog->startLoading();
|
2021-10-27 10:39:34 +08:00
|
|
|
// msgDialog->showFullScreen();
|
2021-10-27 16:03:10 +08:00
|
|
|
if (msgDialog->isHidden())msgDialog->show();
|
2021-10-25 15:00:09 +08:00
|
|
|
});
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress, [=](QObject*, QObject* msg) {
|
|
|
|
|
if (!msgDialog) msgDialog = new GUIMessageDialog(this);
|
|
|
|
|
if (msg)
|
|
|
|
|
{
|
|
|
|
|
QVariant* var = (QVariant*)msg;
|
|
|
|
|
msgDialog->showMessage(QString("Scanning %1%").arg((int)(var->toFloat() * 100.0f)));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
msgDialog->hideMessage();
|
|
|
|
|
}
|
2021-10-27 10:39:34 +08:00
|
|
|
// msgDialog->showFullScreen();
|
2021-10-27 16:03:10 +08:00
|
|
|
if (msgDialog->isHidden())msgDialog->show();
|
2021-10-25 15:00:09 +08:00
|
|
|
});
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd, [=]() {
|
|
|
|
|
if (!msgDialog) return;
|
2021-10-27 16:03:10 +08:00
|
|
|
if (!msgDialog->isHidden())msgDialog->accept();
|
|
|
|
|
delete msgDialog;
|
|
|
|
|
msgDialog = nullptr;
|
2021-10-25 15:00:09 +08:00
|
|
|
});
|
|
|
|
|
DeviceManager::Default()->initDevice();
|
|
|
|
|
centerWidgetHide();
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
2021-10-25 15:00:09 +08:00
|
|
|
delete ui;
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
2021-10-21 14:18:26 +08:00
|
|
|
|
|
|
|
|
void MainWindow::centerWidgetHide() {
|
2021-10-25 15:00:09 +08:00
|
|
|
ui->centralWidget->hide();
|
2021-10-21 14:18:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::centerWidgetShow() {
|
2021-10-25 15:00:09 +08:00
|
|
|
ui->centralWidget->show();
|
2021-10-21 14:18:26 +08:00
|
|
|
}
|