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 
37 class QTimer;
38 
39 namespace 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);
142  void updateFilterListSignal();
143  void componentConnected();
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
armarx::LogViewer::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: LogViewer.h:76
armarx::LogTable
Definition: LogTable.h:55
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::LogViewer::GetWidgetName
static QString GetWidgetName()
Definition: LogViewer.h:70
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
armarx::LogViewer::logTable
LogTable * logTable
Definition: LogViewer.h:149
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::LogViewer::ui
Ui_LogViewer ui
Definition: LogViewer.h:148
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::LogViewer
Definition: LogViewer.h:56
LogTable.h
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:918
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::LogViewer::GetWidgetCategoryIcon
static QIcon GetWidgetCategoryIcon()
Definition: LogViewer.h:82
IceInternal::ProxyHandle<::IceProxy::armarx::Log >
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
armarx::aron::write
requires data::isWriter< WriterT > void write(WriterT &aron_w, const Eigen::Matrix< EigenT, rows, cols, options > &input, typename WriterT::ReturnType &ret, const armarx::aron::Path &aron_p=armarx::aron::Path())
Definition: eigen.h:138
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
ImportExportComponent.h