From e659d5be0974fab8c1cbfad4dbe9c680dfa6f374 Mon Sep 17 00:00:00 2001 From: Louie S Date: Wed, 21 Feb 2024 20:43:58 -0500 Subject: Create rule class --- src/rule.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/rule.cpp (limited to 'src/rule.cpp') diff --git a/src/rule.cpp b/src/rule.cpp new file mode 100644 index 0000000..93c33d6 --- /dev/null +++ b/src/rule.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +#include "rule.h" + +Rule::Rule(int id, int entry_id, When when, QDateTime date, QString color, QString highlight) : + id(id), + entry_id(entry_id), + when(when), + date(date), + color(color), + highlight(highlight) +{ + QComboBox *when_widget; + QDateTimeEdit *date_widget = new QDateTimeEdit(QDate::currentDate()); + QLineEdit *color_widget; // TODO consider making this a color selector widget + QLineEdit *highlight_widget; // TODO consider making this a color selector widget + + when_widget->addItems(QStringList("Before", "After")); + when_widget->setCurrentIndex(this->when); + this->addWidget(when_widget); + + date_widget->setDisplayFormat("MM/dd/yyyy"); + date_widget->setDateTime(this->date); + this->addWidget(date_widget); + + this->addStretch(); + + color_widget->setPlaceholderText("Color"); + if(!this->color.isEmpty()) + color_widget->setText(this->color); + this->addWidget(color_widget); + + highlight_widget->setPlaceholderText("Highlight"); + if(!this->highlight.isEmpty()) + highlight_widget->setText(this->highlight); + this->addWidget(highlight_widget); +} -- cgit