Turns out that the mainwindow reads the settings and sets up things -
except that this has already happened in the constructor of the static
PreferencesDialog. So only keep those parts that aren't handled there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Connects the YearlyStatistics model with the YearlyStatisticsWidget
nothing is shown right now, mostly because I need to do everything
but now it's easyer to add the things that are missing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the old statistics panel at the botton of the new one to have
a reference view of the statistics while programming the new one.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We used to have a very sad way of controlling the statistics,
now we will create the model when there's a need for it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Using QToolBar I was able to remove much of the dead code
from the mainwindow.ui xml file by transforming the QToolButtons
into actions and loading them dynamically in the .cpp code.
I couldn't use the designer for this ( as I wanted ) because
Qt has no notion of ToolBars outside of the areas where the
MainWindow should have one, and we use it in a very different
area.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Turns out that the fix in commit f7119bdccf ("Planner: make sure no old
handles are around when entering Add/Plan") was incorrect. We ONLY want to
remove the existing handlers when we re-plan a dive, NOT when we call add
or plan.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is subtle. The modifications to the selection cause a redraw of the
profile. So we need to make sure that we leave the plan state and return
to profile state BEFORE we do this, otherwise we'll call into
createTemporaryPlan() with invalid data.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While planning we might have made changes to the displayed_dive. So we
need to make sure that the profile is redrawn after we cancel a plan (or a
re-plan).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When doing this, all waypoints of the calculated ascent are now waypoints
in the plan - so the user has to remove the ascent part of the dive in
order to really replan the dive. That's a pain, but we don't keep the data
around that would tell us which waypoints are user input and which ones
were calculated.
Fixes#527
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>