API Documentation
Loading...
Searching...
No Matches
LogTable.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: LogTable
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/LogMessage.h>
35#include <QAbstractTableModel>
36#include <QObject>
37#include <QSortFilterProxyModel>
38namespace NDEVR
39{
40 class NDEVR_WIDGETS_API LogViewTable : public QAbstractTableModel
41 {
42 public:
43 LogViewTable(QObject* parent = nullptr);
44 LogViewTable(const Buffer<LogMessage>& messages, QObject* parent = nullptr);
45 void setMessageSearchTerms(const Buffer<String>& search_terms, uint04 range);
46 virtual ~LogViewTable() {}
47 int rowCount(const QModelIndex& parent) const override;
48 int columnCount(const QModelIndex& parent) const override;
49 QVariant data(const QModelIndex& index, int role) const override;
50 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
51 Qt::ItemFlags flags(const QModelIndex& index) const override;
52 void clear();
53 void setMessages(const Buffer<LogMessage>& messages);
54 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
55 bool insertRows(int position, int rows, const QModelIndex& index = QModelIndex()) override;
56 bool removeRows(int position, int rows, const QModelIndex& index = QModelIndex()) override;
57 void addMessage(const LogMessage& message);
58 void addMessages(const Buffer<LogMessage>& messages);
59 const Buffer<LogMessage>& messages() const { return m_messages; }
60 void setDetectNewLines(bool detect_new_lines);
61 void setShowMicroSeconds(bool show_microseconds);
62 bool showMicroSeconds() const;
63 private:
64 Buffer<String> m_message_search_terms;
65 uint04 m_search_range = 0;
66 Buffer<LogMessage> m_messages;
67 bool m_detect_new_lines;
68 bool m_show_micro_seconds = false;
69 };
70
71 class SortedLogViewTable : public QSortFilterProxyModel
72 {
73 public:
74 SortedLogViewTable(QObject* parent = nullptr);
75 void setLogViewTable(LogViewTable* table);
76 void setMessageSearchTerms(const Buffer<String>& search_terms, uint04 range);
77 void setTimeSearchTerms(const Buffer<String>& search_terms);
78 void setMinimumLevel(uint01 minimal_level);
79 virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
80 virtual bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const override;
81 virtual bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
82 protected:
88 };
89}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition LogMessage.h:40
Definition LogTable.h:41
virtual ~LogViewTable()
Definition LogTable.h:46
const Buffer< LogMessage > & messages() const
Definition LogTable.h:59
Definition LogTable.h:72
uint01 m_minimum_level
Definition LogTable.h:85
Buffer< String > m_message_search_terms
Definition LogTable.h:83
void setTimeSearchTerms(const Buffer< String > &search_terms)
Definition LogTable.cpp:218
void setLogViewTable(LogViewTable *table)
Definition LogTable.cpp:204
LogViewTable * m_raw_log_view
Definition LogTable.h:86
SortedLogViewTable(QObject *parent=nullptr)
Definition LogTable.cpp:197
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
Definition LogTable.cpp:235
void setMessageSearchTerms(const Buffer< String > &search_terms, uint04 range)
Definition LogTable.cpp:209
virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override
Definition LogTable.cpp:264
Buffer< String > m_time_search_terms
Definition LogTable.h:84
uint04 m_search_range
Definition LogTable.h:87
void setMinimumLevel(uint01 minimal_level)
Definition LogTable.cpp:226
virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override
Definition LogTable.cpp:260
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120