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

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  * Source View
0011  */
0012 
0013 #ifndef SOURCEVIEW_H
0014 #define SOURCEVIEW_H
0015 
0016 #include <QTreeWidget>
0017 #include "traceitemview.h"
0018 
0019 class SourceItem;
0020 
0021 class SourceView : public QTreeWidget, public TraceItemView
0022 {
0023     friend class SourceItem;
0024 
0025     Q_OBJECT
0026 
0027 public:
0028     explicit SourceView(TraceItemView* parentView,
0029                         QWidget* parent = nullptr);
0030 
0031     QWidget* widget() override { return this; }
0032     QString whatsThis() const override;
0033     int arrowLevels() { return _arrowLevels; }
0034 
0035 protected Q_SLOTS:
0036     void context(const QPoint &);
0037     void selectedSlot(QTreeWidgetItem*, QTreeWidgetItem*);
0038     void activatedSlot(QTreeWidgetItem*,int);
0039     void headerClicked(int);
0040 
0041 protected:
0042     void keyPressEvent(QKeyEvent* event) override;
0043 
0044 private:
0045     CostItem* canShow(CostItem*) override;
0046     void doUpdate(int, bool) override;
0047     void refresh();
0048     void updateJumpArray(uint,SourceItem*,bool,bool);
0049     bool searchFile(QString&, TraceFunctionSource*);
0050     void fillSourceFile(TraceFunctionSource*, int);
0051 
0052     bool _inSelectionUpdate;
0053 
0054     // arrows
0055     int _arrowLevels;
0056     // temporary needed on creation...
0057     QVector<TraceLineJump*> _jump;
0058     TraceLineJumpList _lowList, _highList;
0059     TraceLineJumpList::iterator _lowListIter, _highListIter;
0060 };
0061 
0062 #endif