Compare commits
4 Commits
v0.2.0-bet
...
v0.2.1-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c95000b8f | ||
|
|
d0186d0759 | ||
|
|
3af0771b55 | ||
|
|
961dbd8aa0 |
@@ -4,8 +4,8 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
|
|||||||
|
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
|
|
||||||
win32:VERSION = 0.2.0.0 # major.minor.patch.build
|
win32:VERSION = 0.2.1.0 # major.minor.patch.build
|
||||||
else:VERSION = 0.2.0 # major.minor.patch
|
else:VERSION = 0.2.1 # major.minor.patch
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||||
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
|
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "ui_aboutdialog.h"
|
#include "ui_aboutdialog.h"
|
||||||
|
|
||||||
|
#ifdef unix
|
||||||
|
#include <gnu/libc-version.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget *parent) :
|
AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AboutDialog)
|
ui(new Ui::AboutDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
#ifdef APP_ARCH
|
||||||
ui->appName->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
|
ui->appName->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
|
||||||
QString os_version = APP_OS_VERSION;
|
#else
|
||||||
os_version = os_version.replace("-D", "");
|
ui->appName->setText(APP_NAME);
|
||||||
ui->version->setText(QString("v%1 %2/%3 (qt %4)").arg(APP_VERSION, APP_OS, os_version, QT_VERSION_STR));
|
#endif
|
||||||
|
QString compiler = getCompilerInfo();
|
||||||
|
ui->version->setText(QString("v%1-%3 (qt %4)").arg(APP_VERSION, compiler, QT_VERSION_STR));
|
||||||
ui->textEdit_2->append(QString("Qt Open Source %1").arg(QT_VERSION_STR));
|
ui->textEdit_2->append(QString("Qt Open Source %1").arg(QT_VERSION_STR));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,3 +24,20 @@ AboutDialog::~AboutDialog()
|
|||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AboutDialog::getCompilerInfo()
|
||||||
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
return QString("clang_%1").arg(__clang_version__);
|
||||||
|
#elif __GNUC__
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return QString("MinGW_%1.%2").arg(QString::number(__MINGW32_MAJOR_VERSION), QString::number(__MINGW32_MINOR_VERSION));
|
||||||
|
#else
|
||||||
|
return QString("GLIBC_%1").arg(gnu_get_libc_version());
|
||||||
|
#endif
|
||||||
|
#elif _MSC_VER
|
||||||
|
return QString("MSVC_%1").arg(_MSC_VER);
|
||||||
|
#else
|
||||||
|
return "unknown";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define ABOUTDIALOG_H
|
#define ABOUTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AboutDialog;
|
class AboutDialog;
|
||||||
@@ -17,6 +18,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AboutDialog *ui;
|
Ui::AboutDialog *ui;
|
||||||
|
QString getCompilerInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ABOUTDIALOG_H
|
#endif // ABOUTDIALOG_H
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ const Filter FilterDialog::getFilter()
|
|||||||
|
|
||||||
void FilterDialog::validateAndAccept()
|
void FilterDialog::validateAndAccept()
|
||||||
{
|
{
|
||||||
if (ui->nameEdit->text().count() == 0)
|
if (ui->nameEdit->text().length() == 0)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, "This filter needs a name", "You need to enter a name to save this filter");
|
QMessageBox::critical(this, "This filter needs a name", "You need to enter a name to save this filter");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
this->menuSelectedBoardItem = nullptr;
|
||||||
|
this->menuSelectedFilterItem = nullptr;
|
||||||
|
this->menuSelectedTaskItem = nullptr;
|
||||||
init();
|
init();
|
||||||
this->selectedBoardIndex = -1;
|
this->selectedBoardIndex = -1;
|
||||||
// Change "name" column size
|
// Change "name" column size
|
||||||
@@ -77,7 +80,8 @@ void MainWindow::openAbout()
|
|||||||
void MainWindow::prepareBoardMenu(const QPoint &pos)
|
void MainWindow::prepareBoardMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
if (ui->boardList->selectedItems().length() == 1) {
|
this->menuSelectedBoardItem = ui->boardList->itemAt(pos);
|
||||||
|
if (this->menuSelectedBoardItem != nullptr) {
|
||||||
QAction *renameAction = new QAction(tr("Edit board"), this);
|
QAction *renameAction = new QAction(tr("Edit board"), this);
|
||||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameBoardMenu);
|
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameBoardMenu);
|
||||||
menu.addAction(renameAction);
|
menu.addAction(renameAction);
|
||||||
@@ -99,15 +103,19 @@ void MainWindow::prepareTaskMenu(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
bool show = false;
|
bool show = false;
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
if (ui->taskList->selectedItems().length() == 1) {
|
this->menuSelectedTaskItem = ui->taskList->itemAt(pos);
|
||||||
|
if (menuSelectedTaskItem != nullptr) {
|
||||||
show = true;
|
show = true;
|
||||||
QAction *renameAction = new QAction(tr("Edit the task"), this);
|
QAction *renameAction = new QAction(tr("Edit the task"), this);
|
||||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameTaskMenu);
|
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameTaskMenu);
|
||||||
menu.addAction(renameAction);
|
menu.addAction(renameAction);
|
||||||
|
|
||||||
QAction *deleteAction = new QAction(tr("Delete from the board"), this);
|
if (selectedBoardIndex > -1)
|
||||||
connect(deleteAction, &QAction::triggered, this, &MainWindow::onRemoveTaskMenu);
|
{
|
||||||
menu.addAction(deleteAction);
|
QAction *deleteAction = new QAction(tr("Delete from the board"), this);
|
||||||
|
connect(deleteAction, &QAction::triggered, this, &MainWindow::onRemoveTaskMenu);
|
||||||
|
menu.addAction(deleteAction);
|
||||||
|
}
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
}
|
}
|
||||||
@@ -246,14 +254,18 @@ void MainWindow::onEditTask(QTreeWidgetItem *item)
|
|||||||
|
|
||||||
void MainWindow::onRemoveBoardMenu()
|
void MainWindow::onRemoveBoardMenu()
|
||||||
{
|
{
|
||||||
if (selectedBoardIndex > -1)
|
if (menuSelectedBoardItem != nullptr)
|
||||||
{
|
{
|
||||||
|
int i = ui->filterListWidget->indexFromItem(menuSelectedFilterItem).row();
|
||||||
QMessageBox::StandardButton result = QMessageBox::question(this, "Delete a board", "Do you want to delete this board?");
|
QMessageBox::StandardButton result = QMessageBox::question(this, "Delete a board", "Do you want to delete this board?");
|
||||||
if (result == QMessageBox::Yes)
|
if (result == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
boards.removeAt(selectedBoardIndex);
|
boards.removeAt(i);
|
||||||
delete ui->boardList->takeItem(selectedBoardIndex);
|
delete ui->boardList->takeItem(i);
|
||||||
selectedBoardIndex = -1;
|
if (selectedBoardIndex == i)
|
||||||
|
{
|
||||||
|
selectedBoardIndex = -1;
|
||||||
|
}
|
||||||
redrawTaskTree();
|
redrawTaskTree();
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@@ -278,14 +290,18 @@ void MainWindow::onRemoveTaskMenu()
|
|||||||
|
|
||||||
void MainWindow::onRemoveFilterMenu()
|
void MainWindow::onRemoveFilterMenu()
|
||||||
{
|
{
|
||||||
if (selectedFilterIndex > -1)
|
if (menuSelectedFilterItem != nullptr)
|
||||||
{
|
{
|
||||||
|
int i = ui->filterListWidget->indexFromItem(menuSelectedFilterItem).row();
|
||||||
QMessageBox::StandardButton result = QMessageBox::question(this, "Delete a filter", "Do you want to delete this filter?");
|
QMessageBox::StandardButton result = QMessageBox::question(this, "Delete a filter", "Do you want to delete this filter?");
|
||||||
if (result == QMessageBox::Yes)
|
if (result == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
filters.removeAt(selectedFilterIndex);
|
filters.removeAt(i);
|
||||||
delete ui->filterListWidget->takeItem(selectedFilterIndex);
|
delete ui->filterListWidget->takeItem(i);
|
||||||
selectedFilterIndex = -1;
|
if (selectedFilterIndex == i)
|
||||||
|
{
|
||||||
|
selectedFilterIndex = -1;
|
||||||
|
}
|
||||||
redrawTaskTree();
|
redrawTaskTree();
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@@ -294,9 +310,10 @@ void MainWindow::onRemoveFilterMenu()
|
|||||||
|
|
||||||
void MainWindow::onEditNameBoardMenu()
|
void MainWindow::onEditNameBoardMenu()
|
||||||
{
|
{
|
||||||
if (selectedBoardIndex > -1)
|
if (menuSelectedBoardItem != nullptr)
|
||||||
{
|
{
|
||||||
Board *b = boards.at(selectedBoardIndex);
|
int i = ui->filterListWidget->indexFromItem(menuSelectedFilterItem).row();
|
||||||
|
Board *b = boards.at(i);
|
||||||
NameDialog dialog("Edit board name", b->getName(), b->getDescription(), this);
|
NameDialog dialog("Edit board name", b->getName(), b->getDescription(), this);
|
||||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||||
{
|
{
|
||||||
@@ -304,7 +321,7 @@ void MainWindow::onEditNameBoardMenu()
|
|||||||
QString newDesc = dialog.getDescription();
|
QString newDesc = dialog.getDescription();
|
||||||
b->setName(newName);
|
b->setName(newName);
|
||||||
b->setDescription(newDesc);
|
b->setDescription(newDesc);
|
||||||
QListWidgetItem *item = ui->boardList->item(selectedBoardIndex);
|
QListWidgetItem *item = ui->boardList->item(i);
|
||||||
item->setText(newName);
|
item->setText(newName);
|
||||||
item->setToolTip(newDesc);
|
item->setToolTip(newDesc);
|
||||||
ui->label->setText(newName);
|
ui->label->setText(newName);
|
||||||
@@ -325,9 +342,10 @@ void MainWindow::onEditNameTaskMenu()
|
|||||||
|
|
||||||
void MainWindow::onEditFilterMenu()
|
void MainWindow::onEditFilterMenu()
|
||||||
{
|
{
|
||||||
if (selectedFilterIndex > -1)
|
if (menuSelectedFilterItem != nullptr)
|
||||||
{
|
{
|
||||||
Filter f = filters[selectedFilterIndex];
|
int i = ui->filterListWidget->indexFromItem(menuSelectedFilterItem).row();
|
||||||
|
Filter f = filters[i];
|
||||||
FilterDialog dialog("Edit the filter", f, boards, status, priorities, this);
|
FilterDialog dialog("Edit the filter", f, boards, status, priorities, this);
|
||||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||||
{
|
{
|
||||||
@@ -347,7 +365,8 @@ void MainWindow::onEditFilterMenu()
|
|||||||
void MainWindow::prepareFilterMenu(const QPoint &pos)
|
void MainWindow::prepareFilterMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
if (ui->filterListWidget->selectedItems().length() == 1) {
|
this->menuSelectedFilterItem = ui->filterListWidget->itemAt(pos);
|
||||||
|
if (this->menuSelectedFilterItem != nullptr) {
|
||||||
QAction *renameAction = new QAction(tr("Edit the filter"), this);
|
QAction *renameAction = new QAction(tr("Edit the filter"), this);
|
||||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditFilterMenu);
|
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditFilterMenu);
|
||||||
menu.addAction(renameAction);
|
menu.addAction(renameAction);
|
||||||
@@ -511,26 +530,24 @@ const QJsonDocument MainWindow::getJsonSave()
|
|||||||
|
|
||||||
Task *MainWindow::getSelectedTask()
|
Task *MainWindow::getSelectedTask()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
||||||
|
if (items.count() != 1)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
if (selectedBoardIndex > -1)
|
if (selectedBoardIndex > -1)
|
||||||
{
|
{
|
||||||
Board *b = boards[selectedBoardIndex];
|
Board *b = boards[selectedBoardIndex];
|
||||||
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
||||||
if (items.count() == 1)
|
return b->taskAt(i);
|
||||||
{
|
|
||||||
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
|
||||||
return b->taskAt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (selectedFilterIndex > -1)
|
else if (selectedFilterIndex > -1)
|
||||||
{
|
{
|
||||||
if (!filterResult.empty())
|
if (!filterResult.empty())
|
||||||
{
|
{
|
||||||
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
||||||
if (items.count() == 1)
|
return filterResult[i];
|
||||||
{
|
|
||||||
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
|
||||||
return filterResult[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -556,6 +573,12 @@ void MainWindow::updateTaskRow(QTreeWidgetItem *item, Task t)
|
|||||||
fgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
fgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||||
item->setForeground(3, fgColor);
|
item->setForeground(3, fgColor);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QBrush fgColor = item->foreground(3);
|
||||||
|
fgColor.setStyle(Qt::BrushStyle::NoBrush);
|
||||||
|
item->setForeground(3, fgColor);
|
||||||
|
}
|
||||||
|
|
||||||
if (!t.getStatusUUID().isEmpty())
|
if (!t.getStatusUUID().isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
#include <QListWidgetItem>
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
@@ -50,6 +51,10 @@ private:
|
|||||||
int16_t selectedBoardIndex;
|
int16_t selectedBoardIndex;
|
||||||
int16_t selectedFilterIndex;
|
int16_t selectedFilterIndex;
|
||||||
|
|
||||||
|
QListWidgetItem *menuSelectedFilterItem;
|
||||||
|
QListWidgetItem *menuSelectedBoardItem;
|
||||||
|
QTreeWidgetItem *menuSelectedTaskItem;
|
||||||
|
|
||||||
QVector<Task*> filterResult;
|
QVector<Task*> filterResult;
|
||||||
|
|
||||||
QVector<Priority> priorities;
|
QVector<Priority> priorities;
|
||||||
|
|||||||
@@ -164,6 +164,7 @@
|
|||||||
<string>Board</string>
|
<string>Board</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionNew"/>
|
<addaction name="actionNew"/>
|
||||||
|
<addaction name="actionNew_filter"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuTask">
|
<widget class="QMenu" name="menuTask">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ const QJsonObject Board::toJson()
|
|||||||
}
|
}
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj[NAME_KEY] = this->name;
|
obj[NAME_KEY] = this->name;
|
||||||
|
obj[UUID_KEY] = this->uuid;
|
||||||
obj[TASKS_KEY] = array;
|
obj[TASKS_KEY] = array;
|
||||||
obj[DESCRIPTION_KEY] = description;
|
obj[DESCRIPTION_KEY] = description;
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
Reference in New Issue
Block a user