Commit graph

36 commits

Author SHA1 Message Date
Robert C. Helling
00f4fa0d1d Profile context menu entry to split a dive
Allow the user to manually split a dive in two.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-07-03 14:47:15 -07:00
Stefan Fuchs
c734a77cf5 Code cleanup: Correct typo "Swith" to "Switch"
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-17 06:36:20 +09:00
Berthold Stoeger
f47f2773fd Dive pictures: don't repopulate DivePictureModel on deletion
On deletion of a single or multiple pictures, the whole DivePictureModel
was repopulated, which was clearly visible in the UI, owing to the
reconstructing of all images in the profile plot.

To avoid this vexing behavior, implement proper deletion routines in
DivePictureModel and ProfileWidget2. Since this needs sensible erase()
semantics the QList<PictureEntry> member of DivePictureModel was
replaced by a QVector. A QVector should be the default anyway, unless
there are very specific reasons to use a QList (which actually is
a deque, not a classical linked list).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21 22:17:28 +03:00
Berthold Stoeger
45395fd466 Dive pictures: Don't plot pictures twice when changing current dive
In MainWindow::current_dive_changed() first plotDive() is called,
which replots all the pictures by calling plotPictures(). This
is pointess, because it plots the pictures of the previous dive.

Then, updateDiveInfo() is called, which resets the dive pictures
and automatically replots them. Thus, switching between dives
both with hundreds of pictures is way slower than necessary.

Switching the plotDive() and updateDiveInfo() calls doesn't work.
The reason is not 100% clear, but it doesn't make sense to plot
pictures of the new dive as long as the profile still shows the
old dive anyway.

As a quick-fix, add a flag to plotDive(), which tells the function
to clear the pictures list instead of redrawing it.
Ultimately, plotDive() should probably be split in two functions.
One for the callers who update the pictures themselves and one
for the others.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-17 07:24:54 -07:00
Robert C. Helling
6b0ecb012d Place divemode changes in submenu of context menu
Also unify the repeated code in slots.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14 23:47:00 +03:00
Willem Ferguson
e46cb2f800 Create divemode switches using profile context menu
Allow the manual creation of divemode switch events using the
profile context menu.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14 23:47:00 +03:00
Willem Ferguson
81a812539c Plot OC-pO2 graph for SCR dives
This commit allows plotting the OC-equivalent pO2 graph for PSCR
dives. This happens in both the cases where there is no external
O2-monitoring AND when there is external pO2 monitoring. The
calculations are only done for PSCR dives and is achieved as
follows:

1) Within plot-info create a pressure-t called OC_pO2 in
   profile.h and populate this variable with the open-circuit
   pO2 values in profile.c.
2) Create a new partialPressureGasItem ocpo2GasItem in
   profilewidget2.h and, in profilewidget2.cpp, initialise it
   to read the plot-info OC_pO2 values and enable its
   display by using the setVisible method. The
   diveplotdatamodel was also touched in order to achieve
   this.
3) Create a pref button that controls the display of OC-pO2 for SCR dives
4) Change the colour of the OC-pO2 grpah to orange
5) Change the connection of the crr_OC_pO2 signal to be appropriate
6) rename the OC_pO2 attribute to scr_OC-pO2

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-04-28 20:11:22 +03:00
Berthold Stoeger
36249f2780 Profile: Conditionally compile pictures-vector on mobile.
This vector is not used on mobile and cause iOS compilation to fail.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-09 11:29:14 -07:00
Berthold Stoeger
f1830cd44e Profile: On dataChanged() only update pictures that actually changed
Only update those pictures of the DivePictureModel that actually changed.
This will be useful once pictures are loaded incrementally.

To do so, replace the pictures array by an array with stable ids. Before
this commit, not-shown pictures are left out of the pictures array, which
makes the mapping from DivePictureModel-ids to the picture array index
non-trivial.

Replace the QList<DivePictureItem *> by a std::vector<std::unique_ptr<DivePictureItem>>
to ease memory management. Sadly, owing to COW semantics, QVector is incompatible
with QScopedPointer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-09 07:50:21 -07:00
Jan Mulder
34bc4fc0af Pictures tied to profile are not supported on mobile
Move divepicturemodel.cpp to the desktop only category and deal
with the (limited) fallout. We, currently, do not support dive
pictures tied to the profile on mobile, so there is no use
including this code.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 21:28:02 +01:00
Berthold Stoeger
85ac3106e6 Typo: indice -> index
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
d9ac716162 Replace CREATE_PP_GAS macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
05974d17c9 Remove two arguments from ProfileWidget2::setupItem()
1) hAxis was always set to timeAxis
2) model was always set to dataModel

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
769c64fe5e Replace ADD_ACTION macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
6cf06fb61d Remove unnecessary deletes in destructor of ProfileWidget2
All the deleted items were added to the scene, which takes
"ownership" (a remarkably fuzzy concept in Qt) of these
objects. In principle, deleting these items is a bug - even
though it is handled gracefully.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Jan Mulder
1892e2af21 Unused code: remove ProfileWidget2::isAddOrPlanner()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Dirk Hohndel
e64dcd12bd desktop UI: no longer attempt to manually show error notifications
report_error() now does this automatically. So all these odd places in which we tried
to make sure that we show errors are no longer needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 15:55:49 +02:00
Jan Mulder
26a0e741b8 code cleanup: remove unimplemented classes and structs
Remove forward declared but not implemented classes and structs.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16 05:31:41 +09:00
Dirk Hohndel
49d0bb8406 Add SPDX header to profile widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Joakim Bygdell
bd0c99dfb7 MOBILE: Display pO2 and Setpoint for CCR dives
For CCR dives we want to display the setpoint and pO2 information,
due to the limited screensize we have to remove the temperature graph or
the view will be to cluttered.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-03-26 21:57:57 -07:00
Dirk Hohndel
9aa7399c1d Now that we are building with C++11 we need override keyword
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-23 16:43:05 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Tomaz Canabrava
98e8a04d01 Silence warnings in Profilewidget2
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:09 -08:00
Dirk Hohndel
17134be96d Profile: don't compile code that isn't needed on mobile
We were creating a couple dozen objects that we never needed and because
of that triggered several dozen callbacks whenever the model data changed.
All for UI elements of the profile that are either not used in the mobile
app (like the calculated ceiling or the partial pressure / tissue
saturation graphs), or are only useful when using the profile
interactively (which we also don't do on mobile).

I don't know if this will make a significant impact on performance, but it
seems like the right thing to do either way.

A positive side effect is that the odd blue line on top of the rendered
profile is gone as well.

Fixes #1007

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-06 13:29:31 -08:00
Tomaz Canabrava
2c5fad73e8 Start to use the QSettings ObjectWrapper
start of the QSettinsg Object Wrapper usage on the code
this first patch removes two macros that generated around
200 lines in runtime for something like a quarter of it
Basically, whenever we changed anything we called the
PreferencesDialog::settingsChanged and connected everythign
to that signal, now each setting has it's own changed signal
and we can call it directly.

The best thing about this approach is that we don't trigger
repaints for things that are not directly profile related. (
actually we still do, but the plan is to remove them in due time)

this commit breaks correct atualization of the profile (because
everything was connected to PreferencesDialog::settingsChanged)
and now I need to hunt a bit for the correct connections

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:01 -08:00
Robert C. Helling
d8e38764fd Drag and Drop Images
Now that we have the possibility to add images without meaningful
time stamps to a dive, we should let the user provide that time
offset manually. This patch allowed pictures to be dragged from
the image list to the profile.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-24 09:22:16 -08:00
Lubomir I. Ivanov
8e7be1b50a 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>
2015-11-06 09:58:34 -08:00
Dirk Hohndel
f3232b1a6f Profile: don't compile the desktop specific parts on mobile
When building subsurface-mobile we won't be using all these UI elements,
so let's not build them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 16:05:44 -08:00
Dirk Hohndel
e7edaea4f8 Untangle Profile from MainWindow: edit current profile
And action can't not just trigger a slot, it can also send a signal.

With this there is no reference to the MainWindow left in the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
2b9316e16a Untangle Profile from MainWindow: update main tab via signal
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
e28f171731 Untangle Profile from MainWindow: refresh display
Instead of directly calling into the MainWindow, redirect this via a
signal so Subsurface mobile can hook it up as needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
1013ba39c5 Untangle Profile from MainWindow: shortcuts
This, too, should be done with signals.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
000c9cc21c Untangle Profile from MainWindow: turn off tts/ndl calculation
I'm not sure we can ever run into this issue anymore since we stop
calculating TTS / NDL past 2 hours, but I guess on a fairly slow CPU this
still could take too long.

But instead of calling into MainWindow let's just change the setting right
here and add a signal to show the notification - that way we can use the
appropriate way to make such notifications on the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
533d724d1b Profile: begin untangling from MainWindow
Use a signal to turn the toolbar on or off.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
8ea7f40457 Merge branch 'cmakeAndPreferences' 2015-11-02 19:54:34 -08:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from desktop-widgets/profile/profilewidget2.h (Browse further)