3#include <QAbstractTableModel>
15#include <unordered_set>
17#include <unordered_map>
33 std::vector<ColumnValueCount>
values;
46 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
47 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
48 QVariant
data(
const QModelIndex& index,
int role)
const override;
49 QVariant
headerData(
int section, Qt::Orientation orientation,
50 int role)
const override;
51 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder)
override;
134 bool ResolveColumn(
int column, std::string& name,
bool& mergeSource)
const;
135 static std::string
ColumnFilterKey(
const std::string& name,
bool mergeSource);
140 void SortIndices(std::vector<unsigned long>& indices,
const std::string& columnName,
141 bool isMergeSource, Qt::SortOrder order)
const;
153 SortKey MakeSortKey(
unsigned long idx,
const std::string& columnName,
bool isMergeSource)
const;
157 bool SortBefore(
unsigned long a,
unsigned long b)
const;
188 const std::string& columnName,
bool mergeSource)
const;
190 const std::string& columnName,
bool mergeSource)
const;
Container class for managing collections of LogEvent objects.
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
Definition EventsTableModel.hpp:39
void SetSearchMode(utils::SearchMode mode)
Definition EventsTableModel.cpp:753
std::vector< unsigned long > m_filteredIndices
Effective rows (upstream ∩ column filters, sorted if m_hasSort)
Definition EventsTableModel.hpp:193
int MatchCount() const
Definition EventsTableModel.hpp:72
void RebuildVisibleColumns()
Definition EventsTableModel.cpp:797
std::string m_sortName
sort column by data name, so it survives column changes
Definition EventsTableModel.hpp:204
SortKey MakeSortKey(unsigned long idx, const std::string &columnName, bool isMergeSource) const
Definition EventsTableModel.cpp:1118
void SyncWithContainer()
Definition EventsTableModel.cpp:173
std::uint64_t m_baseGeneration
container generation the upstream filter was set for
Definition EventsTableModel.hpp:196
std::vector< int > m_matchedRows
model row indices with at least one matching cell
Definition EventsTableModel.hpp:217
void EndReset()
Definition EventsTableModel.cpp:250
QVariant data(const QModelIndex &index, int role) const override
Definition EventsTableModel.cpp:54
std::size_t m_fullSortedCount
Definition EventsTableModel.hpp:203
std::map< std::string, ColumnFilter > m_columnFilters
Definition EventsTableModel.hpp:198
bool m_baseFilterActive
Definition EventsTableModel.hpp:195
bool m_filteringActive
Definition EventsTableModel.hpp:211
QString ComposeCellText(const db::LogEvent &event, const std::string &columnName, bool mergeSource) const
Definition EventsTableModel.cpp:924
const std::vector< unsigned long > & GetFilteredIndices() const
Definition EventsTableModel.hpp:59
QString m_searchTerm
Definition EventsTableModel.hpp:215
ColumnDistinctValues DistinctColumnValues(int column, std::size_t maxValues) const
Definition EventsTableModel.cpp:456
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition EventsTableModel.cpp:34
bool IsColumnFilterExclusion(int column) const
True if column's filter hides the listed values instead of showing them.
Definition EventsTableModel.cpp:574
void RefreshColumns()
Definition EventsTableModel.cpp:275
bool HasAnyColumnFilter() const
Definition EventsTableModel.hpp:92
void ClearColumnFilters()
Definition EventsTableModel.cpp:633
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition EventsTableModel.cpp:46
QSet< QString > ColumnFilterValues(int column) const
Definition EventsTableModel.cpp:534
db::EventsContainer & m_events
Definition EventsTableModel.hpp:192
static int CompareSortKeys(const SortKey &a, const SortKey &b)
Three-way ascending comparison of two keys (ties broken by event id).
Definition EventsTableModel.cpp:1146
bool ResolveColumn(int column, std::string &name, bool &mergeSource) const
Resolves a model column to its data-column name / merge-source flag.
Definition EventsTableModel.cpp:345
void SearchMatchesChanged()
Search matches were recomputed after the row set changed.
Qt::SortOrder m_sortOrder
Definition EventsTableModel.hpp:206
const std::vector< unsigned long > * GetBaseFilteredIndices() const
Definition EventsTableModel.hpp:62
int RowFromActualIndex(int actualIndex) const
Definition EventsTableModel.cpp:659
QSet< QString > AllColumnValues(int column) const
Distinct cell texts of column among all events, ignoring every filter.
Definition EventsTableModel.cpp:514
bool HasColumnFilter(int column) const
Definition EventsTableModel.cpp:526
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Definition EventsTableModel.cpp:135
bool BaseFilterIsStale() const
Definition EventsTableModel.cpp:226
bool SortBefore(unsigned long a, unsigned long b) const
True if row a sorts before row b in the active sort.
Definition EventsTableModel.cpp:1169
std::vector< unsigned long > m_baseFilteredIndices
Rows chosen by the rest of the app.
Definition EventsTableModel.hpp:194
Qt::SortOrder ActiveSortOrder() const
Definition EventsTableModel.hpp:117
bool IsFilteringActive() const
True if a filter is active — distinguishes "no filter" from "filter active, zero matches".
Definition EventsTableModel.hpp:67
void RefreshAll()
Definition EventsTableModel.cpp:220
void SortIndices(std::vector< unsigned long > &indices, const std::string &columnName, bool isMergeSource, Qt::SortOrder order) const
Definition EventsTableModel.cpp:1176
void ColumnFiltersChanged()
std::set< std::string > m_visibleFilterKeys
Keys of the visible columns; only their filters apply.
Definition EventsTableModel.hpp:199
std::vector< int > m_visibleColumnIndices
Definition EventsTableModel.hpp:208
const utils::SearchEngine & GetSearchEngine() const
Definition EventsTableModel.hpp:74
void SetSearchTerm(const QString &term, bool caseSensitive)
Definition EventsTableModel.cpp:727
int ResolveToActualIndex(int row) const
Definition EventsTableModel.cpp:644
void RebuildSearchMatches()
Definition EventsTableModel.cpp:767
int ConfigIndexForColumn(int column) const
Definition EventsTableModel.cpp:700
PrunedColumnState PruneStaleColumnState()
Definition EventsTableModel.cpp:584
bool m_hasSourceColumn
Definition EventsTableModel.hpp:210
std::vector< int > ColumnWidths() const
Definition EventsTableModel.cpp:675
std::uint64_t m_indicesGeneration
container generation m_filteredIndices was built for
Definition EventsTableModel.hpp:197
void AppendSortedRows(std::size_t total)
Definition EventsTableModel.cpp:187
bool m_sortMergeSource
Definition EventsTableModel.hpp:205
void ClearFilter()
Definition EventsTableModel.cpp:329
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Definition EventsTableModel.cpp:1010
bool ShouldShowOriginalIdColumn() const
Definition EventsTableModel.cpp:904
std::unique_ptr< utils::SearchEngine > m_searchEngine
Definition EventsTableModel.hpp:214
void SetColumnFilter(int column, const QSet< QString > &allowed)
Restricts column to allowed (an empty set matches nothing).
Definition EventsTableModel.cpp:544
bool m_searchCaseSensitive
Definition EventsTableModel.hpp:216
const std::vector< int > & MatchedRows() const
Definition EventsTableModel.hpp:73
bool ShouldShowSourceColumn() const
Definition EventsTableModel.cpp:885
bool HasStaleIndices() const
True if the upstream filter or the effective row list is stale.
Definition EventsTableModel.cpp:237
const config::Config & m_config
Definition EventsTableModel.hpp:209
bool HasActiveColumnFilter() const
Definition EventsTableModel.cpp:568
void UpdateColors()
Definition EventsTableModel.cpp:302
void RebuildSearchMatchesAsync()
Asynchronous search rebuild (doesn't block UI)
void SetFilteredIndices(const std::vector< unsigned long > &indices)
Definition EventsTableModel.cpp:315
static std::string ColumnFilterKey(const std::string &name, bool mergeSource)
Definition EventsTableModel.cpp:370
std::unordered_map< unsigned long, int > m_reverseFilteredIndices
Definition EventsTableModel.hpp:207
std::unordered_set< int > m_matchedRowSet
O(1) lookup used in data()
Definition EventsTableModel.hpp:218
int ActiveSortColumn() const
Model column of the active sort, or -1 if there is none or its column is hidden.
Definition EventsTableModel.cpp:708
QVariant GetSortValue(const db::LogEvent &event, const std::string &columnName, bool mergeSource) const
Definition EventsTableModel.cpp:967
void StoreColumnFilter(int column, const QSet< QString > &values, bool exclude)
Definition EventsTableModel.cpp:554
void ApplyEffectiveFilter()
Definition EventsTableModel.cpp:394
bool m_hasSort
Definition EventsTableModel.hpp:200
void SetColumnFilterExcluding(int column, const QSet< QString > &excluded)
Definition EventsTableModel.cpp:549
bool PassesColumnFilters(const db::LogEvent &event, const std::string *skipKey) const
Definition EventsTableModel.cpp:377
void ClearColumnFilter(int column)
Definition EventsTableModel.cpp:616
Advanced search engine supporting multiple search modes.
Definition SearchEngine.hpp:36
SearchMode
Definition SearchEngine.hpp:19
Definition ConfigEditorDialog.cpp:19
Distinct values offered by an Excel-style column filter.
Definition EventsTableModel.hpp:32
bool truncated
More distinct values exist than were listed.
Definition EventsTableModel.hpp:34
bool narrowed
Other filters hid rows, so values may be missing.
Definition EventsTableModel.hpp:35
std::vector< ColumnValueCount > values
Sorted (numeric-aware, case-insensitive)
Definition EventsTableModel.hpp:33
One distinct cell value of a column and how many rows show it.
Definition EventsTableModel.hpp:25
QString value
Definition EventsTableModel.hpp:26
qsizetype count
Definition EventsTableModel.hpp:27
Definition EventsTableModel.hpp:126
bool mergeSource
Definition EventsTableModel.hpp:128
std::string name
Definition EventsTableModel.hpp:127
bool exclude
Definition EventsTableModel.hpp:130
QSet< QString > allowed
allowed values, or excluded ones when exclude
Definition EventsTableModel.hpp:129
Definition EventsTableModel.hpp:165
bool sort
Definition EventsTableModel.hpp:167
Sort key of one row, computed once (see SortIndices / SortBefore).
Definition EventsTableModel.hpp:144
double asDouble
Definition EventsTableModel.hpp:150
long long asInt
Definition EventsTableModel.hpp:149
bool numeric
Definition EventsTableModel.hpp:147
unsigned long index
Definition EventsTableModel.hpp:145
bool isInt
Definition EventsTableModel.hpp:148
QString text
Definition EventsTableModel.hpp:151