Create filter dialog, board description
This commit is contained in:
@@ -68,6 +68,7 @@ linux-* {
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
src/frames/filterdialog.cpp \
|
||||
src/frames/aboutdialog.cpp \
|
||||
src/models/board.cpp \
|
||||
src/main.cpp \
|
||||
@@ -82,6 +83,7 @@ SOURCES += \
|
||||
src/tools.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/frames/filterdialog.h \
|
||||
src/frames/aboutdialog.h \
|
||||
src/models/board.h \
|
||||
src/frames/mainwindow.h \
|
||||
@@ -95,6 +97,7 @@ HEADERS += \
|
||||
src/tools.h
|
||||
|
||||
FORMS += \
|
||||
src/frames/filterdialog.ui \
|
||||
src/frames/aboutdialog.ui \
|
||||
src/frames/mainwindow.ui \
|
||||
src/frames/namedialog.ui \
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>resources/logo.png</file>
|
||||
<file>resources/board_add.png</file>
|
||||
<file>resources/task_add.png</file>
|
||||
<file>resources/add_filter.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
resources/add_filter.png
Normal file
BIN
resources/add_filter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/board_add.png
Normal file
BIN
resources/board_add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
resources/task_add.png
Normal file
BIN
resources/task_add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
80
src/frames/filterdialog.cpp
Normal file
80
src/frames/filterdialog.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
#include "filterdialog.h"
|
||||
#include "ui_filterdialog.h"
|
||||
|
||||
FilterDialog::FilterDialog(QString dialogTitle, QVector<Board*> boards, QVector<Status> status, QVector<Priority> priorities, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FilterDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowTitle(dialogTitle);
|
||||
|
||||
for (Board *b : boards)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
item->setText(b->getName());
|
||||
item->setData(1, b->getUuid());
|
||||
ui->boardListWidget->addItem(item);
|
||||
}
|
||||
|
||||
for (Status s : status)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
item->setText(s.getName());
|
||||
item->setData(1, s.getUUID());
|
||||
ui->statusListWidget->addItem(item);
|
||||
}
|
||||
|
||||
for (Priority p : priorities)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
item->setText(p.getName());
|
||||
item->setData(1, p.getUUID());
|
||||
ui->priorityListWidget->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
FilterDialog::~FilterDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
const Filter FilterDialog::getFilter()
|
||||
{
|
||||
QString name = ui->nameEdit->text();
|
||||
uint8_t dateComparation = 0;
|
||||
if (ui->dateComparationCombobox->currentIndex() > -1)
|
||||
{
|
||||
dateComparation = ui->dateComparationCombobox->currentIndex();
|
||||
}
|
||||
QVector<QString> boards;
|
||||
for (int i = 0; i < ui->boardListWidget->count(); ++i) {
|
||||
QListWidgetItem *item = ui->boardListWidget->item(i);
|
||||
if (item->checkState() == Qt::Checked)
|
||||
{
|
||||
boards.append(item->data(1).toString());
|
||||
}
|
||||
}
|
||||
QVector<QString> status;
|
||||
for (int i = 0; i < ui->statusListWidget->count(); ++i) {
|
||||
QListWidgetItem *item = ui->statusListWidget->item(i);
|
||||
if (item->checkState() == Qt::Checked)
|
||||
{
|
||||
status.append(item->data(1).toString());
|
||||
}
|
||||
}
|
||||
QVector<QString> priorities;
|
||||
for (int i = 0; i < ui->priorityListWidget->count(); ++i) {
|
||||
QListWidgetItem *item = ui->priorityListWidget->item(i);
|
||||
if (item->checkState() == Qt::Checked)
|
||||
{
|
||||
priorities.append(item->data(1).toString());
|
||||
}
|
||||
}
|
||||
return Filter(name, dateComparation, boards, status, priorities);
|
||||
}
|
||||
28
src/frames/filterdialog.h
Normal file
28
src/frames/filterdialog.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef FILTERDIALOG_H
|
||||
#define FILTERDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../models/board.h"
|
||||
#include "../models/priority.h"
|
||||
#include "../models/status.h"
|
||||
#include "../models/filter.h"
|
||||
|
||||
namespace Ui {
|
||||
class FilterDialog;
|
||||
}
|
||||
|
||||
class FilterDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterDialog(QString dialogTitle, QVector<Board*> boards, QVector<Status> status, QVector<Priority> priorities, QWidget *parent = nullptr);
|
||||
~FilterDialog();
|
||||
const Filter getFilter();
|
||||
|
||||
private:
|
||||
Ui::FilterDialog *ui;
|
||||
};
|
||||
|
||||
#endif // FILTERDIALOG_H
|
||||
169
src/frames/filterdialog.ui
Normal file
169
src/frames/filterdialog.ui
Normal file
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterDialog</class>
|
||||
<widget class="QDialog" name="FilterDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>509</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Filter name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nameEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Date comparation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="dateComparationCombobox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ignore date</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On time</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>End today</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ended</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Boards (None = all)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="boardListWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionRectVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Status (None = all)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="statusListWidget">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Priority (None = all)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="priorityListWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FilterDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FilterDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "aboutdialog.h"
|
||||
#include "namedialog.h"
|
||||
#include "taskdialog.h"
|
||||
#include "filterdialog.h"
|
||||
#include "../tools.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
@@ -32,6 +33,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::openAbout);
|
||||
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::onNewBoardClick);
|
||||
connect(ui->actionNew_task, &QAction::triggered, this, &MainWindow::onNewTaskClick);
|
||||
connect(ui->actionNew_filter, &QAction::triggered, this, &MainWindow::onNewFilterClick);
|
||||
connect(ui->boardList, &QListWidget::currentRowChanged, this, &MainWindow::onBoardSelected);
|
||||
connect(ui->boardList, &QListWidget::customContextMenuRequested, this, &MainWindow::prepareBoardMenu);
|
||||
connect(ui->taskList, &QTreeWidget::itemDoubleClicked, this, &MainWindow::onEditTask);
|
||||
@@ -70,51 +72,57 @@ void MainWindow::openAbout()
|
||||
|
||||
void MainWindow::prepareBoardMenu(const QPoint &pos)
|
||||
{
|
||||
if (ui->boardList->selectedItems().length() == 1) {
|
||||
QMenu menu(this);
|
||||
|
||||
QAction *renameAction = new QAction(tr("Rename this board"), this);
|
||||
if (ui->boardList->selectedItems().length() == 1) {
|
||||
QAction *renameAction = new QAction(tr("Edit board"), this);
|
||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameBoardMenu);
|
||||
menu.addAction(renameAction);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction *deleteAction = new QAction(tr("Delete this board"), this);
|
||||
QAction *deleteAction = new QAction(tr("Delete the board and all the tasks"), this);
|
||||
connect(deleteAction, &QAction::triggered, this, &MainWindow::onRemoveBoardMenu);
|
||||
menu.addAction(deleteAction);
|
||||
|
||||
menu.exec(ui->boardList->mapToGlobal(pos));
|
||||
menu.addSeparator();
|
||||
}
|
||||
QAction *addAction = new QAction(tr("New board"), this);
|
||||
connect(addAction, &QAction::triggered, this, &MainWindow::onNewBoardClick);
|
||||
menu.addAction(addAction);
|
||||
|
||||
menu.exec(ui->boardList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void MainWindow::prepareTaskMenu(const QPoint &pos)
|
||||
{
|
||||
if (ui->taskList->selectedItems().length() == 1) {
|
||||
QMenu menu(this);
|
||||
|
||||
if (ui->taskList->selectedItems().length() == 1) {
|
||||
QAction *renameAction = new QAction(tr("Edit the task"), this);
|
||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameTaskMenu);
|
||||
menu.addAction(renameAction);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction *deleteAction = new QAction(tr("Delete from the board"), this);
|
||||
connect(deleteAction, &QAction::triggered, this, &MainWindow::onRemoveTaskMenu);
|
||||
menu.addAction(deleteAction);
|
||||
|
||||
menu.exec(ui->taskList->mapToGlobal(pos));
|
||||
menu.addSeparator();
|
||||
}
|
||||
QAction *addAction = new QAction(tr("New task"), this);
|
||||
connect(addAction, &QAction::triggered, this, &MainWindow::onNewTaskClick);
|
||||
menu.addAction(addAction);
|
||||
|
||||
menu.exec(ui->taskList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void MainWindow::onNewBoardClick()
|
||||
{
|
||||
NameDialog dialog("Create a board", "New empty board", this);
|
||||
NameDialog dialog("Create a board", "New empty board", "", this);
|
||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||
{
|
||||
QString name = dialog.getChoosenName();
|
||||
Board *b = new Board(name);
|
||||
QString desc = dialog.getDescription();
|
||||
Board *b = new Board(name, desc);
|
||||
boards.append(b);
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
item->setStatusTip(desc);
|
||||
ui->boardList->addItem(item);
|
||||
save();
|
||||
}
|
||||
@@ -138,6 +146,17 @@ void MainWindow::onNewTaskClick()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onNewFilterClick()
|
||||
{
|
||||
FilterDialog dialog("New filter", boards, status, priorities, this);
|
||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||
{
|
||||
Filter f = dialog.getFilter();
|
||||
QListWidgetItem *item = new QListWidgetItem(f.getName());
|
||||
ui->filterListWidget->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onBoardSelected(int i)
|
||||
{
|
||||
selectedBoardIndex = i;
|
||||
@@ -145,11 +164,13 @@ void MainWindow::onBoardSelected(int i)
|
||||
{
|
||||
Board *b = boards[selectedBoardIndex];
|
||||
ui->label->setText(b->getName());
|
||||
ui->boardDescription->setText(b->getDescription());
|
||||
ui->actionNew_task->setDisabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->label->setText("<- Select a board");
|
||||
ui->label->setText("No board selected");
|
||||
ui->boardDescription->clear();
|
||||
ui->actionNew_task->setDisabled(true);
|
||||
}
|
||||
redrawTaskTree();
|
||||
@@ -213,13 +234,18 @@ void MainWindow::onEditNameBoardMenu()
|
||||
if (selectedBoardIndex > -1)
|
||||
{
|
||||
Board *b = boards.at(selectedBoardIndex);
|
||||
NameDialog dialog("Edit board name", b->getName(), this);
|
||||
NameDialog dialog("Edit board name", b->getName(), b->getDescription(), this);
|
||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||
{
|
||||
QString newName= dialog.getChoosenName();
|
||||
QString newName = dialog.getChoosenName();
|
||||
QString newDesc = dialog.getDescription();
|
||||
b->setName(newName);
|
||||
ui->boardList->item(selectedBoardIndex)->setText(newName);
|
||||
b->setDescription(newDesc);
|
||||
QListWidgetItem *item = ui->boardList->item(selectedBoardIndex);
|
||||
item->setText(newName);
|
||||
item->setToolTip(newDesc);
|
||||
ui->label->setText(newName);
|
||||
ui->boardDescription->setText(newDesc);
|
||||
save();
|
||||
}
|
||||
}
|
||||
@@ -281,6 +307,12 @@ QVector<Status> MainWindow::defaultStatus()
|
||||
return res;
|
||||
}
|
||||
|
||||
QVector<Filter> MainWindow::defaultFilters()
|
||||
{
|
||||
QVector<Filter> res;
|
||||
return res;
|
||||
}
|
||||
|
||||
const QString MainWindow::getPriorityLabel(QString uuid)
|
||||
{
|
||||
QString res = "";
|
||||
@@ -416,6 +448,7 @@ void MainWindow::redrawBoardList()
|
||||
foreach (Board *b, boards)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(b->getName());
|
||||
item->setToolTip(b->getDescription());
|
||||
l->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "../models/priority.h"
|
||||
#include "../models/status.h"
|
||||
#include "../models/board.h"
|
||||
#include "../models/filter.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
@@ -27,6 +28,7 @@ private slots:
|
||||
void openAbout();
|
||||
void onNewBoardClick();
|
||||
void onNewTaskClick();
|
||||
void onNewFilterClick();
|
||||
void onBoardSelected(int i);
|
||||
void onEditTask(QTreeWidgetItem*);
|
||||
void onRemoveBoardMenu();
|
||||
@@ -45,9 +47,11 @@ private:
|
||||
QVector<Priority> priorities;
|
||||
QVector<Status> status;
|
||||
QVector<Board*> boards;
|
||||
QVector<Filter> filters;
|
||||
|
||||
QVector<Priority> defaultPriorities();
|
||||
QVector<Status> defaultStatus();
|
||||
QVector<Filter> defaultFilters();
|
||||
|
||||
const QString getPriorityLabel(QString uuid);
|
||||
const QString getStatusLabel(QString uuid);
|
||||
|
||||
@@ -26,6 +26,41 @@
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="filterListWidget">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Boards</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="boardList">
|
||||
<property name="minimumSize">
|
||||
@@ -45,17 +80,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>26</pointsize>
|
||||
<pointsize>19</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><- Select a board</string>
|
||||
<string>No board selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="boardDescription">
|
||||
<property name="text">
|
||||
<string>Create or select a board to start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -101,7 +148,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1159</width>
|
||||
<height>24</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuAbout">
|
||||
@@ -128,15 +175,49 @@
|
||||
<addaction name="menuTask"/>
|
||||
<addaction name="menuAbout"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionNew_task"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNew_filter"/>
|
||||
</widget>
|
||||
<action name="actionPreferences">
|
||||
<property name="text">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/images/resources/board_add.png</normaloff>:/images/resources/board_add.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Board</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N, Ctrl+B</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
@@ -147,11 +228,32 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/images/resources/task_add.png</normaloff>:/images/resources/task_add.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New task</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N, Ctrl+T</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_filter">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/images/resources/add_filter.png</normaloff>:/images/resources/add_filter.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New filter</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N, Ctrl+F</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "namedialog.h"
|
||||
#include "ui_namedialog.h"
|
||||
|
||||
NameDialog::NameDialog(QString label, QString defaultName, QWidget *parent) :
|
||||
NameDialog::NameDialog(QString label, QString defaultName, QString description, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NameDialog)
|
||||
{
|
||||
@@ -9,6 +9,7 @@ NameDialog::NameDialog(QString label, QString defaultName, QWidget *parent) :
|
||||
this->setWindowTitle(label);
|
||||
this->defaultName = defaultName;
|
||||
ui->lineEdit->setText(defaultName);
|
||||
ui->descriptionTextEdit->setPlainText(description);
|
||||
}
|
||||
|
||||
NameDialog::~NameDialog()
|
||||
@@ -24,3 +25,10 @@ const QString NameDialog::getChoosenName()
|
||||
}
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
const QString NameDialog::getDescription()
|
||||
{
|
||||
return ui->descriptionTextEdit->toPlainText();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ class NameDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NameDialog(QString label, QString defaultName, QWidget *parent = nullptr);
|
||||
explicit NameDialog(QString label, QString defaultName, QString description, QWidget *parent = nullptr);
|
||||
~NameDialog();
|
||||
const QString getChoosenName();
|
||||
const QString getDescription();
|
||||
|
||||
private:
|
||||
Ui::NameDialog *ui;
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>133</height>
|
||||
<height>227</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>133</height>
|
||||
<height>227</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>133</height>
|
||||
<height>227</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -34,8 +34,8 @@
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>90</y>
|
||||
<x>50</x>
|
||||
<y>190</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
@@ -51,7 +51,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<y>33</y>
|
||||
<width>381</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@@ -61,7 +61,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<y>13</y>
|
||||
<width>58</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@@ -70,6 +70,29 @@
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<width>181</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="descriptionTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>381</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
#define NAME_KEY "name"
|
||||
#define TASKS_KEY "tasks"
|
||||
#define UUID_KEY "uuid"
|
||||
#define DESCRIPTION_KEY "description"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QUuid>
|
||||
|
||||
Board::Board(QString name)
|
||||
Board::Board(QString name, QString description)
|
||||
{
|
||||
QUuid uuid = QUuid::createUuid();
|
||||
this->uuid = uuid.toString(QUuid::WithoutBraces);
|
||||
this->name = name;
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
Board::Board(QJsonObject obj)
|
||||
@@ -20,8 +22,9 @@ Board::Board(QJsonObject obj)
|
||||
QUuid uuid = QUuid::createUuid();
|
||||
this->uuid = obj[UUID_KEY].toString(uuid.toString(QUuid::WithoutBraces));
|
||||
this->name = obj[NAME_KEY].toString("!Missing name!");
|
||||
this->description = obj[DESCRIPTION_KEY].toString("");
|
||||
QJsonArray jsonTasks = obj[TASKS_KEY].toArray();
|
||||
for (QJsonValue value : jsonTasks) {
|
||||
foreach (QJsonValue value, jsonTasks) {
|
||||
Task *t = new Task(value.toObject());
|
||||
this->tasks.append(t);
|
||||
}
|
||||
@@ -46,11 +49,21 @@ const QString Board::getName()
|
||||
return name;
|
||||
}
|
||||
|
||||
const QString Board::getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
void Board::setName(const QString name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
void Board::setDescription(const QString description)
|
||||
{
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
void Board::add(Task t)
|
||||
{
|
||||
tasks.append(new Task(t));
|
||||
@@ -87,6 +100,7 @@ const QJsonObject Board::toJson()
|
||||
QJsonObject obj;
|
||||
obj[NAME_KEY] = this->name;
|
||||
obj[TASKS_KEY] = array;
|
||||
obj[DESCRIPTION_KEY] = description;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
class Board
|
||||
{
|
||||
public:
|
||||
Board(QString name);
|
||||
Board(QString name, QString description);
|
||||
Board(QJsonObject);
|
||||
~Board();
|
||||
|
||||
const QString getUuid();
|
||||
const QString getName();
|
||||
const QString getDescription();
|
||||
void setName(const QString name);
|
||||
void setDescription(const QString description);
|
||||
void add(Task);
|
||||
void remove(uint16_t index);
|
||||
Task *taskAt(uint16_t);
|
||||
@@ -28,6 +30,7 @@ private:
|
||||
QVector<Task*> tasks;
|
||||
QString uuid;
|
||||
QString name;
|
||||
QString description;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "filter.h"
|
||||
#include "qjsonarray.h"
|
||||
|
||||
#define NAME_KEY "name"
|
||||
#define DATE_KEY "date"
|
||||
@@ -6,7 +7,7 @@
|
||||
#define STATUS_KEY "status"
|
||||
#define PRIORITY_KEY "priority"
|
||||
|
||||
filter::filter(QString name, uint8 expectedForComparator, QVector<QString> boards, QVector<QString> status, QVector<QString> priorities)
|
||||
Filter::Filter(QString name, uint8_t expectedForComparator, QVector<QString> boards, QVector<QString> status, QVector<QString> priorities)
|
||||
{
|
||||
this->name = name;
|
||||
this->expectedForComparator = expectedForComparator;
|
||||
@@ -15,7 +16,7 @@ filter::filter(QString name, uint8 expectedForComparator, QVector<QString> board
|
||||
this->priorities = priorities;
|
||||
}
|
||||
|
||||
filter::filter(QJsonObject obj)
|
||||
Filter::Filter(QJsonObject obj)
|
||||
{
|
||||
this->name = obj[NAME_KEY].toString("!Missing name!");
|
||||
this->expectedForComparator = obj[DATE_KEY].toInt();
|
||||
@@ -45,7 +46,7 @@ filter::filter(QJsonObject obj)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<Task *> filter::get(QVector<Board *> allBoards)
|
||||
QVector<Task *> Filter::get(QVector<Board *> allBoards)
|
||||
{
|
||||
QDate now = QDate::currentDate();
|
||||
QVector<Board*> selectedBoards;
|
||||
@@ -85,7 +86,7 @@ QVector<Task *> filter::get(QVector<Board *> allBoards)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool filter::filterStatus(Task *t)
|
||||
bool Filter::filterStatus(Task *t)
|
||||
{
|
||||
if (status.count() == 0)
|
||||
{
|
||||
@@ -102,7 +103,7 @@ bool filter::filterStatus(Task *t)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool filter::filterPriority(Task *t)
|
||||
bool Filter::filterPriority(Task *t)
|
||||
{
|
||||
if (priorities.count() == 0)
|
||||
{
|
||||
@@ -119,7 +120,7 @@ bool filter::filterPriority(Task *t)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool filter::filterDate(Task *t, QDate now)
|
||||
bool Filter::filterDate(Task *t, QDate now)
|
||||
{
|
||||
switch (expectedForComparator) {
|
||||
case 0:
|
||||
@@ -134,7 +135,12 @@ bool filter::filterDate(Task *t, QDate now)
|
||||
return false;
|
||||
}
|
||||
|
||||
const QJsonObject filter::toJson()
|
||||
const QString Filter::getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
const QJsonObject Filter::toJson()
|
||||
{
|
||||
QJsonObject obj;
|
||||
obj[name] = name;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "task.h"
|
||||
#include "board.h"
|
||||
|
||||
class filter
|
||||
class Filter
|
||||
{
|
||||
private:
|
||||
QString name;
|
||||
@@ -19,14 +19,17 @@ private:
|
||||
QVector<QString> status;
|
||||
QVector<QString> priorities;
|
||||
public:
|
||||
filter(QString name, uint8 expectedForComparator,QVector<QString> boards,QVector<QString> status,QVector<QString> priorities);
|
||||
filter(QJsonObject obj);
|
||||
Filter(QString name, uint8_t expectedForComparator,QVector<QString> boards,QVector<QString> status,QVector<QString> priorities);
|
||||
Filter(QJsonObject obj);
|
||||
|
||||
QVector<Task*> get(QVector<Board*>);
|
||||
|
||||
bool filterStatus(Task *t);
|
||||
bool filterPriority(Task *t);
|
||||
bool filterDate(Task *t, QDate now);
|
||||
|
||||
const QString getName();
|
||||
|
||||
const QJsonObject toJson();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user