Fix task priority/status color, fix editable field in config, Fix column
length, Fix redraw after updating config
This commit is contained in:
@@ -4,8 +4,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||||||
|
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
|
|
||||||
win32:VERSION = 0.1.0.0 # major.minor.patch.build
|
win32:VERSION = 0.1.1.0 # major.minor.patch.build
|
||||||
else:VERSION = 0.1.0 # major.minor.patch
|
else:VERSION = 0.1.1 # major.minor.patch
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||||
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
|
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
init();
|
init();
|
||||||
this->selectedBoardIndex = -1;
|
this->selectedBoardIndex = -1;
|
||||||
|
// Change "name" column size
|
||||||
|
ui->taskList->header()->resizeSection(0, 520);
|
||||||
|
// Change "status" column size
|
||||||
|
ui->taskList->header()->resizeSection(1, 150);
|
||||||
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::openPreferences);
|
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::openPreferences);
|
||||||
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::openAbout);
|
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::openAbout);
|
||||||
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::onNewBoardClick);
|
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::onNewBoardClick);
|
||||||
@@ -54,6 +58,7 @@ void MainWindow::openPreferences()
|
|||||||
this->priorities = dialog.getPriorities();
|
this->priorities = dialog.getPriorities();
|
||||||
this->status = dialog.getStatus();
|
this->status = dialog.getStatus();
|
||||||
save();
|
save();
|
||||||
|
redrawTaskTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,33 +131,7 @@ void MainWindow::onNewTaskClick()
|
|||||||
Board *b = boards[selectedBoardIndex];
|
Board *b = boards[selectedBoardIndex];
|
||||||
b->add(t);
|
b->add(t);
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, t.getTitle());
|
updateTaskRow(item, t);
|
||||||
item->setText(3, t.getExpectedFor().toString());
|
|
||||||
|
|
||||||
if (!t.getStatusUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(1, getStatusLabel(t.getStatusUUID()));
|
|
||||||
QBrush bgColor = item->background(1);
|
|
||||||
QBrush fgColor = item->foreground(1);
|
|
||||||
bgColor.setColor(getStatusColor(t.getStatusUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(1, bgColor);
|
|
||||||
item->setForeground(1, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!t.getPriorityUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(2, getPriorityLabel(t.getPriorityUUID()));
|
|
||||||
QBrush bgColor = item->background(2);
|
|
||||||
QBrush fgColor = item->foreground(2);
|
|
||||||
bgColor.setColor(getPriorityColor(t.getPriorityUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(2, bgColor);
|
|
||||||
item->setForeground(2, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->taskList->addTopLevelItem(item);
|
ui->taskList->addTopLevelItem(item);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@@ -190,33 +169,7 @@ void MainWindow::onEditTask(QTreeWidgetItem *item)
|
|||||||
{
|
{
|
||||||
Task editedTask = dialog.getTask();
|
Task editedTask = dialog.getTask();
|
||||||
t->update(editedTask);
|
t->update(editedTask);
|
||||||
item->setText(0, editedTask.getTitle());
|
updateTaskRow(item, editedTask);
|
||||||
item->setText(3, editedTask.getExpectedFor().toString());
|
|
||||||
|
|
||||||
if (!editedTask.getStatusUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(1, getStatusLabel(editedTask.getStatusUUID()));
|
|
||||||
QBrush bgColor = item->background(1);
|
|
||||||
QBrush fgColor = item->foreground(1);
|
|
||||||
bgColor.setColor(getStatusColor(editedTask.getStatusUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(1, bgColor);
|
|
||||||
item->setForeground(1, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!editedTask.getPriorityUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(2, getPriorityLabel(editedTask.getPriorityUUID()));
|
|
||||||
QBrush bgColor = item->background(2);
|
|
||||||
QBrush fgColor = item->foreground(2);
|
|
||||||
bgColor.setColor(getPriorityColor(editedTask.getPriorityUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(2, bgColor);
|
|
||||||
item->setForeground(2, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,6 +265,7 @@ void MainWindow::init()
|
|||||||
QVector<Priority> MainWindow::defaultPriorities()
|
QVector<Priority> MainWindow::defaultPriorities()
|
||||||
{
|
{
|
||||||
QVector<Priority> res;
|
QVector<Priority> res;
|
||||||
|
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "None", QColor("#d9d9d9")));
|
||||||
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "Low", QColor("#309db0")));
|
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "Low", QColor("#309db0")));
|
||||||
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "Medium", QColor("#b08e30")));
|
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "Medium", QColor("#b08e30")));
|
||||||
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "High", QColor("#b04330")));
|
res.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "High", QColor("#b04330")));
|
||||||
@@ -402,6 +356,40 @@ const QJsonDocument MainWindow::getJsonSave()
|
|||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateTaskRow(QTreeWidgetItem *item, Task t)
|
||||||
|
{
|
||||||
|
item->setText(0, t.getTitle());
|
||||||
|
item->setToolTip(0, t.getDescription());
|
||||||
|
item->setText(3, t.getExpectedFor().toString());
|
||||||
|
|
||||||
|
if (!t.getStatusUUID().isEmpty())
|
||||||
|
{
|
||||||
|
item->setText(1, getStatusLabel(t.getStatusUUID()));
|
||||||
|
QBrush bgColor = item->background(1);
|
||||||
|
QBrush fgColor = item->foreground(1);
|
||||||
|
bgColor.setColor(getStatusColor(t.getStatusUUID(), bgColor.color()));
|
||||||
|
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||||
|
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
||||||
|
fgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||||
|
item->setBackground(1, bgColor);
|
||||||
|
item->setForeground(1, fgColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!t.getPriorityUUID().isEmpty())
|
||||||
|
{
|
||||||
|
item->setText(2, getPriorityLabel(t.getPriorityUUID()));
|
||||||
|
QBrush bgColor = item->background(2);
|
||||||
|
QBrush fgColor = item->foreground(2);
|
||||||
|
bgColor.setColor(getPriorityColor(t.getPriorityUUID(), bgColor.color()));
|
||||||
|
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||||
|
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
||||||
|
fgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||||
|
item->setBackground(2, bgColor);
|
||||||
|
item->setForeground(2, fgColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::redrawBoardList()
|
void MainWindow::redrawBoardList()
|
||||||
{
|
{
|
||||||
QListWidget *l = ui->boardList;
|
QListWidget *l = ui->boardList;
|
||||||
@@ -431,33 +419,7 @@ void MainWindow::redrawTaskTree()
|
|||||||
foreach (Task *t, b->getTasks())
|
foreach (Task *t, b->getTasks())
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, t->getTitle());
|
updateTaskRow(item, *t);
|
||||||
item->setText(3, t->getExpectedFor().toString());
|
|
||||||
|
|
||||||
if (!t->getStatusUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(1, getStatusLabel(t->getStatusUUID()));
|
|
||||||
QBrush bgColor = item->background(1);
|
|
||||||
QBrush fgColor = item->foreground(1);
|
|
||||||
bgColor.setColor(getStatusColor(t->getStatusUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(1, bgColor);
|
|
||||||
item->setForeground(1, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!t->getPriorityUUID().isEmpty())
|
|
||||||
{
|
|
||||||
item->setText(2, getPriorityLabel(t->getPriorityUUID()));
|
|
||||||
QBrush bgColor = item->background(2);
|
|
||||||
QBrush fgColor = item->foreground(2);
|
|
||||||
bgColor.setColor(getPriorityColor(t->getPriorityUUID(), bgColor.color()));
|
|
||||||
bgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
|
||||||
fgColor.setColor(Tools::getForegroundColor(bgColor.color()));
|
|
||||||
item->setBackground(2, bgColor);
|
|
||||||
item->setForeground(2, fgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->taskList->addTopLevelItem(item);
|
ui->taskList->addTopLevelItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ private:
|
|||||||
|
|
||||||
const QJsonDocument getJsonSave();
|
const QJsonDocument getJsonSave();
|
||||||
|
|
||||||
|
void updateTaskRow(QTreeWidgetItem *item, Task t);
|
||||||
void redrawBoardList();
|
void redrawBoardList();
|
||||||
void redrawTaskTree();
|
void redrawTaskTree();
|
||||||
void save();
|
void save();
|
||||||
|
|||||||
@@ -124,6 +124,9 @@
|
|||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolButton" name="colorStatusButton">
|
<widget class="QToolButton" name="colorStatusButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@@ -145,7 +148,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>570</x>
|
<x>570</x>
|
||||||
<y>300</y>
|
<y>310</y>
|
||||||
<width>41</width>
|
<width>41</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -161,9 +164,9 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>520</x>
|
<x>520</x>
|
||||||
<y>300</y>
|
<y>310</y>
|
||||||
<width>41</width>
|
<width>41</width>
|
||||||
<height>32</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -213,6 +216,9 @@
|
|||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QListWidget" name="priorityListWidget">
|
<widget class="QListWidget" name="priorityListWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@@ -257,7 +263,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>570</x>
|
<x>570</x>
|
||||||
<y>300</y>
|
<y>310</y>
|
||||||
<width>41</width>
|
<width>41</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -273,7 +279,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>520</x>
|
<x>520</x>
|
||||||
<y>300</y>
|
<y>310</y>
|
||||||
<width>41</width>
|
<width>41</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
|||||||
Reference in New Issue
Block a user