-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
78 lines (77 loc) · 1.92 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* @file mainwindow.cpp
* @brief Authorization window source
* @author mnxoid
*
* Copyright 2014 by mnxoid,
*
* This software is the confidential and proprietary information
* of mnxoid ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with mnxoid.
**/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "auth.h"
#include "windowmanager.h"
#include <QMessageBox>
#include "keyenterreceiver.h"
keyEnterReceiver *key; //!< Enter key receiver (extracted for the sake of memory management)
/**
* @brief Window Manager instance
* @see main.cpp
**/
extern WindowManager WMgr;
/**
* @brief MainWindow constructor
* @param [in] parent - Window parent
**/
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
key = new keyEnterReceiver();
connect(key, SIGNAL(enterPressed()), this, SLOT(on_pushButton_clicked()));
this->installEventFilter(key);
}
/**
* @brief MainWindow destructor
**/
MainWindow::~MainWindow()
{
delete key;
delete ui;
}
/**
* @brief Exit button click handler
**/
void MainWindow::on_pushButton_2_clicked()
{
//Exit button
QApplication::quit();
}
/**
* @brief Login button click handler
**/
void MainWindow::on_pushButton_clicked()
{
//Login button
Access a = Check(ui->lineEdit->text(),ui->lineEdit_2->text());
if (a == ADMIN) {
WMgr.ad->show();
WMgr.mw->hide();
} else if(a == EXUSER) {
WMgr.xu->show();
WMgr.mw->hide();
} else if(a == USER) {
WMgr.us->show();
WMgr.mw->hide();
} else {
QMessageBox* msg = new QMessageBox(this);
msg->setText("Sorry, wrong login or password");
msg->setWindowTitle("Authentication error");
msg->show();
}
}