Frame Pushbuttons implementiert
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# include "EinsatzplanFrameController.hpp"
|
||||
|
||||
EinsatzplanFrameController::EinsatzplanFrameController(QString id, bool admin)
|
||||
:id_m(id),admin_m(admin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EinsatzplanFrameController::deleteMember(QString id){
|
||||
|
||||
}
|
||||
|
||||
void EinsatzplanFrameController::deleteVeranstaltung(QString veranstaltungsname){
|
||||
|
||||
}
|
||||
|
||||
void EinsatzplanFrameController::createMember(QString name, QString email, QString passwort, bool admin){
|
||||
|
||||
}
|
||||
|
||||
void EinsatzplanFrameController::createVeranstaltung(QString name, QString raum, QString campus, QString begin, QString ende){
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# include <QString>
|
||||
|
||||
class EinsatzplanFrameController{
|
||||
protected:
|
||||
QString id_m;
|
||||
bool admin_m;
|
||||
public:
|
||||
EinsatzplanFrameController(QString id = "0000000", bool admin = true);
|
||||
void deleteMember(QString id);
|
||||
void deleteVeranstaltung(QString veranstaltungsname);
|
||||
void createMember(QString name, QString email, QString passwort, bool admin);
|
||||
void createVeranstaltung(QString name, QString raum, QString campus, QString begin, QString ende);
|
||||
};
|
||||
@@ -11,6 +11,7 @@ EinsatzplanFrame::EinsatzplanFrame(QWidget* parent, QString id, bool admin)
|
||||
}
|
||||
)");
|
||||
|
||||
controller_m = new EinsatzplanFrameController(id, admin);
|
||||
|
||||
profileImg_m = new QLabel(this);
|
||||
profileImg_m->setFixedSize(60, 60);
|
||||
@@ -211,7 +212,15 @@ void EinsatzplanFrame::deleteVeranstaltung(){
|
||||
}
|
||||
|
||||
void EinsatzplanFrame::createVeranstaltung(){
|
||||
|
||||
createVerDialog dialog(this);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString name = dialog.getName();
|
||||
QString raum = dialog.getRaum();
|
||||
QString campus = dialog.getCampus();
|
||||
QString begin = dialog.getBegin();
|
||||
QString ende = dialog.getEnde();
|
||||
controller_m->createVeranstaltung(name,raum, campus, begin, ende);
|
||||
}
|
||||
}
|
||||
|
||||
void EinsatzplanFrame::deleteMember(){
|
||||
@@ -226,5 +235,146 @@ void EinsatzplanFrame::deleteMember(){
|
||||
}
|
||||
|
||||
void EinsatzplanFrame::createMember(){
|
||||
createMemDialog dialog(this);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString name = dialog.getName();
|
||||
QString email = dialog.getEmail();
|
||||
QString password = dialog.getPassword();
|
||||
bool isAdmin = dialog.isAdmin();
|
||||
controller_m->createMember(name, email, password, isAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
createMemDialog::createMemDialog(QWidget* parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Mitarbeiter Hinzufügen");
|
||||
setFixedSize(300,400);
|
||||
|
||||
name_m = new QLineEdit(this);
|
||||
name_m->setPlaceholderText("Name");
|
||||
name_m->show();
|
||||
|
||||
|
||||
email_m = new QLineEdit(this);
|
||||
email_m->setPlaceholderText("Email");
|
||||
email_m->show();
|
||||
|
||||
password_m = new QLineEdit(this);
|
||||
password_m->setPlaceholderText("Passwort");
|
||||
password_m->setEchoMode(QLineEdit::Password);
|
||||
password_m->show();
|
||||
|
||||
admin_m = new QCheckBox("Admin?", this);
|
||||
admin_m->show();
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
layout->addWidget(name_m);
|
||||
layout->addWidget(email_m);
|
||||
layout->addWidget(password_m);
|
||||
layout->addWidget(admin_m);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
|
||||
okButton = new QPushButton("OK", this);
|
||||
cancelButton = new QPushButton("Abbrechen", this);
|
||||
|
||||
buttonLayout->addWidget(okButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
QString createMemDialog::getName() const {
|
||||
return name_m->text();
|
||||
}
|
||||
|
||||
QString createMemDialog::getEmail() const {
|
||||
return email_m->text();
|
||||
}
|
||||
|
||||
QString createMemDialog::getPassword() const {
|
||||
return password_m->text();
|
||||
}
|
||||
|
||||
bool createMemDialog::isAdmin() const {
|
||||
return admin_m->isChecked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
createVerDialog::createVerDialog(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setWindowTitle("Veranstaltung Hinzufügen");
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
name_m = new QLineEdit(this);
|
||||
name_m->setPlaceholderText("Veranstaltungskürzel");
|
||||
layout->addWidget(name_m);
|
||||
|
||||
raum_m = new QLineEdit(this);
|
||||
raum_m->setPlaceholderText("Raum");
|
||||
layout->addWidget(raum_m);
|
||||
|
||||
campus_m = new QComboBox(this);
|
||||
campus_m->addItem("Campus A");
|
||||
campus_m->addItem("Campus B");
|
||||
layout->addWidget(campus_m);
|
||||
|
||||
begin_m = new QComboBox(this);
|
||||
begin_m->addItem("08:00");
|
||||
begin_m->addItem("10:00");
|
||||
begin_m->addItem("12:00");
|
||||
begin_m->addItem("14:00");
|
||||
begin_m->addItem("16:00");
|
||||
layout->addWidget(begin_m);
|
||||
|
||||
ende_m = new QComboBox(this);
|
||||
ende_m->addItem("10:00");
|
||||
ende_m->addItem("12:00");
|
||||
ende_m->addItem("14:00");
|
||||
ende_m->addItem("16:00");
|
||||
ende_m->addItem("18:00");
|
||||
layout->addWidget(ende_m);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
|
||||
okButton = new QPushButton("OK", this);
|
||||
cancelButton = new QPushButton("Abbrechen", this);
|
||||
|
||||
buttonLayout->addWidget(okButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
connect(okButton, &QPushButton::clicked, this, &QDialog::accept);
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
QString createVerDialog::getName() const {
|
||||
return name_m->text();
|
||||
}
|
||||
|
||||
QString createVerDialog::getRaum() const {
|
||||
return raum_m->text();
|
||||
}
|
||||
|
||||
QString createVerDialog::getCampus() const {
|
||||
return campus_m->currentText();
|
||||
}
|
||||
|
||||
QString createVerDialog::getBegin() const {
|
||||
return begin_m->currentText();
|
||||
}
|
||||
|
||||
QString createVerDialog::getEnde() const {
|
||||
return ende_m->currentText();
|
||||
}
|
||||
@@ -8,12 +8,17 @@
|
||||
# include <QApplication>
|
||||
# include <QMessageBox>
|
||||
# include <QInputDialog>
|
||||
# include <QCheckBox>
|
||||
# include <QComboBox>
|
||||
# include "../PlanGrid/PlanGrid.hpp"
|
||||
# include "../../Controller/EinsatzplanFrameController/EinsatzplanFrameController.hpp"
|
||||
|
||||
|
||||
class EinsatzplanFrame : public QFrame{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
EinsatzplanFrameController* controller_m;
|
||||
|
||||
QLabel* profileImg_m;
|
||||
QLabel* id_m;
|
||||
QLabel* einsatzplanLabel_m;
|
||||
@@ -25,7 +30,6 @@ protected:
|
||||
QPushButton* deleteMemberButton_m;
|
||||
QPushButton* createVeranstaltungButton_m;
|
||||
QPushButton* deleteVeranstaltungButton_m;
|
||||
|
||||
public:
|
||||
EinsatzplanFrame(QWidget* parent = nullptr, QString id = "0000000", bool admin = true);
|
||||
|
||||
@@ -37,4 +41,47 @@ private slots:
|
||||
void deleteMember();
|
||||
void createMember();
|
||||
|
||||
};
|
||||
|
||||
class createVerDialog : public QDialog{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
|
||||
QLineEdit* name_m;
|
||||
QLineEdit* raum_m;
|
||||
QComboBox* campus_m;
|
||||
QComboBox* begin_m;
|
||||
QComboBox* ende_m;
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
|
||||
public:
|
||||
|
||||
createVerDialog(QWidget* parent = nullptr);
|
||||
|
||||
QString getName() const;
|
||||
QString getRaum() const;
|
||||
QString getCampus() const;
|
||||
QString getBegin() const;
|
||||
QString getEnde() const;
|
||||
};
|
||||
|
||||
class createMemDialog : public QDialog{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QLineEdit* name_m;
|
||||
QLineEdit* email_m;
|
||||
QLineEdit* password_m;
|
||||
QCheckBox* admin_m;
|
||||
QPushButton* okButton;
|
||||
QPushButton* cancelButton;
|
||||
|
||||
public:
|
||||
|
||||
createMemDialog(QWidget* parent = nullptr);
|
||||
|
||||
QString getName() const;
|
||||
QString getEmail() const;
|
||||
QString getPassword() const;
|
||||
bool isAdmin() const;
|
||||
};
|
||||
Reference in New Issue
Block a user