mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 09:23:18 +00:00
Move TasksFile into another file
This commit is contained in:
parent
841c87752f
commit
cd01c39ed7
6 changed files with 50 additions and 27 deletions
|
@ -52,6 +52,7 @@ qt_add_qml_module(mirai
|
|||
# Qt related files
|
||||
src/Backend.h src/Backend.cpp
|
||||
src/TaskItem.h src/TaskItem.cpp
|
||||
src/TasksFile.h src/TasksFile.cpp
|
||||
# Core related files
|
||||
src/core/Mirai.h src/core/Mirai.cpp
|
||||
src/core/TaskItem.h src/core/TaskItem.cpp
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "QtCore/qcontainerfwd.h"
|
||||
#include "QtCore/qtmetamacros.h"
|
||||
#include "QtCore/qvariant.h"
|
||||
#include "TasksFile.h"
|
||||
#include "core/Mirai.h"
|
||||
#include "core/TasksView.h"
|
||||
#include <QtCore/QDateTime>
|
||||
|
|
|
@ -7,16 +7,6 @@
|
|||
#include "TaskItem.h"
|
||||
#include "core/TodoMd.h"
|
||||
|
||||
QString QMLTasksFile::getName()
|
||||
{
|
||||
return QString::fromStdString(tasksFile->getName());
|
||||
}
|
||||
|
||||
QString QMLTasksFile::getPath()
|
||||
{
|
||||
return QString::fromStdString(tasksFile->getPath());
|
||||
}
|
||||
|
||||
QString QMLTaskItem::getRawFormat()
|
||||
{
|
||||
return QString::fromStdString(mirai::TodoMdFormat::TaskToString(*taskItem));
|
||||
|
|
|
@ -10,24 +10,8 @@
|
|||
#include "QtCore/qvariant.h"
|
||||
#include <QtCore/QString>
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
#include <memory>
|
||||
|
||||
#include "core/TaskItem.h"
|
||||
#include "core/TasksFile.h"
|
||||
|
||||
struct QMLTasksFile {
|
||||
|
||||
Q_GADGET
|
||||
Q_PROPERTY(QString name READ getName)
|
||||
Q_PROPERTY(QString path READ getPath)
|
||||
QML_VALUE_TYPE(tasksFile)
|
||||
|
||||
public:
|
||||
QString getName();
|
||||
QString getPath();
|
||||
|
||||
mirai::TasksFile *tasksFile;
|
||||
};
|
||||
|
||||
struct QMLTaskItem {
|
||||
|
||||
|
@ -50,7 +34,7 @@ struct QMLTaskItem {
|
|||
QList<QString> getTags();
|
||||
bool getShouldShowDate();
|
||||
|
||||
mirai::TaskItem *taskItem;
|
||||
mirai::TaskItem *taskItem = nullptr;
|
||||
bool shouldShowDate = false;
|
||||
QList<QString> tags;
|
||||
};
|
||||
|
|
17
src/TasksFile.cpp
Normal file
17
src/TasksFile.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Mirai. Copyright (C) 2024 Vyn
|
||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
|
||||
#include "TasksFile.h"
|
||||
|
||||
QString QMLTasksFile::getName()
|
||||
{
|
||||
return QString::fromStdString(tasksFile->getName());
|
||||
}
|
||||
|
||||
QString QMLTasksFile::getPath()
|
||||
{
|
||||
return QString::fromStdString(tasksFile->getPath());
|
||||
}
|
30
src/TasksFile.h
Normal file
30
src/TasksFile.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Mirai. Copyright (C) 2024 Vyn
|
||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
|
||||
#ifndef QML_TASKSFILE_H
|
||||
#define QML_TASKSFILE_H
|
||||
|
||||
#include "QtCore/qvariant.h"
|
||||
#include <QtCore/QString>
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
|
||||
#include "core/TasksFile.h"
|
||||
|
||||
struct QMLTasksFile {
|
||||
|
||||
Q_GADGET
|
||||
Q_PROPERTY(QString name READ getName)
|
||||
Q_PROPERTY(QString path READ getPath)
|
||||
QML_VALUE_TYPE(tasksFile)
|
||||
|
||||
public:
|
||||
QString getName();
|
||||
QString getPath();
|
||||
|
||||
mirai::TasksFile *tasksFile;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue