summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-06-18 10:45:26 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 14:29:24 -0700
commit2f25fe9f0ba6832020b9a38762a709eaaa09dea1 (patch)
tree616f9384e8e480dab283ee22fe8f81ee9b58ec3c /qt-models
parent4e9128f8472d1ac221d573cf0c0459707c6c7e01 (diff)
downloadsubsurface-2f25fe9f0ba6832020b9a38762a709eaaa09dea1.tar.gz
Rename dive class to avoid conflict
Rename the Dive class in divelistmodel.h to a void a conflict with the Dive class in templatelayout.h Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelistmodel.cpp96
-rw-r--r--qt-models/divelistmodel.h6
2 files changed, 45 insertions, 57 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index add5af515..dfc175ab1 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -1,7 +1,7 @@
#include "divelistmodel.h"
#include "helpers.h"
-Dive::Dive(dive *d)
+MobileDive::MobileDive(dive *d)
{
m_thisDive = d;
setDiveNumber(QString::number(d->number));
@@ -31,185 +31,173 @@ Dive::Dive(dive *d)
setDivemaster(d->divemaster);
}
-QString Dive::date() const
+QString MobileDive::date() const
{
return m_date;
}
-void Dive::setDate(const QString &date)
+void MobileDive::setDate(const QString &date)
{
m_date = date;
}
-QString Dive::location() const
+QString MobileDive::location() const
{
return m_location;
}
-void Dive::setLocation(const QString &location)
+void MobileDive::setLocation(const QString &location)
{
m_location = location;
}
-QString Dive::sac() const
+QString MobileDive::sac() const
{
return m_sac;
}
-void Dive::setSac(const QString &sac)
+void MobileDive::setSac(const QString &sac)
{
m_sac = sac;
}
-QString Dive::gas() const
+QString MobileDive::gas() const
{
return m_gas;
}
-void Dive::setGas(const QString &gas)
+void MobileDive::setGas(const QString &gas)
{
m_gas = gas;
}
-QString Dive::cylinder() const
+QString MobileDive::cylinder() const
{
return m_cylinder;
}
-void Dive::setCylinder(const QString &cylinder)
+void MobileDive::setCylinder(const QString &cylinder)
{
m_cylinder = cylinder;
}
-QString Dive::suit() const
+QString MobileDive::suit() const
{
return m_suit;
}
-void Dive::setSuit(const QString &suit)
+void MobileDive::setSuit(const QString &suit)
{
m_suit = suit;
}
-QString Dive::weight() const
+QString MobileDive::weight() const
{
return m_weight;
}
-void Dive::setWeight(const QString &weight)
+void MobileDive::setWeight(const QString &weight)
{
m_weight = weight;
}
-QString Dive::airtemp() const
+QString MobileDive::airtemp() const
{
return m_airtemp;
}
-void Dive::setAirTemp(const QString &airtemp)
+void MobileDive::setAirTemp(const QString &airtemp)
{
m_airtemp = airtemp;
}
-QString Dive::duration() const
+QString MobileDive::duration() const
{
return m_duration;
}
-void Dive::setDuration(const QString &duration)
+void MobileDive::setDuration(const QString &duration)
{
m_duration = duration;
}
-QString Dive::depth() const
+QString MobileDive::depth() const
{
return m_depth;
}
-void Dive::setDepth(const QString &depth)
+void MobileDive::setDepth(const QString &depth)
{
m_depth = depth;
}
-QString Dive::rating() const
+QString MobileDive::rating() const
{
return m_rating;
}
-void Dive::setRating(const QString &rating)
+void MobileDive::setRating(const QString &rating)
{
m_rating = rating;
}
-dive *Dive::thisDive() const
+dive *MobileDive::thisDive() const
{
return m_thisDive;
}
-void Dive::setThisDive(dive *thisDive)
+void MobileDive::setThisDive(dive *thisDive)
{
m_thisDive = thisDive;
}
-QString Dive::diveNumber() const
+QString MobileDive::diveNumber() const
{
return m_diveNumber;
}
-void Dive::setDiveNumber(const QString &diveNumber)
+void MobileDive::setDiveNumber(const QString &diveNumber)
{
m_diveNumber = diveNumber;
}
-QString Dive::notes() const
+QString MobileDive::notes() const
{
return m_notes;
}
-void Dive::setNotes(const QString &notes)
+void MobileDive::setNotes(const QString &notes)
{
m_notes = notes;
}
-QString Dive::trip() const
+QString MobileDive::trip() const
{
return m_trip;
}
-void Dive::setTrip(const QString &trip)
+void MobileDive::setTrip(const QString &trip)
{
m_trip = trip;
}
-QString Dive::buddy() const
+QString MobileDive::buddy() const
{
return m_buddy;
}
-void Dive::setBuddy(const QString &buddy)
+void MobileDive::setBuddy(const QString &buddy)
{
m_buddy = buddy;
}
-QString Dive::divemaster() const
+QString MobileDive::divemaster() const
{
return m_divemaster;
}
-void Dive::setDivemaster(const QString &divemaster)
+void MobileDive::setDivemaster(const QString &divemaster)
{
m_divemaster = divemaster;
}
-QString Dive::watertemp() const
+QString MobileDive::watertemp() const
{
return m_watertemp;
}
-void Dive::setWatertemp(const QString &watertemp)
+void MobileDive::setWatertemp(const QString &watertemp)
{
m_watertemp = watertemp;
}
-void Dive::setupDiveTempDetails()
+void MobileDive::setupDiveTempDetails()
{
- const char *unit;
- double d_airTemp, d_waterTemp;
-
- d_airTemp = get_temp_units(m_thisDive->airtemp.mkelvin, &unit);
- d_waterTemp = get_temp_units(m_thisDive->watertemp.mkelvin, &unit);
-
- setAirTemp(QString::number(d_airTemp) + unit);
- setWatertemp(QString::number(d_waterTemp) + unit);
-
- if (!m_thisDive->airtemp.mkelvin)
- setAirTemp("");
-
- if (!m_thisDive->watertemp.mkelvin)
- setWatertemp("");
+ setWatertemp(get_temperature_string(m_thisDive->watertemp, true));
+ setAirTemp(get_temperature_string(m_thisDive->airtemp, true));
}
@@ -227,7 +215,7 @@ DiveListModel::DiveListModel(QObject *parent) : QAbstractListModel(parent)
void DiveListModel::addDive(dive *d)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
- m_dives.append(Dive(d));
+ m_dives.append(MobileDive(d));
endInsertRows();
}
@@ -241,7 +229,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
if(index.row() < 0 || index.row() > m_dives.count())
return QVariant();
- const Dive &dive = m_dives[index.row()];
+ const MobileDive &dive = m_dives[index.row()];
if (role == DiveNumberRole)
return dive.diveNumber();
diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h
index cb1918879..68f0c6fa7 100644
--- a/qt-models/divelistmodel.h
+++ b/qt-models/divelistmodel.h
@@ -4,9 +4,9 @@
#include <QAbstractListModel>
#include "dive.h"
-class Dive {
+class MobileDive {
public:
- Dive(dive* d);
+ MobileDive(dive* d);
QString date() const;
void setDate(const QString &date);
@@ -120,7 +120,7 @@ public:
QHash<int, QByteArray> roleNames() const;
private:
- QList<Dive> m_dives;
+ QList<MobileDive> m_dives;
static DiveListModel *m_instance;
};