mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 18:23:19 +00:00
Add source's name next to each task
This commit is contained in:
parent
e2cd994026
commit
a03e71890c
4 changed files with 20 additions and 2 deletions
|
@ -98,6 +98,13 @@ void AppWindow::setupCallbacks()
|
|||
assert(source);
|
||||
return source->id;
|
||||
});
|
||||
|
||||
models().on_get_source_name_from_id([&](int sourceId) {
|
||||
auto source = miraiInstance_->getSourceById(sourceId);
|
||||
assert(source);
|
||||
return slint::SharedString(source->name());
|
||||
});
|
||||
|
||||
miraiInstance_->onSourceAdded([&](mirai::Source *source) {
|
||||
refreshModels();
|
||||
});
|
||||
|
@ -338,6 +345,8 @@ void AppWindow::reloadTasks()
|
|||
unscheduledTasks_->clear();
|
||||
for (int taskIndex = 0; taskIndex < unscheduledTasksView.size(); ++taskIndex) {
|
||||
auto &task = unscheduledTasksView.at(taskIndex);
|
||||
const auto &source = miraiInstance_->getSourceById(task.sourceId());
|
||||
std::println("request name for source id {} : {}", task.sourceId(), source->name());
|
||||
unscheduledTasks_->push_back({
|
||||
.sourceId = task.sourceId(),
|
||||
.eventId = -1,
|
||||
|
|
|
@ -47,4 +47,5 @@ export global AppWindowModels {
|
|||
in-out property<[TaskData]> unscheduled-tasks;
|
||||
|
||||
callback get-source-id-from-name(string) -> int;
|
||||
pure callback get-source-name-from-id(int) -> string;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ export component MainView inherits Rectangle {
|
|||
padding-bottom: 8px;
|
||||
TaskLine {
|
||||
title: task.title;
|
||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
||||
scheduled: task.date.year != 0;
|
||||
date: day.date;
|
||||
checked: task.checked;
|
||||
|
@ -187,6 +188,7 @@ export component MainView inherits Rectangle {
|
|||
padding-bottom: 8px;
|
||||
TaskLine {
|
||||
title: task.title;
|
||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
||||
checked: task.checked;
|
||||
allow-edit-date: true;
|
||||
delete => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue