aboutsummaryrefslogtreecommitdiff
path: root/client/dbconnector.cpp
blob: e9258519230829652f4cdf94e4839fdf0fce9b15 (plain)
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
#include "dbconnector.h"
#include "ui_dbconnector.h"
#include "main.h"

//#include "mainwindow.h"

dbConnector::dbConnector(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::dbConnector)
{
    ui->setupUi(this);
}

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

void dbConnector::on_pushButton_cancel_clicked()
{
    dbConnector::~dbConnector();
}

void dbConnector::on_pushButton_login_clicked()
{
    QString hostname = ui->lineEdit_adress->text();
    QString username = ui->lineEdit_username->text();
    QString password = ui->lineEdit_password->text();
    QString databaseName = ui->lineEdit_database->text();

    dbRef.setHostName(hostname);
    dbRef.setUserName(username);
    dbRef.setPassword(password);
    dbRef.setDatabaseName(databaseName);

    if(dbRef.open()){
        QMessageBox::information(this, "Connection", "GREAT SUCCES!");
        dbConnector::~dbConnector();
    } else {
        QMessageBox::warning(this, "No connection", "Failed to connect");
    }
}