mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Switch from Qt6 to Slint
This commit is contained in:
parent
f8be14bcf8
commit
63bf267a22
107 changed files with 27532 additions and 2896 deletions
73
lib/mirai-core/BaseResource.h
Normal file
73
lib/mirai-core/BaseResource.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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 MIRAI_BASE_RESOURCE_H
|
||||
#define MIRAI_BASE_RESOURCE_H
|
||||
|
||||
#include "TaskItem.h"
|
||||
#include "mirai-core/DateTime.h"
|
||||
#include "mirai-core/Day.h"
|
||||
#include "mirai-core/Event.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mirai
|
||||
{
|
||||
|
||||
class BaseResource
|
||||
{
|
||||
|
||||
public:
|
||||
struct AddTaskData {
|
||||
std::string text;
|
||||
Tags tags;
|
||||
};
|
||||
|
||||
BaseResource(std::string name) : name_(name) {};
|
||||
BaseResource(BaseResource &) = delete;
|
||||
BaseResource(BaseResource &&) = delete;
|
||||
|
||||
virtual ~BaseResource() = default;
|
||||
virtual void save() = 0;
|
||||
virtual void load() = 0;
|
||||
|
||||
void setName(std::string name)
|
||||
{
|
||||
this->name_ = name;
|
||||
}
|
||||
|
||||
const std::string &getName() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
void addDay(const DayData &dayData);
|
||||
Day *day(const Date &date);
|
||||
std::vector<std::unique_ptr<Day>> *days();
|
||||
TaskItem *getTaskById(int taskId);
|
||||
Event *getEventById(int eventId);
|
||||
void deleteTask(const TaskItem &task);
|
||||
|
||||
void setDirty(bool shouldBeDirty);
|
||||
bool isDirty() const;
|
||||
|
||||
int id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
private:
|
||||
static int nextId_;
|
||||
int id_ = nextId_++;
|
||||
std::string name_;
|
||||
std::vector<std::unique_ptr<Day>> days_;
|
||||
bool isDirty_ = false;
|
||||
};
|
||||
|
||||
} // namespace mirai
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue