2018-02-04 14:32:18 +00:00
|
|
|
#ifndef RESOURCESWIDGET_H
|
|
|
|
#define RESOURCESWIDGET_H
|
|
|
|
|
2018-03-04 17:42:02 +00:00
|
|
|
#include "Cutter.h"
|
2018-03-16 21:46:57 +00:00
|
|
|
#include "CutterDockWidget.h"
|
2018-11-10 09:17:52 +00:00
|
|
|
#include "CutterTreeView.h"
|
2018-02-04 14:32:18 +00:00
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
class MainWindow;
|
2018-10-10 11:33:55 +00:00
|
|
|
class ResourcesWidget;
|
2018-03-16 21:46:57 +00:00
|
|
|
|
2018-02-04 14:32:18 +00:00
|
|
|
class ResourcesModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-10-10 11:33:55 +00:00
|
|
|
friend ResourcesWidget;
|
|
|
|
|
2018-02-04 14:32:18 +00:00
|
|
|
private:
|
|
|
|
QList<ResourcesDescription> *resources;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Columns { INDEX = 0, NAME, VADDR, TYPE, SIZE, LANG, COUNT };
|
|
|
|
explicit ResourcesModel(QList<ResourcesDescription> *resources, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
2018-03-21 20:32:32 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
2018-02-04 14:32:18 +00:00
|
|
|
};
|
|
|
|
|
2018-03-16 21:46:57 +00:00
|
|
|
class ResourcesWidget : public CutterDockWidget
|
2018-02-04 14:32:18 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
ResourcesModel *model;
|
2018-11-10 09:17:52 +00:00
|
|
|
CutterTreeView *view;
|
2018-02-04 14:32:18 +00:00
|
|
|
QList<ResourcesDescription> resources;
|
|
|
|
|
|
|
|
public:
|
2018-03-16 21:46:57 +00:00
|
|
|
explicit ResourcesWidget(MainWindow *main, QAction *action = nullptr);
|
2018-02-04 14:32:18 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void refreshResources();
|
|
|
|
void onDoubleClicked(const QModelIndex &);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RESOURCESWIDGET_H
|