servicepassinputdlg.cpp 1.11 KB
#include "servicepassinputdlg.h"
#include "ui_servicepassinputdlg.h"
#include "engineermenuwindow.h"
#include <QDebug>

#define PASS_WORD "0000"

ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ServicePassInputDlg)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_NoSystemBackground);
    setAttribute(Qt::WA_TranslucentBackground);
    setAttribute(Qt::WA_DeleteOnClose);
    this->setResult(QDialog::Accepted);
}

ServicePassInputDlg::~ServicePassInputDlg()
{
    delete ui;
}

void ServicePassInputDlg::on_ctrBtnOk_clicked()
{
    if(ui->lineEdit->text() == PASS_WORD){
        qDebug() << this->parentWidget() <<this->parent();
        EngineerMenuWindow *w = new EngineerMenuWindow(this->parentWidget());
        connect(w,SIGNAL(destroyed(QObject*)),this,SLOT(close()));
        w->setWindowModality(Qt::WindowModal);
        w->show();
        this->hide();
    }
    else {
        qDebug()<< "pass incorrect " <<  ui->lineEdit->text();
        reject();
    }
}

void ServicePassInputDlg::on_ctrBtnCancel_clicked()
{
    reject();
}