Update
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
#include "LoginFrameController.hpp"
|
#include "LoginFrameController.hpp"
|
||||||
|
|
||||||
LoginFrameController::LoginFrameController(std::string id, std::string password)
|
LoginFrameController::LoginFrameController()
|
||||||
:id_m(id), passwort_m(password)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoginFrameController::tryLogin(std::string id, std::string password){
|
||||||
//DatabaseHandler dbHandler = new Databasehandler();
|
//DatabaseHandler dbHandler = new Databasehandler();
|
||||||
//dbHandler.CheckValidLogin();
|
//dbHandler.CheckValidLogin();
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
class LoginFrameController{
|
class LoginFrameController{
|
||||||
private:
|
private:
|
||||||
std::string id_m;
|
|
||||||
std::string passwort_m;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LoginFrameController(std::string id, std::string password);
|
LoginFrameController();
|
||||||
|
bool tryLogin(std::string id, std::string password);
|
||||||
};
|
};
|
||||||
@@ -30,29 +30,33 @@ LoginFrame::LoginFrame(QWidget* parent)
|
|||||||
header_m->show();
|
header_m->show();
|
||||||
|
|
||||||
|
|
||||||
id_m = new QLineEdit("ID...", this);
|
id_m = new QLineEdit( this);
|
||||||
|
id_m->setPlaceholderText("ID...");
|
||||||
id_m->setObjectName("ID");
|
id_m->setObjectName("ID");
|
||||||
id_m->setStyleSheet(R"(
|
id_m->setStyleSheet(R"(
|
||||||
#ID{
|
#ID{
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border: none;
|
|
||||||
background-color: #444444;
|
background-color: #444444;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 5px;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
id_m->show();
|
id_m->show();
|
||||||
|
|
||||||
|
|
||||||
password_m = new QLineEdit("Passwort...",this);
|
password_m = new QLineEdit(this);
|
||||||
|
password_m->setPlaceholderText("Passwort...");
|
||||||
password_m->setObjectName("Password");
|
password_m->setObjectName("Password");
|
||||||
password_m->setStyleSheet(R"(
|
password_m->setStyleSheet(R"(
|
||||||
#Password{
|
#Password{
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border: none;
|
|
||||||
background-color: #444444;
|
background-color: #444444;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 5px;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
password_m->show();
|
password_m->show();
|
||||||
@@ -65,6 +69,10 @@ LoginFrame::LoginFrame(QWidget* parent)
|
|||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: #00C800;
|
background-color: #00C800;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
#loginButton:pressed {
|
||||||
|
background-color: #00A800;
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
loginButton_m->show();
|
loginButton_m->show();
|
||||||
@@ -73,6 +81,8 @@ LoginFrame::LoginFrame(QWidget* parent)
|
|||||||
//create layout
|
//create layout
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
|
|
||||||
|
layout->setContentsMargins(50, 20, 50, 20);
|
||||||
|
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
layout->addWidget(header_m);
|
layout->addWidget(header_m);
|
||||||
header_m->setAlignment(Qt::AlignHCenter);
|
header_m->setAlignment(Qt::AlignHCenter);
|
||||||
@@ -88,4 +98,23 @@ LoginFrame::LoginFrame(QWidget* parent)
|
|||||||
|
|
||||||
//add Layout to LoginFrame
|
//add Layout to LoginFrame
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
//connect loginButton with function
|
||||||
|
connect(loginButton_m, &QPushButton::clicked, this, &LoginFrame::loginButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
//try Login if Button clicked
|
||||||
|
void LoginFrame::loginButtonClicked(){
|
||||||
|
QString id = id_m->text();
|
||||||
|
QString password = password_m->text();
|
||||||
|
|
||||||
|
//check if Contents Valid
|
||||||
|
if (id.isEmpty() || password.isEmpty()){
|
||||||
|
QMessageBox::warning(this, "Fehler", "Bitte füllen Sie sowohl die ID als auch das Passwort aus.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LoginFrameController* controller = new LoginFrameController();
|
||||||
|
bool valid = controller->tryLogin(id.toStdString(), password.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,15 +5,19 @@
|
|||||||
# include <QInputDialog>
|
# include <QInputDialog>
|
||||||
# include <QLabel>
|
# include <QLabel>
|
||||||
# include <QVBoxLayout>
|
# include <QVBoxLayout>
|
||||||
|
# include <QMessageBox>
|
||||||
|
# include "../../Controller/LoginFrameController/LoginFrameController.hpp"
|
||||||
|
|
||||||
class LoginFrame : public QFrame{
|
class LoginFrame : public QFrame{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
protected:
|
||||||
QLabel* header_m;
|
QLabel* header_m;
|
||||||
QLineEdit* id_m;
|
QLineEdit* id_m;
|
||||||
QLineEdit* password_m;
|
QLineEdit* password_m;
|
||||||
QPushButton* loginButton_m;
|
QPushButton* loginButton_m;
|
||||||
|
|
||||||
|
void loginButtonClicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LoginFrame(QWidget* parent = nullptr);
|
LoginFrame(QWidget* parent = nullptr);
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user