From e9c68303aaa353f003a0c68d11d04b9c6062104b Mon Sep 17 00:00:00 2001 From: Louie S Date: Tue, 12 Mar 2024 17:13:50 -0400 Subject: Remove settings file, integrate into assignmentList.cpp --- src/assignmentList.cpp | 12 +++++++----- src/settings.cpp | 14 -------------- src/settings.h | 8 -------- 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 src/settings.cpp delete mode 100644 src/settings.h (limited to 'src') 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 #include #include +#include #include #include #include @@ -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 -#include -#include - -#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 -- cgit