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