Commit graph

297 commits

Author SHA1 Message Date
Dirk Hohndel
df9062bd2e QML UI: next attempt to address the profile scaling
It seems to be much more logical to address the size and scale right
before rendering.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-15 13:55:42 -08:00
Sebastian Kügler
53024ca76d try to fix profile scaling
Different approach here:

- profile gets a bit higher, this was requested on the mailinglist, and
  seems to behave much better with the painted profile, we'd otherwise
  get it magically clipped on the right hand side.
- Make the scaling dpi aware, this fixes scaling for me on the Nexus7, I
  haven't been able to test it properly on other devices, so this needs
  some more testing. The result is visually quite close to what we can
  do, although I'm still getting a somewhat larger margin on the right.
  To get at the devicePixelRatio without too much custom code, I've
  added a property to the QMLProfile to retrieve it from the theme engine.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-13 16:27:41 -08:00
Sebastian Kügler
8199c13f42 fix misrendered profiles when fast-flicking
- Apparently, QMLProfile doesn't like being painted without being
  visible, when flicking quickly through the dives I would get empty
  rendered profiles. Setting the cachebuffer to zero fixes it, and saves
  some memory.
  It still has some unfortunate timing, the profile gets rendered
  mid-flick, which leads to a delay in the flicking motion, quite
  annoying. We will have to somehow make sure that new profiles are
  rendered after flicking, not during
- Smallish cleanups

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-13 03:08:34 +01:00
Sebastian Kügler
9fc19039df Better behavior for dive details flicking
- stop at bounds, this is in line with other flickables. I really
  don't like Flickables floppy default behavior to allow dragging and
  scrolling over the bounds.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-12 07:10:52 -08:00
Sebastian Kügler
142c8b218b Fix bugs in edit drawer
- As the list may get reset on save, the dive_id effectively changes
  since currentItem isn't updated. So after editing, we end up with a
  different currentItem than visible. This is very unintuitive, but
  has to do with the model resetting. It would result in the edit view not
  showing the current dive when opened the second time. Let's make sure
  that out currentItem is always the visible one before we're filling
  the data into the edit page.
- Close the drawer when we're navigating away from the dive item, for
  example when hitting the back button.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-12 03:06:09 +01:00
Sebastian Kügler
ae0f680c6e Kill warning
Apparently parent.height is negative sometimes.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-12 03:06:09 +01:00
Sebastian Kügler
6540e95425 dive details navigation
This patch reworks the navigation of the dive details.

- The detailsview is now a list view with page-sized delegates. This
  allows horizontal swiping to the next and previous dive.
- The central button now allows to open the edit mode for the dive.

Original patch was done by Marco Martin, but needed to be reapplied by
hand.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-12 03:06:09 +01:00
Dirk Hohndel
19e95efd6f Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 06:14:45 -08:00
Dirk Hohndel
82b2b709bc QML UI: Store the dive duration in dive and (fake) divecomputer
This is needed so that our heuristics for fixing up dives don't mess up the
data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:08:42 -08:00
Dirk Hohndel
0d9892645c QML UI: only store the new date/time if they are valid
Otherwise we are overwriting valid data with midnight, Jan 1, 1970.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:07:58 -08:00
Dirk Hohndel
56b3ecb3f6 QML UI: show dive time again
In commit 25aa80846b ("Move Dive class from qthelper.h/cpp to it's own file")
the meaning of getting the "date" of a dive was changed to just be the date and
not the date and time. That's not what the QML code expected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:07:31 -08:00
Dirk Hohndel
a27d78af03 Save a dive has to mean "save to local storage" on mobile
While it makes sense to have the concept of "what's in memory" and "what's on
disk" in a desktop application, on a mobile device that seems like the wrong
approach. If the user edits a dive and taps on "save", they reasonably expect
this to be saved to storage (so our local cache of the remote git repository).
And "Upload to cloud" then pushes the data to the cloud server. It may even be
reasonable to do that automagically, but that I'm not so sure about.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 21:40:03 -08:00
Dirk Hohndel
60d5463311 Remember in settings if we ever synced with the cloud
Otherwise, if the device is offline we would not be able to store changes in
the local cache, completely defeating the purpose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 21:38:44 -08:00
Dirk Hohndel
4f10f7f7ae QML UI: refresh divelist after GPS data was successfully applied
And create a helper to do so to make the code simpler.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:22 -08:00
Jan Mulder
aa6aa416bf show dive.number instead of double location
Small error was introduced in commit 25aa80846b. The dive.location was
shown in the DiveList instead of the intended dive.number

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:09:31 -08:00
Dirk Hohndel
b1f90b6aa0 QML UI: partial, slow and incomplete implementation of delete GPS fix
This only deletes the fix on the mobile device, not on the server.
And it is really really slow. Re-reading the data from the settings just isn't
a smart way to do this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:18:41 -08:00
Dirk Hohndel
038cfcba91 QML UI: add second action to GPS list entries
This one will allow people to see the location on a map. Also not implemented,
yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:17:48 -08:00
Dirk Hohndel
f61b83301a QML UI: better icon for delete
The cancel picture was odd - the trash can is much more typical.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:16:19 -08:00
Dirk Hohndel
249a2c2c09 Gps list: include the time_t timestamp in the model
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>
2016-01-08 23:13:30 -08:00
Dirk Hohndel
b34a507d51 QML UI: support sliding action to allow the user to delete GPS fixes
This is just the UI, the actual deletion is not yet implemented.

I really like this interaction with the list items. Slide them to the left and
you see icons for actions. Right now we have just one and that may seem like
overkill (hey, we could just have the delete icon instead of the application
menu icon, right?) but once we allow the ability to show the GPS location on a
map we'll have two operations and this will make more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 21:48:53 -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
Tomaz Canabrava
89eed5d36e Untangle Library Linkage
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>
2016-01-08 08:04:04 -08:00
Jan Mulder
78eacb6a0c mobile: allow save when local store is actual
When starting ssrf-mobile, and the local divelist is identical to the
cloud version (so same sha1), a save of local modifications to the
cloud should be possible. This fix enables this by pretending
that a suppressed load from cloud on start is still a valid load
from cloud.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:32:24 -08:00
Dirk Hohndel
624e44e73d QML UI: clean up notes field after edit
We don't want any of the rich text markup to sneak into our fields.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:30:58 -08:00
Dirk Hohndel
a0d3480bbe QML UI: fix manual add dive
This had been broken by mistake in commit e5f95daee8 ("QML UI: reimplement
context menu for dive details").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:29:50 -08:00
Dirk Hohndel
b6ae6979e5 QML UI: show the available GPS fixes
So far the user can't interact with these. We should implement an ability to
visualize the GPS fix and to delete it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 21:41:52 -08:00
Dirk Hohndel
2b1ffb3cc4 QML UI: trigger download of GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 21:41:52 -08:00
Dirk Hohndel
bb687f7f8b Remove plasma mobile components, pull from upstream at build time
This prevents us from constantly having to worry about keeping them in sync.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 10:22:20 -08:00
Dirk Hohndel
9c0cb6cfef QML UI: edit notes in rich text mode
This way we don't show <br> for line breaks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06 23:03:07 -08:00
Dirk Hohndel
5860913e41 QML UI: use the same units that Subsurface used when saving the data
We already keep those units around so the backend HTML exporter can match them.
So it makes perfect sense to also apply them in the mobile app.

Fixes #987

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06 21:58:02 -08:00
Dirk Hohndel
e5f95daee8 QML UI: reimplement context menu for dive details
With the mobile components fixed we can now simply switch between different
menu content - no need to play games and redefine the actions on the fly. This
also adds a cancel button for editing and cleans up when the user hits cancel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06 18:21:09 -08:00
Dirk Hohndel
9a28807dd3 Make sure that members are initialied
A couple of members could potentially have been used uninitialized - it's
possible that this was the cause for people overwriting data in cloud storage
with empty dive lists.

See #985

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06 16:58:46 -08:00
Sebastian Kügler
cff0a703e8 sync with mobilecomponents 462b2b4
- Fixes blank pages when keyboard shows up, the margin computation was
  wrong, and apparently we get bogus info about the keyboard geometry.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-07 01:36:15 +01:00
Sebastian Kügler
95bca4b50c sync with mobilecomponents 9d179eb74a227
- Workaround for black squares is merged upstream
- brings back the FAB button, additional
- swipe interaction improvements in the same

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-07 00:39:33 +01:00
Dirk Hohndel
e20005ed36 QML UI: when manually adding a dive clear out all the fields
Otherwise the data from the last dive dispayed (or added) will be shown.

Fixes #983

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 23:06:46 -08:00
Dirk Hohndel
4db5e840bf QML UI: refresh the dive list after edit
This fixes two issues. In general, after edits the dive list wasn't updated so
it showed data inconsistent with what the dive details showed (clearly bogus).
Even more annoyingly, when we change the date or time of a dive it could
obviously move around in the dive list. So we need to resort the dive table and
recreate the dive list. For really long dive lists this is possibly overkill,
but in my testing this seemed very quick and much easier than trying to
manually get this right, even in the case where the list wasn't resorted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 22:59:29 -08:00
Dirk Hohndel
e774c8077b QML UI: allow edit of dive date and time
This is a bit more complicated because we are asking the user to edit the text
field instead of giving them a date and time picker. This is not a great
choice, but let's run with it for now.

One downside is that the user is likely going to edit the date "Oct 29" -> "Oct
25" without adjusting the day of the week. And if we then try to parse that Qt
correctly complains about an invalid date. So we hack around this by removing
the day of the week from both the format and the date entered (which of course
now will break things if the user did, in fact, adjust the day of the week). As
I said, not a great solution.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 22:53:32 -08:00
Dirk Hohndel
415536aba9 QML UI: in dive details edit, put date on its own line
This way we can support a simple way for the user to edit the date.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 22:50:31 -08:00
Dirk Hohndel
e401e725cc Add BasicListItem.qml from plasma-mobile
Sebastian forgot to add this file - so I grabbed the latest version from
today, hoping this is the right one.

This is from a85365111 which is the sha he referenced in his patch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 21:26:20 -08:00
Sebastian Kügler
5d9881b8e1 adjustments needed for latest mobilecomponents
- flickable is gone, Page now just takes the children items, meaning we
  can remove this assignment
- BasicListItem is factored out, and we now need it in our qrc

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-06 04:44:26 +01:00
Sebastian Kügler
548d6fc956 sync with mobilecomponents a85365111 + patches
This is the latest state of the upstream art from Plasma, plus our
patches to disable the gamma effect on the icon, and the drawer removed.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-06 04:41:41 +01:00
Sebastian Kügler
8664925e20 Allow faster scrolling in the dive list
This increases the rather conservative value for the maximum velocity of
the divelist to scroll at max 5 screens per second, meaning it's about 4
times faster. I've picked this value after a bit of testing, it can
surely be tweaked, but feels nicer already.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
2016-01-06 03:50:10 +01:00
Dirk Hohndel
a015e5f4cb QML UI: make top bar elements bigger for easier use
Otherwise hitting those menu buttons is HARD.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 21:38:44 -08:00
Dirk Hohndel
3bfa8de2f7 Cloud storage: fix potential crash when avoiding reloading dive list
If we loaded the dive list from cache and then try to figure out if the remote
repository had anything different, we were being super stupid if the SHA was
identical... we had already cleared the dive list by the time we decided that
we didn't need to load things. Granted, the model was still populated (oops),
but the backend data structure was cleared and accesses to it (e.g., when
drawing the profile) would cause things to crash.

The helper function duplicates some code, but trying to not duplicate the code
made things even harder to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 17:55:37 -08:00
Dirk Hohndel
72ce77a5ee QML UI: hide action button
So far this just comments out the code that enables the action button. Let's
see feedback from the testers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 13:15:33 -08:00
Dirk Hohndel
c53aa7dbfb QML UI: add context menu button
Right now this is an alternative to the magic action button - but the goal is
to replace it completely.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 13:02:46 -08:00
Dirk Hohndel
7cc851ebad QML UI: add main menu button
Right now this is an alternative to the magic action button - but the goal is
to replace it completely.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 13:02:46 -08:00
Miika Turkia
9cebcb836f Give the user more information on cloud credentials
This gives the user a bit more information about the progress of setting
the cloud credentials. IMO, especially the information that the
credentials are invalid is crucial for the user experience.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 10:00:44 -08:00
Rick Walsh
de46f2b37c QML UI: make profile margin scale proportional to dimensions
The QMLProfile height is specified as ~2/3 (actually 0.66) width in
DiveDetailsView.qml. In order to produce an even margin around the profile,
the scaling factor reduction for height needs to be 3/2 times that for width.

MarginFactor is specified as 0.013 to approximate the margin calculated by
commits ef653b4 and 7e2898d for my Galaxy S6.
MarginFactor	= margin  / width
		= 18 / 1365
		= 0.132

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04 10:00:44 -08:00
Dirk Hohndel
e856f816f2 QML UI: use better Google maps link
This still isn't the user experience that I want, but at least now it's not a
static map image anymore but an interactive map.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01 22:24:05 -08:00