From c34930425fadfc4083067b9306159cd8e8ecf6c6 Mon Sep 17 00:00:00 2001 From: Louie S Date: Tue, 23 Jul 2024 20:37:48 -0400 Subject: Rearrange source file locations --- src/frontend/qtwidgets/entry.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/frontend/qtwidgets/entry.cpp (limited to 'src/frontend/qtwidgets/entry.cpp') diff --git a/src/frontend/qtwidgets/entry.cpp b/src/frontend/qtwidgets/entry.cpp new file mode 100644 index 0000000..c95bbb0 --- /dev/null +++ b/src/frontend/qtwidgets/entry.cpp @@ -0,0 +1,36 @@ +#include + +#include "entry.h" + +Entry::Entry(int id, int parent_id, QString desc, QDateTime due, QString due_alt, QUrl link, QString color, QString highlight, bool done, bool hidden) : + id(id), + parent_id(parent_id), + desc(desc), + due(due), + due_alt(due_alt), + link(link), + color(color), + highlight(highlight), + done(done), + hidden(hidden) +{ +} + +QList Entry::entries; + +bool Entry::compare(Entry a, Entry b) { + // 1st level: sort not done before done + if(a.done != b.done) + return a.done < b.done; + // next level: sort on due date + if(a.due != b.due) + return a.due < b.due; + // next level: sort on alt due date + if(a.due_alt != b.due_alt) + return a.due_alt < b.due_alt; + // next level: sort on description + if(a.desc != b.desc) + return a.desc < b.desc; + // otherwise, sort on id + return a.id < b.id; +} -- cgit