File indexing completed on 2024-04-28 05:41:37

0001 /*
0002     This file is part of KCachegrind.
0003 
0004     SPDX-FileCopyrightText: 2003-2016 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only
0007 */
0008 
0009 /*
0010  * StackSelection for KCachegrind
0011  * For function selection of a most expected stack,
0012  *  to be put into a QDockWindow
0013  */
0014 
0015 #ifndef STACKSELECTION_H
0016 #define STACKSELECTION_H
0017 
0018 #include <QWidget>
0019 #include "tracedata.h"
0020 
0021 class QTreeWidget;
0022 class QTreeWidgetItem;
0023 class TraceFunction;
0024 class TraceData;
0025 class StackBrowser;
0026 
0027 
0028 class StackSelection : public QWidget
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     explicit StackSelection(QWidget* parent = nullptr);
0034     ~StackSelection() override;
0035 
0036     TraceData* data() const { return _data; }
0037     void setData(TraceData*);
0038     StackBrowser* browser() const { return _browser; }
0039     EventType* eventType() { return _eventType; }
0040     EventType* eventType2() { return _eventType2; }
0041     ProfileContext::Type groupType() { return _groupType; }
0042 
0043 Q_SIGNALS:
0044     void functionSelected(CostItem*);
0045 
0046 public Q_SLOTS:
0047     void setFunction(TraceFunction*);
0048     void setEventType(EventType*);
0049     void setEventType2(EventType*);
0050     void setGroupType(ProfileContext::Type);
0051 
0052     void stackSelected(QTreeWidgetItem*,QTreeWidgetItem*);
0053     void browserBack();
0054     void browserForward();
0055     void browserUp();
0056     void browserDown();
0057     void refresh();
0058     void rebuildStackList();
0059 
0060 private:
0061     void selectFunction();
0062 
0063     TraceData* _data;
0064     StackBrowser* _browser;
0065     TraceFunction* _function;
0066     EventType* _eventType;
0067     EventType* _eventType2;
0068     ProfileContext::Type _groupType;
0069 
0070     QTreeWidget* _stackList;
0071 };
0072 
0073 #endif