itom  4.1.0
pythonLogWidget.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  University of Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef PYTHONLOGWIDGET_H
29 #define PYTHONLOGWIDGET_H
30 
31 #ifdef __APPLE__
32 extern "C++" {
33 #endif
34 
35 #include "../common/commonGlobal.h"
36 
37 #include "common/abstractApiWidget.h"
38 
39 #include "../common/typeDefs.h"
40 
41 #include "commonWidgets.h"
42 
43 #include <qscopedpointer.h>
44 
46 
47 class ITOMWIDGETS_EXPORT PythonLogWidget : public ito::AbstractApiWidget
48 {
49  Q_OBJECT
50 
51  Q_PROPERTY(int maxMessages READ getMaxMessages WRITE setMaxMessages NOTIFY maxMessagesChanged)
52  Q_PROPERTY(bool outputStream READ getOutputStream WRITE setOutputStream)
53  Q_PROPERTY(bool errorStream READ getErrorStream WRITE setErrorStream)
54  Q_PROPERTY(int verticalSizeHint READ getVerticalSizeHint WRITE setVerticalSizeHint)
55  Q_PROPERTY(bool autoScroll READ getAutoScroll WRITE setAutoScroll)
56 
57  WIDGET_ITOM_API
58 
59  public Q_SLOTS:
60  void setMaxMessages(const int newMaxMessages);
61  ito::RetVal setOutputStream(bool enabled);
62  ito::RetVal setErrorStream(bool enabled);
63  void setVerticalSizeHint(int value);
64  void clear();
65  void setAutoScroll(bool autoScroll);
66 
67 
68  Q_SIGNALS:
69  void maxMessagesChanged(const int newMaxMessages);
70 
71  public:
72  explicit PythonLogWidget(QWidget* parent = NULL);
73  ~PythonLogWidget();
74 
75  int getMaxMessages() const;
76  bool getOutputStream() const;
77  bool getErrorStream() const;
78  int getVerticalSizeHint() const;
79  bool getAutoScroll() const;
80 
81  protected:
82 // void createActions();
83  virtual ito::RetVal init();
84  QSize sizeHint() const;
85 
86  QScopedPointer<PythonLogWidgetPrivate> d_ptr;
87 
88  public slots:
89  void messageReceived(QString message, ito::tStreamMessageType messageType);
90 
91  private Q_SLOTS:
92  void showContextMenu(const QPoint &pt);
93 
94  private:
95  Q_DECLARE_PRIVATE(PythonLogWidget);
96  Q_DISABLE_COPY(PythonLogWidget);
97 };
98 
99 #ifdef __APPLE__
100 }
101 #endif
102 
103 #endif // PYTHONLOGWIDGET_H
Definition: pythonLogWidget.cpp:46
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Definition: pythonLogWidget.h:47
Definition: abstractApiWidget.h:57
tStreamMessageType
Definition: typeDefs.h:76