summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp19
-rw-r--r--qt-ui/downloadfromdivecomputer.h1
2 files changed, 14 insertions, 6 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 31d1ddaa0..91e38ae36 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -500,7 +500,8 @@ void DownloadThread::run()
DiveImportedModel::DiveImportedModel(QObject *o) : QAbstractTableModel(o),
lastIndex(0),
- firstIndex(0)
+ firstIndex(0),
+ checkStates(0)
{
}
@@ -525,13 +526,17 @@ QVariant DiveImportedModel::data(const QModelIndex& index, int role) const
struct dive* d = get_dive( index.row() + firstIndex);
if (role == Qt::DisplayRole) {
switch(index.column()){
- case 0 : return QVariant(d->when);
- case 1 : return QVariant(d->duration);
- case 2 : return QVariant(d->maxdepth);
- case 3 : return QVariant(d->latitude);
- case 4 : return QVariant(d->longitude);
+ case 0 : return QVariant((int) d->when);
+ case 1 : return QVariant(d->duration.seconds);
+ case 2 : return QVariant(d->maxdepth.mm);
+ case 3 : return QVariant(d->latitude.udeg);
+ case 4 : return QVariant(d->longitude.udeg);
}
}
+ if (role == Qt::CheckStateRole) {
+ return checkStates[index.row() + firstIndex] ? Qt::Checked : Qt::Unchecked;
+ }
+ return QVariant();
}
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
@@ -541,5 +546,7 @@ void DiveImportedModel::setImportedDivesIndexes(int first, int last)
beginInsertRows(QModelIndex(), 0, last - first);
lastIndex = last;
firstIndex = first;
+ delete[] checkStates;
+ checkStates = new bool[last-first];
endInsertRows();
}
diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h
index 799b0c991..c49ad9a40 100644
--- a/qt-ui/downloadfromdivecomputer.h
+++ b/qt-ui/downloadfromdivecomputer.h
@@ -37,6 +37,7 @@ public:
private:
int firstIndex;
int lastIndex;
+ bool *checkStates;
};
class DownloadFromDCWidget : public QDialog {