Use the same logic as we do for newly added dives.
As a side effect this patch appears to fix the issues with getting the
newly planned dive selected.
Fixes#692
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should correctly set all the values and puts us in edit mode.
Testing so far looks good for both single dive and multiple dives selected
(i.e., you can paste into multiple dives).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a dialog for reading and writing settings to and
from dive computers, with a menu entry in MainWindow to
open the dialog.
I will build up on this dialog and change it as needed.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the problem I pointed out im my comment to #667 and hopefully also
the original problem although I cannot confirm since i cannot reproduce the
problem in the first place.
See #677
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt internally always uses / as directory separator. #651 shows that in the recent
files menu, under windows we can have double entries with both versions of the
separator. This patch should normalize the menu entires to use the native separator
(i.e. \ on Windows). (Untested due to lack of Windows computer).
See #651
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use const-reference where we can gain a bit of speed from that
and clear an else { if {}} by using else if.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Our core structures are kept consistent by calling delete_single_dive()
and there is no reason at all to even touch the UI selection as this all
goes away with cleanUpEmpty()
Fixes#660
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we had a trip selected, we ignored that and simply called
the DiveAdd functions, but the mainTab code that deal with selections
to show one or more dives or trips asked how many trips were selected
to the DiveList, and since a trip was selected things go kabum.
Fixes#606
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The profile was still the planner one, so we need to force
a replot.
Fixes#621
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do not use MainWindow::instance() inside of a non-static
mainWindow method, that's just bogus.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the code that saves and restores the dive planner
settings.
Fixes#608
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The filter menu wasn't connected to anything other than a debug print.
This removes that menu.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code hoocks the pictures with the preferences change.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The export dialog was being created but never free'd.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new macro hides all 5 lines of code from the old code to just one,
since we already have 15 buttons and more are comming, and *every*
code is just the same, it's a logical change that will make us reduce
now 75 lines of code to just 15, in the future this can be bigger.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was way too complicated because we used to edit a "live" dive that
was on the dive list. All we really need to do is systematically make
sure that all the widgets are in the correct state.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Recreate the helper function (which now does something fairly different)
to share the common code between the two modes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I had tested this mostly with add dive and completely forgot to track the
same changes in the planning routine. Oops.
This allowed to get rid of a no longer useful helper as well.
Fixes#594
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This gets rid of the stagingDive and stops the constant adding and
removing of dives from the divelist (that was an INSANE design,
seriously).
When adding or planning a dive all work is now done in the dedicated
displayed_dive.
Add dive mostly works - when the user clicks save the dive is added to the
dive list and selected.
Plan dive is mostly untested. It passed trivial "start planner, save"
testing so it's not entirely broken, but I'm sure there's more work to be
done there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of passing in a divenr of -1 to make it clear things this changes
things to use an options "clear" flag.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No longer use the dive structure that is passed in but instead always use
the displayed_dive to display things.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't have a concept of what to do when plotting multiple dives, so
let's not pretend and remove all the messing around with lists.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A little bit of CI: Print our logo on the print out dive plan.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is almost a rewrite of the Search function on the WebView
the old code had a few uneeded things, mostly being a subclass
of QMainWindow instead of the QWebView - this makes the code
use a tiny bit less ram.
The SearchBox was also moved to an own class ( we can use it
later to filter the contents of the DiveList for instance )
and a forced use of the pixmaps for the Mac and Windows platform
was added.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since not all platforms support theme icons, we need to pack
them into resources and fallback to that resource theme.
There seems to be a bug in Qt
(https://bugreports.qt-project.org/browse/QTBUG-16697), thus
default theme name (hicolor) does not work. So we test for
'window-close' theme icon on startup and if not found, set theme
name to 'subsurface'
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This one-liner re-adds the possibility to edit manually added dives.
Tested because I didn't belived that it was going to be so easy, but it
seems that it was.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The planner used the selected dive on the dive list, and
when there's a filtering in action it can be in a state where
there's no dive selected.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- application level proxy is reconfigured on settings saving
- tested with direct connection (no proxy), local proxy without auth
(tinyproxy) and SOCKS (ssh -D dynamic port forwarding)
- not sure about QNetworkProxy reuse between invocations
- consider using QNetworkProxyFactory (but since no plain TCP
connections are used, QNetworkProxy seems to be good choice)
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is my first attempt at grouping UI elements of the planner in a
sensible way.
It might still be sensible to combine the two bottom panes into one.
In addition there is a new field "altutude" which is sychronized with the
surface pressure as for planning we often know the altitude of the dive
site rather than the atmospheric pressure.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Back in 6699e3ab ("Add print button to planner") unconditional printing
code was added. This puts that same code behind NO_PRINTING macro.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Back in 708f19830e ("Planner: New plannerSettingsWidget") the Globe
widget handling changed, and this updates the NO_MARBLE build option to
work after that.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>