5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _DEBUGOUTPUT_H_
22 #define _DEBUGOUTPUT_H_
24 #include "simulator.h"
25 #include "simulatorinterface.h"
32 // NOTE : The buffer sizes need to be large enough to handle the flood of data when X12/X10 simulator starts up with TRACE_SIMPGMSPACE=1 (> 40K!).
33 // These are maximum sizes, not necessarily allocated sizes.
34 #ifndef DEBUG_OUTPUT_WIDGET_OUT_BUFF_SIZE
35 // This buffer holds received and processed data until it can be printed to our console.
36 #define DEBUG_OUTPUT_WIDGET_OUT_BUFF_SIZE (50 * 1024) // [bytes]
38 #ifndef DEBUG_OUTPUT_WIDGET_INP_BUFF_SIZE
39 // This buffer is active if line filter is enabled and holds received data until it can be filtered and placed in output buffer.
40 #define DEBUG_OUTPUT_WIDGET_INP_BUFF_SIZE (50 * 1024) // [bytes]
47 class QAbstractButton
;
48 class QMessageLogContext
;
49 class FilteredTextBuffer
;
51 using namespace Simulator
;
53 class DebugOutput
: public QWidget
58 explicit DebugOutput(QWidget
* parent
, SimulatorInterface
* simulator
);
59 virtual ~DebugOutput();
61 static QRegularExpression
makeRegEx(const QString
& input
, bool * isExlusive
= NULL
);
64 void filterExprChanged(const QRegularExpression
& expr
);
65 void filterEnabledChanged(const bool enabled
);
66 void filterExclusiveChanged(const bool exlusive
);
67 void filterChanged(bool enable
, bool exclusive
, const QRegularExpression
& expr
);
68 void tracebackDeviceChange(QIODevice
* device
);
73 void processBytesReceived();
74 void onDataBufferOverflow(const qint64 len
);
75 void onFilterStateChanged();
76 void onFilterTextChanged(const QString
&);
77 void onFilterToggled(bool enable
);
78 void on_bufferSize_editingFinished();
79 void on_actionWordWrap_toggled(bool checked
);
80 void on_actionClearScr_triggered();
81 void on_actionShowFilterHelp_triggered();
85 SimulatorInterface
* m_simulator
;
86 FilteredTextBuffer
* m_dataBufferDevice
;
91 const static quint16 m_savedViewStateVersion
;
94 class DebugOutputFilterValidator
: public QValidator
97 DebugOutputFilterValidator(QObject
*parent
= Q_NULLPTR
) : QValidator(parent
) { }
98 virtual State
validate(QString
& input
, int &) const;
101 class DeleteComboBoxItemEventFilter
: public QObject
105 DeleteComboBoxItemEventFilter(QObject
*parent
= Q_NULLPTR
) : QObject(parent
) { }
107 bool eventFilter(QObject
*obj
, QEvent
*event
);
110 #endif // _DEBUGOUTPUT_H_