#include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include #include "tabformwidget.h" #include "SelectFormWidget.h" #include "ScanFormWidget.h" #include "guimessagedialog.h" #include "device/DeviceManager.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { const QString style = "*{background-color:#3c3c3c; font-family:Microsoft YaHei; 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-color: #323232; /* same as the pane color */\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" "QLabel#systemMsgBar{min-width:500px;}\n" "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; }" "QDialog QWidget QWidget{ background:transparent;color:#3078d8}" "QDialog QWidget QWidget QLabel{ font-size:30px}" "QLabel#lbl_progressicon{min-width:75px;max-width:75px;}" "#spacer_1, #spacer_2{min-width:2px;max-width:2px;margin-top:6px;margin-bottom:6px;border-right:1px solid #0078d8;}"//green with 2 ; 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){ if (!msgDialog) msgDialog = new GUIMessageDialog(this); if (msg) { QString* str = (QString*)msg; msgDialog->showMessage(*str); } else { msgDialog->showMessage("Something went error!"); } msgDialog->showExitButton(); msgDialog->stopLoading(); msgDialog->showFullScreen(); }); connect(EventCenter::Default(),&EventCenter::InvokeOperationStart,[=](QObject*,QObject* msg){ if (!msgDialog) msgDialog = new GUIMessageDialog(this); if (msg) { QString* str = (QString*)msg; msgDialog->showMessage(*str); } else{ msgDialog->hideMessage(); } msgDialog->hideExitButton(); msgDialog->startLoading(); msgDialog->showFullScreen(); }); 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(); } msgDialog->hideExitButton(); msgDialog->showFullScreen(); }); connect(EventCenter::Default(),&EventCenter::InvokeOperationEnd,[=](){ if (!msgDialog) return; msgDialog->stopLoading(); msgDialog->hide(); }); DeviceManager::Default()->initDevice(); centerWidgetHide(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::centerWidgetHide() { ui->centralWidget->hide(); } void MainWindow::centerWidgetShow() { ui->centralWidget->show(); }