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
|
||||
|
||||
win32:VERSION = 0.2.0.0 # major.minor.patch.build
|
||||
else:VERSION = 0.2.0 # major.minor.patch
|
||||
win32:VERSION = 0.2.1.0 # major.minor.patch.build
|
||||
else:VERSION = 0.2.1 # major.minor.patch
|
||||
|
||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||
DEFINES += APP_NAME=\"\\\"TaskBoard\\\"\"
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
#ifdef unix
|
||||
#include <gnu/libc-version.h>
|
||||
#endif
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
#ifdef APP_ARCH
|
||||
ui->appName->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
|
||||
QString os_version = APP_OS_VERSION;
|
||||
os_version = os_version.replace("-D", "");
|
||||
ui->version->setText(QString("v%1 %2/%3 (qt %4)").arg(APP_VERSION, APP_OS, os_version, QT_VERSION_STR));
|
||||
#else
|
||||
ui->appName->setText(APP_NAME);
|
||||
#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));
|
||||
}
|
||||
|
||||
@@ -17,3 +24,20 @@ AboutDialog::~AboutDialog()
|
||||
{
|
||||
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
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
@@ -17,6 +18,7 @@ public:
|
||||
|
||||
private:
|
||||
Ui::AboutDialog *ui;
|
||||
QString getCompilerInfo();
|
||||
};
|
||||
|
||||
#endif // ABOUTDIALOG_H
|
||||
|
||||
@@ -137,7 +137,7 @@ const Filter FilterDialog::getFilter()
|
||||
|
||||
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");
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->menuSelectedBoardItem = nullptr;
|
||||
this->menuSelectedFilterItem = nullptr;
|
||||
this->menuSelectedTaskItem = nullptr;
|
||||
init();
|
||||
this->selectedBoardIndex = -1;
|
||||
// Change "name" column size
|
||||
@@ -77,7 +80,8 @@ void MainWindow::openAbout()
|
||||
void MainWindow::prepareBoardMenu(const QPoint &pos)
|
||||
{
|
||||
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);
|
||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameBoardMenu);
|
||||
menu.addAction(renameAction);
|
||||
@@ -99,15 +103,19 @@ void MainWindow::prepareTaskMenu(const QPoint &pos)
|
||||
{
|
||||
bool show = false;
|
||||
QMenu menu(this);
|
||||
if (ui->taskList->selectedItems().length() == 1) {
|
||||
this->menuSelectedTaskItem = ui->taskList->itemAt(pos);
|
||||
if (menuSelectedTaskItem != nullptr) {
|
||||
show = true;
|
||||
QAction *renameAction = new QAction(tr("Edit the task"), this);
|
||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditNameTaskMenu);
|
||||
menu.addAction(renameAction);
|
||||
|
||||
if (selectedBoardIndex > -1)
|
||||
{
|
||||
QAction *deleteAction = new QAction(tr("Delete from the board"), this);
|
||||
connect(deleteAction, &QAction::triggered, this, &MainWindow::onRemoveTaskMenu);
|
||||
menu.addAction(deleteAction);
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
}
|
||||
@@ -246,14 +254,18 @@ void MainWindow::onEditTask(QTreeWidgetItem *item)
|
||||
|
||||
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?");
|
||||
if (result == QMessageBox::Yes)
|
||||
{
|
||||
boards.removeAt(selectedBoardIndex);
|
||||
delete ui->boardList->takeItem(selectedBoardIndex);
|
||||
boards.removeAt(i);
|
||||
delete ui->boardList->takeItem(i);
|
||||
if (selectedBoardIndex == i)
|
||||
{
|
||||
selectedBoardIndex = -1;
|
||||
}
|
||||
redrawTaskTree();
|
||||
save();
|
||||
}
|
||||
@@ -278,14 +290,18 @@ void MainWindow::onRemoveTaskMenu()
|
||||
|
||||
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?");
|
||||
if (result == QMessageBox::Yes)
|
||||
{
|
||||
filters.removeAt(selectedFilterIndex);
|
||||
delete ui->filterListWidget->takeItem(selectedFilterIndex);
|
||||
filters.removeAt(i);
|
||||
delete ui->filterListWidget->takeItem(i);
|
||||
if (selectedFilterIndex == i)
|
||||
{
|
||||
selectedFilterIndex = -1;
|
||||
}
|
||||
redrawTaskTree();
|
||||
save();
|
||||
}
|
||||
@@ -294,9 +310,10 @@ void MainWindow::onRemoveFilterMenu()
|
||||
|
||||
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);
|
||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||
{
|
||||
@@ -304,7 +321,7 @@ void MainWindow::onEditNameBoardMenu()
|
||||
QString newDesc = dialog.getDescription();
|
||||
b->setName(newName);
|
||||
b->setDescription(newDesc);
|
||||
QListWidgetItem *item = ui->boardList->item(selectedBoardIndex);
|
||||
QListWidgetItem *item = ui->boardList->item(i);
|
||||
item->setText(newName);
|
||||
item->setToolTip(newDesc);
|
||||
ui->label->setText(newName);
|
||||
@@ -325,9 +342,10 @@ void MainWindow::onEditNameTaskMenu()
|
||||
|
||||
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);
|
||||
if (dialog.exec() == QDialog::DialogCode::Accepted)
|
||||
{
|
||||
@@ -347,7 +365,8 @@ void MainWindow::onEditFilterMenu()
|
||||
void MainWindow::prepareFilterMenu(const QPoint &pos)
|
||||
{
|
||||
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);
|
||||
connect(renameAction, &QAction::triggered, this, &MainWindow::onEditFilterMenu);
|
||||
menu.addAction(renameAction);
|
||||
@@ -511,28 +530,26 @@ const QJsonDocument MainWindow::getJsonSave()
|
||||
|
||||
Task *MainWindow::getSelectedTask()
|
||||
{
|
||||
|
||||
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
||||
if (items.count() != 1)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (selectedBoardIndex > -1)
|
||||
{
|
||||
Board *b = boards[selectedBoardIndex];
|
||||
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
||||
if (items.count() == 1)
|
||||
{
|
||||
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
||||
return b->taskAt(i);
|
||||
}
|
||||
}
|
||||
else if (selectedFilterIndex > -1)
|
||||
{
|
||||
if (!filterResult.empty())
|
||||
{
|
||||
QList<QTreeWidgetItem*> items = ui->taskList->selectedItems();
|
||||
if (items.count() == 1)
|
||||
{
|
||||
int16_t i = ui->taskList->indexOfTopLevelItem(items[0]);
|
||||
return filterResult[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -556,6 +573,12 @@ void MainWindow::updateTaskRow(QTreeWidgetItem *item, Task t)
|
||||
fgColor.setStyle(Qt::BrushStyle::SolidPattern);
|
||||
item->setForeground(3, fgColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
QBrush fgColor = item->foreground(3);
|
||||
fgColor.setStyle(Qt::BrushStyle::NoBrush);
|
||||
item->setForeground(3, fgColor);
|
||||
}
|
||||
|
||||
if (!t.getStatusUUID().isEmpty())
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QListWidgetItem>
|
||||
#include <QBrush>
|
||||
#include <QJsonDocument>
|
||||
|
||||
@@ -50,6 +51,10 @@ private:
|
||||
int16_t selectedBoardIndex;
|
||||
int16_t selectedFilterIndex;
|
||||
|
||||
QListWidgetItem *menuSelectedFilterItem;
|
||||
QListWidgetItem *menuSelectedBoardItem;
|
||||
QTreeWidgetItem *menuSelectedTaskItem;
|
||||
|
||||
QVector<Task*> filterResult;
|
||||
|
||||
QVector<Priority> priorities;
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
<string>Board</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionNew_filter"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTask">
|
||||
<property name="title">
|
||||
|
||||
@@ -99,6 +99,7 @@ const QJsonObject Board::toJson()
|
||||
}
|
||||
QJsonObject obj;
|
||||
obj[NAME_KEY] = this->name;
|
||||
obj[UUID_KEY] = this->uuid;
|
||||
obj[TASKS_KEY] = array;
|
||||
obj[DESCRIPTION_KEY] = description;
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user