Commit graph

22 commits

Author SHA1 Message Date
Dirk Hohndel
ec0fc9d70b Change the api to update a single dive
Instead of searching for the dive in the list, just make sure we are given
the index.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 11:50:04 -08:00
Dirk Hohndel
6f953d51de QML UI: correctly notify of model change
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>
2016-01-27 11:32:40 -08:00
Tomaz Canabrava
25aa80846b Move Dive class from qthelper.h/cpp to it's own file
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>
2016-01-08 08:04:44 -08:00
Dirk Hohndel
a0aa27e864 QML UI: handle editing of depth
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>
2016-01-01 00:55:34 -08:00
Dirk Hohndel
0962b504ce QML UI: get add dive closer to being useful
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>
2015-12-26 21:37:18 -08:00
Dirk Hohndel
dc0be271bd QML UI: set up time and dive number when adding dive
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>
2015-12-26 21:34:45 -08:00
Dirk Hohndel
7ffe7a8c8a Dive list model: add GPS string access
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>
2015-12-26 13:33:10 -08:00
Dirk Hohndel
9e6991a0e1 QML-UI: we need a way to update the dive model
Otherwise our UI will get out of sync with our dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-07 22:23:09 -08:00
Sebastian Kügler
9ef475844d Fix crasher
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>
2015-12-03 12:48:51 -08:00
Dirk Hohndel
2f2e9da2cd Clear the Dive model before repopulating it
Otherwise we could get duplicate dives in the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-30 10:09:46 -08:00
Dirk Hohndel
ddef5650f6 Make Subsurface-mobile compile again
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>
2015-11-16 15:38:29 -08:00
Grace Karanja
390c10bb08 QML UI: Remove unneeded MobileDive class
The MobileDive class in divelistmodel.h is a duplication of the
Dive class in templatelayout.h. This patch moves the Dive to
the qthelper file.

[Dirk Hohndel: merged with upstream master - let's hope I didn't
               mess anything up]

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:47:48 -07:00
Grace Karanja
5a7dbf0225 QML UI: Use AddDive instead of clear dive
No need to clear the dives when adding a new one.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
a3bdf49b84 QML UI: Clear divelist model before starting new dive
When user clicks on AddDive, we should clear the model.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -07:00
Dirk Hohndel
7e7dcb2451 QML UI: sort by date, not by date string
Just a quick bit of cleanup to separate date (the sortable, numeric value)
from the date string that we want to display (but not sort by).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 11:17:48 -07:00
Grace Karanja
aae27629c4 QL UI: Add DiveId role to DiveListModel
This will be used when rendering the dive profile and also when
saving the dive changes.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-17 19:12:39 +03:00
Grace Karanja
ebcf3e67c5 QML UI: whitespace fix
Fix some whitespace issues in the QMLManager and DiveListModel
classes.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-10 06:04:18 -07:00
Grace Karanja
2f25fe9f0b 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>
2015-06-20 14:29:24 -07:00
Grace Karanja
d613ed0105 Add more dive details to the DiveListModel
Add some more details to the model.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:57 -07:00
Grace Karanja
ee9452ae8a Group dives by trips
Group dives according to the allocated dive trips.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:39 -07:00
Grace Karanja
305509ad5f Add dive notes to the divelistmodel
Add the dive notes field into the DiveListModel class.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:08 -07:00
Grace Karanja
b7e4b35cde Add DiveListModel
This model will be used to show the dives in QML. This commit adds
the model, and the means to link it to QML.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:26:56 -07:00