source: subsurface/qt-models/diveimportedmodel.h @ 3f0d210

Last change on this file since 3f0d210 was 3f0d210, checked in by Dirk Hohndel <dirk@…>, 7 months ago

QML UI: add downloaded dives to dive list

This already takes into account which of those dives were selected.
Right now all we have is select all or none - this needs actual support
in the UI, but once that's there, it will just work (famous last words).

Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#ifndef DIVEIMPORTEDMODEL_H
2#define DIVEIMPORTEDMODEL_H
3
4#include <QAbstractTableModel>
5#include "core/dive.h"
6
7class DiveImportedModel : public QAbstractTableModel
8{
9        Q_OBJECT
10public:
11        enum roleTypes { DateTime = Qt::UserRole + 1, Duration, Depth};
12
13        DiveImportedModel(QObject *parent = 0);
14        void setDiveTable(struct dive_table *table);
15        int columnCount(const QModelIndex& index = QModelIndex()) const;
16        int rowCount(const QModelIndex& index = QModelIndex()) const;
17        QVariant data(const QModelIndex& index, int role) const;
18        QVariant headerData(int section, Qt::Orientation orientation, int role) const;
19        void setImportedDivesIndexes(int first, int last);
20        Qt::ItemFlags flags(const QModelIndex &index) const;
21        void clearTable();
22        QHash<int, QByteArray> roleNames() const;
23        Q_INVOKABLE void repopulate();
24        Q_INVOKABLE void recordDives();
25public
26slots:
27        void changeSelected(QModelIndex clickedIndex);
28        void selectAll();
29        void selectNone();
30
31private:
32        int firstIndex;
33        int lastIndex;
34        bool *checkStates;
35        struct dive_table *diveTable;
36};
37
38#endif
Note: See TracBrowser for help on using the repository browser.