diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/cleanertablemodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/cylindermodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/divecomputerextradatamodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/divecomputermodel.cpp | 7 | ||||
-rw-r--r-- | qt-models/divelocationmodel.cpp | 3 | ||||
-rw-r--r-- | qt-models/divepicturemodel.cpp | 2 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 17 | ||||
-rw-r--r-- | qt-models/diveplotdatamodel.cpp | 2 | ||||
-rw-r--r-- | qt-models/gpslistmodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/models.cpp | 2 | ||||
-rw-r--r-- | qt-models/tankinfomodel.cpp | 4 | ||||
-rw-r--r-- | qt-models/treemodel.cpp | 7 | ||||
-rw-r--r-- | qt-models/weightmodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/weigthsysteminfomodel.cpp | 4 |
14 files changed, 46 insertions, 7 deletions
diff --git a/qt-models/cleanertablemodel.cpp b/qt-models/cleanertablemodel.cpp index d2405d42f..77d3f3369 100644 --- a/qt-models/cleanertablemodel.cpp +++ b/qt-models/cleanertablemodel.cpp @@ -7,6 +7,7 @@ CleanerTableModel::CleanerTableModel(QObject *parent) : QAbstractTableModel(pare int CleanerTableModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return headers.count(); } diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 87edd5fe0..af01650a4 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -286,6 +286,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in int CylindersModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return rows; } diff --git a/qt-models/divecomputerextradatamodel.cpp b/qt-models/divecomputerextradatamodel.cpp index 8c0c828e3..0f89a2a6b 100644 --- a/qt-models/divecomputerextradatamodel.cpp +++ b/qt-models/divecomputerextradatamodel.cpp @@ -51,6 +51,7 @@ QVariant ExtraDataModel::data(const QModelIndex &index, int role) const int ExtraDataModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return rows; } diff --git a/qt-models/divecomputermodel.cpp b/qt-models/divecomputermodel.cpp index 51b1a767b..58641ff77 100644 --- a/qt-models/divecomputermodel.cpp +++ b/qt-models/divecomputermodel.cpp @@ -2,7 +2,7 @@ #include "dive.h" #include "divelist.h" -DiveComputerModel::DiveComputerModel(QMultiMap<QString, DiveComputerNode> &dcMap, QObject *parent) : CleanerTableModel() +DiveComputerModel::DiveComputerModel(QMultiMap<QString, DiveComputerNode> &dcMap, QObject *parent) : CleanerTableModel(parent) { setHeaderDataStrings(QStringList() << "" << tr("Model") << tr("Device ID") << tr("Nickname")); dcWorkingMap = dcMap; @@ -47,6 +47,7 @@ QVariant DiveComputerModel::data(const QModelIndex &index, int role) const int DiveComputerModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return numRows; } @@ -78,6 +79,10 @@ Qt::ItemFlags DiveComputerModel::flags(const QModelIndex &index) const bool DiveComputerModel::setData(const QModelIndex &index, const QVariant &value, int role) { + // We should test if the role == Qt::EditRole + Q_UNUSED(role); + + // WARN: This seems wrong - The values don't are ordered - we need a map from the Key to Index, or something. QList<DiveComputerNode> values = dcWorkingMap.values(); DiveComputerNode node = values.at(index.row()); dcWorkingMap.remove(node.model, node); diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index d185de1fe..f77953760 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -24,6 +24,7 @@ LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTabl int LocationInformationModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return COLUMNS; } @@ -159,6 +160,8 @@ bool LocationInformationModel::setData(const QModelIndex &index, const QVariant bool LocationInformationModel::removeRows(int row, int count, const QModelIndex & parent) { + Q_UNUSED(count); + Q_UNUSED(parent); if(row >= rowCount()) return false; diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 602663ec1..173cf9dd0 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -78,6 +78,7 @@ void DivePictureModel::updateDivePictures() int DivePictureModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return 2; } @@ -126,5 +127,6 @@ void DivePictureModel::removePicture(const QString &fileUrl, bool last) int DivePictureModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return numberOfPictures; } diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index eeae69a87..c3996d077 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -25,7 +25,7 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows) void DivePlannerPointsModel::createSimpleDive() { - struct gasmix gas = { 0 }; + struct gasmix gas = {}; // initialize the start time in the plan diveplan.when = displayed_dive.when; @@ -201,6 +201,7 @@ bool DivePlannerPointsModel::recalcQ() int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return COLUMNS; // to disable CCSETPOINT subtract one } @@ -253,7 +254,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &value, int role) { - struct gasmix gas = { 0 }; + struct gasmix gas = {}; int i, shift; if (role == Qt::EditRole) { divedatapoint &p = divepoints[index.row()]; @@ -295,7 +296,7 @@ void DivePlannerPointsModel::gaschange(const QModelIndex &index, QString newgas) { int i = index.row(); gasmix oldgas = divepoints[i].gasmix; - gasmix gas = { 0 }; + gasmix gas = {}; if (!validate_gas(newgas.toUtf8().data(), &gas)) return; while (i < rowCount() && gasmix_distance(&oldgas, &divepoints[i].gasmix) == 0) @@ -334,6 +335,7 @@ Qt::ItemFlags DivePlannerPointsModel::flags(const QModelIndex &index) const int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return divepoints.count(); } @@ -479,7 +481,10 @@ void DivePlannerPointsModel::setSafetyStop(bool value) void DivePlannerPointsModel::setReserveGas(int reserve) { - prefs.reserve_gas = reserve * 1000; + if (prefs.units.pressure == units::BAR) + prefs.reserve_gas = reserve * 1000; + else + prefs.reserve_gas = psi_to_mbar(reserve); emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1)); } @@ -586,8 +591,8 @@ int DivePlannerPointsModel::lastEnteredPoint() int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in, int ccpoint, bool entered) { - struct gasmix air = { 0 }; - struct gasmix gas = { 0 }; + struct gasmix air = {}; + struct gasmix gas = {}; bool usePrevious = false; if (gas_in) gas = *gas_in; diff --git a/qt-models/diveplotdatamodel.cpp b/qt-models/diveplotdatamodel.cpp index 1110f19df..7a7ab195f 100644 --- a/qt-models/diveplotdatamodel.cpp +++ b/qt-models/diveplotdatamodel.cpp @@ -14,6 +14,7 @@ DivePlotDataModel::DivePlotDataModel(QObject *parent) : int DivePlotDataModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return COLUMNS; } @@ -96,6 +97,7 @@ const plot_info &DivePlotDataModel::data() const int DivePlotDataModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return pInfo.nr; } diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp index 84f5e7f3a..3ea03f040 100644 --- a/qt-models/gpslistmodel.cpp +++ b/qt-models/gpslistmodel.cpp @@ -35,6 +35,7 @@ void GpsListModel::clear() int GpsListModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return m_gpsFixes.count(); } diff --git a/qt-models/models.cpp b/qt-models/models.cpp index 6f6b501de..48b22797c 100644 --- a/qt-models/models.cpp +++ b/qt-models/models.cpp @@ -26,6 +26,7 @@ const QPixmap &trashForbiddenIcon() Qt::ItemFlags GasSelectionModel::flags(const QModelIndex &index) const { + Q_UNUSED(index); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -94,5 +95,6 @@ QVariant LanguageModel::data(const QModelIndex &index, int role) const int LanguageModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return languages.count(); } diff --git a/qt-models/tankinfomodel.cpp b/qt-models/tankinfomodel.cpp index 0a06a3b08..b32437392 100644 --- a/qt-models/tankinfomodel.cpp +++ b/qt-models/tankinfomodel.cpp @@ -16,6 +16,7 @@ const QString &TankInfoModel::biggerString() const bool TankInfoModel::insertRows(int row, int count, const QModelIndex &parent) { + Q_UNUSED(row); beginInsertRows(parent, rowCount(), rowCount()); rows += count; endInsertRows(); @@ -24,6 +25,8 @@ bool TankInfoModel::insertRows(int row, int count, const QModelIndex &parent) bool TankInfoModel::setData(const QModelIndex &index, const QVariant &value, int role) { + //WARN Seems wrong, we need to check for role == Qt::EditRole + Q_UNUSED(role); struct tank_info_t *info = &tank_info[index.row()]; switch (index.column()) { case DESCRIPTION: @@ -78,6 +81,7 @@ QVariant TankInfoModel::data(const QModelIndex &index, int role) const int TankInfoModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return rows + 1; } diff --git a/qt-models/treemodel.cpp b/qt-models/treemodel.cpp index 558f690b2..01db3520f 100644 --- a/qt-models/treemodel.cpp +++ b/qt-models/treemodel.cpp @@ -13,6 +13,7 @@ TreeItem::~TreeItem() Qt::ItemFlags TreeItem::flags(const QModelIndex &index) const { + Q_UNUSED(index); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -25,6 +26,8 @@ int TreeItem::row() const QVariant TreeItem::data(int column, int role) const { + Q_UNUSED(column); + Q_UNUSED(role); return QVariant(); } @@ -55,6 +58,9 @@ QVariant TreeModel::data(const QModelIndex &index, int role) const bool TreeItem::setData(const QModelIndex &index, const QVariant &value, int role) { + Q_UNUSED(index); + Q_UNUSED(value); + Q_UNUSED(role); return false; } @@ -99,5 +105,6 @@ int TreeModel::rowCount(const QModelIndex &parent) const int TreeModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return columns; } diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp index 88ebeff6b..1ab8c24c8 100644 --- a/qt-models/weightmodel.cpp +++ b/qt-models/weightmodel.cpp @@ -143,6 +143,7 @@ Qt::ItemFlags WeightModel::flags(const QModelIndex &index) const int WeightModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return rows; } diff --git a/qt-models/weigthsysteminfomodel.cpp b/qt-models/weigthsysteminfomodel.cpp index 1ddc2e940..daa305284 100644 --- a/qt-models/weigthsysteminfomodel.cpp +++ b/qt-models/weigthsysteminfomodel.cpp @@ -11,6 +11,7 @@ WSInfoModel *WSInfoModel::instance() bool WSInfoModel::insertRows(int row, int count, const QModelIndex &parent) { + Q_UNUSED(row); beginInsertRows(parent, rowCount(), rowCount()); rows += count; endInsertRows(); @@ -19,6 +20,8 @@ bool WSInfoModel::insertRows(int row, int count, const QModelIndex &parent) bool WSInfoModel::setData(const QModelIndex &index, const QVariant &value, int role) { + //WARN: check for Qt::EditRole + Q_UNUSED(role); struct ws_info_t *info = &ws_info[index.row()]; switch (index.column()) { case DESCRIPTION: @@ -66,6 +69,7 @@ QVariant WSInfoModel::data(const QModelIndex &index, int role) const int WSInfoModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return rows + 1; } |