summaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-11-06 14:40:20 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-06 09:58:34 -0800
commit8e7be1b50a93e667663b29d84dbd66c2a31975dc (patch)
tree8c18b762d72009a5819563951dc2c7d64d20cd2b /profile-widget/profilewidget2.cpp
parent61e768036e63d4006fc5b46b687ecf9fd1150f21 (diff)
downloadsubsurface-8e7be1b50a93e667663b29d84dbd66c2a31975dc.tar.gz
Untangle DiveCalculatedCeiling from MainWindow
DiveCalculatedCeiling is the last class the references MainWindow in the profile-widget stack. In modelDataChanged() it looks for the information() widget and sets a slot for the dateTimeChanged() signal that information() emits. To solve the issue we make DiveCalculatedCeiling recieve a ProfileWidget2 reference and make ProfileWidget2 emit the dateTimeChangedItems() signal. ProfileWidget2 itself listens for the dateTimeChanged() signal that information() emits and emits dateTimeChangedItems() to notify any possible children/item listeners in the ProfileWidget2::dateTimeChanged() slot. The connection between ProfileWidget2 and information() is set in MainWindow. This makes DiveCalculatedCeiling unaware of MainWindow and which class originally emits the dateTimeChanged() signal to ProfileWidget2. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> -- Think delegation. Tomaz, please take a look at this one, to double check if i messed up. also i have zero idea how the mobile app is setting these connections, if it does so even. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r--profile-widget/profilewidget2.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 6b83508b4..177ceab75 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -92,7 +92,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
cylinderPressureAxis(new DiveCartesianAxis(this)),
gasPressureItem(new DiveGasPressureItem()),
diveComputerText(new DiveTextItem()),
- diveCeiling(new DiveCalculatedCeiling()),
+ diveCeiling(new DiveCalculatedCeiling(this)),
decoModelParameters(new DiveTextItem()),
reportedCeiling(new DiveReportedCeiling()),
pn2GasItem(new PartialPressureGasItem()),
@@ -302,7 +302,7 @@ void ProfileWidget2::setupItemOnScene()
setupItem(reportedCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1);
setupItem(diveCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1);
for (int i = 0; i < 16; i++) {
- DiveCalculatedTissue *tissueItem = new DiveCalculatedTissue();
+ DiveCalculatedTissue *tissueItem = new DiveCalculatedTissue(this);
setupItem(tissueItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::TISSUE_1 + i, DivePlotDataModel::TIME, 1 + i);
allTissues.append(tissueItem);
DivePercentageItem *percentageItem = new DivePercentageItem(i);
@@ -708,6 +708,11 @@ void ProfileWidget2::recalcCeiling()
diveCeiling->recalc();
}
+void ProfileWidget2::dateTimeChanged()
+{
+ emit dateTimeChangedItems();
+}
+
void ProfileWidget2::settingsChanged()
{
// if we are showing calculated ceilings then we have to replot()