diff options
Diffstat (limited to 'ui/qt/widgets')
-rw-r--r-- | ui/qt/widgets/expert_info_view.cpp | 55 | ||||
-rw-r--r-- | ui/qt/widgets/expert_info_view.h | 42 |
2 files changed, 97 insertions, 0 deletions
diff --git a/ui/qt/widgets/expert_info_view.cpp b/ui/qt/widgets/expert_info_view.cpp new file mode 100644 index 0000000000..1436ee23a4 --- /dev/null +++ b/ui/qt/widgets/expert_info_view.cpp @@ -0,0 +1,55 @@ +/* expert_info_view.cpp + * Tree view of Expert Info data. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include "expert_info_view.h" +#include <ui/qt/models/expert_info_model.h> +#include <ui/qt/models/expert_info_proxy_model.h> + +#include <QHeaderView> + +ExpertInfoTreeView::ExpertInfoTreeView(QWidget *parent) : QTreeView(parent) +{ +} + +void ExpertInfoTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) +{ + if (current.isValid()) + { + if (current.parent().isValid()) { + ((ExpertInfoProxyModel*)model())->setSeverityMode(ExpertInfoProxyModel::Packet); + } else { + ((ExpertInfoProxyModel*)model())->setSeverityMode(ExpertInfoProxyModel::Group); + } + + QModelIndex model_index = ((ExpertInfoProxyModel*)model())->mapToSource(current); + + if (model_index.parent().isValid()) { + ExpertPacketItem* currentItem = static_cast<ExpertPacketItem*>(model_index.internalPointer()); + if (currentItem != NULL) + { + emit goToPacket(currentItem->packetNum(), currentItem->hfId()); + } + } + } + + QTreeView::currentChanged(current, previous); +} + +/* * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/ui/qt/widgets/expert_info_view.h b/ui/qt/widgets/expert_info_view.h new file mode 100644 index 0000000000..7662cf330d --- /dev/null +++ b/ui/qt/widgets/expert_info_view.h @@ -0,0 +1,42 @@ +/* expert_info_view.h + * Tree view of Expert Info data. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef EXPERT_INFO_VIEW_H +#define EXPERT_INFO_VIEW_H + +#include <config.h> +#include <QTreeView> + +class ExpertInfoTreeView : public QTreeView +{ + Q_OBJECT +public: + ExpertInfoTreeView(QWidget *parent = 0); + +signals: + void goToPacket(int packet_num, int hf_id); + +protected slots: + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); +}; +#endif // EXPERT_INFO_VIEW_H + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |