aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-03-16Update Subsurface-mobile versionGravatar Dirk Hohndel
I believe this deserves a major version number increment. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16Android: remove legacy FTDI supportGravatar Dirk Hohndel
This works on almost no devices anymore and has been replaced by the USB serial support for Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: better memory managementGravatar Dirk Hohndel
Instead of relying on the std::vector staying unchanged and not freeing its members, instead keep a copy of the object in our DCDeviceData class. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: simply restart the download after receiving permissionGravatar Dirk Hohndel
If the user tries to download from a device that he hasn't given the app permission to read from, Android will pop up a dialogue asking for that permission. With this after giving the permission we continue (well, technically, restart) the download which is likely the expected behavior. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: refresh USB device list on entering download from DCGravatar Dirk Hohndel
The usbRescan() code is smart enough not to duplicate entries that might already be there. And with this the user doesn't have to manually tap rescan if they didn't open Subsurface-mobile via the intent after a device was plugged in. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android: don't show /dev/ttyS* connectionGravatar Christof Arnosti
Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: remove "autoselect driver" option for unknown VID/PIDsGravatar Christof Arnosti
Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16mobile UI: rescan button on DC Download page rescans BT/BLE/USBGravatar Dirk Hohndel
This way even if a USB device wasn't added through an Android intent, we still have a way to scan for it and select it. This is especially important in case a user has a cable that we haven't seen yet (i.e. with a VID/PID that we haven't added to Subsurface-mobile), but that nevertheless works with the android usb serial drivers. This also makes the flow a little more logical / consistent when deciding which connections to show. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16mobile UI: remove special case for Atomic AquaticsGravatar Dirk Hohndel
This dive computer hasn't been supported on Android in quite a while. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: stop adding the obsolete 'usb-serial' connectionGravatar Dirk Hohndel
The code that supported this has now been replaced by the USB device selection code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: pass in the UsbDevice when downloadingGravatar Dirk Hohndel
This finally allows us to download from not just the first device, but specifically the device that the user picks. Passing the object through a void pointer is not nice - but since this traverses C code other solutions (like passing an index into the list) seemed even worse. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: show download page again after USB permission grantedGravatar Dirk Hohndel
If the user hadn't granted USB permissions, yet, we asynchronously get informed once they did that. This ensures that the user gets taken back to the download page once they approve. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: parse the usbDevice when responding to intentGravatar Dirk Hohndel
This vastly simplifies our handling of devive information as we simply use what is already in the descriptor. This way we do not duplicate information about USB devices in the QMLManager. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: pass the usbDevice for intent handlingGravatar Dirk Hohndel
Instead of creating a string with all the object information, simply pass the actual object to the C++ code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: remove alternative way of scanning for devicesGravatar Dirk Hohndel
We now always create a list of usb devices that doesn't list a driver for known devices, and adds multiple entries with each of the drivers for devices that are unknown to us. This removes some debugging output in the ..._open() function as well. This could be combined with Christof's earlier commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: add helper to recognize chipsets known to usGravatar Dirk Hohndel
This will allow us to know when we can guess the driver. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android/usb: guess the actual manufacturer and productGravatar Dirk Hohndel
For a small number of dive computers we can actually figure out the real information which we can then later show to the user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16usb-serial-for-android: React to usb "permit granted" intent (stub)Gravatar Christof Arnosti
When a user is downloading from a DC for the first time (without using the "usb device connected" popup), the user is requested to grant permission to use the USB device. This is done asynchronously, thus the download is aborted. To be more user-friendly, we now react to the intent with the "usb granted" result. The plan here is to start the download again. Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16usb-serial-for-android: More fields in device descriptorGravatar Christof Arnosti
As discussed in issue #2657, there are now more fields about the usb device information in android_usb_serial_device_descriptor. Additionally, the user-facing string now makes more sense: "vendor [<bus# as integer>:<dev# as integer>]" Where vendor is as reported by android, but shortened to 16 characters. Examples: FTDI [1:2] Silicon Labs [1:4] Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16usb-serial-for-android: Use correct format spezifier for size_tGravatar Christof Arnosti
Signed-off-by: Christof Arnosti <charno@charno.ch>
2020-03-16usb-serial-for-android: Use wakelockGravatar Christof Arnosti
Android takes some pretty hard measures to save power, including shutting down the CPU. Since this can interfer with the download from an usb serial device, we now use a wakelock to keep the CPU running during download. Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16android usb serial: Prepare device / driver selectGravatar Christof Arnosti
This commit contains the serial_android_usb part of the changes proposed in issue #2657. What's implemented: - A data structure that contains all the data that can be used to describe an usb device (including user-facing string). - A function to get a list of all attached usb devices (optionally with selectable driver class). - Changes in the serial_android_usb_open-function and in the Java part to use the information about the usb device and optionally selected driver when connecting. This commit keeps compatibility with the current UI-Code in the case that only one USB-Device is connected. If two devices are connected, only the first one is tried. There are still some small things to do: - Change the user-facing string to something more descriptive. - Parts which aren't uesd anymore when the UI-Part is implemented are simply marked as obsolete (to keep compatibility for now). But generally it seems to work. [Dirk Hohndel: some white space / coding style adjustments] Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16mobile/download: only use device guess if no USB device plugged inGravatar Dirk Hohndel
If we explicitly open the download page after the use plugged in a USB device, don't try to use guesses from the BT/BLE pairings to populate the device/connection dropdowns. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-14iostream: fix incorrect rfcomm error case when writingGravatar Linus Torvalds
This is the exact same case as the previous commit, just for the writing side. Once again, it's the subsurface rfcomm iostream code that can return DC_STATUS_SUCCESS with a byte count of zero when something goes wrong with the write. And once again, our libdivecomputer iostream code didn't try to be robust and protect itself from that case. The fix is equivalent, although slightly simpler, since the write side doesn't have the whole timeout issue. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-03-14iostream: fix incorrect rfcomm error case when readingGravatar Linus Torvalds
We had two independent bugs here, both of which needed to fire for this to cause a problem. This fixes both of them. The first bug was that our rfcomm code would return DC_STATUS_SUCCESS with a zero-sized read when a timeout happened, or when the rfcomm socket had disconnected. That makes absolutely no sense. We should return DC_STATUS_TIMEOUT on timeout, and DC_STATUS_IO if the socket has disconnected without any data. The fix to this is to make the whole rfcomm iostream read logic much simpler: there's no need to loop at all for partial results, because the libdivecomputer iostream side will do the loop for us (and handle partial results much better: it knows if the target backend can handle those partial results or not). The second bug was in our libdivecomputer iostream read() function, which reacted very badly to this bad return value. This updates our libdivecomputer branch to one that is more careful about things. Reported-by: linuxcrash <albin@mrty.ch> Debugged-by: Jef Driesen <jef@libdivecomputer.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-03-12Make statistics window resizable on MacGravatar Robert C. Helling
For some reason, the window needs an active maximize button to be resizable on Mac. Fixes #2671 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-12cleanup: remove current_dive parameter from divesSelected signalGravatar Berthold Stoeger
The diveListNotifier.divesSelected() signal is used to inform the models of a selection change. It sent the current dive as a second parameter. This is redundant, because the only sender of the signal sets current_dive just before sending the signal. Remove the parameter, which appears to be an artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-12divetripmodel: change current dive if no dives are selectedGravatar Berthold Stoeger
The DiveTripModelTree::divesSelected() returned early if no dives were selected. Thus, the current dive was not updated. Remove the check for no dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-12mobile/export: fix invalid referenceGravatar Dirk Hohndel
This just removes broken code. That file select dialog is still just a very strange idea and should be revisited at some point. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12mobile UI: stop trying to play with opacityGravatar Dirk Hohndel
Since we are switching between pages, the whole opacity mechanics make no sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12mobile UI: remove duplicate StartPageGravatar Dirk Hohndel
This was a merge error in the dive list rewrite and brought in a code block that had moved, which caused issues with correctly switching to the dive list. Calling setupActions() moves to the diveListView (where it really belongs). Instead of messing with the visibility of components of the same page, we now simply switch out the shown page. Fixes #2667 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12mobile UI: make user and log messages consistent for no cloudGravatar Dirk Hohndel
A number of our messages were misleading in the no cloud case. This should help to reduce confusion. Adding the save_dives() call after creation of the repo appears to help us have a valid repo in place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-11Grammar: replaces 'indexes' by 'indices'Gravatar Robert C. Helling
Grammar-nazi ran git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g' to prevent future wincing when reading the source code. Unfortunatly, Qt itself is infected as in QModelIndexList QItemSelection::indexes() const Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-10Add timestamps to libdivecomputer.logGravatar Christof Arnosti
Since I learned while trying to implement this that getting sub-second resolution time in portable C99 is hard (especially for someone who is used to the comfort of std::chrono and Howard Hinnants date library) the timer-implemetation from libdivecomputer is now copied to the subsurface source. Signed-off-by: Christof Arnosti <charno@charno.ch>
2020-03-10Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10translation tooling: fix script to not include Kirigami stringsGravatar Dirk Hohndel
Not sure when it started doing that - we don't want those in our translations, I believe. Also, we appear to suddenly get problems with too many numerus lines unless the existing translation is deleted, first. Very strange. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10Android: stop trying to list only FTDI based serial DCsGravatar Dirk Hohndel
Thanks to the new USB serial implementation also that complex special-casing is no longer needed. This should do the right thing now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10Android: remove USB devices we don't supportGravatar Dirk Hohndel
The HID devices and the Atomics Aquatics Cobalt cannot work on Android right now. We should claim to support them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10undo infrastructure: improve undo command textsGravatar Dirk Hohndel
For many of the commands it is fairly easy to add information that makes it easier to figure out what actually happened. That's especially true for commands operating on dives. Trip and dive site edits haven't been given these more elaborate undo texts (yet). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10cloud storage: add list of changes made to commit messagesGravatar Dirk Hohndel
This should make it easier to figure out what operations lead to the commit that is written to git. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10core: make command texts available for C codeGravatar Dirk Hohndel
Create a C string (which the caller needs to free) with the executed commands in this session. The detour via the callback allows us to not make the corelib depend on the commands, which is nice for tests, export-html, and smtk2ssrf. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10undo infrastructure: collect the texts for the executed commandsGravatar Dirk Hohndel
This creates a single string with all the undo texts that are on the stack. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10build-system: remove pointless distinction between desktop and mobileGravatar Dirk Hohndel
It's the same sources, the same library. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile UI: six new iconsGravatar Dirk Hohndel
I will (mis)use these for moving dives out of trips and to the trip above or below and of course for undo/redo. And the weirdest one is the 'local offer' icon that seemed a reasonably good fit to edit trip details. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile UI: save changes to trip detailsGravatar Dirk Hohndel
The logic when we show the save button is a little fragile (and visually I'm not sure I love the disabled button), but hey, this works. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile: add ability to update trip detailsGravatar Dirk Hohndel
This creates up to two undo events. This seems like such a small issue that it's not worth creating yet another undo command for this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile UI: add divelist context drawer action to edit trip detailsGravatar Dirk Hohndel
For now this only shows the trip details. They can be edited on the page, but there is no way to save those edits, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile models: add trip location and notesGravatar Dirk Hohndel
First step towards making those accessible and then editable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile/dive-list: add context menu when long-pressing on tripGravatar Dirk Hohndel
This doesn't show the dive specific actions and sets the stage for trip edit actions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>