Correctly tracking the status of our authentication with the cloud service
is non-trivial, especially since the user may quit Subsurface between
registering and verifying an account, they might even register on one
machine and verify on another.
This tries to make sure that when in doubt we check with the cloud service
backend. And we show errors in the UI.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This now sets the preference variable / config entry and keeps them in
sync. Doesn't actually change the behavior at program start, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This simplifies the distance calculations and removes a dependency.
This version uses propper math instead of my to simple previous version.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also change the name of the enum and make sure all the inner functions get
passed the remote transport information.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user didn't enable saving the password to the preferences, then the
password was cleared out as the preferences got synced.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes it clear that we are working with the cloud storage and removes
the (in that case, redundant) branch name from the title.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
libgit2 takes forever (a minute or so) to figure out that it can't connect
to a remote server.
So if we are using https as connection protocol, quickly check utilizing
RFCs 2324/7168 to make sure we can reach the cloud server (and not some
captive portal or something).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This seems to work better than moving the Globe up there.
It's not ideal (I really want to be able to show one big picture for the
site - and on all the sites without pictures we show nothing), but for now
I think this is better than having the profile there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reverts commit ec8ba5f830.
Turns out that moving the globeGps widget to a different quadrant breaks
the parent relationship and that causes things not to work. I know that I
tested this and didn't notice any issues, but I now can reproduce a broken
default screen. So let's revert.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While this isn't what I really want (I wanted pictures of the dive site
instead of the profile), at least this makes it clear that we aren't
editing a dive but instead are looking at a site.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This now happens in its own thread...
But leave the infrastructure so we can ask questions about the geo
encoding
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And use this to find a dive site within a certain radius of a GPS fix.
This will be used to figure out if dive sites might be the same.
This uses a new Qt5 component (Positioning) which was added in Qt5.2.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When downloading GPS data from the Subsurface webservice we repopulated
the globe before purging all the unused GPS fixes from the list of dive
sites which caused massive clutter (until the next time the user changed
the displayed dive or did anything else that caused the globe to redraw
itself).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After we import all the GPS fixes from the Subsurfae webservice we delete
the ones that didn't match any dives. The algorithm skipped every other
one by mistake.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp
- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.
- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.
- include stdint.h
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This triggers when the email address / password is changed in the
preferences. It opens an https connection with the backend server (the URL
is hardcoded) which should create an account with these credentials.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we added two dives, and then tried to edit
the first added one, the current 'added dive'
set on main_tab would be the second one, so when
we got to the accept() part of the call, it would
reselect the last added_dive that we had.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The name of the dive site on the globe wasn't being
updated when we changed the name of it in the dive
management dialog.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were ignoring the displayed_dive_site
as we were adding it and the changes weren't
accepted yet.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the current_dive was the same as the dive send to
the LocationInformation widget, we would do nothing,
wich is wrong because we could have filled the information
on an add_dive_site action and then cancelled it, so the
info will stay there until we change it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The progress bar shows the progress of both the rendering part and the
templating part, unfortunately we can't check the progress of Grantlee
templating engine so the progess bar doesn't have a constant pace it
stops a little around 20%.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the main function that prints dive lists.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move print_options struct to printoptions.h, its more relevant to be
placed here.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code can be removed as we don't need QT printing code anymore.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove obsolete code and add new customizable print code to the options
dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't need any further calls to printLayout as it will be replaced by
Printer class that handles the new custom printing capability.
Also fix one coding style issue.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Connect the signals and slots so we can use the stuff I programmed.
Sorry for the noise on the patch - most of this is whitespace
fixes done by the QtCreator.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This method was written a long time ago, now we need to use the new
versions of it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We didn't save the uuid of the newly created dive site on the affected
dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Reject changes was correct only for Edit, but not for Add. When in add
mode we need to retrieve the old dive site, and when in edit mode we
should do nothing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Edit will always fire,
Filtering only if the dive site already exists.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And not when we are adding a new dive site.
Also, remove hide button call.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm not sure if this is the right approach, but it seems to work: when we
reset the state of the widget, we try to get the current dive site from
the current dive, and set it.
This way it will work for the globe later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we start the dive site edit dialog, either for add or for edit, we
don't save the state, so the reject state didn't know what to do with the
dive site.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All those calls are unnecessary:
The first will be called when the QComboBox in the MainTab changes
its index, and the other two calls shouldn't be called: the only thing
that should change a dive site inside the LocationManagement is the
LocationManagement.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'll connect this in the future with a few methods that will try to
maintain state between dive changes.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We can only enter in editing state by opening the editing dialog, so the
mainwindow check is now invalid. and also we shouldn't set the editingmode
to false, since we will edit until the user clicks close.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we didn't have a proper dive_site_table, the dive sites where
scattered across all dives and so we looped over all dives to find the
dive sites and add them to the tree. Now this is a bit cleaner, a bit
faster.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The globe used to allow the user to pick a dive site if the dive didn't
have coordinates, but this is now wrong since when in dive site editing
mode we can select multiple times new coordinates for it, and it should
only be marked as finished when the user actually finishes it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When setting a dive, we fire the dive site change a few times after the
index of the QComboBox is changed; we don't need that - fire just once.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clear was the right method to call when we used a line edit, and the line
edit didn't had a model to provide data. Calling clear() on a QComboBox
will delete all itens inside of it, and what we wanted was to choose an
invalid index - and that's -1
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code was commented out when I started to port the locations to new
code, and it's harmless to remove it now.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we are modifying the dive site inside of the dive, we can't ask the
dive for the new one, and we also can't use the name of the dive site, as
there's the possibility that two or more could have the same name, so rely
only on the index of it to get the uuid. The index is variable since we
will sort the dive_site_table alphabetically, but this doesn't matter
since we are using it only temporarely to get the uuid, and this one never
changes.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The KMessageWidget that we used was from an ancient version of KDE4, KF5
is out for quite a while, so it's good that we also update our software
that uses parts of KDE.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So, there's only one crash left (that I put a big TODO: on the maintab.cpp
about) and I'll fix it tomorrow as it's quite late here and I'm almost
sleeping at the keyboard.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I tought about it a bit, and the combobox of the location management was a
bit overkill - we already have another combobox to select the divesite and
also the plus button to add one.
If the user wanna edit the current divesite, he can go to menu and edit it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We are not going to use the add, edit, remove buttons. Removing will be
automatical, addition will be triggered when clicking on the plus on the
dive site. edit is automatically enabled as soon as you try to edit
anything.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Correctly change and update the dive_site, updating the name on the
combobox or other attached views.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also reorganized a bit of the code, and renamed a few misleading methods.
[Dirk Hohndel: remove some C++11 code]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Trigger the ManageDiveSite from the MainMenu.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The credential callback doesn't appear to work (at least not the way I
implemented it) with v0.22 and earlier.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far there is no mechanism to actually create a repository on the
server, so this only works with the two test repositories.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Cloud storage makes more sense that remote storage - at least I assume
that more people are used to thinking about "storing things in the cloud".
Don't use PIN or passphrase, call it a password everywhere.
Don't use copy_string() to copy the password - the git credentials routine
asserts that password is not NULL, so make sure we at least have a pointer
to an empty string here.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should be asked when we are in dive_site_edit mode.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
run std::sort on the dive_site list inside of the model.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only happens if you dont't have any divesites in your list, but either
way, it could happen.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When changing the index of the combobox we were discarting the
dive_site_id. This fixes it.
Now I need to understand what's happening to the globe.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The LocationEdit now correctly connects to the QComboBox signals, not the
QLineEdit signals.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch updates the DiveLocationModel when the
GeoLoockupInformationThread finishes, and also selects
the correct index for the displayed dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I forgot about this one, and we are going to use it
in the mobile version too.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This class will surely be used on the mobile version, and it was very
tangled inside divepicturewidget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another attempt to make it easyer to create the mobile version of
Subsurface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another attempt to make it easyer to create the mobile version.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
One more step to make it easyer to port the app to Mobile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is another effort to make it easyer for the mobile
interface of Subsurface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>