QML documentation recommends against using the cacheBuffer for longer
lists and doing more testing shows that this really doesn't help at all.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Small optimization that reduces the number of accesses to the underlying
model. Instead of evaluating the isInvalid member eight times per
delegate, we only check it once.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Without this check we'll show the 'Please tap the plus botton...'
notification during app initialization as we are showing the initial set
of messages - which makes no sense.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of not showing a notification until after we are done loading
the data into our models, tell the user that we are about to do that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Until the app is initialized, we have problems getting the 'floating'
passive notifications to show up and be useful. Instead update the user
by filling a text block on the otherwise empty initial page of the app.
Delay the switch to the dive list until the app is initialized and then
use the passive notifications again. While we are initializing also show
a busy spinner so the user doesn't think the app is hung.
As a side effect of this change, the dive list isn't shown until our
models are initialized. And strangely this causes every single possible
delegate to be instantiated. We can prevent that by not setting the dive
list model until after we are done setting up the model.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This simply passes the text to the existing notification text mechanism.
The call to processEvents() ensures that Qt processes the UI events
after we updated the notification and that the user gets timely updates;
otherwise the UI might look like the app is hanging.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing the dive site of a dive, the dive-table of the
corresponding dive site was not properly updated by the undo
commands. Try to get this right.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was triggered by a change in enabled, but what is really changing is
the visible property. This should work better.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Especially on smaller screens we had issues fitting this on the screen.
And it looks fine on larger screens as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was using the myData alias that exists in the dive list but not on
the dive details. This might work (because the models both use the same
underlying base model), but given that we are using the currentItem of
this ListView, I'm guessing that this would just silently fail (maybe
with a warning in the log).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A second tap on the back button will then end add/edit or close the dive
details and get us back to the dive list.
This fixes an issue where tapping on back with the context menu open
would bring you back to the dive list with the context menu still open,
and because then change the text in the context menu as those are
designed differently.
Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The
- mergeLocalRepo()
- openLocalThenRemote()
functions were not invoked from outside QMLManager.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
QMLManager::changesNeedSaving() behaves differently on iOS:
it only saves locally with saveChangesLocal(), whereas all
other OS save to cloud with saveChangesCloud(). Nevertheless,
even for other OS saveChangesLocal() is called even though
that will be called in saveChancesCloud anyway. Therefore,
compile the saveChangesLocal() call in changesNeedSaving
conditionally.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
At least in 4.9.3.1258/3.0.1 I was able to reproduce a situation where I
edit one dive, go back to the dive list, then tap on a different dive
and then the keyboard pops up, obscuring a big chunk of the screen.
This tries to make sure the keyboard isn't shown in dive view mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are two places where we try to prevemt unintended app exits.
Once, in the onBackRequested signal handler on the dive list. This was
missing special handling for the situation where one of the drawers was
open.
The second place is the onClosing signal handler in main.qml. Naively I
thought that this was enough to catch all cases where we were about to
exit the app, but apparently an explicit manager.quit() is a bit too
forceful and doesn't get to that signal handler.
With this commit we check for open drawers in both places. Belts and
suspenders, I guess.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
You can already get to the map by either clicking on the location text
or on the left action button. This third way to get there reduces the
available space for the location text, and can cause positioning issues
with very long location texts creating three or more lines of text,
which then overwrites the dateRow below.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The compiler complained that we were passing a float to the
QFont::setPointSize() function, which expects an integer.
Solve this by using the QFont::setPointSizeF() function.
This might introduce a user-visible change, albeit very unlikely:
We now may set the point-size to a non-integer number.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The compiler complains that members were initialized out-of-order.
Even though this is not an issue here it is correct to emit a
warning, since only then it is guaranteed that the objects are
destructed in reverse-order with respect to construction.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Some slots in QMLManager were not called from the outside, some
only directly from C++-code. Make the former private and the latter
public member functions.
The idea here is to document which functions are actually called
from the outside and which are called from QML or connected to
signals.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There appears to be no reason for two-phase initialization.
Let's keep things simple: let the constructor produce a
functioning object.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
According to the Qt-docs you *may* send the new values in the
NOTIFY signal of Q_PROPERTYs. However, since changes will lead
to a reevaluation of a whole expression, this argument will be
unused. All it does is make the code more verbose and brittle:
What happens if you send the wrong value?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We have a singleton class ThemeInterface, which means that it
is global and exists only once. It's members are static, i.e.
also global. A message from the department of redundancy department?
In any case, that makes no sense. Let's just make these members
local to the class.
I would even rip out the whole singleton thing, since the object
is not accessed anywhere outside from QML. Let's keep it for now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
An Android user might reasonably assume that they can use the back button to
close the global or context drawers. So act accordingly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should deal with the rather confusing 'No dive in dive list' shown
while loading and processing the dive list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since apparently the header property of the ListView isn't reliably
making sure that our filter input line is visible, let's move the filter
header to be it's own visual element and manually manage the
relationship between that and the ListView.
The obvious idea was to anchor the ListView to the bottom of the
filterHeader, but that didn't work in my tests. So instead we are using
the topMargin to make sure that there is space to show the header.
Because this re-indents the whole filterHeader, 'git show -w' gives a
much better idea what this commit actually changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of the crude and error prone bool, let's just use the right tool
for this job.
In order to avoid issues with a goto across a mutex boundary, this
slightly restructures the code in one place - 'git show -w' makes it
clear that this is really rather simple in its changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm suspicious that an issue that some people have seen around changes
not being saved is caused by our handling of alreadySaving.
When starting with Subsurface-mobile in no-autosync mode, we were able
to end in a scenario where alreadySaving was true, even though there
were no unsaved changes. And in that case no changes made during such a
session were saved unless the user forced a manual sync with the server.
This commit radically changes our approach to handling the flag. It
moves it right next to the actual calls into code that could modify git
storage, and ensures that the flag can never stay set.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was disabled in the past because it was deemed to slow. A lot
of time has passed, since. Maybe on current phones / iPads this is
acceptable again?
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a context menu entry for top level dives that allows the user
to create a trip for that dive.
Unfortunately this creates a new string to translate right before a
release...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we start adding a dive, we actually create a diveAdd undo command
so we have a dive that the user can edit. Which means we need to undo
this action if we cancel.
Also, for a more consistent UI, we should pop the dive details page that
we used to edit this dive and bring the user back to the dive list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We still used pageStack.push() all over the place.
Also, in showPage, disable the map hack if the user actively picks a
different page.
This should fix an issue where the user picked the map and then tried to
add a dive to the dive list - and instead of the dive edit was shown the
map again.
Reported-by: Hartley Horwitz <hhrwtz@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's possible for our code to think that the user wants to pan the
profile before realizing that the user actually is making a pinch
gesture. In that case the profile could get stuck in semi-transparent
mode. This prevents that from happening by explicitly resetting the
opacity to 1.0 when we start a pinch.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And allow touchpad gestures to be recognized as well. This has no
negative impact on the mobile platforms, but makes it much easier to
test profile scaling / panning on the desktop.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way someone trying to swipe from dive to dive won't inadvertantly
pan the profile instead. And panning it really only makes sense when
zoomed in in the first place.
This could leave us in a situation where we zoom in, pan, zoom out and
now the profile is out of whack and we cannot correct it. A simple click
on the profile fixes that.
The real solution would be some constraining / adjusting as we zoom and
pan to ensure we keep things correctly positioned. Maybe I'll figure out
the correct way to do this later...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I would love to figure out a way how to bundle the user manual and load
it from the device file system, but in the meantime this should continue
to work.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The hardcoded widths with fixed values was just flat our broken and
created all kinds of strange artifacts.
But even with this somewhat more idiomatic approach this still isn't
perfect - on wider screens it doesn't shrink back to the minimum column
width. But that seems like a bit of a corner case. Overall this feels
like a huge improvement.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The number of possible sequences of events when the user is connecting a
USB device is rather surprising. These changes try to ensure that in
every case we get USB connection information we do in fact show the
correct (or best guess) connection.
See #2686
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The location information model is updated automatically by the
divelist-model and the undo commands. Therefore remove the
QMLManager::updateSiteList() function. We do have to keep
the locationListChanged() signal though, because the list
of dive sites is not exported via model/view but rather via
a Q_PROPERTY. We really should change that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The git parser loads into the global dive table, even if it
is called indirectly via parse_file(). However, parse_file()
may be given a different table. Fix this by extending the
git parser state.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
While I remember some of the thinking that went into doing things this way,
the more I read the code, the less it makes sense to me.
This is a rather drastic step, but in reasonably extensive testing it seems
to work in every case that I tried.
That's rather embarrassing, actually.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing a dive on mobile we might have to create a new
dive site. That site is added to the global dive site table
in the undo command. However, the code in QMLManager created
the dive site with create_dive_site*() functions, which already
adds it to the table. The undo command then added the dive
site again leading to a hang of the application.
To solve this problem, create new alloc_dive_site*()
functions that do the same as create_dive_site*()
but do not add it to the table.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This seems to make more sense than to not select anything (which was the
previous behavior).
If the same connection is still available, select it again. Otherwise
pick the top connection (which is the right thing to do if the user has
just plugged in a USB device and refreshes the list -- that device will
show up as top entry).
Based on a suggestion by Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes sense because USB devices will only show up when connected,
while BT/BLE will get listed once they are paired, even if not currently
connected. So the higher likelihood of being the device a user is looking
for is for any USB devices that show up, so those should go first.
Suggested-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
While this has worked fine for a long time, it now suddenly seems to trigger
crashes. So let's not do that (there are a number of discussions online that
talk about how this could indeed lead to BadThings(tm) happening.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way one can execute dive list manipulations without the detour
to the dive details screen. For example you can long-press on a dive and then
add it to a trip or remove it from a trip.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The default policy closes the context drawer if there is a button release
outside the context drawer area. That messes with the intended UI. For us a
much more useful behavior is to have the next click outside of the drawer close
the drawer.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This one exposes undo/redo as well as some basic trip manipulations, very similar
to what's already available on the dive details page. Except that here it also
makes sense to add a selected dive to a trip above or below (if those exist and
the dive isn't already in a trip).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now this is only available on the DiveDetails screen. The menu entries
are only enabled if there is such a trip to add the dive to (and if the dive
isn't already part of a trip).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we remove the newest dive from its trip, it becomes inaccessible in the app,
but the dive data saved to disk appears to be correct.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In add and edit mode this is confusing and wrong.
There is a bug in Kirigami that creates lots of bogus error message about
missing mainFlickable. That needs to be patched out.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In some situations we ended up with the wrong location name. One way to
reproduce the problem was to edit an existing dive location to be a substring
of an existing location name. Save the dive, then immediately edit it again.
The wrong location would be filled in.
The code here looks strange and unnecessary, but it seems to fix the issue.
The aliases don't seem to make the code any easier to understand. This replaces
them in the case of the location combo box with direct accesses to the data on
the DiveDetailsEdit page. It may be worth removing all of them. The
locationModel alias was unused.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we are using the existing command infrastructure, this isn't specific to
undoing a delete.
This commit renames the function and removes its use in the UI, the next commit
will then add the generic undo to the UI.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the divelist model is now placed on top of the common
models, we can directly reset the filter.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Command that just swaps two dives. This is rather complex,
as for example a dive site might be created.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This still has an odd bug. When we swipe the dive details to change the
selected dive and that action causes a trip to expand or collapse, then
the color change / highlight in the dive list isn't updated correctly,
even though the log file indicates that we made the necessary changes.
This also changes the coloring of the selected dive; having the same coloring
as a trip was very confusing. This is a bit stark, but it clearly communicates
the distinction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The whole load from cloud thing will have to be audited. It appears
to me that there are way too many model resets...?
The only thing that is left is dive editing. Let's do that next.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of using the model, copy the code we have in the desktop version
which manually creates a 15m/40min dive and passes that to the addDive
undo command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After swiping through the dive list, select the currently visible dive.
Thus, the dive is highlighted in the overview pane.
The connection with the QMLManager feels atrocious, but I would prefer to have
as little logic in QML as possible.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The currently shown dive is now controlled by the core.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
MobileSwipeModel is probably not an ideal name, but all I could come up with.
One of the main complications here is that our list is reversed with respect to
the source model. We should change that one day. Probably by moving the
sorting down to the core-model.
Since looking up the source row is somewhat expensive, the lookup is cached for
a single entry because accesses come in bursts for a single dive. This should
be a good compromise and avoids keeping track of a full row-to-dive array.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we want to add a second model, but not have to manage two models
everywhere, create a class MobileModels that contains both of the models. When
calling reset() on that class, it will reset both of the models, etc.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To unify mobile and desktop, let's use the current_dive variable
of the core to indicate the current dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a small step in unifying mobile and desktop.
I'm unsure whether it is correct to play this via the QMLManager or whether we
should call form QML directly into the model?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This obviously breaks everything, but now we can start fixing
things.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Implements the ListView and its delegate to use the dynamic data
provided by the DiveSummaryModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Recalcluate not only the statistics for the given period, but also
the global first and last dive date.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of transporting the global first and last dive date
in the dive summary, calculate it in an external function.
Since we already have time and date functions in qthelper.cpp
implement those functions there. Provide a stub in QMLInterface
so that QML can access these standalone functions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When the cylinders became a dynamic data structure, a get_cylinder() call
suddenly could return a NULL pointer. So use get_or_create_cylinder() for the
first call when parsing the user's data.
Also, deal with an oddity where the string lists look different because an
empty list technically isn't the same as a list with one empty string.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This seems to work much more reliably as it specifically compares the cursor
position to the visible bottom and top of the screen.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The GridLayout isn't part of a Layout, so set its width and
have the combo box fill it's part of the grid.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This still is way to fragile. Ordering of object completion doesn't appear
consistent. Hopefully bringing the properties all into one (now reasonably
named) object will help.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't expect this to be complieted. I'll keep it in the tree
for the moment, but expect to remove all of the related code
eventually.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With the columnSpan 3 (in a grid with only two columns) they were drawn
on top of the drop down for the theme.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In a color swatch the color of the body of the swatch is the one that
matters. And we need to ensure readability. So for each pair of colors,
use the combination in the regular order (color/textcolor) for the
background swatch, and inverted for the text swatch.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The TemplateLabel comes with a set background color which creates a very odd
effect and makes the text generally unreadable in the color swatches.
Fix this by matching the color of the parent rectangle.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These are not color swatches like the rest, these are the column titles, so
don't draw them the same way as the color swatches.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder,
this secures no change in behaviour.
Signed-off-by: jan Iversen <jan@casacondor.com>
Show all colors in a theme, allowing user to change theme.
This is preparation for allowing users to click on the individual
colors and change them.
Signed-off-by: jan Iversen <jan@casacondor.com>
Make variables and functions static where possible, this is done
to prevent different versions of theme with different values.
Signed-off-by: jan Iversen <jan@casacondor.com>
Use the TemplatePage and TemplateButton in the converted pages.
In order to avoid a bigger search/replace all other pages are left
untouched (for now).
Signed-off-by: jan Iversen <jan@casacondor.com>
Do "git mv SsrfButton TemplateButton", and search/replace
all uses.
The general idea of the templates are to secure common layout,
but also to isolate the Kirigami parts (slowly) in the templates.
Signed-off-by: Jan Iversen <jani@apache.org>
Usually, we use PascalCase (i.e. camelCase with a capital
letter at the start) for class names. For consistency, let's
do it here as well.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
QMLInterface::instance() is only used in one single place. This
makes the whole notion of having a global instance of the object
moot, isn't it?
Simply make the object static to the function that uses it, which
guarantees that the object will be created when the function is
called. I.e. the same behavior is retained with less complexity.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It appears weird to connect the QMLInterface signal/slot combination
in a static helper function. This generates a bunch of lambdas that
call the instance() function.
Instead, simply do the connections in the constructor as we do it
in numerous other places.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When either length or volume unit is changed, the text needs to be
changed.
Let signal lengthChanged and volumeChanged cause a recalcation and therefore
new text.
Signed-off-by: jan Iversen <jan@casacondor.com>
Emit signals for each standard color when theme changes.
The iconStyle property was changed from being a constant, because it can
change, and thus a signal was added.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove extra empty lines in themeinterface.cpp just a cleanup, no functionality
change.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
fontMetrics is no longer used in production code, but still in the theme test
page.
Isolate fontMetrics in ThemeTest page.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to remove fontMetrics from QML, replace references (height)
in DownloadFromDiveComputer and Settings
Add include kirigami as needed
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move setting of font properties used throughout to themeInterface.
Add new settings "currentScale".
The properties are kept in main (subsurfaceTheme) in order not to do
a big search/replace.
Update settings to use currectScale and signal changes in themeinterface.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Check defaultfont and calculate basepointsize in themeinterface instead
of in QML.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There were quite a few issues with the code - clearly a complete failure of
code review.
- all values were '??' if a period contained no dives
- imperial units were not calculated at all
- significant truncation and data loss in the way totals were added as meters
and minutes instead of the higher precision data that is available
- several issues in striing conversion methodology, e.g. missing zero padding
for minutes
- missing maxSac
- incorrectly calculated avgSac
- incorrectly claculated number of EANx dives
- hard to read code with most variables named 'temp'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Solve kirigami error:
INFO: qrc:/org/kde/kirigami/ScrollablePage.qml:187: TypeError: Cannot assign to read-only property "parent".
Kirigami.scrollPage does not allow a ListModel be defined, even though it is allowed in QtQuick.
Signed-off-by: jan Iversen <jan@casacondor.com>
Add dive_move variable to qmlinterface, to make it aviable to QML.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace subsurfaceTheme with ThemeNew, since there are still 2 objects
subsurfaceTheme in main.qml and ThemeNew in themeinterface.*
Replace theme color references with ThemeNew, as they are no longer available
in main.qml (subsurfaceTheme).
Signed-off-by: jan Iversen <jan@casacondor.com>
Move setup call and registration from subsurface-helper
to themeInterface, in order to keep the registration where the code
are.
Signed-off-by: jan Iversen <jan@casacondor.com>
Add DivePlannerSummary, a page to show in dive centers.
Allow user to select period for the 2 colums in DiveSummary.
Default is "Total" and "3 month", but allowing the user to change
these, make it a very simple tool to view how the user progresses.
Variables are taken from Backend.
[Dirk Hohndel: adjusted text strings as these aren't really months]
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create DiveSummary class in backend-shared and make the DiveSummary calculation
results available to QML.
This adds a loop over all dives (could have been done with a model, but the
models available to mobile are very limited, so use the basic way).
[Dirk Hohndel: renamed the results variable and combined a couple of commits]
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add property "colorBackground" to allow instances of templateLabel to have
background color overwritten.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A lot of whitespace issues have snuck in recently, this just cleans those up so
that I don't need to hand-edit patches every time I touch this file (since
QtCreator automatically fixes whitespace when I make changes).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply replace it with QLatin1String. There is a tiny performance penalty,
but none of that code would care.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update Settings to use ThemeNew (for theme change)
Reduce subsurfaceTheme in main
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently subsurfaceTheme resides in main.qml, where it does not naturally
belong.
Add C++ class that will replace subsurfaceTheme in main.qml in a 1-1 manner.
This opens future posibilities
- on top of the 3 themes, allow users to select colors/fonts
- add stylesheets to Template* components
- make day/night shift automatically.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update size and colors.
Changing the TemplateSection, automatically changes all sections
in the system, converted to the new layout.
The styling would be better in a style/theme class, but
subsurfaceTheme is in main.qml and not in a C++ class, so for now
use primitive styling.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The standard SpinBox uses far too much real estate.
The new SpinBox have a smaller footprint, and more visual effect.
Changing the TemplateSpinBox, automatically changes all spinboxes
in the system, converted to the new layout.
The styling would be better in a style/theme class, but
subsurfaceTheme is in main.qml and not in a C++ class, so for now
use primitive styling.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add property pressureUnit to use as BAR/PSI text.
Added slot to catch when user changes BAR <-> PSI.
Add Backend variables to Planning section.
Signed-off-by: jan Iversen <jan@casacondor.com>
Add surface_segment to plannerShared and then
update desktop-widgets.
Signed-off-by: jan Iversen <jan@casacondor.com>
desktop-widgets: use plannerShared for surface_segment
Change getter/setter for surface_segment to plannerShared, in
order to share the conversion with mobile diveplanner
Signed-off-by: jan Iversen <jan@casacondor.com>
Duplicate deco_mode to DECO_MODE, in order to make it available to QML.
Duplicate enum divemode_t to DIVE_MODE in order to make it
available to QML. Only part of the enum is made available.
Signed-off-by: jan Iversen <jan@casacondor.com>
Add bottompo2, decopo2 and bestmixend to QMLInterface
Bestmixend in gas options changing with
meter/feet
Signed-off-by: jan Iversen <jan@casacondor.com>
The real values are 1.0 to 10.0, but QML needs int so mobile
gets values 10.0 to 100.0
add sacfactor() to QMLInterface and update QML.
Signed-off-by: jan Iversen <jan@casacondor.com>
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp
to plannerShared, to facilitate the same results in mobile
diveplanner
Use Backend for bottomsac/decosac and update to check
for switch LITER <-> CUFT
Add bottomsac/decosac to QMLinterface.
Signed-off-by: jan Iversen <jan@casacondor.com>
Variables without conversion, do not need to pass plannerShared
(due to the QML interface).
Simple variables do not pass plannerShared, but diveplanner
in desktop-widgets and qmlinterface in mobile-widgets call the
implementation directly.
Signed-off-by: jan Iversen <jan@casacondor.com>
Catch when volume type is changed and update bottomsac/decosac.
Also update text l/min <-> cuft/min and add a space between value and unit.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Drop_stone_mode, when set, affect the descent rate, so place it alongside the
descent rate.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add simple variables, where getter uses prefs. and setters call directly to set
function (without using plannerShared).
rename last_stop --> last_stop6m
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make notes rates available to QML through the Backend interface.
Remove the corresponding variables from plannerShared.
Getters are from prefs. while setters are linked to diveplan model.
Remark: signals from qPrefDivePlanner is used, because the diveplanner model
sets qPrefDivePlanner but do not issue special signals.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For METRIC and IMPERIAL, show the radiobuttons disabled
For PERSONALIZED, allow user to select individual units.
Signed-off-by: jan Iversen <jan@casacondor.com>
Use Backend instead of Planner for ascent/descent variables.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make ascent/descent rates available to QML through the Backend interface.
Remark signals from qPrefDivePlanner is used because the diveplanner model
sets qPrefDivePlanner but does not issue its own signals.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove string version of unit_system, duration_units, length, pressure,
temperature, vertical_speed_time, and volume, including tests and make signals
strongly typed in C++
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change Settings and DivePlannerSetup to use the strongly typed enums
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add qPrefUnit Q_PROPERTY but using QMLInterface enums, that way
all variables become strongly typed in QML.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create section advanced around the remaining gridlayouts, and adjust.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move gridlayout unit_settings to TemplateSection units, without changing
anything (apart from adding a visible: attribute).
Removed first label in units_settings, since it is the title of the section
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move gridlayout themesetting to TemplateSection theme and use the
TemplateTitle. Also switch from using PrefDisplay.mobile_scale to
subsurfaceTheme.currentScale
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
move gridlayout divecomputers to TemplateSection general, without changing
anything (apart from adding a visible: attribute and replacing the Rectangle
used to draw a line at the bottom with a TemplateLine on top.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
move gridlayout defaultCylinder to TemplateSection general, without changing
anything (apart from adding a visible: attribute and replacing the Rectangle
used to draw a line at the end with a TemplateLine at the top).
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
move gridlayout cloudSettings to TemplateSection general, without changing
anything (apart from adding a visible: attribute and removing the rectangle
used to create a line).
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ColumnLayout does not work well with TemplateSection,
so change to Column
Add TemplateSection "General Settings"
"General Settings" are open when visiting page first time.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
bump import versions to reflect Qt 5.12
and remove unused imports
remark QtQuick 1 and QtQuick.Controls 1 are depreciated since Qt 5.12
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace Control.TextEdit with TemplateTextEdit, in order to use
common font/color scheme.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace Control.ComboBox with TemplateComboBox, in order to use
common font/color scheme.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace Control.label with TemplateLabel, in order to use
common font/color scheme.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace CloudStatus.<value> with backend.<value> as part
of making enum sharing between C/C++ and QML more robust.
Replace PrefCloudStorage.verification_status with
backend.verification_status to use the strongly typed function.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add CLOUD_STATUS enum to interface.
Add cloud_verifification_status variable to interface, and make
it strongly typed in QML.
using backend.cloud_verification_status = 1 will fail but
backend.cloud_verification_status = backend.CS_UNKNOWN is correct.
Added note to the original definitions of the enums that they have been
duplicated.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a header file that contains a duplicate of the enums,
that are needed in QML in one class.
the unit enums are added imidiatly, since they are needed
or will be neede shortly in Settings and DivePlannerSettings
This class will also contain Q_PROPERTY and signal/slot for
variables used in QML. This is done to allow e.g.
deco_mode qPrefUnits::planner_deco_mode()
void qPrefUnits::set_planner_deco_mode(deco_mode)
as strongly typed in C++
and
DECO_MODE planner_deco_mode()
void set_planner_deco_mode(DECO_MODE)
as strongly typed in QML
Remark: wrong assignments gives errors in QML
The advantage over using strings or the value directly is that
QML detects typos and flags them as errors/warnings.
It is important to note that the class may only contain
a) a function call to the implementation
b) a reference to a global variable e.g. prefs.
Added note to the original definitions of the enums that they
have been duplicated.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
add missing colors so that dark theme contains the
same colors as "colors in use".
Update the darkTheme() to correctly copy colors from
pink theme
Signed-off-by: jan Iversen <jan@casacondor.com>
add missing colors so that pink theme contains the
same colors as "colors in use".
Update the pinkTheme() to correctly copy colors from
pink theme
Signed-off-by: jan Iversen <jan@casacondor.com>
add missing colors so that blue theme contains the
same colors as "colors in use".
Update the blueTheme() to correctly copy colors from
blue theme
Signed-off-by: jan Iversen <jan@casacondor.com>
move contrastAccentColor, lightDrawerColor
to block of used colors in order to avoid confusion.
move darkDrawerColor to dark theme.
Signed-off-by: jan Iversen <jan@casacondor.com>
default_cylinder was moved from PrefGeneral to PrefEquipment,
but Settings was not updated
update Settings.
Signed-off-by: jan Iversen <jan@casacondor.com>
When changing METERS <-> FEET, the text change automatically
between "m/min" and "ft/min".
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do not use a.set_b(value); it works, but it introduces yet another way of using
the QML/C++ interface, furthermore the function might not be called set_b in
some future, which is the reason the function is define in Q_PROPERTY
Use a.b = value, that respects Q_PROPERTY, and is slightly more performant,
most importantly it's like all the other settings so noone starts wondering why
this is special.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Set the text of ascent/descent rates.
This shows the correct speed units when the user switches between metric and imperial.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
but the proper way, as a direct check on
PrefCloudStorage.
This secures PrefCloudStorage is only tested once and not
n times. As a sideeffect it saves typing and control.
Signed-off-by: Jan Iversen <jan@casacondor.com>
(planning is excluded, due to not finished UI).
Connect all spinboxes with plannerShared.
This change allows live testing and compare with the desktop version.
Signed-off-by: Jan Iversen <jan@casacondor.com>
(planning is excluded, due to not finished UI).
Connect all checkboxes with plannerShared.
This change allows live testing and compare with the desktop version.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Switch oldStatus from qmlprefs to qmlmanager
This is the last use of QMLPrefs, which can later be safely removed.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
oldStatus() is kept in qmlPrefs during the login process to allow
for a couple of special cases:
- if a user have added dives in NO_CLOUD mode and changes to use the
cloud these dives are copied to the Cloud, instead of being lost.
- if a user does a bailout from the login process (this should not
happen anymore) the old status is restored.
The pure solution would be to have oldStatus at the top level (e.g.
a property in qml) and only change it when actually being in the
login process, however due to way the qmlmanager is written it proved
very difficult and not worth the effort.
In order to be able to remove qmlPrefs, oldStatus are moved to
qmlManager.
This commit only contain the creation of the variable and the supporting
code.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
prefs.showpin is the same as
PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
but is actually implemented as a separate variable.
Removing showPin in order to limit use of QMLPrefs, which is the overall goal.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove no longer used function setCredentialStatus() from qmlprefs.
This is done to secure there are no missing setCredentialStatus calls
in the code.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
call setOldStatus() and set_filename().
saveCredentials() will adjust email and password.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This setCredentialStatus() will never do anything, because qPrefCloudStorage
is identical to prefs.cloud_verification_status, and can thus be
safely removed.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Revert to the divelist by setting oldStatus() directly to
set_cloud_verification_status()
This is done to further limit the use of setCredentialStatus() and
prepare to remove qmlPrefs.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update revertToNoCloudIfNeeded() to not use setCredentialStatus() by adding an
extra call to setOldStatus()
setOldStatus() is called in setCredentialStatus together with
set_cloud_verification_status() therefore these 2 calls need to added when
removing setCredentialStatus().
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
qmlprefs::setCredentialStatus() basically only does something when called with
CS_NOCLOUD.
A number of setCredentialStatus() calls happen where status cannot be
CS_NOCLOUD, and therefore setCredentialStatus() can be safely replaced with
set_cloud_verification_status()
This limits the use of qmlprefs::setCredentialStatus(), but there are still a
couple of more complicated calls.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace all credentialStatus() with cloud_verification_status()
Where both prefs.credentialStatus and
PrefCloudStorage.cloud_verification_status are being set, remove
prefs.credentialStatus.
These replacements are valid since credentialStatus() is a simple
envelope over cloud_verification_status().
Also remove qmlPrefs::credentialStatus() from qmlPrefs (mostly to ensure no
replacements was forgotten).
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove m_credentialStatus in qmlpref, but let the setter/getter
stay, using qPrefCloudStorage::cloud_verification_status()
instead.
This change ensures that qmlPrefs:credentialStatus() returns the
same as qPrefCloudStorage::cloud_verification_status(), and the
setter/getter of credentialStatus can later be removed safely.
This is a "checkpoint" to ensure everything works without a temporary
credentialStatus. No code part depend on the difference between
qmlPrefs::credentialStatus() and
qPrefCloudStorage::cloud_verification_status(), but the code reference
both.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove use of prefs. (apart from instanciating the object) in
main.qml
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the divelist is only visible if online/offline (CS_VERIFIED/CS_NOCLOUD),
there is no need to check that to enable "Add dive manually".
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Manual sync was enabled both for CS_VERIFIED (online) and CS_NOCLOUD (offline)
and then in the trigger CS_NOCLOUD lead to a login screen, potentially
confusing the user.
Only enable manual sync with verified cloud credentials.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
prefs. is only important during the signin process, so use the standard
PrefCloudStorage variable
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
cloudPin does only have the values "" and NULL, so replace cloudPin()
with "" in csa->backend() call
remove setting of cloudPin to ""
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
cloudPin is only set to "" and NULL, therefore and "if" checking if
cloudPin is not empty will never have affect.
Remove else part.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move verifyCredentials() from public slots to private, eliminating
the need to MOC and making the C++/QML interface on function less
complicated.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add pin parameter to saveCredentials() thereby having all info about
credentials in one function call.
Add "" as pin in saveCredentials() - main.qml, when verifying
credentials.
replace verifyCredentials() with saveCredentials() in the register
button on the pin page.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
clearCredentials() was only called from one place (in the same file), copy
functionality and remove function.
It was declared as a public slot, so this saves a little bit of overhead too.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
cancelCredentialsPinSetup() is no longer used, so remove it.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Copy functionality from cancelCredentialsPinSetup() into Cancel in
CloudCredentials.qml, this is part of the general qmlprefs cleanup.
Remove rootItem.returnTopPage() since the user stays on this page
(sees credentials again).
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>