Commit graph

740 commits

Author SHA1 Message Date
jan Iversen
8d66633fe7 core: make qPref::cloud_status the only version of the enum
add enum to qPref and remove elsewhere
update source core to reference qPref.

the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-10 10:30:50 -07:00
jan Iversen
19803ab3c3 mobile-widgets: solve cloudstatus register problem
Use Q_ENUM instad of Q_ENUMS (which is depreciated) since it does the
meta registration for all Qt platforms.

Q_ENUM require the enum to be defined in the class and cannot refer to
a global class, therefore copied enum to class.

This commit is made to get the release to work, with minimal changes,
this class will be moved to qPref and the double definition solved

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-05 12:31:56 -07:00
jan Iversen
2f95141330 core: remove double definition of enum cloud_storage_status
Remove cloud_storage_status from qmlprefs.h.
usage to qPref::

enum cloud_storage_status is not used from C, but only from C++, and
having the same structure defined multiple times is a maintenance
challenge.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-04 05:32:30 +08:00
Dirk Hohndel
e79d177c71 Android: limit the amount of data copied to clipboard
The clipboard fails if we attempt to copy more than 1MB of data. But the
data buffer used is shared between all transactions 'in flight' and we
cannot tell what else is currently using that buffer. Limiting ourselves
to 500k of text for the logfiles seems reasonable and hopefully makes it
more likely that the transaction will succeed (sadly, Qt doesn't tell us
if it failed).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-28 06:52:14 -07:00
Dirk Hohndel
bcde65b152 iOS and Android: try more logfile locations
On some devices (e.g., a Sony Xperia phone) the GenericDataLocation is
not app writeable. Instead of just giving app, try a few other default
locations as well (and since all of these are actually string lists,
try all of the options that Qt gives us).

Reasonably, we should only set the libdivecomputer logfile name if we
found a writeable location.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-28 06:17:31 -07:00
Dirk Hohndel
1161782f3b QML UI: provide information why logfile couldn't be written
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-28 05:39:10 -07:00
Dirk Hohndel
478b5de9e7 QML UI: fix layout of Download page
The info text from the download process wasn't rendered correctly.
maximumWidth ended being a recursive reference and as a result the text
would render as very narrow and super-tall field.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-27 16:28:01 -07:00
Dirk Hohndel
ef17c78e23 QML UI: remove unused property
We always save the libdivecomputer log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-27 16:05:36 -07:00
Dirk Hohndel
f998b59900 QML UI: don't use anchors within Layouts
Qt 5.11 adds useful warnings when code attempts to use anchors within
Layouts and even tells you how to fix things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-26 03:56:44 +08:00
jan Iversen
ff88e7ee99 mobile: remove MapWidget from mobile-resources.qrc
remove MapWidget entries from mobile-resources.qrc, and
reference map-widget.qrc in Subsurface-mobile.pro for iOS

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-21 20:27:58 -07:00
Dirk Hohndel
74d1afc0d5 mobile: iOS/Android: always delete libdivecomputer.log at start
This way the user doesn't inadvertantly end up with information from a previous
run of Subsurface-mobile when they copy the logs to the clipboard.

Not sure we should do the same when building for desktop, so right now it's
only when building for a device.

Reported-by: Thomas Fänge <thomas.fange@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-21 17:17:35 +09:00
Dirk Hohndel
b75eae95c1 QML UI: remove unused property
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 13:23:59 +09:00
Dirk Hohndel
7f7e7cf51d QML UI: ensure we track vendor/product for download
This is based on something that Anton Ludin sent to the mailing list.
Reading through the code it seemed that there were scenarios in which
DC_vendor and DC_product were not updated correctly. That's one of the
problems of the declarative approach in QML - it can be very hard to
figure out which code is run when in certain situations.

This may help address the issue with FTDI downloads no longer working on
Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 12:07:11 +09:00
Dirk Hohndel
1ccf21f08d QML UI: improve banner in global drawer
The asynchronous load seemed to be (at least one of) the culprit(s) of
the banner occasionally not showing up.
Making the font for the cloud ID smaller looks better (and works much
better for long email addresses).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 11:50:14 +09:00
Dirk Hohndel
7ec9c206b5 QML UI: store nocloud data when adding cloud credentials
We want to allow people to keep dives they collected without a cloud
account. The code was mostly there, we just got confused about the
existing status because we ran through this twice (no cloud -> unknown
-> verified). This way we explicitly remember this kind of transition.

Fixes #1404

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 11:13:13 +09:00
Dirk Hohndel
e6835d76cc QML UIL: fix more problems with members moving from manager to prefs
That change clearly would have benefited from better code review.
This is a superset of a change proposed by Jan Iversen.

Closes #1406

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 09:34:27 +09:00
Dirk Hohndel
a5380bb741 core: add free_samples helper
And use it in the UI and planner code.

See #1411

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 09:27:11 +09:00
jan Iversen
49f3da3bfd mobile: set alloc_samples to 0 when resetting.
set alloc_samples = 0 when settings dc->sample = 0 and dc->samples = 0

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-20 07:59:07 +09:00
Murillo Bernardes
2466351a5f mobile: use full icon path.
For some reason Kirigami.Icon mess up icon display when filename
extension is omitted. Because of this a perfectly good, scalable svg
show up as a low resolution scaled up icon.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-06-18 06:54:40 +09:00
jan Iversen
cc77046db5 mobile: move call to savePreferences back to manager.
calls to savePreferences was moved to prefs. in
b8eb348f54, but the corresponding
C++ code was not merged.

Revert call to savePreferences to manager.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-18 06:52:59 +09:00
jan Iversen
a24f0d3107 mobile: revert e993d4f005
The commit secured that plotDive was not called before actually being used.
However our (rather fragile) C++ qml interface did not work correctly (ony sometimes).

Revert the previous commit.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-18 06:37:01 +09:00
Dirk Hohndel
ca84d96a50 QML UI: show the cloud credentials in the global drawer banner
This is an additional side-benefit of rolling our own banner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
Dirk Hohndel
c8ef3d7924 QML UI: build our own icon and header for global drawer
Kirigami appears to have a bug that makes it fail to show our icon.
With this we can be much more flexible in what we show in the top area
of the global drawer.

Fixes #1331

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
Dirk Hohndel
238d47710e Whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
jan Iversen
74ee577357 mobile: add Dark_gps.svg
The blue gps was reused for the dark theme.
Copy Blue_gps.svg and change color to dark.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-17 19:42:16 +09:00
Murillo Bernardes
fed2a283b2 mobile: fix reference to credentialStatus property
Commit b8eb348f moved credentialStatus but missed one spot.

When starting from a fresh install, clicking "No cloud mode” fails because of this.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-06-16 04:01:49 -07:00
Dirk Hohndel
16d7620e21 QML UI: fix variable reference
Looks like commit 807571a588 ("core: update deviceData default from
qml") never actually was tested with dive computer download. This looks
rather like an automatic renaming gone wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-16 11:19:49 +09:00
jan Iversen
b8eb348f54 mobile: move settings from qmlmanager to qmlprefs
add settings variables/functions to qmlprefs
remove settings variables/functions from qmlmanager
change manager. to prefs. in qml files for setting variables/functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
62ca5e90e1 mobile: move NOCLOUD_LOCALSTORAGE from qmlmanager.cpp to .h
Make NOCLOUD_LOCALSTORAGE public for other qml functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
d0e9f62624 mobile: add qmlprefs class
add class to cmake and pro
register class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
13b9c7a822 Mobile: correct wrong C++ ref in qml
change data() to manager.
correct comboDevice -> comboConnection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-11 09:43:32 -07:00
jan Iversen
470c218b79 core: remove qml properties from downloadfromcthread
Remove Q_OBJECT and qml properties from DCDeviceData class
Remove DCDeviceData register from mobile-helper.cpp
Change DCDeviceData constructor to be without parameters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
807571a588 core: update deviceData default from qml
remove setting default in qml to C++

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
682e1b63f5 mobile: add DCDeviceData properties to qmlmanager
add DCDeviceData qml properties etc. to qmlmanager

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
f7e8f21245 mobile: remove context icons
Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 20:54:10 +02:00
jan Iversen
eaaf0fc431 mobile: remove png/svg icons not used
Delete icons that are taken from kirigami

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 19:48:36 +02:00
jan Iversen
aab8f0dcf6 profile: make profile self contained
move qmlprofile.* to profile dir, to keep all parts of the
widget in one place.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
99eff8e247 mobile: clean use of DiveId in qmlprofile
Remove unused signal and simplify qml access to
m_diveId

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
e993d4f005 mobile: do not call plotDive during startup
Check in profile if visible before calling plotDive

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
0acda9a509 mobile: white space clean in DiveDetailsView.qml
Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
64c0881e9f mobile: decoupled ssrf.qrc and mobile.qrc
remove /subsurface.qrc from .pro
copy missing mapwidget icon references to mobile-resources.pro

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
f7fde20a2c mobile: main.qml, change load of dive.jpg
change load of dive.jpg to reflect new location.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
cee754f200 mobile: mobile unreferenced ic icons
Remove 24px icons not referenced.
update README.license

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
92b505be72 mobile: remove unneeded alias from mobile-resources
remove alias where alias == file
rename *24px* icons and remove alias

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
1c9bd08d55 mobile: clean qml dir (move dive.jpg to icons)
Cleanup qml dir by moving dive.jpg to the icon dir

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
552f625e52 mobile: sort mobile-resources.qrc
Sort to make it easier to read.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
487a4b2c32 mobile: correct comboProduct if model changes
update  onModelChanged in comboProduct to read the
current index

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-07 18:43:56 +02:00
jan Iversen
03f30f6281 mobile: delay combobox selection for download.
Set index of comboboxes in Download screen when the page
becomes visible instead of when it is created.

The pages is created before QBluetoothDeviceDiscoveryAgent on iOS and desktop,
therefore combobox indexes cannot be set during page creation.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04 10:27:13 -07:00
Berthold Stoeger
36b9e5e31e Cleanup: fold core/helpers.h into core/qthelper.h
helpers.h included qthelper.h and all functions declared in helpers.h
were defined in qthelper.h. Therefore fold the former into the latter,
since the split seems completely arbitrary.

While doing so, change the return-type of get_dc_nichname from
"const QString" to "QString".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-04 08:50:10 -07:00
jan Iversen
76f61468e6 mobile: add timer to measure startup.
Subsurface-mobile has a long startup time; in order to isolate the problem(s) a
timer is added to see where time is "lost".

The collected startup times are added to the clipboard together with the other
logs, allowing test users to report back.

All this is only enabled when compiling with -DENABLE_STARTUP_TIMING

Closes #1340

[Dirk Hohndel: collapsed multiple commits and minor white space cleanups, added
               missing QMutex variable]

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-30 21:47:07 -07:00