aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-11 09:55:14 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-11 12:35:54 -0800
commitd1c4bcf570cdab98785a453855428a1e8dcc944f (patch)
tree95c28bc2de064fd36b4d77d524c7f3053f5ee174 /qt-ui
parent73d60574243d7ea8a41726a3cd21d412697813e3 (diff)
downloadsubsurface-d1c4bcf570cdab98785a453855428a1e8dcc944f.tar.gz
New profile: enable switching between dive computers
This was mostly in place, just needed to be hooked up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/profile/diveplotdatamodel.cpp6
-rw-r--r--qt-ui/profile/diveplotdatamodel.h2
-rw-r--r--qt-ui/profile/profilewidget2.cpp7
4 files changed, 14 insertions, 3 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 4f2fd9642..08c678974 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -486,6 +486,7 @@ void MainWindow::on_actionPreviousDC_triggered()
{
dc_number--;
ui.InfoWidget->updateDiveInfo(selected_dive);
+ ui.graphicsView->plotDives(QList<struct dive*>() << (current_dive));
redrawProfile();
}
@@ -493,6 +494,7 @@ void MainWindow::on_actionNextDC_triggered()
{
dc_number++;
ui.InfoWidget->updateDiveInfo(selected_dive);
+ ui.graphicsView->plotDives(QList<struct dive*>() << (current_dive));
redrawProfile();
}
diff --git a/qt-ui/profile/diveplotdatamodel.cpp b/qt-ui/profile/diveplotdatamodel.cpp
index 94a8af5ba..700ca6503 100644
--- a/qt-ui/profile/diveplotdatamodel.cpp
+++ b/qt-ui/profile/diveplotdatamodel.cpp
@@ -109,6 +109,7 @@ void DivePlotDataModel::setDive(dive* d, const plot_info& info)
clear();
Q_ASSERT(d != NULL);
diveId = d->id;
+ dcNr = dc_number;
pInfo = info;
beginInsertRows(QModelIndex(), 0, pInfo.nr-1);
endInsertRows();
@@ -119,6 +120,11 @@ int DivePlotDataModel::id() const
return diveId;
}
+int DivePlotDataModel::dcShown() const
+{
+ return dcNr;
+}
+
#define MAX_PPGAS_FUNC( GAS, GASFUNC ) \
double DivePlotDataModel::GASFUNC() \
{ \
diff --git a/qt-ui/profile/diveplotdatamodel.h b/qt-ui/profile/diveplotdatamodel.h
index 47ebe03e0..34af0daad 100644
--- a/qt-ui/profile/diveplotdatamodel.h
+++ b/qt-ui/profile/diveplotdatamodel.h
@@ -24,6 +24,7 @@ public:
void setDive(struct dive *d, const plot_info& pInfo);
const plot_info& data() const;
int id() const;
+ int dcShown() const;
double pheMax();
double pn2Max();
double po2Max();
@@ -32,6 +33,7 @@ public:
private:
plot_info pInfo;
int diveId;
+ int dcNr;
};
#endif
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 42e95f620..4ed637cd6 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -271,12 +271,13 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
if (!d)
return;
- // No need to do this again if we are already showing that dive,
- // so we check the unique id of the dive against the one we are
+ // No need to do this again if we are already showing the same dive
+ // computer of the same dive, so we check the unique id of the dive
+ // and the selected dive computer number against the ones we are
// showing (can't compare the dive pointers as those might change).
// I'm unclear what the semantics are supposed to be if we actually
// use more than one 'dives' as argument - so ignoring that right now :-)
- if (d->id == dataModel->id())
+ if (d->id == dataModel->id() && dc_number == dataModel->dcShown())
return;
setProfileState();