diff --git a/src/Controller/LoginFrameController/LoginFrameController.cpp b/src/Controller/LoginFrameController/LoginFrameController.cpp index 877f989..84892ce 100644 --- a/src/Controller/LoginFrameController/LoginFrameController.cpp +++ b/src/Controller/LoginFrameController/LoginFrameController.cpp @@ -1,8 +1,11 @@ #include "LoginFrameController.hpp" -LoginFrameController::LoginFrameController(std::string id, std::string password) -:id_m(id), passwort_m(password) +LoginFrameController::LoginFrameController() { + +} + +bool LoginFrameController::tryLogin(std::string id, std::string password){ //DatabaseHandler dbHandler = new Databasehandler(); //dbHandler.CheckValidLogin(); } \ No newline at end of file diff --git a/src/Controller/LoginFrameController/LoginFrameController.hpp b/src/Controller/LoginFrameController/LoginFrameController.hpp index 372db99..73537f8 100644 --- a/src/Controller/LoginFrameController/LoginFrameController.hpp +++ b/src/Controller/LoginFrameController/LoginFrameController.hpp @@ -3,9 +3,7 @@ class LoginFrameController{ private: - std::string id_m; - std::string passwort_m; - public: - LoginFrameController(std::string id, std::string password); + LoginFrameController(); + bool tryLogin(std::string id, std::string password); }; \ No newline at end of file diff --git a/src/View/LoginFrame/LoginFrame.cpp b/src/View/LoginFrame/LoginFrame.cpp index 8f35e38..9a3c7b7 100644 --- a/src/View/LoginFrame/LoginFrame.cpp +++ b/src/View/LoginFrame/LoginFrame.cpp @@ -30,29 +30,33 @@ LoginFrame::LoginFrame(QWidget* parent) header_m->show(); - id_m = new QLineEdit("ID...", this); + id_m = new QLineEdit( this); + id_m->setPlaceholderText("ID..."); id_m->setObjectName("ID"); id_m->setStyleSheet(R"( #ID{ color: #333333; font-size: 25px; font-weight: bold; - border: none; background-color: #444444; + border-radius: 10px; + padding: 5px; } )"); id_m->show(); - password_m = new QLineEdit("Passwort...",this); + password_m = new QLineEdit(this); + password_m->setPlaceholderText("Passwort..."); password_m->setObjectName("Password"); password_m->setStyleSheet(R"( #Password{ color: #333333; font-size: 25px; font-weight: bold; - border: none; background-color: #444444; + border-radius: 10px; + padding: 5px; } )"); password_m->show(); @@ -65,6 +69,10 @@ LoginFrame::LoginFrame(QWidget* parent) font-size: 30px; font-weight: bold; background-color: #00C800; + border-radius: 10px; + } + #loginButton:pressed { + background-color: #00A800; } )"); loginButton_m->show(); @@ -73,6 +81,8 @@ LoginFrame::LoginFrame(QWidget* parent) //create layout QVBoxLayout* layout = new QVBoxLayout(); + layout->setContentsMargins(50, 20, 50, 20); + layout->addStretch(1); layout->addWidget(header_m); header_m->setAlignment(Qt::AlignHCenter); @@ -88,4 +98,23 @@ LoginFrame::LoginFrame(QWidget* parent) //add Layout to LoginFrame 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()); + } + } \ No newline at end of file diff --git a/src/View/LoginFrame/LoginFrame.hpp b/src/View/LoginFrame/LoginFrame.hpp index 39b7729..735ee34 100644 --- a/src/View/LoginFrame/LoginFrame.hpp +++ b/src/View/LoginFrame/LoginFrame.hpp @@ -5,15 +5,19 @@ # include # include # include +# include +# include "../../Controller/LoginFrameController/LoginFrameController.hpp" class LoginFrame : public QFrame{ Q_OBJECT -private: +protected: QLabel* header_m; QLineEdit* id_m; QLineEdit* password_m; QPushButton* loginButton_m; + void loginButtonClicked(); + public: LoginFrame(QWidget* parent = nullptr); }; \ No newline at end of file