LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
MainWindowPresenter.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "EventsContainer.hpp"
4#include "IControler.hpp"
5#include "IDataParser.hpp"
6#include "IEventsView.hpp"
7#include "IMainWindowView.hpp"
8#include "IUiPanels.hpp"
9
10#include <filesystem>
11#include <cstddef>
12
13namespace ui
14{
15
21{
22 public:
24 db::EventsContainer& events, ui::ISearchResultsView& searchResults,
25 ui::IEventsListView* eventsListView,
26 ui::ITypeFilterView* typeFilterView,
27 ui::IItemDetailsView* itemDetailsView);
28
30 void PerformSearch();
31
33 void LoadLogFile(const std::filesystem::path& path);
34
42 void LoadLogFile(std::unique_ptr<parser::IDataParser> parser,
43 const std::filesystem::path& path);
44
53 void MergeLogFile(std::unique_ptr<parser::IDataParser> parser,
54 const std::filesystem::path& path,
55 const std::string& existingAlias,
56 const std::string& newFileAlias,
57 const std::string& timestampField = "timestamp");
58
60 bool IsParsing() const { return m_isParsing; }
61
63 void UpdateTypeFilters();
64
67
69 void SetItemDetailsVisible(bool visible);
70
71 // parser::IDataParserObserver
72 void ProgressUpdated() override;
73 void NewEventFound(db::LogEvent&& event) override;
74 void NewEventBatchFound(std::vector<std::pair<int,
75 db::LogEvent::EventItems>>&& eventBatch) override;
76
77 private:
78 static int ClampToInt(std::size_t value);
79 void clearAllData();
80 void RunParserAsync(std::unique_ptr<parser::IDataParser> parser,
81 const std::filesystem::path& path,
82 const std::string& previousStatus);
83
91 bool m_isParsing {false};
93};
94
95} // namespace ui
Container class for managing collections of LogEvent objects.
Interface for controller components in the MVC architecture.
Interface definitions for data parsing components.
High-performance, thread-safe container for managing large collections of LogEvent objects.
Definition EventsContainer.hpp:129
Represents a single, structured log event with key-value data.
Definition LogEvent.hpp:97
std::vector< std::pair< std::string, std::string > > EventItems
A collection of key-value pairs representing event data (eventFieldName, data).
Definition LogEvent.hpp:101
Toolkit-agnostic controller interface for the MVC architecture.
Definition IControler.hpp:55
Observer interface for receiving notifications from data parsers.
Definition IDataParser.hpp:52
Interface describing the primary events list view used by the UI.
Definition IEventsView.hpp:15
Toolkit-agnostic interface for the item/event details pane.
Definition IUiPanels.hpp:87
Toolkit-agnostic contract exposing the handful of main-window interactions needed by the presenter lo...
Definition IMainWindowView.hpp:13
Toolkit-agnostic contract for the search results panel.
Definition IUiPanels.hpp:22
Toolkit-neutral interface for the type filter checklist panel.
Definition IUiPanels.hpp:51
Pure C++ presenter that orchestrates main-window interactions independently of the underlying widget ...
Definition MainWindowPresenter.hpp:21
void NewEventBatchFound(std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch) override
Called when a batch of new events is discovered during parsing.
Definition MainWindowPresenter.cpp:703
db::EventsContainer & m_events
Definition MainWindowPresenter.hpp:86
IMainWindowView & m_view
Definition MainWindowPresenter.hpp:84
ui::IEventsListView * m_eventsListView
Definition MainWindowPresenter.hpp:88
static int ClampToInt(std::size_t value)
Definition MainWindowPresenter.cpp:82
void ApplySelectedTypeFilters()
Applies the selected type filters to the event list.
Definition MainWindowPresenter.cpp:551
void MergeLogFile(std::unique_ptr< parser::IDataParser > parser, const std::filesystem::path &path, const std::string &existingAlias, const std::string &newFileAlias, const std::string &timestampField="timestamp")
Parses and merges a log file with existing data, sorted by timestamp.
Definition MainWindowPresenter.cpp:340
bool m_isParsing
Definition MainWindowPresenter.hpp:91
void NewEventFound(db::LogEvent &&event) override
Called when a new event is discovered during parsing.
Definition MainWindowPresenter.cpp:698
void PerformSearch()
Runs the search pipeline using the current UI state.
Definition MainWindowPresenter.cpp:89
void UpdateTypeFilters()
Rebuilds the available type filters from current events.
Definition MainWindowPresenter.cpp:464
void SetItemDetailsVisible(bool visible)
Shows or hides the item details view.
Definition MainWindowPresenter.cpp:662
bool IsParsing() const
Allows views to query whether parsing is active.
Definition MainWindowPresenter.hpp:60
void clearAllData()
Definition MainWindowPresenter.cpp:719
ui::IItemDetailsView * m_itemDetailsView
Definition MainWindowPresenter.hpp:90
ui::ITypeFilterView * m_typeFilterView
Definition MainWindowPresenter.hpp:89
bool m_progressConfigured
Definition MainWindowPresenter.hpp:92
void RunParserAsync(std::unique_ptr< parser::IDataParser > parser, const std::filesystem::path &path, const std::string &previousStatus)
Definition MainWindowPresenter.cpp:222
ui::ISearchResultsView & m_searchResultsView
Definition MainWindowPresenter.hpp:87
void ProgressUpdated() override
Called when parsing progress is updated.
Definition MainWindowPresenter.cpp:671
void LoadLogFile(const std::filesystem::path &path)
Parses and loads a log file, updating shared UI state.
Definition MainWindowPresenter.cpp:151
mvc::IController & m_controller
Definition MainWindowPresenter.hpp:85
Data parsing components and interfaces.
Definition IControler.hpp:22
Definition IErrorPresenter.hpp:5