summaryrefslogtreecommitdiff
path: root/src/assignmentList.cpp
blob: 91c4716148e7f6d57f4ee69e57d6ff3be28fcd1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <QAction>
#include <QApplication>
#include <QCoreApplication>
#include <QDate>
#include <QFile>
#include <QMessageBox>
#include <QObject>
#include <QStandardPaths>
#include <QUiLoader>

#include <QDebug>
#include <QSettings>

#include "assignmentList.h"
#include "settings.h"

AssignmentList::AssignmentList() {
	// set QSettings information
	QCoreApplication::setOrganizationName("assignment-list-qt"); // TODO grab this from a config.h type file
	QCoreApplication::setApplicationName("assignment-list-qt"); // TODO grab this from a config.h type file

	// ensure QSettings location exists
	this->initializeSettings();

	// load uic
	ui.setupUi(this);

	this->initializeUI();
}

void AssignmentList::initializeSettings() {
	QSettings settings;
	QFile path = settings.fileName();

	if(!path.exists()) {
		qDebug() << "Creating Config";
		Settings::createConfig();
	}
}

void AssignmentList::initializeUI() {
	// create menu connections
	QObject::connect(ui.actionPreferences, &QAction::triggered, this, &AssignmentList::preferences);
	QObject::connect(ui.actionReload, &QAction::triggered, this, &AssignmentList::reload);
	QObject::connect(ui.actionExit, &QAction::triggered, this, QApplication::quit);
	QObject::connect(ui.actionAdd_Group, &QAction::triggered, this, &AssignmentList::addGroup);
	QObject::connect(ui.actionClean_Hidden, &QAction::triggered, this, &AssignmentList::cleanHidden);
	QObject::connect(ui.actionAbout, &QAction::triggered, this, &AssignmentList::aboutDialog);

	// create toolbar
	ui.toolBar->addAction(ui.actionAdd_Group);

	//Config() // from config.h
	this->setupDB();
	this->displayWidgets();
	this->show();
}

void AssignmentList::setupDB() {
	qDebug() << "WIP";
}

void AssignmentList::displayWidgets() {
	QDate today = QDate::currentDate();
	ui.title->setText(today.toString("dddd, MMM d yyyy"));
	//this->drawGroups();
}

// Open the 'addGroup' form
void AssignmentList::addGroup() {
	qDebug() << "WIP";
}

// Open the 'editGroup; form
void AssignmentList::editGroup(int id) {
	qDebug() << "WIP";
}

void AssignmentList::preferences() {
	qDebug() << "WIP";
}

void AssignmentList::reload() {
	qDebug() << "WIP";
}

void AssignmentList::cleanHidden() {
	qDebug() << "WIP";
}

void AssignmentList::aboutDialog() {
	QMessageBox about;
	about.about(this, "About Assignment List", "Created by Louie S. - 2023");
}