aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
AgeCommit message (Collapse)Author
2014-07-01Show subsurface logo in dive plan print outGravatar Robert C. Helling
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>
2014-06-30Fixed SearchBar layout and iconsGravatar Tomaz Canabrava
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>
2014-06-30User survey: don't ask more than once per invocationGravatar Dirk Hohndel
Otherwise when the user selects "Ask Again" they will get asked when they change preferences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30Make the planner settings respond well to unit system changes.Gravatar Robert C. Helling
[Dirk Hohndel: removed printf/qDebug() debug output] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-28Merge branch 'fixPlannerStartTime'Gravatar Dirk Hohndel
2014-06-28Planner: implement sane way to set the start time of the planned diveGravatar Dirk Hohndel
This uses the same widgets we use on the maintab. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-28Fallback to loading theme icons from resourcesGravatar Sergey Starosek
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>
2014-06-26Re-enable possibility to edit manually added dive.Gravatar Tomaz Canabrava
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>
2014-06-26Break really long lineGravatar Tomaz Canabrava
Hard to read on the editor. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26Fix crash when trying to add a dive or plan when a filter is active.Gravatar Tomaz Canabrava
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>
2014-06-26Implement proxy re-configurationGravatar Sergey Starosek
- 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>
2014-06-26Rearrange planner UI elementsGravatar Robert Helling
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>
2014-06-24Fix NO_PRINTING building againGravatar Anton Lundin
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>
2014-06-18Fix building with NO_MARBLE againGravatar Anton Lundin
Back in 708f19830e2a ("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>
2014-06-14User survey: force running the survey from command lineGravatar Dirk Hohndel
This way people can test the dialog much easier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-13Start a user survey dialogGravatar Dirk Hohndel
The idea is that a week after the user starts using Subsurface we ask them if they would like to submit a survey response. If you are running a development build, don't wait seven days. This patch doesn't do anything with the user's selections, doesn't submit anything to our server, etc. It's just a placeholder to tune what we should ask, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12Delay loading of some settings until laterGravatar Dirk Hohndel
This early in init_ui() the settings may not be available, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12Planner: New plannerSettingsWidgetGravatar Robert C. Helling
In planner mode, this replaces the globe with the dive plan and introduces a new plannerSettingsWidget in the diveListPane. All new fields are still disfunctional. This is WIP. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-09mainwindow.cpp: fix a warning about parenthesesGravatar Lubomir I. Ivanov
"warning: suggest parentheses around assignment used as truth value [-Wparentheses]" I think 4.8.2 is confused about this one, but we suppress it regardless by separating into two assignments. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08Simplify the code that checks if it's OK to close the current fileGravatar Dirk Hohndel
And make sure it gets called whenever it needs to get called - it was missing from the openRecentFile case. Fixes #530 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04Disclaimer included in the printed diveplanGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04Force TTS/NDL calculation off if things take too longGravatar Dirk Hohndel
This is kind of a random cut off, but if plotting the dive takes more than a second and TTS/NDL is on, we force it off. Because the algorithm for that is fundamentally quadratic in nature it can take a VERY long time - getting users to think something is broken. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Closing the window should behave like triggering QuitGravatar Dirk Hohndel
It seems odd to have different behavior depending on whether the window manager tells us that the user wants to close the window or whether the user hits quit or ctrl-q. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Dive edit: when asked ti quit while editing, offer to discard current editGravatar Dirk Hohndel
This is equivalent behavior to what we do when planning a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Make most of the shortcuts widget specificGravatar Dirk Hohndel
Having the window specific means that you can't have a key do different things on different widgets. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Add print button to plannerGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Layout improvements to the dive planGravatar Robert C. Helling
Changed to html. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Make the new picture widget display the pictures.Gravatar Tomaz Canabrava
Small changes in the model to display the pictures of the dives. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>