LogTable.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::
17* @author Mirko Waechter ( mirko.waechter at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
25// ArmarX
27#include <ArmarXCore/interface/core/Log.h>
28
30
31
32// Qt
33#include <QApplication>
34#include <QTableWidget>
35
36// C++
37#include <mutex>
38#include <vector>
39
40#define ARMARX_LOG_TIMESTR "Time"
41#define ARMARX_LOG_COMPONENTSTR "Component"
42#define ARMARX_LOG_TAGSTR "Tag"
43#define ARMARX_LOG_VERBOSITYSTR "Verbosity"
44#define ARMARX_LOG_MESSAGESTR "Message"
45#define ARMARX_LOG_FILESTR "File"
46#define ARMARX_LOG_FUNCTIONSTR "Function"
47#define ARMARX_LOG_LOGGINGGROUPSTR "Group"
48
49namespace armarx
50{
51
52
53 class LogTableModel;
54
55 class LogTable : public QTableView, public Logging
56 {
57 Q_OBJECT
58 protected:
59 void
61 {
63 maxNewLogLevelType = eUNDEFINED;
64 }
65
66 void showEvent(QShowEvent* event) override;
67 void hideEvent(QHideEvent*) override;
68
69 public:
70 explicit LogTable(QWidget* parent = 0);
71 ~LogTable() override;
72
73 int
75 {
76 return newMessageCount;
77 }
78
79 MessageType
84
85 QString getCurrentLiveFilter() const;
86 void liveFilter(const QString& search, int startRow = 0);
87 bool liveSearch(const QString& search);
88 void resetLiveFilter();
89 void resetLiveSearch();
90
91 QString
93 {
94 return lastLiveFilter;
95 }
96
99 void liveFilterRow(const QString& filterStr, int row);
100 public slots:
101 bool checkAutoScroll(const QModelIndex& parent, int start, int end);
102 bool checkAutoScroll(int dummy = 0);
103 void itemsAdded(QModelIndex leftTop, QModelIndex bottomRight);
104 void rowsInserted(const QModelIndex& parent, int start, int end) override;
105 void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
106 bool selectNextSearchResult(bool backwards = true, bool keepSelectionIfPossible = false);
107 void doubleClickOnCell(const QModelIndex& index);
108
109 protected:
113 std::mutex bufferMutex;
114 std::vector<LogMessage> logBuffer;
118
119
120 friend class LogSearch;
121 };
122} // namespace armarx
uint8_t index
The EditorFileOpener class.
MessageType getMaxNewLogLevelType()
Definition LogTable.h:80
void liveFilter(const QString &search, int startRow=0)
Definition LogTable.cpp:136
void doubleClickOnCell(const QModelIndex &index)
Definition LogTable.cpp:416
bool selectNextSearchResult(bool backwards=true, bool keepSelectionIfPossible=false)
Definition LogTable.cpp:360
void showEvent(QShowEvent *event) override
Definition LogTable.cpp:267
bool autoscrollActive
Definition LogTable.h:110
QString lastLiveFilter
Definition LogTable.h:115
QString currentLiveFilter
Definition LogTable.h:115
void liveFilterRow(const QString &filterStr, int row)
Definition LogTable.cpp:121
bool liveSearch(const QString &search)
Definition LogTable.cpp:209
LogTableModel * getModel()
Definition LogTable.cpp:234
~LogTable() override
Definition LogTable.cpp:110
std::mutex bufferMutex
Definition LogTable.h:113
void fillSearchResults()
friend class LogSearch
Definition LogTable.h:120
void resetLiveFilter()
Definition LogTable.cpp:218
std::vector< LogMessage > logBuffer
Definition LogTable.h:114
MessageType maxNewLogLevelType
Definition LogTable.h:112
void hideEvent(QHideEvent *) override
Definition LogTable.cpp:285
QString getCurrentLiveFilter() const
Definition LogTable.cpp:115
LogTable(QWidget *parent=0)
Definition LogTable.cpp:39
bool checkAutoScroll(const QModelIndex &parent, int start, int end)
Definition LogTable.cpp:240
void itemsAdded(QModelIndex leftTop, QModelIndex bottomRight)
Definition LogTable.cpp:262
void resetLiveSearch()
Definition LogTable.cpp:227
void resetNewMessageCount()
Definition LogTable.h:60
QString getLiveFilterStr()
Definition LogTable.h:92
int selectedSearchIndex
Definition LogTable.h:116
EditorFileOpener fileOpener
Definition LogTable.h:117
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override
Definition LogTable.cpp:351
void rowsInserted(const QModelIndex &parent, int start, int end) override
Definition LogTable.cpp:298
int getNewMessageCount()
Definition LogTable.h:74
This file offers overloads of toIce() and fromIce() functions for STL container types.