mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-12 13:43:20 +00:00
Add color for events and source tags
This commit is contained in:
parent
d208fc6ca4
commit
4bca7fac3e
12 changed files with 95 additions and 39 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "mirai-core/MarkdownDataProvider.h"
|
||||
#include "mirai-core/Mirai.h"
|
||||
#include "selenite/palette.h"
|
||||
#include "slint_color.h"
|
||||
#include "slint_string.h"
|
||||
#include "ui.h"
|
||||
#include <bits/chrono.h>
|
||||
|
@ -97,6 +98,19 @@ void AppWindow::setupCallbacks()
|
|||
return slint::SharedString(source->name());
|
||||
});
|
||||
|
||||
models().on_get_source_color_from_id_as_hex([&](int sourceId) {
|
||||
auto source = miraiInstance_->getSourceById(sourceId);
|
||||
assert(source);
|
||||
return slint::SharedString(source->color());
|
||||
});
|
||||
|
||||
models().on_get_source_color_from_id_as_color([&](int sourceId) {
|
||||
auto source = miraiInstance_->getSourceById(sourceId);
|
||||
assert(source);
|
||||
auto color = selenite::hexStringToColor(source->color());
|
||||
return slint::Color::from_rgb_uint8(color.r, color.g, color.b);
|
||||
});
|
||||
|
||||
models().on_get_source_path_from_id([&](int sourceId) {
|
||||
auto source = miraiInstance_->getSourceById(sourceId);
|
||||
assert(source);
|
||||
|
@ -150,8 +164,11 @@ void AppWindow::setupCallbacks()
|
|||
miraiInstance_->addSource(std::string(name), "FileSystemMarkdown", std::move(file));
|
||||
});
|
||||
|
||||
actions().on_edit_source([&](int sourceId, slint::SharedString name, slint::SharedString path) {
|
||||
miraiInstance_->editSource(sourceId, std::string(name), std::string(path));
|
||||
actions().on_edit_source([&](int sourceId, slint::SharedString name, slint::SharedString color,
|
||||
slint::SharedString path) {
|
||||
miraiInstance_->editSource(
|
||||
sourceId, std::string(name), std::string(color), std::string(path)
|
||||
);
|
||||
});
|
||||
|
||||
actions().on_delete_task_clicked([&](int sourceId, int taskId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue