2017-03-29 10:18:37 +00:00
|
|
|
#ifndef FUNCTIONSWIDGET_H
|
|
|
|
#define FUNCTIONSWIDGET_H
|
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
#include <QDockWidget>
|
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include "qrcore.h"
|
2017-04-13 15:14:02 +00:00
|
|
|
#include "dashboard.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
class MainWindow;
|
2017-04-13 15:14:02 +00:00
|
|
|
class QTreeWidgetItem;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-04-09 19:55:06 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class FunctionsWidget;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
|
|
|
|
class FunctionModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
MainWindow *main;
|
|
|
|
|
|
|
|
QList<FunctionDescription> *functions;
|
|
|
|
QSet<RVA> *import_addresses;
|
|
|
|
|
|
|
|
|
|
|
|
QFont highlight_font;
|
|
|
|
QFont default_font;
|
|
|
|
bool nested;
|
|
|
|
|
|
|
|
int current_index;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static const int FunctionDescriptionRole = Qt::UserRole;
|
|
|
|
static const int IsImportRole = Qt::UserRole + 1;
|
|
|
|
|
|
|
|
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *import_addresses, bool nested, QFont default_font, QFont highlight_font, MainWindow *main, QObject *parent = 0);
|
|
|
|
|
|
|
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QModelIndex parent(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
|
|
void beginReloadFunctions();
|
|
|
|
void endReloadFunctions();
|
|
|
|
|
|
|
|
void updateCurrentIndex();
|
|
|
|
|
|
|
|
bool isNested() { return nested; }
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void cursorAddressChanged(RVA addr);
|
2017-04-28 13:38:01 +00:00
|
|
|
void functionRenamed(const QString &prev_name, const QString &new_name);
|
2017-04-28 13:09:40 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class FunctionSortFilterProxyModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
FunctionSortFilterProxyModel(FunctionModel *source_model, QObject *parent = 0);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
|
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
class FunctionsWidget : public DockWidget
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit FunctionsWidget(MainWindow *main, QWidget *parent = 0);
|
|
|
|
~FunctionsWidget();
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
void setup() override;
|
|
|
|
|
|
|
|
void refresh() override;
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private slots:
|
2017-05-04 14:16:21 +00:00
|
|
|
void functionsTreeView_doubleClicked(const QModelIndex &index);
|
2017-03-29 10:18:37 +00:00
|
|
|
void showFunctionsContextMenu(const QPoint &pt);
|
|
|
|
|
|
|
|
void on_actionDisasAdd_comment_triggered();
|
|
|
|
|
|
|
|
void on_actionFunctionsRename_triggered();
|
|
|
|
|
|
|
|
void on_action_References_triggered();
|
|
|
|
|
|
|
|
void showTitleContextMenu(const QPoint &pt);
|
|
|
|
|
|
|
|
void on_actionHorizontal_triggered();
|
|
|
|
|
|
|
|
void on_actionVertical_triggered();
|
|
|
|
|
2017-04-10 10:25:33 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-28 13:09:40 +00:00
|
|
|
QTreeView *getCurrentTreeView();
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
Ui::FunctionsWidget *ui;
|
|
|
|
MainWindow *main;
|
2017-04-13 15:14:02 +00:00
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
QList<FunctionDescription> functions;
|
|
|
|
QSet<RVA> import_addresses;
|
|
|
|
|
|
|
|
FunctionModel *function_model;
|
|
|
|
FunctionSortFilterProxyModel *function_proxy_model;
|
|
|
|
|
|
|
|
FunctionModel *nested_function_model;
|
|
|
|
FunctionSortFilterProxyModel *nested_function_proxy_model;
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
void refreshTree();
|
|
|
|
void setScrollMode();
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
#endif // FUNCTIONSWIDGET_H
|