aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
AgeCommit message (Collapse)Author
2014-06-01Add a method to update the dive pictures on the model.Gravatar Tomaz Canabrava
Call that method from the mainWindow when the dive changes. The updateDivePictures walks around the events of the first dc (since all pictures are distributed allong all dive computers) to get the events of type '123' (I wonder if there's not a better way to save pictures on the dive, like an linked list of char* named pictures.) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: show the plan notes in the new widgetGravatar Dirk Hohndel
That was easy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: add dive plan output area that replaces dive listGravatar Dirk Hohndel
When switching to / from plan mode, we switch to show either the dive plan detail widget, or the dive list widget. So far this widget does nothing. This just makes sure it's there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Move code from the Planner that doesn't belongs there.Gravatar Tomaz Canabrava
Moved the connections between DivePlannerPointsModel and MainWindow from inside the Planner class to the MainWindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: set up a cylinder, even if no current dive is selectedGravatar Dirk Hohndel
If there was no current dive we didn't set up any cylinder at all which was a bit awkward as we use AIR but have no cylinder corresponding to it, which breaks assumptions elsewhere. Instead we use either the default cylinder or make one up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: really fix crash after aborting plannerGravatar Dirk Hohndel
Duh. We had to reload the list (and make sure the internal data structures are recreated as well) before restoring the selection. I also switched to simply accessing the widget directly, instead of via the dive_list() call. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: prevent crash when canceling plan with existing dive listGravatar Dirk Hohndel
There is still something seriously wrong here. For now let's just not restore the selection and at least this prevents us from crashing. But I still don't understand why it crashes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Fixes showing the Empty Profile when Add / Plan dive is cancelled.Gravatar Tomaz Canabrava
for some reason the next selected dive is NULL after cancelling the plan. I'm investigating. This patch fixes the show of the empty profile and it also untangles some parts of the code, keeping the mainwindow where it should belong : the mainwindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Try to clear out the profile when dive list is emptyGravatar Dirk Hohndel
This only partially works. If I start from an empty dive list, plan a dive, then abort, there are still leftovers in the profile widget. Hitting Ctrl-W clears that out. But it just runs the same cleanUpEmpty() again... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive planner: remember the selection before new dives get handledGravatar Dirk Hohndel
On an empty dive list we would remember the new dive (which gets auto-selected since it's the only dive) and then crash when we try to restore that selection after cancel (in which case that new dive is gone). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive add: remove duplicate codeGravatar Dirk Hohndel
This is already done when we create the fake dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: correctly refresh the displayGravatar Dirk Hohndel
We were making things way too hard (and were doing things that don't need doing, like clearing the DivePlanPointModel). Currently we still crash after manually adding a dive or when canceling a plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27SetFocus only works if the widget is enabledGravatar Dirk Hohndel
One could argue that this makes sense... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: use the gas in the first cylinder for initial planGravatar Dirk Hohndel
As Tomaz suggested, I don't need to pass the information whether we are on the planner into the function - it's part of the DivePlannerPointsModel and therefore already knows. Also, we want to make sure we actually use the gas that's in the first cylidner of the staging dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: better handle the temporary dive used for planningGravatar Dirk Hohndel
This still crashes when you abort the plan. And when you accept the plan, the profile stays stuck in PLAN mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: disable the dive list when working on a planGravatar Dirk Hohndel
And reenable it when refreshing the screen. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: clean up the logic for starting up the plannerGravatar Dirk Hohndel
The existing code had no chance of every working - on so many levels. First unselect all dives, then extract data from a selected dive? Set up the cylinder data (which didn't work), and then clear the data again? What the heck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Activate the PlannerGravatar Tomaz Canabrava
On the cleanup dirk forgot to set the plan tipe to PLAN instead of ADD Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Don't include the ascent in the default diveGravatar Dirk Hohndel
Allow to both create the full default dive or ownly the descent and bottom part (so the planner can deal with the ascent). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Make the planner show something.Gravatar Tomaz Canabrava
This is working in the wrong way, mostly because I'm setting the plannermodel to ADD state ( and the planner graphic to the correct PLAN state ), but I don't know why - when on PLAN state on the model, things just don't work. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Created a function to create a fake dive for Add and Plan states.Gravatar Tomaz Canabrava
This function should likely to move to C in the future, I'm only adding this here because I'm changing this file so much ( already 4 rewrites of the function ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Remove uneeded call.Gravatar Tomaz Canabrava
The disableDcShortcuts is called inside of the ProfileGraphics ( I actually think that this method should be moved to there ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Small code cleanup.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Move method down below to easy comparisson with another.Gravatar Tomaz Canabrava
Planner and add states are driving me nuts. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Re-enable using the new profile.Gravatar Tomaz Canabrava
This correctly enables the planner on the new profile, but it doesn't triggers the correct paint on the canvas. [Dirk Hohndel: remove other remnants of the disabled planner as well] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Remove leftovers from the planner.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Remove a ton of code.Gravatar Tomaz Canabrava
The code removed was already ported to the New Profile. We managed to clean quite a bit. huhhy Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Profile now correctly displays the planned dive.Gravatar Tomaz Canabrava
But it doesn't move the handlers yet, and when you confirm it you also must click on the dive to select it or the profile will show garbage. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Back to profile or empty state when finishing addition.Gravatar Tomaz Canabrava
This patch adds a signal to MainTab, that should be removed from there when we finish the rework on the edit part, to go to the edit classes, but in the meantime, let's keep it there. The signal is connected to the ProfileWidget in a way that the end of the edit will also trigger the profile to go back to ProfileState (show the dive, if there's any) or empty Profile (if there's none). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Enable editing the 'Add dive' from the new profile.Gravatar Tomaz Canabrava
This is highly broken in many ways - but it's the right first step. I ported two of the most important methods from the old profile and now if you are in add dive mode, double clicking on the new profile will correctly add a handler on the planned dive. To see and move the handler around, however, you need to activate the old planner. Next step: add the handlers on the new profile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Shortcuts for the exporting window.Gravatar Gehad elrobey
Add the ability to close the exporting window, also Quit Subsurface with this window in front, for consistency. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Implementing export dialogGravatar Miika Turkia
As our menus are getting many export entries, it is better to create a single export dialog where user is able to select the export type and whether to export selected dives or all of them. This should also be more intuitive than the current way when export from file menu export all dives and right click menu on divelist exports only selected dives. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Dive list: add context menu function to renumber dive(s)Gravatar Dirk Hohndel
No attempt is made to ensure that what the user does is sane. So this can result in duplicate numbers, non-consecutive numbers, non-monotonous numbers, whatever floats the users boat. You can renumber a single dive or all selected dives (with a starting number given that is applied to the oldest selected dive and then for each newer selected dive that number is incremented by one). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Fix selection after downloading dives from the dive computerGravatar Dirk Hohndel
If we successfully download dives, the old selection should be cleared and the one of the newly downloaded dives should be selected. I decided to pick the last dive downloaded, which for most dive computers (but for example not for the Uemis SDA) will be the first or earliest of the dives. That seems much more intuitive than keeping the previous selection around. Of course this is harder than it should be because of the way we track selections and because we need a consistent dive list model in order to change the selection. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-14Do not use default filename as default for "Save as"Gravatar Dirk Hohndel
This may sound counterintuitive but it actually makes sense. If you have a default filename that's the name of you "normal working file". If you want "Save as" something, that by definition is NOT your normal working file but a subset or an experiment or something. And you most definitely do NOT want to overwrite your default file with that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-13Do not check for null before free.Gravatar Tomaz Canabrava
C specs says that we can safelly free a NULL pointer, so there's no reason to check if it's null before freeing it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08When starting the planner, copy cylinders from currently selected dive.Gravatar Robert C. Helling
This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Offer to discard the plan when Quit is triggered in planner.Gravatar Robert C. Helling
Upon pressing Ctrl-Q or the window close button a modal dialog was shown to remind the user that the planned dive is not saved. This patch triggers the "cancel plan" action before trying to quit. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Globe: we always center on the current diveGravatar Dirk Hohndel
Simplify the API (we'll take advantage of this in the next commit). We always center the globe on the current dive, so no point in passing that dive in. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-05Make rulergraph a pref as wellGravatar Dirk Hohndel
I don't see a point in treating it differently from the other graphs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-26Add GUI support for exporting in CSV formatGravatar Miika Turkia
This patch adds an item to File menu to export all dives in CSV format. Naturally this includes also the code to perform the export. Fixes #434 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-26Use proper export text instead of saveGravatar Miika Turkia
When exporting UDDF logs the file name selection dialog should talk about export, not save. This patch changes that text Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Ctrl-W and -Q support for GPS, divelogs.de, divecomputer and CVS importGravatar Dirk Hohndel
Getting closer to consistent behavior. See #489 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Quit Subsurface with yearly stats window in frontGravatar Miika Turkia
Add ability to quit Subsurface with a Ctrl-Q shortcut even if the yearly statistics window is active. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Close yearly statistics with shortcutv4.0.96Gravatar Miika Turkia
This enables closing the yearly statistics window with esc or ctrl+w keys. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Quit Subsurface with user manual window in frontGravatar Dirk Hohndel
Add ability to quit Subsurface with a Ctrl-Q shortcut even if the user manual window is active. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17Mark a lot of TODO's where I think it should be moved to C code.Gravatar Tomaz Canabrava
This marks a lot of todo's where I think there's core stuff being mangled on the interface - we should remove this from the interface to make testing and maintenability easier. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16Renaming the prefs struct members to be consistent with the QSettings.Gravatar Gehad Elrobey
-Renaming prefs members for consistency. -Changing references of QSettings to the prefs structure instead. -Removing unused functions in pref.h were left over from an old version. -Changing the data-type of bool members to short for consistency with other members. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11Remove some unneeded explicit paths in includesGravatar Gehad
The include path is set up correctly so we don't need these explicit paths in includes. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>