summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
AgeCommit message (Collapse)Author
2014-07-15Save and restore Dive Planner SettingsGravatar Tomaz Canabrava
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>
2014-07-14Remove unused menu "Filter"Gravatar Anton Lundin
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>
2014-07-11It's safe to delete NULL pointersGravatar Tomaz Canabrava
Small code cleanup, it's safe to delete null pointers. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11Read the preferences upon initialization for the show/hide picturesGravatar Tomaz Canabrava
Forgot to add this one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11misc capitalisation and spellingGravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10Show/Hide pictures working.Gravatar Tomaz Canabrava
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>
2014-07-10Fix memory leak on the Export DialogGravatar Tomaz Canabrava
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>
2014-07-10Macro to simplify the creation of toggle buttons on the ProfileGravatar Tomaz Canabrava
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>
2014-07-10Correctly sets the 'enabled' flag on the picture buttonGravatar Tomaz Canabrava
Forgot to add this one, oops. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10Added the toggle picture button and hoocked it upGravatar Tomaz Canabrava
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>
2014-07-10mainwindow capitalisation consistencyGravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-06UI restructure: cleanup the code when canceling an editGravatar Dirk Hohndel
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>
2014-07-04UI restructure: simplify setup of add and plan modeGravatar Dirk Hohndel
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>
2014-07-04UI restructure: correctly setup planningGravatar Dirk Hohndel
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>
2014-07-04UI restructureGravatar Dirk Hohndel
Don't clear out the model after we already set up the cylinders. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03UI restructure: when adding a dive via displayed_dive it needs valid idGravatar Dirk Hohndel
Otherwise we have one (or - yikes - more) dives with id 0. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03UI restructure: use displayed_dive for add dive and plan diveGravatar Dirk Hohndel
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>
2014-07-03UI restructure: updateDiveInfo displays displayed_diveGravatar Dirk Hohndel
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>
2014-07-03UI restructure: updateDiveInfo shows the selected dive by defaultGravatar Dirk Hohndel
So don't be redundant. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03UI restructure: plotDive: plot current dive by default & use displayed_diveGravatar Dirk Hohndel
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>
2014-07-02UI restructure: plotDive should just take one diveGravatar Dirk Hohndel
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>
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>