summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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