10 #include <QHeaderView>
11 #include <QVBoxLayout>
12 #include <QSignalMapper>
13 #include <QPushButton>
15 #include <QSpacerItem>
21 #include <QRegularExpression>
37 mUserInteractedWithScrollbar =
false;
46 mSearchbar =
new Searchbar(mPlainTextEdit);
54 connect(model, SIGNAL(updated(spdlog::level::level_enum, std::string, std::string)),
this, SLOT(
handleChannelUpdated(spdlog::level::level_enum, std::string, std::string)));
56 mSearchAction =
new QAction(
this);
59 mChannelLabel =
new QLabel(
this);
117 mVerboseButton =
new QPushButton(
"Show all",
this);
135 return mPlainTextEdit;
145 if (mCurrentChannel ==
"")
149 if (logger_name != mCurrentChannel)
154 if ((t == spdlog::level::level_enum::info) && mInfoSeverity) {
157 else if ((t == spdlog::level::level_enum::warn) && mWarningSeverity) {
160 else if ((t == spdlog::level::level_enum::err) && mErrorSeverity) {
163 else if ((t == spdlog::level::level_enum::debug) && mDebugSeverity) {
166 else if (t == spdlog::level::level_enum::critical) {
190 return regEx.match(stringToCheck).hasMatch();
200 if ((
sender() == mSelector) || p == 0) {
201 mCurrentChannelIndex = p;
206 mCurrentChannelIndex = model->
rowCount() - 1;
209 if (mCurrentChannelIndex == -2) {
218 mPlainTextEdit->
clear();
230 if ((entry->mMsgType == spdlog::level::level_enum::info) && mInfoSeverity) {
233 else if ((entry->mMsgType == spdlog::level::level_enum::warn) && mWarningSeverity) {
236 else if ((entry->mMsgType == spdlog::level::level_enum::err) && mErrorSeverity) {
239 else if ((entry->mMsgType == spdlog::level::level_enum::debug) && mDebugSeverity) {
242 else if (entry->mMsgType == spdlog::level::level_enum::critical) {
259 if (
sender() == mDebugButton)
261 mDebugSeverity =
state;
263 else if (
sender() == mInfoButton)
265 mInfoSeverity =
state;
267 else if (
sender() == mWarningButton)
269 mWarningSeverity =
state;
271 else if (
sender() == mErrorButton)
273 mErrorSeverity =
state;
275 else if (
sender() == mMuteButton)
282 else if (
sender() == mVerboseButton)
301 mSearchFilter = filter;
302 std::cout << mSearchFilter.QString::toStdString() << std::endl;
311 if (!mUserInteractedWithScrollbar)
312 mUserInteractedWithScrollbar =
true;
321 model->
handleLogmanagerCallback(spdlog::level::level_enum::debug , channel_name, channel_name +
" has manually been added to channellist");
328 if (!mUserInteractedWithScrollbar)
332 void LoggerWidget::scrollToBottom()
337 void LoggerWidget::saveSettings()
339 LoggerSettings settings = { mDebugSeverity, mInfoSeverity, mWarningSeverity, mErrorSeverity };
343 void LoggerWidget::restoreSettings()
346 mDebugSeverity = settings.debugSeverity;
347 mInfoSeverity = settings.infoSeverity;
348 mWarningSeverity = settings.warningSeverity;
349 mErrorSeverity = settings.errorSeverity;
368 return mSearchIconPath;
373 return mSearchIconStyle;
378 mSearchIconPath = path;
383 mSearchIconStyle =
style;
This class represents a channel in the channel model. It primarily holds the channel name and its ent...
const QString name() const
const QList< ChannelEntry * > * getEntries() const
QReadWriteLock * getLock()
Table model for log channels.
void handleLogmanagerCallback(const spdlog::level::level_enum &t, const std::string &channel_name, const std::string &msg_text)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
static ChannelModel * instance()
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
A combobox for selecting a logger channel.
Abstract class for Widgets within HAL's ContentArea.
QVBoxLayout * mContentLayout
Appends log messages to the corresponding LoggerWidget.
void appendLog(spdlog::level::level_enum log_type, QString const &msg)
bool isExactMatch() const
bool isCaseSensitive() const
bool isRegularExpression() const
A QFrame with a QLineEdit that can be used to input a substring to search for.
void saveLoggerSettings(const LoggerSettings &settings)
LoggerSettings loggerSettings() const
static SettingsManager * instance()
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
void actionTriggered(int action)
void setIcon(const QIcon &icon)
AdjustToContentsOnFirstShow
void setCurrentText(const QString &text)
void setEditable(bool editable)
QLineEdit * lineEdit() const const
void setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy policy)
void setFrameStyle(int style)
void setText(const QString &)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * sender() const const
void setReadOnly(bool ro)
int compare(const QString &other, Qt::CaseSensitivity cs) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString fromStdString(const std::string &str)
bool isEmpty() const const
std::string toStdString() const const
The ChannelEntry struct is used by the ChannelItem class to store a single entry.