This should prevent the device from draining battery like crazy.
This is not the same as the interval at which we record fixes - getting a
fix every 5 minutes gives us a better chance to notice when we moved the
minimum distance.
Also add some more comments to the code that does the actual handling of
storing the data.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a direct conversion of the existing code in subsurfacewebservices
to the different data structures in use here. I did not try to abstract
this out to have both share a common helper because I assume that the
Subsurface web service will pretty quickly become obsolete (together with
the companion app).
Right now this is not hooked up anywhere.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we don't clutter the main settings and we don't have to deal with
making sure we are reading and writing from/to the right group.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- anchor the label to the left of the date field
- elide the text instead
This fixes the bug in the dive list where the dive's location overflowed
over the date, especially visible on phones in portrait mode.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- paint() can become a hot path, especially when we think about
repainting the item on size changes. In general, it's a really good
idea to keep this function as fast as possible, as we want to be able to
repaint the item when needed. Also, ProfileWidget is pretty heavy to
set up, so rather spend a bit of memory there.
- Rename profile to m_profileWidget, it already was member var.
- Sizing ... I have to admit I don't understand the rendering of the
ProfileWidget. I'd like it to do the following things:
- render at native resolution, we don't want to resize it
- react to item changes - we want to reset the size and
re-render the widget into the item in those cases
- perhaps be able to use a couple more of the profilewidget's
features
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Styled texts
- don't put all the properties of the text items in one long line, makes
the code more readable and is in line with coding style used
throughout.
- button and profile move into their own items, button moves to the
right (it's more of a contextual item, so it's better placed top
right, further more, a control is generally easier to reach on the
right without covering information unnecessarily. Code-wise, it's also
a more logical encapsulation.
- dpi-aware sizing of dive profile, use units.gridUnit instead of
hard-coded pixels.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Using Label instead of text gives us consistent coloring and styling of
the text labels. Also remove the boldness to make it comply to the
design language used.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
anchors.fill does essentially the same, as the item is positioned at 0,0
of the parent by default.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- word-wrap and style the log message at the bottom, this should fix
clipping of error messages down there
- introduce units.smallPointSize, which defines a small font size to use
for toned-down display elements (e.g. the date in the dive list)
- No need to assign the default value to Text.text
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This line seems to be a left-over from a refactoring. It doesn't do
anything, just produces a warning, so just remove it.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is rather simplistic and will clutter the settings. I'm not convinced
this is the BEST way to do this, but it's a rather straight forward way to
get persistant storage of the location fixes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
qDebug is nice when testing on the desktop, but it has to go to the
message area on an Android device to make things easy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The log page have an extra top bar that is not needed.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use the view, rather than the model to check if the list is empty. This
allows us to use the property notifiers rather than a function call, and
hence fixes updating the visibility of the startpage when the listview
gets filled (or emptied).
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes sure we don't accept any input from the startpage when
interacting with the divelist -- they're really mutually exclusive.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want short labels here in order to allow more horizontal space to be
taken by the inputs.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This provides a bit more spacing around the logo and aligns the text to
the bottom of the logo, rather than to its horizontal center. Looks
cleaner.
Text in the login page is now aligned towards the inputs, giving a
closer connection between label and widget.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We use units.largeSpacing margins for page-level spacing.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This change streamlines the navigation across the pages to be in line
with the stackview organization. The top bar becomes a static element
with the title and a button that either opens the preferences or shows
the back arrow.
This makes it a bit more efficient, since we load the title bar only
one, and there are no strange animations in the title. The stackview
gets the role of content container, the "chrome" around it is laid out
in main.qml.
Most of the churn in this patch comes from moving large blocks of code
between files with different indentation levels.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This isn't necessary anymore with the default font size fixed, remove
it. The label itself is still useful for coloring, and perhaps more
styling in the future.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit adds a start page that is shown when there are no dives in
the list, for example when the user first starts the app. Instead of a
large empty screen, we offer 3 ways for the user to get dives onto the
device: download from cloud storage, dive computer and adding dives
manually.
This fills in the empty space in the dive list, and isn't a top-level
item since it really just makes sure the user isn't greeted with a big
empty space, which looks pretty unpolished, but rather guided through
the first steps.
Needs aligning of the naming in the actions.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Add margins consistent with other pages
- Top-align the dialog, we want to keep the inputs as high as possible
on the screen to prevent the on-screen-keyboard from covering them
- Add a checkbox to show the password, with input on mobile devices,
this is a commonly found and useful feature
- Remove Cancel button, this is just navigation chrome, the user can
simply use the back button in the top bar (will be fixed in a
subsequent patch)
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes the organization of the qml files a bit more fine-grained, it
prevents mixing of .cpp and QML files, and also of what's compiled, and
what's included in the app as qrc data.
In particular:
- subsurface specific QML items go into the qml/ subdirectory
- theme and unit definitions to into qml/theme subdirectory (they
already were located in a theme directory)
- generic components, such as our Label goes into qml/components
This facilitates sharing of functionality and identifying common stuff
better. Ideally, we can pull qml/theme and qml/components from a
standardized set at some point, so we don't have to maintain that code.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Tabs slippped in while the rest of the file uses spaces.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- add sizing information for fonts and fontmetrics
- compute devicePixelRatio from fontmetrics
This shows that Android doesn't give us accurate information about the
default font (hence the Text items being way too small) and a wrong
Screen.devicePixelRatio, which we can actually compute ourselves.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a Label that we can use for styled text until we figured out how to
set the default font size.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- gridUnits is dynamic again, using FontMetrics now
- Add a page to display some sizing-relevant details, so we can debug
dpi problems a bit better on Android
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- This allows us to use these new things without changing much in our
own code, things now work again.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will be needed at some point, so better put it in the right place
already, so we don't forget enabling the singleton usage once we've
fleshed out how that could work exactly.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- remove the singleton usage, this will need a bit more magic in the
background. Not a huge problem since we're only using one instance
anyway, and the object itself is rather light
- hardcode gridUnit for now. I'd like to use TextMetrics or FontMetrics
there directly, but I'm not sure we can depend on Qt 5.4 and QtQuick
2.5.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a currently work-in-progress attempt at making a minimal set of
Plasma components available.
The code needs a bunch of adjustments yet, which I'm making in tune with
upstream. The idea is to create a standardized sub-set of Plasma's QML
API for applications, which brings only minimal new dependencies (for
now: none).
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- fix spacing and sizing in TopBar
- use an anchor layout for the delegate and split out labels and values: this
allows more uniform alignment
- add the subsurface mobile icon to the first page
- various visual touch-ups to taste
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- section headers get underline with a thick line
- items are separated by spacing and a thin grey line at the bottom
- spacing on both sides, aligning with header
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- colors for accentuation (background and text)
- text color to paint on highlights
- units.spacing (derived from gridUnit, so it's dpi-corrected)
- port main.qml, especially the application header to this theming and
sizing
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Theme: For theming, we're just defining some colors centrally for now
- Units: This object provides dpi-corrected sizing in the form of
gridUnit. The idea is to base gridUnit on the rendered font size, so
the ui scales with text size. As this interpolates font size and dpi,
the sizing is rather responsive.
These are the basics, now we can kill lots of hardcoded pixel values.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Correctly show the log messages. The log window will display all
messages emitted by the QML Manager class.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
When closing the log window, do not try to save the changes. This
should only be done when closing the DiveDetails.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Start working on the add dive feature, to enable the user add a
new dive using the mobile UI.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
The top bars on the main page and dive details should be the same height
and keep the same layout.
[Dirk Hohndel: refactored Joakim's patch to work on top of what was
already in master]
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The top bars on the main page and dive details should be the dame height
and keep the same layout.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Butons are sized based in the text printed on them,
we want our buttons to have a meaningful minimum size and a
preferred size that is similar regardless of screen resolution.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This resizes the dive profile to always maintain an equal width and
height, so that the sizing is the same in all devices.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we try to set up a message before the window has been instantiated we
should ignore the message, not crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add some style to the menu button so that it fits the theme.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
White is boring, so lets change the color of the android app to
a more pleasing subsurface blue.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Runing the android version on a phone the screen must be tilted
sideways to accommodate all buttons.
This creates a single button that triggers a popup menu that houses the buttons.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a better way for showing the profile. The show() and hide()
statements are replaced by a QTransform statement.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
When testing subsurface-mobile on the desktop from an account that had a
default file set up in the Subsurface preferences that file would already
be loaded creating rather confusing output.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a DiveDetails.qml to hold the dive details, and display it in
the stack view when the user taps on a dive.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Link the QMLProfile class to the DiveList.qml file. The profile is
displayed above the dive details.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Add a C++ class to render the dive profile. The rendered image is then
passed on to QML.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements saving of some dive details to the cloud service. When the
user closes an open dives, any changed details will be cached, and when they
click on the 'Save Changes' button is pressed, the changes will be saved to
the cloud.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
This is just a quick first stab to do this, but it at least allows us to
share some information with the user.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QML on Android doesn't support multiple windows, so dialogs that work on
the desktop are not a good solution on Android. A much more natural way to
present sub windows is a stackView.
In order to do this Preferences needs to be an item and the structure of
the ApplicationWindow needs to change a bit.
This also removes the hard coded sizes and instead tries to design this in
a resolution independent manner.
The diff appears larger than the actual change because of an increase of
indentation for the ApplicationWindow content.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't hard code sizes as devices tend to have much higher pixel density
than desktop computers. Instead make sizes relative to the content.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Android the app figures out the size by itself.
Also change the name to match our naming scheme (Subsurface mobile for the
QML UI).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Show the dive details in editable text boxes. This will make it easier
for the user to edit the displayed information.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Load dives from the Subsurface cloud service using the user's saved
credentials. This will display the dives in the same way as loading
them from a local file.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Add a button in the main qml file to show the preferences window. This
window is linked to the QMLManager class, so any changes made will be
saved to the user's settings file.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Show more dive info in the extended view of the dive.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On the QML page, dives are repeated. Adding process_dives to
QMLManager after calling parse_file solves this.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Group dives according to the allocated dive trips.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a dive is clicked, show the dive details on the QML page.
This contains basic details, and will be expanded further.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This file contains a styled button for use in QML
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Set a rounded blue rectangle on the selected item.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This model will be used to show the dives in QML. This commit adds
the model, and the means to link it to QML.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a link between the C++ and QML parts of the app using the
qmlRegisterType function.
[Dirk Hohndel: changed the name to org.subsurfacedivelog.mobile]
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a QMLManager class. This class will be used as a link between
the C++ and QML aspects of the mobile application.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a dialog to select dive files in the QML interface, and also
add a menu entry to open the dialog.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a menu with an Exit submenu in the main.qml file. This closes
the application when clicked.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a resource file to hold any QML files that will be used in the
mobile port.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a qt-mobile directory, with a blank main.qml file. This file
will be built up-on to come up with a usable mobile interface.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>