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 signals:
101 //! Emitted from the context menu to pin the given line (assign a label).
102 void addLabelRequested(const LogMessage& message);
103 //! Emitted from the context menu to remove the pin on the given line.
104 void removeLabelRequested(const LogMessage& message);
105
106 public slots:
107 //! Build the right-click menu ("Add label" / "Remove label") for the row under pos.
108 void showContextMenu(const QPoint& pos);
109 bool checkAutoScroll(const QModelIndex& parent, int start, int end);
110 bool checkAutoScroll(int dummy = 0);
111 void itemsAdded(QModelIndex leftTop, QModelIndex bottomRight);
112 void rowsInserted(const QModelIndex& parent, int start, int end) override;
113 void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
114 bool selectNextSearchResult(bool backwards = true, bool keepSelectionIfPossible = false);
115 void doubleClickOnCell(const QModelIndex& index);
116
117 protected:
124
125
126 friend class LogSearch;
127 };
128} // 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:173
void doubleClickOnCell(const QModelIndex &index)
Definition LogTable.cpp:453
void showContextMenu(const QPoint &pos)
Build the right-click menu ("Add label" / "Remove label") for the row under pos.
Definition LogTable.cpp:119
bool selectNextSearchResult(bool backwards=true, bool keepSelectionIfPossible=false)
Definition LogTable.cpp:397
void showEvent(QShowEvent *event) override
Definition LogTable.cpp:304
bool autoscrollActive
Definition LogTable.h:118
QString lastLiveFilter
Definition LogTable.h:121
QString currentLiveFilter
Definition LogTable.h:121
void liveFilterRow(const QString &filterStr, int row)
Definition LogTable.cpp:158
bool liveSearch(const QString &search)
Definition LogTable.cpp:246
LogTableModel * getModel()
Definition LogTable.cpp:271
~LogTable() override
Definition LogTable.cpp:114
void fillSearchResults()
friend class LogSearch
Definition LogTable.h:126
void resetLiveFilter()
Definition LogTable.cpp:255
MessageType maxNewLogLevelType
Definition LogTable.h:120
void hideEvent(QHideEvent *) override
Definition LogTable.cpp:322
QString getCurrentLiveFilter() const
Definition LogTable.cpp:152
LogTable(QWidget *parent=0)
Definition LogTable.cpp:37
bool checkAutoScroll(const QModelIndex &parent, int start, int end)
Definition LogTable.cpp:277
void itemsAdded(QModelIndex leftTop, QModelIndex bottomRight)
Definition LogTable.cpp:299
void removeLabelRequested(const LogMessage &message)
Emitted from the context menu to remove the pin on the given line.
void resetLiveSearch()
Definition LogTable.cpp:264
void resetNewMessageCount()
Definition LogTable.h:60
QString getLiveFilterStr()
Definition LogTable.h:92
int selectedSearchIndex
Definition LogTable.h:122
EditorFileOpener fileOpener
Definition LogTable.h:123
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override
Definition LogTable.cpp:388
void rowsInserted(const QModelIndex &parent, int start, int end) override
Definition LogTable.cpp:335
int getNewMessageCount()
Definition LogTable.h:74
void addLabelRequested(const LogMessage &message)
Emitted from the context menu to pin the given line (assign a label).
This file offers overloads of toIce() and fromIce() functions for STL container types.