summaryrefslogtreecommitdiff
path: root/src/assignmentList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/assignmentList.cpp')
-rw-r--r--src/assignmentList.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp
index c8da5c3..91c4716 100644
--- a/src/assignmentList.cpp
+++ b/src/assignmentList.cpp
@@ -1,25 +1,43 @@
#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
- QFile file("/home/louie/Development/projects/assignment-list-qt/src/main.ui");
- file.open(QIODevice::ReadOnly);
- QUiLoader loader;
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);