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

0001 /*
0002     This file is part of KCachegrind.
0003 
0004     SPDX-FileCopyrightText: 2003-201 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only
0007 */
0008 
0009 /*
0010  * Instruction View
0011  */
0012 
0013 #ifndef INSTRVIEW_H
0014 #define INSTRVIEW_H
0015 
0016 #include <QTreeWidget>
0017 
0018 #include "traceitemview.h"
0019 
0020 class InstrItem;
0021 
0022 class InstrView : public QTreeWidget, public TraceItemView
0023 {
0024     friend class InstrItem;
0025 
0026     Q_OBJECT
0027 
0028 public:
0029     explicit InstrView(TraceItemView* parentView,
0030                        QWidget* parent = nullptr);
0031 
0032     QWidget* widget() override { return this; }
0033     QString whatsThis() const override;
0034     int arrowLevels() { return _arrowLevels; }
0035 
0036     void restoreOptions(const QString& prefix, const QString& postfix) override;
0037     void saveOptions(const QString& prefix, const QString& postfix) override;
0038 
0039 protected Q_SLOTS:
0040     void context(const QPoint &);
0041     void selectedSlot(QTreeWidgetItem*, QTreeWidgetItem*);
0042     void activatedSlot(QTreeWidgetItem*,int);
0043     void headerClicked(int);
0044 
0045 protected:
0046     void keyPressEvent(QKeyEvent* event) override;
0047 
0048 private:
0049     CostItem* canShow(CostItem*) override;
0050     void doUpdate(int, bool) override;
0051     void refresh();
0052     void setColumnWidths();
0053     bool searchFile(QString&, TraceObject*);
0054     void fillInstr();
0055     void updateJumpArray(Addr,InstrItem*,bool,bool);
0056     bool fillInstrRange(TraceFunction*,
0057                         TraceInstrMap::Iterator,TraceInstrMap::Iterator);
0058 
0059     bool _inSelectionUpdate;
0060 
0061     // arrows
0062     int _arrowLevels;
0063     // temporary needed on creation...
0064     QVector<TraceInstrJump*> _jump;
0065     TraceInstrJumpList _lowList, _highList;
0066     TraceInstrJumpList::iterator _lowListIter, _highListIter;
0067 
0068     // remember width of hex code column if hidden
0069     int _lastHexCodeWidth;
0070 
0071     // widget options
0072     bool _showHexCode;
0073 };
0074 
0075 #endif