Commit graph

1293 commits

Author SHA1 Message Date
Berthold Stoeger
c8ec2f5b1c mobile: use undo-command to apply gps fixes
The goal is to send the signal for the correct dives / divesites
and thus not having to reload the whole model.

Right now the mobile UI does not yet catch the diveSiteChanged signals.

[Dirk Hohndel: small fix to ensure that we trigger a save to storage]

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:57 -07:00
Dirk Hohndel
ca911e6916 mobile: correctly reset model instead of disconnecting it
This is a much better workaround for the invalid accesses to the
underlying data while transitioning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:57 -07:00
Berthold Stoeger
0f390183e2 mobile/undo: remove deletedDive and deletedTrip from QMLManager
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09 12:41:57 -07:00
Berthold Stoeger
9fb52cc45c mobile/undo: create undo-action and connect to undo of dive deletion
Still buggy: Removing a dive followed by undo shows the wrong dive
in the list. But clicking on it gives the correct dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:57 -07:00
Berthold Stoeger
c0095f690f mobile/undo: compile undo commands and call undo command for deletion.
First steps towards full undo on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:11 -07:00
Berthold Stoeger
730fd26814 mobile/divelist: connect click on trip to toggle MobileListModel
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09 12:41:11 -07:00
Dirk Hohndel
edeaf7fa57 mobile: remove collapsed model that we no longer use
The dive list now uses the mobile list model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:11 -07:00
Dirk Hohndel
b382445e59 mobile/divelist: rewrite the QML dive list
This isn't perfect yet, but it looks fairly reasonable.

This commit was mainly written by Dirk, but includes a few fixes from Berthold
which where squashed into this commit as they really should have been part of
the initial version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09 12:41:11 -07:00
Dirk Hohndel
90f8c1138e mobile/DC-download: be more careful exiting download page
Don't just pop the top page off the stack, but pop the download page.
Also explicitly switch to the dive list afterwards.

Additionally, fix a typo in the code that attempts to deal with the
shortcut buttons. I believe that right now this code is completely
broken, but while I contemplate how this should work, let's at least fix
the stupid typo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:40:44 -07:00
Dirk Hohndel
8138279a04 mobile UI: ensure download page is shown if started by plug-in event
The order of execution of the various routines is a bit counter intuitive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:40:44 -07:00
Dirk Hohndel
174bb91326 mobile UI: move code to open download page on device plug-in
This makes the code easier to reuse and uses the helper we just added.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:40:44 -07:00
Dirk Hohndel
93080f129d mobile UI: add consistent way to show a page
And have the existing shortcut functions use that helper.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:40:44 -07:00
Berthold Stoeger
2fcd4fff0a cleanup: fix NOCLOUD_LOCALSTORAGE leak
The macro NOCLOUD_LOCALSTORAGE creates the path to the local git
repository as a C-string. None of the users were freeing the string
and thus leaking memory.

Replace the macro by an inline function that creates a QString
and pass down to C-functions using the qPrintable() macro.
Note that every qPrintable() invocation does a UTF16->UTF8
conversion. This could be avoided by either using a std::string
or a QByteArray. However, we are talking about microseconds of
CPU time in operations that typically take seconds. Not worth
it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09 12:11:01 -07:00
Dirk Hohndel
fe932059fe usb-serial-for-android: switch detection to usb-serial and add more PID/VID
If we detect any of the known PID/VID combinations, use 'usb-serial' instead of
'FTDI'. Also add the now supported additional PID/VID combinations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-08 11:21:54 -07:00
Dirk Hohndel
7d9e907681 debug: try to capture changes that don't invalidate git cache
At least in those cases where we are sending a divesChanged signal we can
easily check if the cache was properly invalidated. Of course this won't help
in cases where we don't notify the dive list about changes, either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 18:47:34 -08:00
Dirk Hohndel
45d37fd51b mobile UI: remove obsolete access to already removed model role
We no longer have a dive role - on the plus side, we also don't use this
variable, so I guess this isn't a big deal.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 18:47:18 -08:00
Dirk Hohndel
b92b5998ff mobile UI: re-enable download status when restarting download
When tapping on 'retry' we didn't clear the flag that decided which message to
display.

Fixes: #2651

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 16:48:34 -08:00
Dirk Hohndel
97e26fd51b mobile: allow disabling BT support from the command line
This is a quick hack to reduce the noise in the log file when chasing other
bugs. Maybe this should not be enabled on release builds, but right now I don't
think the harm that having this in would do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-06 10:00:13 +01:00
Dirk Hohndel
9f8d593a15 Mobile UI: fix typo in disabled planner setup
While this is disabled and is unlikely to be completed, the typo caused
confusion with translators.

This shows one of the weaknesses of the way we set up our translations, in that
always both desktop and mobile are translated together, and disabled code is
also included in those translations, causing unnecessary work for the
translators.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-04 08:03:44 -08:00
Berthold Stoeger
d6114fc37e mobile/filter: derive numShown from a new Q_PROPERTY
The number of dives was updated when the model of the list was
changed. Since we removed the multi-threading, the model is
not disconnected/connected anymore and therefore we don't get
the appropriate signal. Instead of introducing a different
signal, make the shown-value a Q_PROPERTY. Thus, we can easily
send a changed signal if we have to.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
4cff23ef7a mobile: remove filter settings
These are not used anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
eed4e2746d filter: don't search in background on mobile
I experienced weird crashes that seemed timing-related when
using the filter. Therefore, remove the multi-threading thing.
So far no more crashes, but keep a close eye on that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Dirk Hohndel
b5a427c880 mobile/filter: use more appropriate placeholder text
This way it matches the filter mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
e0766aa4bd filter: introduce people- and tags-filtering in the mobile UI
Add a combo-box where the user can switch between "fulltext",
"people" and "tags" filtering. Connect the combobox to the
already existing filter-code.

Dirk: make combo-box smaller by using a smaller font and restricting
the width. Setting both maximum and preferred widths gives more
consistent results.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01 10:21:44 -08:00
Dirk Hohndel
140d552e6d mobile/profile: make the wait before dragging even shorter
Several users still found the wait too long - this is near instantaneous it
just ignores brief taps.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-25 10:17:57 -08:00
Dirk Hohndel
c6f73ae144 mobile/export: fix styling of radio buttons
Use the TemplateRadioButton to get the default styling - and by switching to the
RadioButton from Controls.2 we also get exclusivity by default.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Dirk Hohndel
4d72352e64 mobile/profile: enable zoom and pan for the QML profile
When running mobile on desktop there are some odd jumps in the mouse position while in
drag mode (press and hold, then move). They make the user interface seem jerky.
But I haven't observed the same behavior on the mobile device when testing. So
I'm not sure what to do with that.

Using opacity to indicate that the user is able to pan the profile seems reasonably
obvious; not sure if it's the best possible way to do this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Dirk Hohndel
3cf958e658 mobile/profile: add invisible rectangle around QMLProfile
This way we can clip the profile to it's designated size.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Dirk Hohndel
becaa1227f mobile/developer: add menu entry to temporarily enable verbose mode
One could argue that this should be a preference. I like the fact that it isn't
persistent, though.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Dirk Hohndel
d6c47ad362 mobile/export: fix horrendous user interface
This should never have been merged as it was. The UI was atrocious and the
functionality was by and large untested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
d8cc2b57b2 mobile/resources: fix incorrectly coded XSLT stylesheets
The prefix meant that on device these weren't found.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
9e36968881 mobile/export: don't allow file based exports on Android
There is no native file dialog, access to the file system is highly restricted
and will be much more so in Android 11. Let's not even start with this.

This should never have been merged as it was.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
0178f0c7e7 mobile/export: remove most of the export options
A tablet or phone is not a computer. What would you do with a CSV or TeX/LaTeX
file on a phone. Yeah, I get it, feature parity.

This should never have been merged.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
b8c02c9b03 mobile/export: clean up whitespace
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
619de80dfd mobile UI: restructure menu
This changes the 'GPS' entry to be called 'Location', moves the 'Map' entry
below that, and reuses the map icon for both the map inside this submenu and
for the main menu item.

It moves the 'About' entry under 'Help' and both 'Export' and 'Dive summary'
under 'Dive management'.

This way we have only five (or with 'Developer' enabled, six) entries in the
main menu making it much more appropriate for really tiny screens.

Additionally, the entrieis moved into sub-menus are ones that are not all that
commonly used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-13 14:01:34 -08:00
Dirk Hohndel
f915c45c43 mobile/summary: remove some debug output
I don't think we need that anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
4b3761861e mobile/summary: expand refresh button
Buttons ignore the width of the enclosed label and base their width on the
illogically named implicitWidth instead.

Also translate the button text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
57024d188c mobile/summary: more UI fine tuning
Creating more space for the header column and a little visual separation for
the different sections.

The commit is much smaller than it looks - try 'git show -w'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
a7d1dbd013 mobile UI: fix font size breakage on Android
The pointSize() of a font can return -1 if the font was originally specificied
with a pixelSize. Work around this by using QFontInfo to calculate the correct
value.

Additionally, don't use the pointSize() of a font when we can instead use the
calculated size.

This fixes the problem with the missing star ratings on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 16:45:04 -08:00
Dirk Hohndel
ba201eabc7 mobile UI: fix alignment issue in dive details view
The 'Map it' button could overlap with the dive number below, depending on font
size. This fixes the issue.

Reported-by: Peter Reinold <mcc.nash@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 12:45:55 -08:00
Jason Bramwell
caabf1b888 Correcting typos of the word celsius
Corrected typo of the word celsius in three files:
core/import-csv.c
core/divefileter.h
mobile-widgets/qml/Settings.qml

These were spelled as celcius but corrected these to celsius.
The 'core files were just comments but the mobile-widgets file would be
'active' code.

Reported by: tormento <turment@gmail.com>
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 12:45:55 -08:00
Berthold Stoeger
2ec570098b Cleanup: remove exportFunc class
exportFunc was a collections of functions for exporting dive data.
It had no state, therefore there is no reason for it to ever be
instantiated.

Simply remove the class. Rename the saveProfile function to
exportProfile so that all export functions start with "export".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-09 12:13:18 -08:00
Dirk Hohndel
3bb9b08f33 mobile UI: correctly determine the number of columns when screen size changes
This also deals with a bug we had before where we didn't re-start the calculation
for the various sizes from the assumption of 'at least 21 grid units'. Now you can
rotate the device and the right thing will happen.

Small warning - this checks the orientation of the screen, which is exactly what
you want it to do on your device. When running mobile on desktop this may not be
what you expect. Even if the window has a portrait aspect ratio, your screen is
likely still landscape... so testing this feature in mobile on desktop mode is a
bit harder...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 13:58:54 -08:00
Dirk Hohndel
96a56cf04d mobile/settings: add UI for single column preference
This is placed in the Advanced section as I expect this to be rather unusual
for people to enable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 13:58:54 -08:00
Dirk Hohndel
6c7411c776 mobile/summary: use more intuitive time periods
No one will ask you about your dives in the last seven months (and the
existing code actually provided the past 210 days in that case). Instead
do more intuitive periods. Last month, quarter, half year, year.

Use Qt's ability to make sane date calculations easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
fb057b7094 mobile/summary: improve the spacing of the content
Use more idiomatic ways to indent the rows, replace the TemplateLabel with a
simple Label since drawing the extra rectangle for the background of the
TemplateLabel is obviously redundant and using it doesn't change the number
of properties we need to set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
5f6b7450a9 mobile/summary: correctly align text to vertical center
I keep forgetting that the verticalAlignment is only within the current object,
which means that in a single line label it has no meaning at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
feab249bf2 mobile/summary: add refresh button
On tablet devices, the summary page stays open and therefore
the summary is not refreshed. For now, add a button. Later, this
should be connected to signals when dives are edited, added or
deleted.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
a93c303b8b mobile/summary: add section headers
Add section headers to the dive summaries on mobile by adding
a section-property. Of course, this will not work on desktop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
1809dbd00a mobile/summary: remove dive summary calculation
Since we now use a model to calculate the dive summary, there
is no need to export recalculation of the dive summary via
QMLInterface.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08 10:29:36 -08:00