It's possible that this will create an out of order dive list, but it
seems the most consistent way to do things and to avoid more than one dive
with the same dive number (which could have happened if you add several
dives manually that are not the newest dives in the dive list).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I tried various things to do this from QML but it just doesn't seem to
work at all. So I gave up and instead added a trivial helper function.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These can then be used from QML to map the index into the model (the sort
model corresponds directly to the indices in QML) to the dive id and back.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may seem weird, but it seems to work to make sure that the model
actually is correctly updated when updating a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After reserving only the required amount of data for stats_by_type, we
showed an extra DC type on the statistics (no more extra space filled
with 0 at the end of the buffer)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Copying the entry pointer and assuming that it stays valid is of course totally
bogus. This is most likely the reason for the random crashes people have
observed.
See #992
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds dive type based division to the "yearly statistics" window.
Thus people can see the stats from individually from OC, CCR, PSCR and
freedive.
See #949
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of using the Settings as our data structure and constantly accessing
them, we now have a QMap for the GPS fixes and only access the Settings to keep
them in sync with the QMap. This should significantly speed things up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Just having the string means we lost the unique value that we can use as key to
indentify a specific GPS fix.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
and rename it to DiveObjectHelper, since it should be an QObject
based class to make it easier on the QML, grantlee and widgets
side to display the dive's internal data.
each Q_PROPERTY defined in the DiveObjectHelper.h file
can be acessed directly via it's name.
So, if you are on a model that returns a dive, acess it's name
by dive.name
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
with the adittion of gpslistmodel/location, the libraries
qt-models had a direct dependency on subsurface-core, and
subsurface-core had a direct dependency on qt-models, this is
bad.
Moving a bit of code around I'v managed to clean this out, and
also to clear a bit of uneeded code (GpsTracker and gpsTracker where
basically the same thing.)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Getting closer to being able to really edit / add dives in the mobile UI.
This works for manually added dives - needs a bit more thought for dives
downloaded from dive computers as we don't necessarily want to change the
maxdepth in conflict with the samples.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now we at least start out with the corret date, time and number. This still
isn't functional as a lot of the data aren't used and the way you save the data
is completely silly, but it's another step in the right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most likely when you manually add a dive on a device it is just about to happen
or just ended, so starting out with the current time is likely a good guess.
Which makes it the last dive in the dive list, so give it the next sequential
number.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the QML UI needs the GPS information, we need a way to get to it.
I'm not convinced that having it as comma separated string is the best way to
go, but that's what I need for the Google API so that's what I picked for now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Then the user can select the two copies and merge them as two different
computers. Without this, the selection could is screwd up and there
is no option to merge in the context menu.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
m_dives can be empty, so make sure we don't push an invalid QModelIndex
into the mode.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a quick fix but it changes semantice. Previously weight() gave you
the total weight carried, now it just gives you the first weight item on
the list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The profileprintmodel.cpp/.h and the
tableprintmode.cpp/.h pairs are obsolete.
The print layouting is now handled via the Grantlee library
and HTML.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This drastically improves the time it takes to select a dive
with several pictures at the expense of longer startup and
bigger hash files.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This required a bit more untangling, but with this it seems we can build
subsurface-mobile again (at least on the desktop).
Interesting is the removal from inside the ImageDownloader of the call to
DivePictureModel::instance()->updateDivePictures() - which actually could
cause some interesting recursion issues. If it turns out we did indeed
need this, it needs to be re-architected.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Altering DivePicture model to allow deleting images
from the QListView without immediate updating of the
list. Updating is determined by an additioanl parameter
Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
This one was pretty easy because of the work I did a few months
ago to separate the models from the UI.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.
Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions
Same thing applies for metrics.h/cpp
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Did a git rebase and some stuff changed in the meantime;
This is a compatibility commit: Add a few include directories
on the cmake to quiet some ui_headers.h not being found (the
ones that are created automatically by uic) and a few noiseances
like models requiring interface functionality.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like
include "subsurface-core/dive.h"
for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
One specific string did not translate. First, Dirk and I (via IRC)
suspected a leading space was the issue (see commit eccac1321f).
However, I found out that the problem was still there. A non translated
string "%1 shown", when applying a filter on the divelist, and looking at
a trip line. It shows always untranslated "%1 shown". Extracting
to-be-translated strings from the code, I found 2 errors: Class
<classname> lacks Q_OBJECT macro.
This patch adds a missing tr() definition and implementation to 2 structs.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently, it can happen that the default cylinder is not set
even though same_string(prefs.default_cylinder, "") is false.
Then we fall back to the 11.1l air cylinder.
This should silence a warnign about "Too many gases".
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adding { } to if clause to avoid dangling warning
/Users/guidolerch/src/subsurface/qt-models/cylindermodel.cpp:117:
warning: add explicit braces to avoid dangling else [-Wdangling-else]
[Dirk Hohndel: combined two of Guido's patches to one that is simpler]
Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
void DivePlannerPointsModel::setupCylinders() in diveplannermodel.cpp
handles setting up cylinders for the planner. If there is a current
dive, cylinders form that dive are copied. Otherwise the default
cylinder is added and lacking that a standard size cylinder.
If the current dive does not have any cylinders, we could end up
without cylinders. This patch adds a test for this case and delegates
to the other two sources of a cylinder in that case.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When there is only one gasmix in the list we should show the icon that tells the
user that they can't remove the last gasmix from the list.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The filter that takes care to show the dive sites that have the
same gps information should not take into account dives that have
no gps information.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I have manually added dives from an ancient version of Subsurface.
Trying to edit these caused Subsurface to crash due to comparison of
string of dc.model that did not exist (to a static string). And further
down the execution path we were crashing as there were no samples
associated with the dive.
See #941
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently transifex drops the leading space in the translation string and
then at runtime the string no longer matches. So let's just code this
differently.
This of course creates a new string but that new string should be the
string that transifex already asks people to translate...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Spell Setpoint without space in user visable strings.
Explain authorized_paired.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>