LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
EventTagManager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <set>
6#include <map>
7#include <nlohmann/json.hpp>
8
9namespace ui::qt::utils
10{
11
23{
24 public:
25 struct Tag
26 {
27 std::string name;
28 std::string color; // Hex color code
29 std::string description;
30 };
31
33 {
35 std::set<std::string> tagNames; // Tag names applied to this event
36 std::string notes;
37 int64_t timestamp; // When annotation was created
38 };
39
41
43 void addTagType(const Tag& tag);
44
46 void removeTagType(const std::string& tagName);
47
49 const std::vector<Tag>& tagTypes() const { return m_tags; }
50
52 void tagEvent(int eventId, const std::string& tagName);
53
55 void untagEvent(int eventId, const std::string& tagName);
56
58 void annotateEvent(int eventId, const std::string& notes);
59
61 const std::set<std::string>& getEventTags(int eventId) const;
62
64 const std::string& getEventAnnotation(int eventId) const;
65
67 const std::map<int, EventAnnotation>& allAnnotations() const { return m_annotations; }
68
70 std::vector<int> getEventsWithTag(const std::string& tagName) const;
71
73 void saveTags();
74
76 void loadTags();
77
79 void clearTags();
80
81 private:
82 EventTagManager() = default;
83
84 std::vector<Tag> m_tags;
85 std::map<int, EventAnnotation> m_annotations;
86 std::string m_tagsFilePath;
87};
88
89} // namespace ui::qt::utils
Manages tags/annotations for log events.
Definition EventTagManager.hpp:23
void annotateEvent(int eventId, const std::string &notes)
Add annotation/notes to event.
Definition EventTagManager.cpp:110
std::map< int, EventAnnotation > m_annotations
Definition EventTagManager.hpp:85
void addTagType(const Tag &tag)
Add a tag type (e.g., "Error", "Warning", "Important")
Definition EventTagManager.cpp:20
void untagEvent(int eventId, const std::string &tagName)
Untag an event.
Definition EventTagManager.cpp:75
const std::string & getEventAnnotation(int eventId) const
Get annotation for an event.
Definition EventTagManager.cpp:101
std::string m_tagsFilePath
Definition EventTagManager.hpp:86
const std::vector< Tag > & tagTypes() const
Get all tag types.
Definition EventTagManager.hpp:49
void saveTags()
Save tags to file.
Definition EventTagManager.cpp:139
std::vector< Tag > m_tags
Definition EventTagManager.hpp:84
void tagEvent(int eventId, const std::string &tagName)
Tag an event.
Definition EventTagManager.cpp:45
const std::map< int, EventAnnotation > & allAnnotations() const
Get all annotated events.
Definition EventTagManager.hpp:67
std::vector< int > getEventsWithTag(const std::string &tagName) const
Filter events by tag.
Definition EventTagManager.cpp:126
void loadTags()
Load tags from file.
Definition EventTagManager.cpp:189
void removeTagType(const std::string &tagName)
Remove a tag type.
Definition EventTagManager.cpp:33
void clearTags()
Clear all tags.
Definition EventTagManager.cpp:260
static EventTagManager & getInstance()
Definition EventTagManager.cpp:14
const std::set< std::string > & getEventTags(int eventId) const
Get tags for an event.
Definition EventTagManager.cpp:92
Definition AppDataDir.hpp:14
Definition EventTagManager.hpp:33
std::set< std::string > tagNames
Definition EventTagManager.hpp:35
std::string notes
Definition EventTagManager.hpp:36
int eventId
Definition EventTagManager.hpp:34
int64_t timestamp
Definition EventTagManager.hpp:37
Definition EventTagManager.hpp:26
std::string description
Definition EventTagManager.hpp:29
std::string color
Definition EventTagManager.hpp:28
std::string name
Definition EventTagManager.hpp:27