diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c9841a8..d3d137fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +desktop: add column for dive notes to the dive list table desktop: fix bug when printing a dive plan with multiple segments desktop: fix bug in bailout gas selection for CCR dives desktop: fix crash on cylinder update of multiple dives diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index aa5c04a7f..46b4a15fb 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -69,15 +69,16 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString()); QString settingName = QString("showColumn%1").arg(i); QAction *a = new QAction(title, header()); - bool showHeaderFirstRun = !(i == DiveTripModelBase::MAXCNS || - i == DiveTripModelBase::GAS || - i == DiveTripModelBase::OTU || - i == DiveTripModelBase::TEMPERATURE || - i == DiveTripModelBase::TOTALWEIGHT || - i == DiveTripModelBase::SUIT || - i == DiveTripModelBase::CYLINDER || - i == DiveTripModelBase::SAC || - i == DiveTripModelBase::TAGS); + bool showHeaderFirstRun = i == DiveTripModelBase::NR || + i == DiveTripModelBase::DATE || + i == DiveTripModelBase::RATING || + i == DiveTripModelBase::DEPTH || + i == DiveTripModelBase::DURATION || + i == DiveTripModelBase::PHOTOS || + i == DiveTripModelBase::BUDDIES || + i == DiveTripModelBase::DIVEGUIDE || + i == DiveTripModelBase::COUNTRY || + i == DiveTripModelBase::LOCATION; bool shown = s.value(settingName, showHeaderFirstRun).toBool(); a->setCheckable(true); a->setChecked(shown); diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index e55d620df..1613087c4 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -57,6 +57,7 @@ static QVariant dive_table_alignment(int column) case DiveTripModelBase::BUDDIES: case DiveTripModelBase::DIVEGUIDE: case DiveTripModelBase::LOCATION: + case DiveTripModelBase::NOTES: return int(Qt::AlignLeft | Qt::AlignVCenter); } return QVariant(); @@ -256,6 +257,8 @@ QString DiveTripModelBase::getDescription(int column) return tr("Dive guide"); case LOCATION: return tr("Location"); + case NOTES: + return tr("Notes"); default: return QString(); } @@ -352,10 +355,14 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role) case LOCATION: return QString(get_dive_location(d)); case GAS: - char *gas_string = get_dive_gas_string(d); - QString ret(gas_string); - free(gas_string); - return ret; + { + char *gas_string = get_dive_gas_string(d); + QString ret(gas_string); + free(gas_string); + return ret; + } + case NOTES: + return QString(d->notes); } break; case Qt::DecorationRole: @@ -444,6 +451,8 @@ QVariant DiveTripModelBase::headerData(int section, Qt::Orientation orientation, return tr("Dive guide"); case LOCATION: return tr("Location"); + case NOTES: + return tr("Notes"); } break; case Qt::ToolTipRole: @@ -1745,5 +1754,7 @@ bool DiveTripModelList::lessThan(const QModelIndex &i1, const QModelIndex &i2) c return lessThanHelper(strCmp(d1->diveguide, d2->diveguide), row_diff); case LOCATION: return lessThanHelper(strCmp(get_dive_location(d1), get_dive_location(d2)), row_diff); + case NOTES: + return lessThanHelper(strCmp(d1->notes, d2->notes), row_diff); } } diff --git a/qt-models/divetripmodel.h b/qt-models/divetripmodel.h index 99eb0c488..62f9efceb 100644 --- a/qt-models/divetripmodel.h +++ b/qt-models/divetripmodel.h @@ -43,6 +43,7 @@ public: DIVEGUIDE, COUNTRY, LOCATION, + NOTES, COLUMNS };