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)));
65 mSearchAction =
new QAction(
this);
70 mChannelLabel =
new QLabel(
this);
114 mVerboseButton =
new QPushButton(
"Show all",
this);
132 return mPlainTextEdit;
142 if (mCurrentChannel ==
"")
146 if (logger_name != mCurrentChannel)
151 if ((t == spdlog::level::level_enum::info) && mInfoSeverity) {
154 else if ((t == spdlog::level::level_enum::warn) && mWarningSeverity) {
157 else if ((t == spdlog::level::level_enum::err) && mErrorSeverity) {
160 else if ((t == spdlog::level::level_enum::debug) && mDebugSeverity) {
163 else if (t == spdlog::level::level_enum::critical) {
187 return regEx.match(stringToCheck).hasMatch();
197 if ((
sender() == mSelector) || p == 0) {
198 mCurrentChannelIndex = p;
203 mCurrentChannelIndex = model->
rowCount() - 1;
206 if (mCurrentChannelIndex == -2) {
215 mPlainTextEdit->
clear();
227 if ((entry->mMsgType == spdlog::level::level_enum::info) && mInfoSeverity) {
230 else if ((entry->mMsgType == spdlog::level::level_enum::warn) && mWarningSeverity) {
233 else if ((entry->mMsgType == spdlog::level::level_enum::err) && mErrorSeverity) {
236 else if ((entry->mMsgType == spdlog::level::level_enum::debug) && mDebugSeverity) {
239 else if (entry->mMsgType == spdlog::level::level_enum::critical) {
256 if (
sender() == mDebugButton)
258 mDebugSeverity =
state;
260 else if (
sender() == mInfoButton)
262 mInfoSeverity =
state;
264 else if (
sender() == mWarningButton)
266 mWarningSeverity =
state;
268 else if (
sender() == mErrorButton)
270 mErrorSeverity =
state;
272 else if (
sender() == mMuteButton)
279 else if (
sender() == mVerboseButton)
298 mSearchFilter = filter;
299 std::cout << mSearchFilter.QString::toStdString() << std::endl;
308 if (!mUserInteractedWithScrollbar)
309 mUserInteractedWithScrollbar =
true;
318 model->
handleLogmanagerCallback(spdlog::level::level_enum::debug , channel_name, channel_name +
" has manually been added to channellist");
325 if (!mUserInteractedWithScrollbar)
329 void LoggerWidget::scrollToBottom()
334 void LoggerWidget::saveSettings()
336 LoggerSettings settings = { mDebugSeverity, mInfoSeverity, mWarningSeverity, mErrorSeverity };
340 void LoggerWidget::restoreSettings()
343 mDebugSeverity = settings.debugSeverity;
344 mInfoSeverity = settings.infoSeverity;
345 mWarningSeverity = settings.warningSeverity;
346 mErrorSeverity = settings.errorSeverity;
365 return mSearchIconPath;
370 return mSearchIconStyle;
375 mSearchIconPath = path;
380 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.