summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/assignmentList.cpp12
-rw-r--r--src/settings.cpp14
-rw-r--r--src/settings.h8
3 files changed, 7 insertions, 27 deletions
diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp
index 09ef6e3..953d443 100644
--- a/src/assignmentList.cpp
+++ b/src/assignmentList.cpp
@@ -2,6 +2,7 @@
#include <QApplication>
#include <QCoreApplication>
#include <QDate>
+#include <QDir>
#include <QFile>
#include <QMessageBox>
#include <QObject>
@@ -18,7 +19,6 @@
#include "entryLayout.h"
#include "groupLayout.h"
#include "preferencesDialog.h"
-#include "settings.h"
AssignmentList::AssignmentList() {
// set QSettings information
@@ -35,12 +35,14 @@ AssignmentList::AssignmentList() {
void AssignmentList::initializeSettings() {
QSettings settings;
- QFile path = settings.fileName();
+ QDir local_data_dir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
- if(!path.exists()) {
- qDebug() << "Creating Config";
- Settings::createConfig();
+ settings.beginGroup("paths");
+ if(!settings.contains("db_path")) {
+ qDebug() << "Setting default db_path";
+ settings.setValue("db_path", local_data_dir.filePath("data.db"));
}
+ settings.endGroup();
}
void AssignmentList::initializeUI() {
diff --git a/src/settings.cpp b/src/settings.cpp
deleted file mode 100644
index 4fe67d1..0000000
--- a/src/settings.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <QDir>
-#include <QSettings>
-#include <QStandardPaths>
-
-#include "settings.h"
-
-void Settings::createConfig() {
- QSettings settings;
- QDir local_data_dir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
-
- settings.beginGroup("paths");
- settings.setValue("db_path", local_data_dir.filePath("data.db"));
- settings.endGroup();
-}
diff --git a/src/settings.h b/src/settings.h
deleted file mode 100644
index bec3c22..0000000
--- a/src/settings.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef SETTINGS_H
-#define SETTINGS_H
-
-namespace Settings {
- void createConfig();
-};
-
-#endif