LogViewer.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#include <mutex>
26
27#include <QPointer>
28#include <QToolBar>
29
31
32#include <ArmarXGui/gui-plugins/LoggingPlugin/ui_LogViewer.h>
34
35#include "LogTable.h"
36
37class QTimer;
38
39namespace armarx
40{
41
42 class LogTableModel;
43
44 /*!
45 \page ArmarXGui-GuiPlugins-LogViewer LogViewer
46 \brief The log viewer allows you to filter and view log messages from
47 all running ArmarX applications.
48 \image html LogViewer.png
49 ArmarXGui Documentation \ref LogViewer
50 \see LoggingPlugin
51 */
52 /*!
53 \class LogViewer
54 \see LoggingPlugin
55 */
58 public Log
59 {
60 Q_OBJECT
61 public:
62 LogViewer();
63 ~LogViewer() override;
64 //inherited from ArmarXMdiWidget
65
66 void loadSettings(QSettings* settings) override;
67 void saveSettings(QSettings* settings) override;
68
69 static QString
71 {
72 return "Meta.LogViewer";
73 }
74
75 static QIcon
77 {
78 return QIcon("://icons/papyrus.svg");
79 }
80
81 static QIcon
83 {
84 return QIcon("://icons/papyrus.svg");
85 }
86
87 QPointer<QWidget> getCustomTitlebarWidget(QWidget* parent) override;
88
89 // inherited from Component
90 void onInitComponent() override;
91 void onConnectComponent() override;
92 void onExitComponent() override;
93
94 // inherited from Log
95 void write(const std::string& who,
96 Ice::Long time,
97 const std::string& tag,
98 MessageType severity,
99 const std::string& message,
100 const std::string& file,
101 Ice::Int line,
102 const std::string& function,
103 const Ice::Current& = Ice::emptyCurrent);
104 void writeLog(const LogMessage& msg, const Ice::Current& = Ice::emptyCurrent) override;
105
106
107 void setRow(const LogMessage& msg, int rowIndex);
108 LogTable* addEmptyFilter();
109 LogTable* addFilter(QString filterId,
110 QString filterName,
111 QString loggingGroup,
112 QString componentFilter,
113 QString tagFilter,
114 MessageType minimumVerbosity,
115 QString messageFilter,
116 QString fileFilter,
117 QString functionFilter);
118 //! This function checks, if there are new components in the log and if so, it creates new filters for these components
119 bool checkAndAddNewFilter(const QString& loggingGroupName, const QString& componentName);
120
121
122 public slots:
123 void addNewEntry(const LogMessage& msg);
124 void performLiveFilter(QString searchStr, int startRow = 0);
125 void performLiveSearch(QString searchStr);
126 void clearSelectedLog();
127 void clearAllLogs();
128 void pauseLogging(bool pause = false);
129 void addFilter();
130 void editFilter(QTreeWidgetItem* item, int column);
131 void removeSelectedFilter();
132 void removeFilter(QTreeWidgetItem* item);
133 void filterSelectionChanged(QTreeWidgetItem* item, QTreeWidgetItem* previous);
134 void insertPendingEntries();
135 void searchTypeChanged(int index);
136 void selectNextSearchResult();
137 void selectPreviousSearchResult();
138 void updateFilterList();
139 void OpenConfigureDialog();
140 signals:
141 void newEntry(const LogMessage& msg);
144
145 protected:
146 bool onClose() override;
147
148 Ui_LogViewer ui;
150
151 private:
152 QString loggingGroupNameToFilterName(const QString& loggingGroupName) const;
153
154 bool loggingPaused;
155 LogPrx logProxy;
156 std::vector<LogMessage> buffer;
157 IceUtil::Time lastLiveSearchEditChangeTime;
158 std::map<QString, LogTable*> filterMap;
159
160 std::vector<LogMessage> pendingEntries;
161
162 mutable std::mutex pendingEntriesMutex;
163 QTimer* pendingEntriesTimer;
164 QToolBar* customToolbar;
165 };
166} // namespace armarx
uint8_t index
#define ARMARXCOMPONENT_IMPORT_EXPORT
LogTable * logTable
Definition LogViewer.h:149
void componentConnected()
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void updateFilterListSignal()
Ui_LogViewer ui
Definition LogViewer.h:148
void newEntry(const LogMessage &msg)
static QIcon GetWidgetCategoryIcon()
Definition LogViewer.h:82
static QString GetWidgetName()
Definition LogViewer.h:70
static QIcon GetWidgetIcon()
Definition LogViewer.h:76
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::Log > LogPrx
Definition LogSender.h:58