summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2018-03-19QML UI: Fix checkbox colorGravatar Joakim Bygdell
The background color in our own checkbox should match the page background. Also includes some whitespace cleanup. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19QML UI: drop focus when selecting a locationGravatar Joakim Bygdell
Make sure to drop focus both for typing and when selecting an entry from the list. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19Mobile: change location combobox idGravatar Joakim Bygdell
Change the id of the location combobox to math the naming scheme of the other comboboxes. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19Mobile: Fix location comboboxGravatar Joakim Bygdell
In the initial move to comboboxes the correct location model was not used. This uses the correct model and makes it behave like the other comboboxes. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19Mobile: for multiple buddies pick index of firstGravatar Joakim Bygdell
When a dive has multiple buddies, pick the index of the first to prevent the user from hanving to scroll through the entire list when editing. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19QML UI: drop focus on editGravatar Joakim Bygdell
Drop focus on editable comboboxes when pressing enter. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19Moblie: remove comparison when savingGravatar Joakim Bygdell
Removing the comparison of currentText vs editText when saving buddies fixes the issue of data loss when dive has more than one buddy. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19QML UI: drop focus when ComboBox element is pickedGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19QML UI: cylinders aren't editableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19QML UI: switch editing back to comboBoxGravatar Joakim Bygdell
The HintsTextEdit just doesn't feel natural and intuitive. Edit, fixed rebase issues. Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-14Cleanup: introduce copy_qstring() functionGravatar Berthold Stoeger
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-12Mobile: pass QString as value to registerError()Gravatar Berthold Stoeger
registerError() may be called from a different thread context. Passing the message as a const-reference may lead to a dangling reference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-11main.qml: handle mapPage in pageStack.onCurrentItemChanged()Gravatar Lubomir I. Ivanov
When the slot pageStack.onCurrentItemChanged() is reached make sure that the stackView becomes non-interactive. This prevents swiping left on the map to "go back". Also, always reload the map markers when the map becomes visible. This is not optimal and instead something in the lines of: DiveList.model.onChanged() is a much better solution. Ideally the map reload should happen on dive removal, dive addition, dive edits and sync from cloud. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: add a drawer action for the mapGravatar Lubomir I. Ivanov
This action uses the Breeze icon "map-globe.svg" and calls showMap(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: modify showMap() to not accept locationGravatar Lubomir I. Ivanov
showMap() uses a location to open Google Maps in a browser. Make showMap() a generic function to push the mapPage on the view stack. Update the calls to this function from child widgets and pages. Also either call mapPage.centerOnLocation() or mapPage.centerOnDiveSiteUUID() depending if the caller wants the map to center on a dive site or on map coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: create an instance of MapPageGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11mobile-resources.qrc: add the map related resources for mobileGravatar Lubomir I. Ivanov
1) QML files 2) Map widget specific icons 3) The Breeze map-globe.svg icon Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11mappage.qml: add a Kirigami page for the map widgetGravatar Lubomir I. Ivanov
The Page object has the following functionality: - reloadMap(): reload all map markers. - centerOnDiveSiteUUID(): center the map on a dive site uuid. - centerOnLocation(): the map on a latitude, longitude in decimal. - Select a dive list entry based on a marker selected on the map via diveList.setCurrentDiveListIndex() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11divelist.qml: add the setCurrentDiveListIndex() helperGravatar Lubomir I. Ivanov
Add the setCurrentDiveListIndex() wrapper for: diveListView.currentIndex = idx wich also makes it possible to disable the scroll animation when selecting dive list indexes which are too far apart. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-02-24QML UI Mobile: correct margins on log pageGravatar Jan Mulder
Also a developer likes to see a nicely formatted page, so correct some bugs in margin handling on the log page. There was a strange multi-line whitespace on the top of the list, and the total width of the page was (initially) a little smaller than full page, so showing a small strip of the page left on the pageStack. This just looks weird. So again, cosmetics only. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24Mobile QML UI: wideScreen property changeGravatar Jan Mulder
See also 15cdcdbc6. There, we introduced the wideScreen (set to true) to evade a (cosmetic) bug in (most likely) Kirigami. The top dive was partially obscured on the start of the app. And by setting the wideScreen to true, the application header became of a fixed height. Numerous changes further in Kirigami, we can now set this property to false. This results in a correctly displayed divelist at the start of the app, and *also* an application header that correcly hides itself when scrolling up, and displays itself again when scrolling down. So, a behavior that is common to, for example, mobile brouwsers. This all said. I still believe this is a workround for strange behavior. In fact, we should not need to set this wideScreen property at all, and Kirigami should behave correct in all cases (true, false, unset at our end). It behaves correctly when set to true or false, but still displays a partially hidden top item in the dive list when unset. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24Revert "Mobile QML UI: fix more background colors (gpslist)"Gravatar Jan Mulder
This worked correctly while compiled against Qt 5.10.0, but after installing Qt 5.10.1 the behavior was just wrong. And as there seems no way to color the background of a Kirigami SwipeListItem, just revert this, and accept the (slightly) inconsistent coloring of the page (for now). This reverts commit 6700715b5dc1d314bc73800d8f8ec387d4d20d16. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-19QML UI: do not overflow right margin on BT textGravatar Jan Mulder
Trivial and cosmetics only fix. The width of the rescan button was forgotten, and this pushed the right margin to the right, causing the combo menus to overflow the right margin. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17Mobile QML UI: fix more background colors (gpslist)Gravatar Jan Mulder
And another one. The SwipeListItem also needs to have a set background color. Unfortunately, the lines between the individual SwipeListItem disappeared, so, set the smallest possible border on these items. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17Mobile QML UI: color the application header correctlyGravatar Jan Mulder
Also, this got broken after the Kirigami to verion 2.2 in main.qml. So, set the header background color according to our theme setting. Notice, that there is a remaining issue here. We could color the text color in the header, but now, this seems impossible (or I do not understand how and where to set this). Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17Mobile QML UI: fix background colorsGravatar Jan Mulder
For some reason, after the update of the main.qml to version 2.2, all Kirigami Pages and scrollablePages show up plain white. So now, set a proper background for these pages. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17Mobile QML UI: Divelist hover/selected colorsGravatar Jan Mulder
This is subtle one. With the changing of the theme color, it appeared that the hover and selected colors in the divelist where wrong (as in, always blue-ish). This is easily solved by setting the activeBackgroundColor to our theme color, and Kirigami does the rest (tint and opaque settings for the different states a selected dive can be in). Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17Mobile QML: main.qml to Kirigmi 2.2Gravatar Jan Mulder
This is a long standing issue. I wish to keep up with Kirigami developments including new versions of their controls, but this is not always easy. While we upgraded to Kirigmi 2.2 for most of our QML earlier, using this new version of main.qml breaks numerous stuff. In fact, so much that we just needed to wait. With the progress in Kirigmi, it is now possible to upgrade, with still some issues on our side to be fixed, but this is manageble now. The main show-stopper was a construct to set our theme colors, for example: Kirigami.Theme.highlightColor = Qt.binding(...) This is not posssible any more, as the Kirigami.Theme has made these readonly on their end. This commit just removes the assignments to the now readonly theme items. And the setting of a correct theme color for the action button. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-11Mobile QML: set fontsize for developer logGravatar Jan Mulder
Just set the fontsize to something sane. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-08Mobile cleanup: remove unused actionsGravatar Jan Mulder
Trivial removal of 2 unused Kirigami actions. These were leftovers from the time we had a very different style of cloud account management. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-02mobile cleanup: repair stupid mistakeGravatar Jan Mulder
Commits fed2c5b6a1 and 572fc4707 erroneously deleted two aliases. That is corrected here. Yes, QML with only runtime errors can be a pain. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile: introduce simple private helper updateAllGlobalLists()Gravatar Jan Mulder
As we need to update our new stringlist models on multiple locations, just refactor them into a new function. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile cleanup: restyle construction of locationlistGravatar Jan Mulder
See also e6e1473e6. The construction of the locationlist was not the same as the 3 previous lists, and it needs the inclusion of a new model file (divelocationmodel.cpp) in the mobile app. In addition, as the mobile app is mainly interested in a simple stringList (model) to populate a HintsText field (or maybe later a combobox), this stringlist is added to the model, to easy interfacing with QML. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile cleanup: unduplicate code and do not loop over dives (3)Gravatar Jan Mulder
See e6e1473e6. Exact same commit but here for the list of divemaster. The careful reader will spot a small addition to the clearDetailsEdit() QML function. Two more field are cleared. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile cleanup: unduplicate code and do not loop over dives (2)Gravatar Jan Mulder
See e6e1473e6. Exact same commit but here for the list of buddies. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile cleanup: unduplicate code and do not loop over dives (1)Gravatar Jan Mulder
This is the first of a set of commits that are (very) similar. It appeared that a number of more or less static lists, which are constructed by a loop over all dives in the logbook, were executed when changing focus to a next dive. For example, the in this commit addressed list of used dive suits. What was wrong was that the suitList was linked to a dive. There is only a need to construct the list of used suits when data is changed (and obviously, once on startup of the app). Further, it appeared that a lot of code was duplicated and that we can use (in this case) the same code from the desktop completionmodels.cpp. Basically, this commit involves the following changes: - include completionmodels.cpp in mobile and desktop (so move it from the desktop only category to the generic category). - remove double code from DiveObjectHelper.cpp - Do not differentiate in the init phase and the normal refresh of the list - the per dive logic is now only the getting of a previously constructed list (in init or update of the divelist). There are no visible changes in the UI, other than a better performance when scrolling over dive details. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31Make report_error() reentrantGravatar Berthold Stoeger
Remove the global error buffer and pass the error string directly to the frontend. The frontend is then responsible for accumulating errors. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31Use error callback to log errors in QMLManagerGravatar Berthold Stoeger
Instead of manually logging errors after each potentially error-producing function, use the error-callback. The error texts are accumulated in the QMLManager object for further use. The text is transported to the QMLManager object via a queued connection. Thus, errors can be reported from other threads without having to deal with manual locking. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-25Remove function-call indirection in qmlmanager.cppGravatar Berthold Stoeger
QMLManager::tryRetrieveDataFromBackend() was a one-liner calling void QMLManager::checkCredentialsAndExecute() with a pointer-to-member. The latter was never called with a different pointer, therefore fold the latter into the former and remove the indirection. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Mobile: start message timer on startupGravatar Berthold Stoeger
Since the timer will be started on first message anyway, we might just start it at application startup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Mobile: don't show timer twice in log-messageGravatar Berthold Stoeger
This was probably an oversight - the timer was only shown for very specific messages. This was change to show the timer for all messages. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Remove redundant local variables cloudPwd and cloudUserGravatar Berthold Stoeger
These were assigned the member variables QMLManager::m_cloudPassword and QMLManager::m_cloudPassword. Use the member variables directly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Remove redundant QML getter functionsGravatar Berthold Stoeger
QMLManager was full of redundant getter functions of the type bool QMLManager::locationServiceAvailable() const { return m_locationServiceAvailable; } These can be removed changing READ keywords to MEMBER keywords in the QPROPERTY declarations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11Introduce helper function empty_string()Gravatar Berthold Stoeger
There are ca. 50 constructs of the kind same_string(s, "") to test for empty or null strings. Replace them by the new helper function empty_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10mobile: fix crash on delete dive from divelistGravatar Jan Mulder
This is a somewhat hacky commit. For a very long time, the delete from the divelist on mobile crashed. That is, not always for anyone, but for me almost consistently. This commit tries to solve it. I found that trying to save the delete immediately after removing data from the underlying model seemed to cause the crash. Hacking around, I found that a simple beginResetModel/endResetModel between the delete of the underlying model data and actual save is sufficient to solve the crash. The big question is, why does this all work? I suspect some of race condition between deleting model data, and giving the QML engine the opportunity to do its thing. This is also related to issue #311, but that is not implemented here. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-08Move resetting of current file out of clear_dive_file_data()Gravatar Berthold Stoeger
This is the only case where C-code sets the current file. Remove this call for a better separation of C-backend and C++-frontend parts. There were four callers of clear_dive_file_data(). Two of them would call set_filename() anyway. For the remaining two add an explicit call to set_filename(). This commit fixes a bug introduced in commit b3901aa8f90499ee2a34efdddc2463105afc53f1: The cloud-online menu entry was still enabled after "closing" the cloud storage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-07Remove redundant call to clear_dive_file_data()Gravatar Berthold Stoeger
In QMLManager::saveCloudCredentials(), clear_dive_file_data() was called just before calling openLocalThenRemote(). The latter calls the former anyway, so remove the former. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-03mobile: silence warnings in the app logGravatar Jan Mulder
The new SHA mysteriously caused more than 300 extra warnings in the app log. It was caused by a code change in Kirigami. The way to suppress it is, in hindsight, after some hours of searching, trivial. A Kirigami.BasicListItem shall have an icon defined. And as we do not care about any icon here, just define it empty. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-03mobile: newer Kirigami SHAGravatar Jan Mulder
This commit consists of the following 3 parts: 1. There are 2 source files added, adapt our build process accordingly. 2. Due to a change in icon and kirigami QML prefixes, we need to adapt for this as well. Changed mobile-resources.qrc for that. When this would not be changed, the icons will not be found. 3. To further prepare for the future, abandon the iconName property in favour of the new icon grouped property, which can have more attributes than only the name. But currently it is only a syntactic change. Tested on Android device, and no visible changes. Signedoff-by: Jan Mulder <jlmulder@xs4all.nl