summaryrefslogtreecommitdiff
path: root/src/ruleLayout.cpp
blob: f922f1ae9fbd1de149f7a8e907ec3213fc026b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <QComboBox>
#include <QDate>
#include <QDateTimeEdit>
#include <QLineEdit>

#include "ruleLayout.h"

RuleLayout::RuleLayout(const Rule &r) :
	rule(r)
{
	QComboBox *when_widget = new QComboBox;
	QDateTimeEdit *date_widget = new QDateTimeEdit(QDate::currentDate());
	QLineEdit *color_widget = new QLineEdit; // TODO consider making this a color selector widget
	QLineEdit *highlight_widget = new QLineEdit; // TODO consider making this a color selector widget

	QStringList when_options;
	when_options.append("Before");
	when_options.append("After");
	when_widget->addItems(when_options);
	when_widget->setCurrentIndex(this->rule.when);
	this->addWidget(when_widget);

	date_widget->setDisplayFormat("MM/dd/yyyy");
	date_widget->setDateTime(this->rule.date);
	this->addWidget(date_widget);

	this->addStretch();

	color_widget->setPlaceholderText("Color");
	if(!this->rule.color.isEmpty())
		color_widget->setText(this->rule.color);
	this->addWidget(color_widget);

	highlight_widget->setPlaceholderText("Highlight");
	if(!this->rule.highlight.isEmpty())
		highlight_widget->setText(this->rule.highlight);
	this->addWidget(highlight_widget);
}