add todos

This commit is contained in:
2025-12-21 22:22:59 +01:00
parent 22a1b7e369
commit 0101ea1ec0
10 changed files with 273 additions and 36 deletions

View File

@@ -1,8 +1,9 @@
#pragma once
#include "components/todoEntry.hpp"
#include "services/todoAdapter.hpp"
#include <memory>
#include <string>
#include <vector>
class TodoService {
public:
@@ -12,11 +13,15 @@ class TodoService {
std::map<int, TodoEntry *> getTodos();
void init();
void removeTodo(int id);
TodoEntry *addTodo(std::string text, bool emitSignal = true);
TodoEntry *addTodo(std::string text, bool emitSignal = true, bool persist = true);
void updateTodo(int id, std::string text);
private:
void load();
int nextId = 1;
std::map<int, TodoEntry *> todos;
sigc::signal<void()> refreshSignal;
std::unique_ptr<ITodoAdapter> adapter;
};