From 6c9d7e079cceade194b5faa6c65e98920be697ef Mon Sep 17 00:00:00 2001 From: Louie S Date: Fri, 15 Mar 2024 16:35:30 -0400 Subject: sorting implemented; functionality is now matching pyqt version --- src/backend/db_sqlite.cpp | 30 +++++++++++++++--------------- src/backend/db_sqlite.h | 10 +++++----- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/backend') diff --git a/src/backend/db_sqlite.cpp b/src/backend/db_sqlite.cpp index 4e62153..f9b9a8e 100644 --- a/src/backend/db_sqlite.cpp +++ b/src/backend/db_sqlite.cpp @@ -47,8 +47,8 @@ BackendDB::BackendDB() { } // load groups -QList BackendDB::loadGroups() { - QList output; +QList BackendDB::loadGroups() { + QList output; { QSqlDatabase database(this->openDB()); @@ -56,7 +56,7 @@ QList BackendDB::loadGroups() { query.exec("SELECT * FROM groups"); while(query.next()) { - output.append(new Group( + output.append(Group( query.record().field("id").value().toInt(), query.record().field("name").value().toString(), Group::Column(query.record().field("column").value().toInt()), @@ -70,8 +70,8 @@ QList BackendDB::loadGroups() { } // load entries -QList BackendDB::loadEntries() { - QList output; +QList BackendDB::loadEntries() { + QList output; { QSqlDatabase database(this->openDB()); @@ -79,7 +79,7 @@ QList BackendDB::loadEntries() { query.exec("SELECT * FROM entries"); while(query.next()) { - output.append(new Entry( + output.append(Entry( query.record().field("id").value().toInt(), query.record().field("parent_id").value().toInt(), query.record().field("description").value().toString(), @@ -97,8 +97,8 @@ QList BackendDB::loadEntries() { return output; } -QList BackendDB::loadEntries(int parent_id) { - QList output; +QList BackendDB::loadEntries(int parent_id) { + QList output; { QSqlDatabase database(this->openDB()); @@ -108,7 +108,7 @@ QList BackendDB::loadEntries(int parent_id) { query.bindValue(0, parent_id); query.exec(); while(query.next()) { - output.append(new Entry( + output.append(Entry( query.record().field("id").value().toInt(), query.record().field("parent_id").value().toInt(), query.record().field("description").value().toString(), @@ -127,8 +127,8 @@ QList BackendDB::loadEntries(int parent_id) { } // load entries -QList BackendDB::loadRules() { - QList output; +QList BackendDB::loadRules() { + QList output; { QSqlDatabase database(this->openDB()); @@ -136,7 +136,7 @@ QList BackendDB::loadRules() { query.exec("SELECT * FROM rules"); while(query.next()) { - output.append(new Rule( + output.append(Rule( query.record().field("id").value().toInt(), query.record().field("entry_id").value().toInt(), (Rule::When) query.record().field("before_after").value().toInt(), @@ -151,8 +151,8 @@ QList BackendDB::loadRules() { } // load entries -QList BackendDB::loadRules(int entry_id) { - QList output; +QList BackendDB::loadRules(int entry_id) { + QList output; { QSqlDatabase database(this->openDB()); @@ -162,7 +162,7 @@ QList BackendDB::loadRules(int entry_id) { query.bindValue(0, entry_id); query.exec(); while(query.next()) { - output.append(new Rule( + output.append(Rule( query.record().field("id").value().toInt(), query.record().field("entry_id").value().toInt(), (Rule::When) query.record().field("before_after").value().toInt(), diff --git a/src/backend/db_sqlite.h b/src/backend/db_sqlite.h index 93ae050..b23f208 100644 --- a/src/backend/db_sqlite.h +++ b/src/backend/db_sqlite.h @@ -12,11 +12,11 @@ class BackendDB : QSqlDatabase { public: BackendDB(); - QList loadGroups(); - QList loadEntries(); - QList loadEntries(int parent_id); - QList loadRules(); - QList loadRules(int entry_id); + QList loadGroups(); + QList loadEntries(); + QList loadEntries(int parent_id); + QList loadRules(); + QList loadRules(int entry_id); int insertGroup(const Group &new_group); int insertEntry(const Entry &new_entry); int insertRule(const Rule &new_rule); -- cgit