| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#ifndef TABLEMODEL_H |
| 33 |
#define TABLEMODEL_H |
| 34 |
|
| 35 |
#include <QStandardItemModel> |
| 36 |
#include <QStandardItem> |
| 37 |
#include <QMap> |
| 38 |
|
| 39 |
#include "table.h" |
| 40 |
|
| 41 |
class TableModel : public QStandardItemModel { |
| 42 |
Q_OBJECT |
| 43 |
|
| 44 |
public: |
| 45 |
TableModel(QObject *parent); |
| 46 |
|
| 47 |
static const int TABLE_COL_IDX = 0; |
| 48 |
static const int DIR_COL_IDX = 1; |
| 49 |
static const int STATUS_COL_IDX = 2; |
| 50 |
static const int PRELOAD_COL_IDX = 3; |
| 51 |
static const int PROGRESS_COL_IDX = 4; |
| 52 |
|
| 53 |
void install(list_t *tables); |
| 54 |
void uninstall(table_kind_t kind); |
| 55 |
void enable(QStandardItem *item, bool value); |
| 56 |
void updateTable(table_t *tbl); |
| 57 |
void updateItem(QStandardItem *item); |
| 58 |
void updateProgress(void); |
| 59 |
|
| 60 |
table_t *tableFromItem(QStandardItem *item); |
| 61 |
bool isInstalled(QStandardItem *item); |
| 62 |
bool isInstalled(table_kind_t kind); |
| 63 |
|
| 64 |
QStandardItem *insertRoot(table_kind_t kind); |
| 65 |
QStandardItem *insertTable(table_t *tbl); |
| 66 |
|
| 67 |
QStandardItem *getRoot(table_kind_t kind); |
| 68 |
void insertRow(int row, const QList<QStandardItem*> &items); |
| 69 |
|
| 70 |
private: |
| 71 |
void updateRootItem(QStandardItem *item); |
| 72 |
void updateChildItem(QStandardItem *item); |
| 73 |
|
| 74 |
QMap<table_kind_t, QStandardItem*> itemFromKind; |
| 75 |
}; |
| 76 |
|
| 77 |
#endif |