2017-03-29 10:18:37 +00:00
|
|
|
#ifndef SYMBOLSWIDGET_H
|
|
|
|
#define SYMBOLSWIDGET_H
|
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
#include <memory>
|
2018-05-02 12:06:31 +00:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-02 12:06:31 +00:00
|
|
|
#include "Cutter.h"
|
2018-03-16 21:46:57 +00:00
|
|
|
#include "CutterDockWidget.h"
|
2017-11-19 12:56:10 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
class MainWindow;
|
2017-04-13 15:14:02 +00:00
|
|
|
class QTreeWidgetItem;
|
2018-10-10 11:33:55 +00:00
|
|
|
class SymbolsWidget;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
namespace Ui {
|
|
|
|
class SymbolsWidget;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2018-05-02 12:06:31 +00:00
|
|
|
class SymbolsModel: public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend SymbolsWidget;
|
|
|
|
|
2018-05-02 12:06:31 +00:00
|
|
|
private:
|
|
|
|
QList<SymbolDescription> *symbols;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Column { AddressColumn = 0, TypeColumn, NameColumn, ColumnCount };
|
|
|
|
enum Role { SymbolDescriptionRole = Qt::UserRole };
|
|
|
|
|
2018-05-04 07:58:32 +00:00
|
|
|
SymbolsModel(QList<SymbolDescription> *exports, QObject *parent = nullptr);
|
2018-05-02 12:06:31 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SymbolsProxyModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-05-04 07:58:32 +00:00
|
|
|
SymbolsProxyModel(SymbolsModel *sourceModel, QObject *parent = nullptr);
|
2018-05-02 12:06:31 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
|
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
class SymbolsWidget : public CutterDockWidget
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-03-16 21:46:57 +00:00
|
|
|
explicit SymbolsWidget(MainWindow *main, QAction *action = nullptr);
|
2017-03-29 10:18:37 +00:00
|
|
|
~SymbolsWidget();
|
|
|
|
|
|
|
|
private slots:
|
2018-05-02 12:06:31 +00:00
|
|
|
void on_symbolsTreeView_doubleClicked(const QModelIndex &index);
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-02 12:06:31 +00:00
|
|
|
void refreshSymbols();
|
2017-11-19 12:56:10 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
private:
|
2017-10-02 09:41:28 +00:00
|
|
|
std::unique_ptr<Ui::SymbolsWidget> ui;
|
2018-05-02 12:06:31 +00:00
|
|
|
QList<SymbolDescription> symbols;
|
|
|
|
SymbolsModel *symbolsModel;
|
|
|
|
SymbolsProxyModel *symbolsProxyModel;
|
2017-04-13 15:14:02 +00:00
|
|
|
|
|
|
|
void setScrollMode();
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SYMBOLSWIDGET_H
|