Visual Computing Library
Loading...
Searching...
No Matches
text_edit_logger.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_QT_GUI_TEXT_EDIT_LOGGER_H
24#define VCL_QT_GUI_TEXT_EDIT_LOGGER_H
25
26#include <vclib/misc/logger/logger.h>
27#include <vclib/qt/gui/text_edit_logger/debug_io_device.h>
28
29#include <QFrame>
30
31namespace vcl::qt {
32
33namespace Ui {
34class TextEditLogger;
35} // namespace Ui
36
37class TextEditLogger : public QFrame, public vcl::Logger<QTextStream>
38{
40
41 Ui::TextEditLogger* mUI;
42
43 DebugIODevice* mDebugIoDevice;
44
45 QTextStream* mDebugStream;
46 QTextStream* mErrorStream;
47 QTextStream* mMsgStream;
48 QTextStream* mWarningStream;
49
50public:
51 using Logger<QTextStream>::startTimer;
52
53 explicit TextEditLogger(QWidget* parent = nullptr);
55
56 TextEditLogger(const TextEditLogger&) = delete;
57 TextEditLogger& operator=(const TextEditLogger&) = delete;
58
59 void enableDebugLogging(bool enable);
60
61 void setPercentage(uint newPerc) override;
62
63protected:
64 QTextStream* levelStream(LogLevel lvl) const override;
65
66 void alignLeft(QTextStream& stream) const override;
67
68 void alignRight(QTextStream& stream) const override;
69
70 void setWidth(QTextStream& stream, uint width) const override;
71
72 void flush(QTextStream& stream) const override;
73};
74
75} // namespace vcl::qt
76
77#endif // VCL_QT_GUI_TEXT_EDIT_LOGGER_H
Definition logger.h:40
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
Definition debug_io_device.h:32
Definition text_edit_logger.h:38
QTextStream * levelStream(LogLevel lvl) const override
Returns the stream corresponding to the given LogLevel.
Definition text_edit_logger.cpp:70