source: comparacioncriptosistemas/interfaz/Criptosistema_Interfaz/sistema.cpp @ c7b52e9

interfaz
Last change on this file since c7b52e9 was c7b52e9, checked in by lhernandez <lhernandez@…>, 8 years ago

Se realizo el prototipo no funcional adaptado a la aplicacion de escritorio, preparada para enlazar a las funcionalidades de los criptosistemas

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#include "sistema.h"
2#include "ui_sistema.h"
3#include <QDebug>
4#include "QMessageBox"
5
6Sistema::Sistema(QWidget *parent) :
7    QMainWindow(parent),
8    ui(new Ui::Sistema)
9{
10    ui->setupUi(this);
11    setWindowTitle("**** Criptosistema ****");
12
13    setWindowFlags(Qt::Window|Qt::MSWindowsFixedSizeDialogHint|Qt::WindowMinimizeButtonHint);
14    //this->ui->pass->placeholderText();
15
16    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(Autenticate()));
17
18}
19
20Sistema::~Sistema()
21{
22    delete ui;
23}
24
25void Sistema::Autenticate()
26{
27
28    QString user = ui->user->text();
29    QString pass = ui->pass->text();
30
31    qDebug() << user;
32    qDebug() << pass;
33
34    //bool ok = user == "admin" && pass == "123" ? true: false;
35
36    if (user == ""){
37
38        QString style = "QLabel{ color: #DF0101; font-size: 11px; font-style: italic; margin-left: 10px; }";
39        this->ui->label_6->setText("Este campo es obigatorio");
40        ui->label_6->setStyleSheet(style);
41
42        if (pass != "") {
43
44            this->ui->label_7->setText("");
45
46            QString stylee = "QLabel{ background-color: #fffff; }";
47            this->ui->label_8->setText("");
48            ui->label_8->setStyleSheet(stylee);
49        }
50    }
51    if (pass == ""){
52
53        QString style = "QLabel{ color: #DF0101; font-size: 11px; font-style: italic; margin-left: 10px; }";
54        this->ui->label_7->setText("Este campo es obigatorio");
55        ui->label_7->setStyleSheet(style);
56
57        if (user != "") {
58            this->ui->label_6->setText("");
59
60            QString stylee = "QLabel{ background-color: #fffff; }";
61            this->ui->label_8->setText("");
62            ui->label_8->setStyleSheet(stylee);
63        }
64    }
65
66    if (user != "" && pass != ""){
67
68        if (user == "admin" && pass == "123"){
69            Dialog *app = new Dialog;
70            app->show();
71            close();
72        }
73        else{
74
75            QString style = "QLabel{ background-color: #FCDFDF; font-size: 13px; font-style: italic; margin-left: 10px; }";
76            this->ui->label_8->setText("El usuario no es válido");
77            this->ui->label_7->setText("");
78            this->ui->label_6->setText("");
79            ui->label_8->setStyleSheet(style);
80        }
81    }
82}
Note: See TracBrowser for help on using the repository browser.