summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-02-26 17:48:02 -0500
committerLouie S <louie@example.com>2024-02-26 17:48:02 -0500
commit2473da03572c3b9d8e29ae6120e5177156699f2a (patch)
tree8ac7ac2e8a3c5cc152f04e4d7e65b66f984935f6 /src
parentbdb594ada83058ae35edb5edf01703afa203e593 (diff)
Create skeleton for add_group_form
Diffstat (limited to 'src')
-rw-r--r--src/add_group_form.cpp30
-rw-r--r--src/add_group_form.h19
-rw-r--r--src/assignmentList.cpp4
3 files changed, 52 insertions, 1 deletions
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 <QMessageBox>
+
+#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 <QErrorMessage>
#include <QSettings>
+#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