5 Commits

15 changed files with 245 additions and 38 deletions

View File

@@ -4,8 +4,8 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
CONFIG += c++17
win32:VERSION = 0.3.0.0 # major.minor.patch.build
else:VERSION = 0.3.0 # major.minor.patch
win32:VERSION = 0.3.1.1 # major.minor.patch.build
else:VERSION = 0.3.1.1 # major.minor.patch
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
@@ -63,6 +63,23 @@ linux-* {
QMAKE_CXXFLAGS_RELEASE *= -O3
}
freebsd-* {
message("Build for FreeBSD")
DEFINES += APP_OS=\"\\\"$$system(freebsd-version -u)\\\"\"
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
DEFINES += APP_ARCH=\"\\\"$$system(uname -m)\\\"\"
ARCH = $$system(uname -m)
equals(ARCH, aarch64) {
message("CPU Architecture : aarch64")
QMAKE_CXXFLAGS_RELEASE += -mtune=cortex-a72
}
equals(ARCH, amd64) {
message("CPU Architecture : amd64")
QMAKE_CXXFLAGS_RELEASE += -march=skylake
}
QMAKE_CXXFLAGS_RELEASE *= -O3
}
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

View File

@@ -28,8 +28,10 @@ QString AboutDialog::getCompilerInfo()
#elif __GNUC__
#ifdef __MINGW32__
return QString("MinGW_%1.%2").arg(QString::number(__MINGW32_MAJOR_VERSION), QString::number(__MINGW32_MINOR_VERSION));
#else
#elif __linux__
return QString("GLIBC_%1.%2").arg(QString::number(__GLIBC__), QString::number(__GLIBC_MINOR__));
#else
return "unknown";
#endif
#elif _MSC_VER
return QString("MSVC_%1").arg(_MSC_VER);

View File

@@ -11,6 +11,7 @@ BoardConfigDialog::BoardConfigDialog(Board *b, QWidget *parent) :
ui->setupUi(this);
ui->nameField->setText(b->getName());
ui->descriptionField->setPlainText(b->getDescription());
ui->showStatusCheckbox->setChecked(b->isShowingStatus());
if (!b->isAutoStatus())
{
QVector<Status> statuses = TaskStateService::getInstance()->getStatuses();
@@ -44,6 +45,11 @@ bool BoardConfigDialog::isAutoStatus()
return ui->autoStatusCheckbox->isChecked();
}
bool BoardConfigDialog::isShowingStatus()
{
return ui->showStatusCheckbox->isChecked();
}
const QString BoardConfigDialog::getStatus()
{
if (!ui->autoStatusCheckbox->isChecked())

View File

@@ -20,6 +20,7 @@ public:
const QString getName();
const QString getDescription();
bool isAutoStatus();
bool isShowingStatus();
const QString getStatus();
private slots:

View File

@@ -37,7 +37,14 @@
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showStatusCheckbox">
<property name="text">
<string>Show the board status</string>
</property>
</widget>
</item>
@@ -72,10 +79,10 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>

View File

@@ -5,6 +5,7 @@
#define STATUS_KEY "status"
#define BOARDS_KEY "boards"
#define FILTERS_KEY "filters"
#define DEFAULT_STATUS "default_status"
#include <QUuid>
#include <QColor>
@@ -69,6 +70,7 @@ void MainWindow::openPreferences()
{
TaskStateService::getInstance()->updatePriorities(dialog.getPriorities());
TaskStateService::getInstance()->updateStatuses(dialog.getStatus());
TaskStateService::getInstance()->setDefaultStatus(dialog.getDefaultStatus());
save();
redrawTaskTree();
}
@@ -355,6 +357,7 @@ void MainWindow::onEditNameBoardMenu()
QString newDesc = dialog.getDescription();
b->setName(newName);
b->setDescription(newDesc);
b->setShowingStatus(dialog.isShowingStatus());
if (!dialog.isAutoStatus())
{
std::optional<Status> status = TaskStateService::getInstance()->getStatusByUUID(dialog.getStatus());
@@ -485,6 +488,14 @@ void MainWindow::init()
}
TaskStateService::getInstance()->updatePriorities(priorities);
TaskStateService::getInstance()->updateStatuses(statuses);
QString defaultStatusUUID = save[DEFAULT_STATUS].toString("");
for (Status s : TaskStateService::getInstance()->getStatuses())
{
if (s.getUUID() == defaultStatusUUID)
{
TaskStateService::getInstance()->setDefaultStatus(s);
}
}
redrawFilterList();
redrawBoardList();
return;
@@ -570,6 +581,7 @@ const QJsonDocument MainWindow::getJsonSave()
obj[STATUS_KEY] = jsonStatus;
obj[BOARDS_KEY] = jsonBoards;
obj[FILTERS_KEY] = jsonFilters;
obj[DEFAULT_STATUS] = TaskStateService::getInstance()->getDefaultStatus().getUUID();
doc.setObject(obj);
return doc;
}
@@ -694,7 +706,7 @@ void MainWindow::redrawTaskTree()
{
delete l->takeTopLevelItem(i);
}
if (selectedBoardIndex > -1)
if (selectedBoardIndex > -1 && selectedBoardIndex < boards.count())
{
Board *b = boards[selectedBoardIndex];
std::optional<Status> boardStatus = TaskStateService::getInstance()->getStatusByUUID(b->getStatus());
@@ -711,7 +723,7 @@ void MainWindow::redrawTaskTree()
ui->taskList->addTopLevelItem(item);
}
}
else if (selectedFilterIndex > -1)
else if (selectedFilterIndex > -1 && selectedFilterIndex < filters.count())
{
Filter f = filters[selectedFilterIndex];
filterResult = f.filter(boards);
@@ -731,6 +743,8 @@ void MainWindow::redrawBoardStatus()
if (selectedBoardIndex > -1)
{
Board *b = boards[selectedBoardIndex];
if (b->isShowingStatus())
{
std::optional<Status> boardStatus = TaskStateService::getInstance()->getStatusByUUID(b->getStatus());
if (boardStatus.has_value())
{
@@ -739,6 +753,7 @@ void MainWindow::redrawBoardStatus()
ui->boardStatus->setVisible(true);
}
}
}
}
void MainWindow::save()

View File

@@ -48,6 +48,8 @@ private:
void init();
// properties
int16_t selectedBoardIndex;
int16_t selectedFilterIndex;
@@ -60,6 +62,8 @@ private:
QVector<Board*> boards;
QVector<Filter> filters;
// functions
QVector<Priority> defaultPriorities();
QVector<Status> defaultStatus();
QVector<Filter> defaultFilters();

View File

@@ -20,6 +20,7 @@ PrefDialog::PrefDialog(QWidget *parent) :
statusUUIDRef.append(s.getUUID());
setItemColor(item, s.getColor());
ui->statusListWidget->addItem(item);
ui->defaultStatusCombobox->addItem(s.getName(), s.getUUID());
}
QVector<Priority> priorities = TaskStateService::getInstance()->getPriorities();
@@ -31,6 +32,8 @@ PrefDialog::PrefDialog(QWidget *parent) :
ui->priorityListWidget->addItem(item);
}
ui->defaultStatusCombobox->setCurrentText(TaskStateService::getInstance()->getDefaultStatus().getName());
connect(ui->addStatusButton, &QPushButton::clicked, this, &PrefDialog::onAddStatusButtonClick);
connect(ui->addPriorityButton, &QPushButton::clicked, this, &PrefDialog::onAddPriorityButtonClick);
connect(ui->statusListWidget, &QListWidget::currentRowChanged, this, &PrefDialog::onItemSelectionChange);
@@ -80,6 +83,24 @@ QVector<Status> PrefDialog::getStatus()
return res;
}
Status PrefDialog::getDefaultStatus()
{
QVector<Status> status = TaskStateService::getInstance()->getStatuses();
QString uuid = ui->defaultStatusCombobox->currentData().toString();
for (Status s : status)
{
if (uuid == s.getUUID())
{
return s;
}
}
if (status.count() > 0)
{
return status[0];
}
return Status("", "", QColor::fromRgb(0, 0, 0));
}
void PrefDialog::onAddStatusButtonClick()
{
QColor bgColor = Tools::getRandomColor();

View File

@@ -22,6 +22,7 @@ public:
QVector<Priority> getPriorities();
QVector<Status> getStatus();
Status getDefaultStatus();
private slots:
void onAddStatusButtonClick();

View File

@@ -3,7 +3,7 @@
<class>PrefDialog</class>
<widget class="QDialog" name="PrefDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
<enum>Qt::WindowModality::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
@@ -41,10 +41,10 @@
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget">
@@ -66,10 +66,10 @@
<widget class="QListWidget" name="statusListWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>601</width>
<height>291</height>
<x>40</x>
<y>64</y>
<width>571</width>
<height>161</height>
</rect>
</property>
</widget>
@@ -80,7 +80,7 @@
<property name="geometry">
<rect>
<x>90</x>
<y>350</y>
<y>290</y>
<width>521</width>
<height>21</height>
</rect>
@@ -90,7 +90,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>352</y>
<y>292</y>
<width>58</width>
<height>16</height>
</rect>
@@ -103,7 +103,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<y>330</y>
<width>58</width>
<height>16</height>
</rect>
@@ -119,7 +119,7 @@
<property name="geometry">
<rect>
<x>90</x>
<y>390</y>
<y>330</y>
<width>113</width>
<height>21</height>
</rect>
@@ -135,7 +135,7 @@
<property name="geometry">
<rect>
<x>210</x>
<y>390</y>
<y>330</y>
<width>26</width>
<height>22</height>
</rect>
@@ -148,9 +148,9 @@
<property name="geometry">
<rect>
<x>570</x>
<y>310</y>
<y>240</y>
<width>41</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<property name="text">
@@ -164,9 +164,9 @@
<property name="geometry">
<rect>
<x>520</x>
<y>310</y>
<y>240</y>
<width>41</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<property name="text">
@@ -179,10 +179,10 @@
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>310</y>
<width>41</width>
<height>21</height>
<x>10</x>
<y>240</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="text">
@@ -196,15 +196,115 @@
<property name="geometry">
<rect>
<x>70</x>
<y>310</y>
<width>41</width>
<height>21</height>
<y>240</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Up</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>11</x>
<y>4</y>
<width>601</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sort status by display priority. The lowest status will only be displayed if higher statuses are not assigned to the board.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>10</x>
<y>79</y>
<width>20</width>
<height>121</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>0</x>
<y>60</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Low</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>0</x>
<y>204</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>High</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>20</x>
<y>360</y>
<width>591</width>
<height>16</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<width>141</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Default (for new task)</string>
</property>
</widget>
<widget class="QComboBox" name="defaultStatusCombobox">
<property name="geometry">
<rect>
<x>440</x>
<y>384</y>
<width>171</width>
<height>26</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">

View File

@@ -16,6 +16,7 @@ TaskDialog::TaskDialog(QWidget *parent) :
QDate expectedFor = QDate::currentDate();
expectedFor = expectedFor.addDays(10);
ui->expectedForEdit->setDate(expectedFor);
ui->statusCombo->setCurrentText(TaskStateService::getInstance()->getDefaultStatus().getName());
}
TaskDialog::TaskDialog(Task *t, QWidget *parent) :

View File

@@ -6,6 +6,7 @@
#define DESCRIPTION_KEY "description"
#define AUTOSTATUS_KEY "auto_status"
#define STATUS_KEY "status"
#define SHOW_STATUS_KEY "show_status"
#include <QJsonArray>
#include <QJsonValue>
@@ -29,6 +30,7 @@ Board::Board(QJsonObject obj)
this->description = obj[DESCRIPTION_KEY].toString("");
this->autoStatus = obj[AUTOSTATUS_KEY].toBool(true);
this->statusUUID = obj[STATUS_KEY].toString();
this->showStatus = obj[SHOW_STATUS_KEY].toBool(!this->autoStatus);
QJsonArray jsonTasks = obj[TASKS_KEY].toArray();
foreach (QJsonValue value, jsonTasks) {
Task *t = new Task(value.toObject());
@@ -81,6 +83,11 @@ const QString Board::getStatus()
return statusUUID;
}
bool Board::isShowingStatus()
{
return showStatus;
}
bool Board::isAutoStatus()
{
return autoStatus;
@@ -102,6 +109,11 @@ void Board::setDirtyStatus(Status s)
this->statusUUID = s.getUUID();
}
void Board::setShowingStatus(bool v)
{
this->showStatus = v;
}
void Board::removeDirtyStatus()
{
this->autoStatus = true;
@@ -148,6 +160,7 @@ const QJsonObject Board::toJson()
obj[AUTOSTATUS_KEY] = this->autoStatus;
obj[TASKS_KEY] = array;
obj[DESCRIPTION_KEY] = description;
obj[SHOW_STATUS_KEY] = this->showStatus;
return obj;
}

View File

@@ -19,11 +19,13 @@ public:
const QString getName();
const QString getDescription();
const QString getStatus();
bool isShowingStatus();
bool isAutoStatus();
void setName(const QString name);
void setDescription(const QString description);
void setDirtyStatus(Status s);
void setShowingStatus(bool);
void removeDirtyStatus();
void add(Task);
@@ -42,6 +44,7 @@ private:
QString statusUUID;
bool autoStatus;
bool showStatus;
};

View File

@@ -21,6 +21,11 @@ void TaskStateService::updatePriorities(QVector<Priority> priorities)
this->priorities = priorities;
}
void TaskStateService::setDefaultStatus(Status s)
{
this->defaultStatus = s;
}
QVector<Status> TaskStateService::getStatuses()
{
return statuses;
@@ -31,6 +36,11 @@ QVector<Priority> TaskStateService::getPriorities()
return priorities;
}
Status TaskStateService::getDefaultStatus()
{
return this->defaultStatus;
}
std::optional<Status> TaskStateService::getStatusByUUID(QString uuid)
{
foreach (Status s, statuses) {
@@ -74,7 +84,9 @@ TaskStateService::TaskStateService()
priorities.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "Medium", QColor(176, 142, 48)));
priorities.append(Priority(QUuid::createUuid().toString(QUuid::WithoutBraces), "High", QColor(176, 67, 48)));
statuses.append(Status(QUuid::createUuid().toString(QUuid::WithoutBraces), "To Do", QColor(143, 143, 143)));
statuses.append(Status(QUuid::createUuid().toString(QUuid::WithoutBraces), "Working on", QColor(95, 48, 176)));
Status defaultStatus = Status(QUuid::createUuid().toString(QUuid::WithoutBraces), "To Do", QColor(143, 143, 143));
statuses.append(Status(QUuid::createUuid().toString(QUuid::WithoutBraces), "Completed", QColor(48, 176, 73)));
statuses.append(defaultStatus);
statuses.append(Status(QUuid::createUuid().toString(QUuid::WithoutBraces), "Working on", QColor(95, 48, 176)));
this->defaultStatus = defaultStatus;
}

View File

@@ -13,9 +13,11 @@ public:
void updateStatuses(QVector<Status>);
void updatePriorities(QVector<Priority>);
void setDefaultStatus(Status s);
QVector<Status> getStatuses();
QVector<Priority> getPriorities();
Status getDefaultStatus();
std::optional<Status> getStatusByUUID(QString);
std::optional<Priority> getPriorityByUUID(QString);
@@ -26,6 +28,8 @@ private:
TaskStateService();
static TaskStateService *instance;
Status defaultStatus = Status("", "", QColor::fromRgb(0,0,0));
QVector<Priority> priorities;
QVector<Status> statuses;
};