diff options
Diffstat (limited to 'client/dbconnector.cpp')
-rw-r--r-- | client/dbconnector.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/client/dbconnector.cpp b/client/dbconnector.cpp new file mode 100644 index 0000000..5ed1efc --- /dev/null +++ b/client/dbconnector.cpp @@ -0,0 +1,49 @@ +#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 = "thecrapbox"; + +// QSqlDatabase db = MainWindow.loginDb(adress, username, password); + +// QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); +// return; + dbRef.setHostName(hostname); + dbRef.setUserName(username); + dbRef.setPassword(password); + dbRef.setDatabaseName("thecrapbox"); + + if(dbRef.open()){ + QMessageBox::information(this, "Connection", "GREAT SUCCES!"); + } else { + QMessageBox::warning(this, "No connection", "Failed to connect"); + } +} + + + + |