From 2473da03572c3b9d8e29ae6120e5177156699f2a Mon Sep 17 00:00:00 2001 From: Louie S Date: Mon, 26 Feb 2024 17:48:02 -0500 Subject: Create skeleton for add_group_form --- src/add_group_form.cpp | 30 ++++++++++++++++++++++++++++++ src/add_group_form.h | 19 +++++++++++++++++++ src/assignmentList.cpp | 4 +++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/add_group_form.cpp create mode 100644 src/add_group_form.h (limited to 'src') diff --git a/src/add_group_form.cpp b/src/add_group_form.cpp new file mode 100644 index 0000000..5662208 --- /dev/null +++ b/src/add_group_form.cpp @@ -0,0 +1,30 @@ +#include + +#include "add_group_form.h" + +AddGroupForm::AddGroupForm() { + // load uic + ui.setupUi(this); + + // setup dialog button connections + QObject::connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + QObject::connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &AddGroupForm::handleSubmit); +} + +void AddGroupForm::handleSubmit() { + QString name_text = ui.new_group_name->text(); + QString column_text = ui.new_group_column->currentText(); + QString link_text = ui.new_group_link->text(); + QMessageBox error_message; + + if(name_text.isEmpty()) { + error_message.setIcon(QMessageBox::Warning); + error_message.setWindowTitle("Error Message"); + error_message.setText("Name cannot be blank"); + error_message.setParent(this); + error_message.show(); + } + + // TODO insert into database + this->close(); +} diff --git a/src/add_group_form.h b/src/add_group_form.h new file mode 100644 index 0000000..c3b3765 --- /dev/null +++ b/src/add_group_form.h @@ -0,0 +1,19 @@ +#ifndef ADDGROUPFORM_H +#define ADDGROUPFORM_H + +#include "ui_add_group_form.h" + +class AddGroupForm : public QDialog { + Q_OBJECT + + public: + AddGroupForm(); + + private: + Ui::Dialog ui; + + private slots: + void handleSubmit(); +}; + +#endif diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp index 0ccda0e..ef040a8 100644 --- a/src/assignmentList.cpp +++ b/src/assignmentList.cpp @@ -12,6 +12,7 @@ #include #include +#include "add_group_form.h" #include "assignmentList.h" #include "backend/db_sqlite.h" #include "settings.h" @@ -87,7 +88,8 @@ void AssignmentList::displayWidgets() { // Open the 'addGroup' form void AssignmentList::addGroup() { - qDebug() << "WIP"; + AddGroupForm create_new_group_dialog; + create_new_group_dialog.exec(); } // Open the 'editGroup; form -- cgit