"Fossies" - the Fresh Open Source Software Archive

Member "cutter-1.8.2/src/widgets/MemoryMapWidget.h" (20 May 2019, 1858 Bytes) of package /linux/privat/cutter-1.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "MemoryMapWidget.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.7.4_vs_1.8.0.

    1 #pragma once
    2 
    3 #include <memory>
    4 
    5 #include "core/Cutter.h"
    6 #include "CutterDockWidget.h"
    7 
    8 #include <QAbstractListModel>
    9 #include <QSortFilterProxyModel>
   10 
   11 class MainWindow;
   12 class QTreeWidget;
   13 class MemoryMapWidget;
   14 
   15 namespace Ui {
   16 class MemoryMapWidget;
   17 }
   18 
   19 
   20 class MainWindow;
   21 class QTreeWidgetItem;
   22 
   23 
   24 class MemoryMapModel: public QAbstractListModel
   25 {
   26     Q_OBJECT
   27 
   28     friend MemoryMapWidget;
   29 
   30 private:
   31     QList<MemoryMapDescription> *memoryMaps;
   32 
   33 public:
   34     enum Column { AddrStartColumn = 0, AddrEndColumn, NameColumn, PermColumn, ColumnCount };
   35     enum Role { MemoryDescriptionRole = Qt::UserRole };
   36 
   37     MemoryMapModel(QList<MemoryMapDescription> *memoryMaps, QObject *parent = 0);
   38 
   39     int rowCount(const QModelIndex &parent = QModelIndex()) const;
   40     int columnCount(const QModelIndex &parent = QModelIndex()) const;
   41 
   42     QVariant data(const QModelIndex &index, int role) const;
   43     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
   44 };
   45 
   46 
   47 
   48 class MemoryProxyModel : public QSortFilterProxyModel
   49 {
   50     Q_OBJECT
   51 
   52 public:
   53     MemoryProxyModel(MemoryMapModel *sourceModel, QObject *parent = nullptr);
   54 
   55 protected:
   56     bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
   57     bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
   58 };
   59 
   60 
   61 
   62 class MemoryMapWidget : public CutterDockWidget
   63 {
   64     Q_OBJECT
   65 
   66 public:
   67     explicit MemoryMapWidget(MainWindow *main, QAction *action = nullptr);
   68     ~MemoryMapWidget();
   69 
   70 private slots:
   71     void on_memoryTreeView_doubleClicked(const QModelIndex &index);
   72 
   73     void refreshMemoryMap();
   74 
   75 private:
   76     std::unique_ptr<Ui::MemoryMapWidget> ui;
   77 
   78     MemoryMapModel *memoryModel;
   79     MemoryProxyModel *memoryProxyModel;
   80     QList<MemoryMapDescription> memoryMaps;
   81 
   82     void setScrollMode();
   83 
   84     RefreshDeferrer *refreshDeferrer;
   85 };