TaskTreeView.cpp held the page widgets as well as the view. TaskPage, TaskDetails, RelationSection and TaskRow now live in TaskPage.hpp/.cpp; the search helpers shared by both live in TaskSearch.hpp. No behaviour change.
23 lines
700 B
C++
23 lines
700 B
C++
#pragma once
|
|
|
|
#include "NodeGraph.hpp"
|
|
|
|
#include <algorithm>
|
|
#include <cctype>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace tp::taskboard {
|
|
|
|
[[nodiscard]] inline std::string lowercaseText(std::string text) {
|
|
std::transform(text.begin(), text.end(), text.begin(), [](unsigned char c) { return char(std::tolower(c)); });
|
|
return text;
|
|
}
|
|
|
|
[[nodiscard]] inline std::optional<ui::NodeId> taskIdQuery(const std::string& query) {
|
|
const std::string digits = query.starts_with('#') ? query.substr(1) : query;
|
|
if (digits.empty() || !std::all_of(digits.begin(), digits.end(), [](unsigned char c) { return std::isdigit(c); }))
|
|
return std::nullopt;
|
|
return ui::NodeId(std::stoull(digits));
|
|
}
|
|
}
|