"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/widgets/CommentsWidget.h" between
cutter-1.8.3.tar.gz and cutter-1.9.0.tar.gz

About: cutter is a Qt and C++ GUI for radare2 reverse engineering framework.

CommentsWidget.h  (cutter-1.8.3):CommentsWidget.h  (cutter-1.9.0)
#ifndef COMMENTSWIDGET_H #ifndef COMMENTSWIDGET_H
#define COMMENTSWIDGET_H #define COMMENTSWIDGET_H
#include <memory> #include <memory>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "core/Cutter.h" #include "core/Cutter.h"
#include "common/AddressableItemModel.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h" #include "CutterTreeWidget.h"
#include "widgets/ListDockWidget.h"
class MainWindow; class MainWindow;
class QTreeWidgetItem; class QTreeWidgetItem;
class CommentsWidget; class CommentsWidget;
namespace Ui { struct CommentGroup
class CommentsWidget; {
} QString name;
RVA offset;
QList<CommentDescription> comments;
};
class CommentsModel : public QAbstractItemModel class CommentsModel : public AddressableItemModel<>
{ {
Q_OBJECT Q_OBJECT
friend CommentsWidget; friend CommentsWidget;
private: private:
QList<CommentDescription> *comments; QList<CommentDescription> *comments;
QMap<QString, QList<CommentDescription>> *nestedComments; QList<CommentGroup> *nestedComments;
bool nested; bool nested;
public: public:
enum Column { OffsetColumn = 0, FunctionColumn, CommentColumn, ColumnCount } ; enum Column { OffsetColumn = 0, FunctionColumn, CommentColumn, ColumnCount } ;
enum NestedColumn { OffsetNestedColumn = 0, CommentNestedColumn, NestedColum nCount }; enum NestedColumn { OffsetNestedColumn = 0, CommentNestedColumn, NestedColum nCount };
enum Role { CommentDescriptionRole = Qt::UserRole, FunctionRole }; enum Role { CommentDescriptionRole = Qt::UserRole, FunctionRole };
CommentsModel(QList<CommentDescription> *comments, CommentsModel(QList<CommentDescription> *comments,
QMap<QString, QList<CommentDescription>> *nestedComments, QList<CommentGroup> *nestedComments,
QObject *parent = nullptr); QObject *parent = nullptr);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelInd QModelIndex index(int row, int column, const QModelIndex &parent = QModelInd
ex()) const; ex()) const override;
QModelIndex parent(const QModelIndex &index) const; QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt: QVariant headerData(int section, Qt::Orientation orientation,
:DisplayRole) const; int role = Qt::DisplayRole) const override;
bool isNested() const; bool isNested() const;
void setNested(bool nested); void setNested(bool nested);
RVA address(const QModelIndex &index) const override;
}; };
class CommentsProxyModel : public QSortFilterProxyModel class CommentsProxyModel : public AddressableFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
CommentsProxyModel(CommentsModel *sourceModel, QObject *parent = nullptr); CommentsProxyModel(CommentsModel *sourceModel, QObject *parent = nullptr);
protected: protected:
bool filterAcceptsRow(int row, const QModelIndex &parent) const override; bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const overr ide; bool lessThan(const QModelIndex &left, const QModelIndex &right) const overr ide;
}; };
class CommentsWidget : public CutterDockWidget class CommentsWidget : public ListDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CommentsWidget(MainWindow *main, QAction *action = nullptr); explicit CommentsWidget(MainWindow *main, QAction *action = nullptr);
~CommentsWidget(); ~CommentsWidget() override;
protected: protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
private slots: private slots:
void on_commentsTreeView_doubleClicked(const QModelIndex &index); void onActionHorizontalToggled(bool checked);
void onActionVerticalToggled(bool checked);
void on_actionHorizontal_triggered();
void on_actionVertical_triggered();
void showTitleContextMenu(const QPoint &pt); void showTitleContextMenu(const QPoint &pt);
void refreshTree(); void refreshTree();
private: private:
std::unique_ptr<Ui::CommentsWidget> ui;
MainWindow *main;
CommentsModel *commentsModel; CommentsModel *commentsModel;
CommentsProxyModel *commentsProxyModel; CommentsProxyModel *commentsProxyModel;
CutterTreeWidget *tree; QAction actionHorizontal;
QAction actionVertical;
QList<CommentDescription> comments; QList<CommentDescription> comments;
QMap<QString, QList<CommentDescription>> nestedComments; QList<CommentGroup> nestedComments;
void setScrollMode(); QMenu *titleContextMenu;
}; };
#endif // COMMENTSWIDGET_H #endif // COMMENTSWIDGET_H
 End of changes. 18 change blocks. 
27 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)