106 lines
3.6 KiB
C++
106 lines
3.6 KiB
C++
#include "login.h"
|
|
#include "ui_login.h"
|
|
#include "deviceproxy.h"
|
|
#include "deviceinfo.h"
|
|
//#include "qc_applicationwindow.h"
|
|
#include <QKeyEvent>
|
|
|
|
LogIn::LogIn(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::LogIn)
|
|
{
|
|
ui->setupUi(this);
|
|
Init();
|
|
}
|
|
|
|
LogIn::~LogIn()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void LogIn::keyPressEvent(QKeyEvent * event)
|
|
{
|
|
if(event->modifiers() == Qt::ControlModifier) { // 如果按下了CTRL键
|
|
if(event->key() == Qt::Key_M)
|
|
{
|
|
this->close();
|
|
emit DEV->MsgLogInSuccess(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
void LogIn::Init()
|
|
{
|
|
this->setWindowTitle("机台软件用户登录");
|
|
ui->Password->setEchoMode(QLineEdit::Password);
|
|
// ui->Logo->setPixmap(QPixmap(":/Image/WI.jpg"));
|
|
// ui->Frame->setPixmap(QPixmap(":/Image/WIF.jpg"));
|
|
// ui->Password->setEchoMode(QLineEdit::Password); //隐藏密码
|
|
}
|
|
|
|
|
|
|
|
void LogIn::on_LogInUser_clicked()
|
|
{
|
|
|
|
if(ui->cmbType->currentText() == "用户" && ui->Password->text() == "xhyq")
|
|
{
|
|
DEVICE_INFO->printDeviceSystemInfo("登录用户!");
|
|
this->close();
|
|
// QC_ApplicationWindow::getAppWindow()->menuBar()->findChild<QMenu*>("dockwidgets_menu")->setEnabled(false);
|
|
// QC_ApplicationWindow::getAppWindow()->deviceStateInfoDCWidget->show();
|
|
// QC_ApplicationWindow::getAppWindow()->deviceControlPanelDCWidget->show();
|
|
// //QC_ApplicationWindow::getAppWindow()->devicectluserDCWidget->show();
|
|
// //QC_ApplicationWindow::getAppWindow()->devicestateuserDCWidget->show();
|
|
// QC_ApplicationWindow::getAppWindow()->deviceAlarmDCWidget->hide();
|
|
// QC_ApplicationWindow::getAppWindow()->dmPlot->hide();
|
|
// QC_ApplicationWindow::getAppWindow()->cameraDCWidget->hide();
|
|
// QC_ApplicationWindow::getAppWindow()->deviceSetDCWidget->hide();
|
|
// QC_ApplicationWindow::getAppWindow()->deviceSystemInfoDCWidget->show();
|
|
emit DEV->MsgLogInSuccess(false);
|
|
}
|
|
else if(ui->cmbType->currentText() == "厂家" && ui->Password->text() == "westlake")
|
|
{
|
|
DEVICE_INFO->printDeviceSystemInfo("登录厂家!");
|
|
this->close();
|
|
// QC_ApplicationWindow::getAppWindow()->menuBar()->findChild<QMenu*>("dockwidgets_menu")->setEnabled(true);
|
|
//// QC_ApplicationWindow::getAppWindow()->deviceStateInfoDCWidget->show();
|
|
//// QC_ApplicationWindow::getAppWindow()->deviceControlPanelDCWidget->show();
|
|
//// QC_ApplicationWindow::getAppWindow()->devicectluserDCWidget->hide();
|
|
//// QC_ApplicationWindow::getAppWindow()->devicestateuserDCWidget->hide();
|
|
//// QC_ApplicationWindow::getAppWindow()->deviceAlarmDCWidget->hide();
|
|
//// QC_ApplicationWindow::getAppWindow()->dmPlot->hide();
|
|
//// QC_ApplicationWindow::getAppWindow()->cameraDCWidget->hide();
|
|
//// QC_ApplicationWindow::getAppWindow()->deviceSetDCWidget->show();
|
|
//// QC_ApplicationWindow::getAppWindow()->deviceSystemInfoDCWidget->hide();
|
|
emit DEV->MsgLogInSuccess(true);
|
|
}
|
|
else
|
|
{
|
|
QMessageBox::information(this, "提示", "密码错误!操作类型与密码不匹配");
|
|
}
|
|
//QC_ApplicationWindow::getAppWindow()->menuWidget()->setEnabled(false);
|
|
|
|
}
|
|
|
|
//void LogIn::on_DisplayPassword_clicked()
|
|
//{
|
|
// if(ui->DisplayPassword->isChecked())
|
|
// {
|
|
// ui->Password->setEchoMode(QLineEdit::Normal);
|
|
// }
|
|
// else
|
|
// {
|
|
// ui->Password->setEchoMode(QLineEdit::Password);
|
|
// }
|
|
//}
|
|
|
|
//void LogIn::on_RegisterUser_clicked()
|
|
//{
|
|
// QMessageBox::information(this, "提示", "此功能暂未开启");
|
|
//// Register* R = new Register();
|
|
//// R->show();
|
|
//}
|
|
|
|
|