mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive d/l selection UI: Add the check states
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
76725265fc
commit
55cc16d77d
2 changed files with 14 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
private:
|
||||
int firstIndex;
|
||||
int lastIndex;
|
||||
bool *checkStates;
|
||||
};
|
||||
|
||||
class DownloadFromDCWidget : public QDialog {
|
||||
|
|
Loading…
Add table
Reference in a new issue