aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2014-07-23Only use HTML if the text has a <table>Gravatar Tomaz Canabrava
The text we generate for the diveplan has a table inside, and we must use HTML only for the dive plan. so I treat all text as HTML, look for a table item, if it doesn't have, I treat it as Simple text and set it on the notes. Works and makes linus loves me again. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Code cleanup: HeartRate item was doing insane thingsGravatar Tomaz Canabrava
This simplifies so much of the code that we were using to control the visibility of the HeartRate. now things are much saner. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Animation speed is a value, not a booleanGravatar Tomaz Canabrava
This breaks compatibility with old preferences, but it's a single key and not that very important so I don't think it's a bigger issue I've renamed prefs.animation to prefs.animation_speed to denote that it's a value, and not a state. Also, fixed the places that were treating it as a state (on/off) to treat it like a correct value. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Don't plot pictures in Print modeGravatar Tomaz Canabrava
The pictures were being plotted in print mode, the main reason for this was that when we entered print mode and had already a picture plotted, the method would return before removing them from the screen. This fixes it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Set visibility in a saner wayGravatar Tomaz Canabrava
for some reason we did a if(true) setValue(true) else serValue(false) now we just use the value to set the value. =p Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Break really long line.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Whitespace fixes.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-19De-duplicate planner default settingsGravatar Anton Lundin
All other default settings we get from subsurfacestartup.c's initialization of the prefs struct. The planner had its defaults there and in the retrieve of the settings from QSettings. This changes so the defaults for planner settings will be read from the defaults prefs struct as all other settings. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18get_gas_at_time needs to always give us a valid gasv4.1.91Gravatar Dirk Hohndel
Before this function was changed it was really supposed to just change a gas that was passed in in case there was an event that changed the mix - but with the new name the caller will assume that they get a valid gasmix. And promptly we had one caller that didn't initialize gas to be based on the first cylinder before calling get_gas_at_time(). Instead of adding yet one more spot that knows about the oddity of the old API I simply changed get_gas_at_time() to do what it name appears to imply and fixed the other callers not to bother to initialize the gasmix. Fixes #647 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Add missing application iconGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Print: remove the options for height from display.h's 'struct options'Gravatar Lubomir I. Ivanov
Not supported. Also the profile in "6 dives per page" doesn't really allow much variations because it looks bad if we scale it down further on A4. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Print: remove the height sliders from the PrintOptions classGravatar Lubomir I. Ivanov
These were hidden and we don't really support them because our print layouting is not that flexible in Qt! Note: printoptions.ui is now converted to UNIX line breaks. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Do not plot text twice for information.Gravatar Tomaz Canabrava
Well, the information was bad, it was being printed twice if the text is HTML, print only once. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Bypass the PDF bug by painting on a QImage and paint the image to pdfGravatar Tomaz Canabrava
well... we have a good and working printing system now. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Close the print dialog after a sucessfull printGravatar Tomaz Canabrava
I think it's intuitive to do not warn if everything was according to the plan, and keep the dialog open after a print was due is something that I find it strange. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Add the HTML Delegate to printing.Gravatar Tomaz Canabrava
This patch just adds the HTML Delegate to print the text. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Fixed memleakGravatar Tomaz Canabrava
The model was not being deleted when the table was, and thus we recreated it for every print. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18No need to delete a QPointerGravatar Tomaz Canabrava
QPointer is a smart pointer, it will delete itself when the refcount == 0. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Save / Restore the QPainter before operations.Gravatar Tomaz Canabrava
I don't know if this fixes anything, but it is asked of us to do that by the Qt docs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Added a HTML Displayable DelegateGravatar Tomaz Canabrava
Added a HTML delegate to show rendered HTML on print. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Convert get_gas_from_events to get_gas_at_timeGravatar Anton Lundin
This converts the get_gas_from_events to a get_gas_at_time function that actually maps our events to what cylinder and thus gas we are breathing at that time. [Dirk Hohndel: fixed to actually use the gas that was looked up (and make things compile)] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Use more of our propper types in the plannerGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Correct usage of current_dive to displayed_diveGravatar Anton Lundin
current_dive is the selected dive, and displayed_dive is the one we are currently drawing. They are quite often the same one, but not in the case of adding a dive for example. This fixes potential null pointer dereferences in the case of a blank divelist, and makes sure we use the correct data in the case of adding and planning dives. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Use "6m" and "20ft" instead of "6m/20ft".Gravatar Henrik Brautaset Aronsen
Get rid of unit type shortcut in planner. Also use "to" instead of "-" in ascent rate intervals. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Replace cylinder_is_used with is_cylinder_usedGravatar Anton Lundin
is_cylinder_used uses get_cylinder_index as underlaying function that does the right thing with with respect on how to find the closest matching cylinder, and handles both types of gaschange events correctly. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Planner: correctly deal with units in Ascent/descent ratesGravatar Dirk Hohndel
This adds two changes a) it uses rint() to make sure we don't truncate the displayed values b) it moves the update of the displayed values into a helper function that is also called whenever the settings change Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Planner: Ascent/descent rates are stored in mm/s not in m/minGravatar Robert C. Helling
So should be defaults. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Hide gachange events in the first 30 secondsGravatar Anton Lundin
Back in 4.0 we hide all gaschange events during the first 30 seconds, not just gaschange events on second 0. Eg, the OSTC3 emits its gaschange event on the first sample, which can be 2, 10 or 30 seconds into the dive. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Use get_cylinder_index instead of get_gasidxGravatar Anton Lundin
Replace get_gasmix_from_event and get_gasidx with get_cylinder_index. get_cylinder_index actually knows about both types of gaschange events and the difference between them. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Add missing struct keyword in DivePlotDataModelGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Use plot_data cylinderindex instead of event dataGravatar Anton Lundin
For the info box, we can't use the event data, because its not 1:1 mapped to whats in the cylinder and what we actually switched to. Use the plot_data here we already calculated what we are switching to. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Store drop_stone_mode, bottomsac, decosac in prefsGravatar Gaetan Bisson
The values for drop_stone_mode, bottomsac, and decosac are typically the kind of personal data specific to a diver that is unlikely to change from one dive plan to the next. This patch stores/restores them to/from the preferences file. For this, it adds bottomsac and decosac to the prefs structure; drop_stone_mode was already there, though not stored/restored. Signed-off-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Translate velocity units in planner settingsGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Pick the correct timezoneoffset for the day in questionGravatar Dirk Hohndel
Calculating the timezoneoffset for the current date really makes no sense whatsoever when displaying a time that isn't "now". Fixes #605 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Desselects the trip before dive add / plan, and reselects it on cancelGravatar Tomaz Canabrava
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>
2014-07-16Force replot of selected_dive when canceling planGravatar Tomaz Canabrava
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>
2014-07-16Use 'this' instead of ::instance() when iside of same class.Gravatar Tomaz Canabrava
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>
2014-07-16Fixed creating recursion on the connectionsGravatar Tomaz Canabrava
Ugh. Each time you wanted to change a cylinder, a new connection was being created on this object, delaying the correctly setup of the item. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Complete the name of the first Cylinder on editGravatar Tomaz Canabrava
When you entered part of the name of a cylinder this was being treated as a new cylinder, and not selecting the first one. Fixes #628 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Added a 'use default file' button on preferences.Gravatar Tomaz Canabrava
Added a 'Use default file' button on preferences in a way that doesn't clutters the interface. Fixes #630 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Fix saving and storing the dive plan notes when there's html on itGravatar Tomaz Canabrava
We save an HTML table-based plan, so we need to get the text as html, not plaintext. Fixes #634 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Date picker l10n for profile and plannerGravatar Sergey Starosek
- set application-wide locale from preferences - use custom date format for display Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Rely on QNetworkReply finished() signal instead of AccessManager oneGravatar Tomaz Canabrava
The access manager is only one, while we can make requests from different parts of the application, so relying on the manager finished() signal to see if something was done or not was a not very good move. The QNetworkReply is created when a get() is invocked on the AccessManager and that's unique. connect it's finished() signal instead. bonus: code cleanup. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16More strings to translate for statistics tabGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16pN2 » pN₂, pO2 » pO₂Gravatar Henrik Brautaset Aronsen
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Disable DC shortcuts on closing data fileGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Fix SearchBar growing vertically on window resizeGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Fix layout for User SurveyGravatar Sergey Starosek
- apply vertical layout to top-level dialog. This solves label clipping - call adjustSize() on dialog to fit all labels (translated text could be longer than original) Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Change in logic while aplying gps fixes to divesGravatar Salvador Cuñat
We were actually searching dives which match the dowloaded position fixes. So we're also trying to take into account if the fix is automatic or no based on a limited amount of predefined strings (bad idea, as the user can change in companion app settings the predefined string). This way, in actual implementation, if program concludes that a fix has been manually got or, simply, the user is unlucky enough to have all the position fixes out of the dive time, find_dive_n_near() function will pair fix and dive in an ordered way (1st fix -> 1st dive; 2nd fix -> 2nd dive ...) which is probably erroneous, except for manual position fixes. BTW actual implementation can't pair the same gps position with more than one dive, which would be the case, e.g. in repetitive dives while at anchor in the same point. The patch changes the logic: - Search positions for defined dives (instead of dives for defined positions) without care if position has manually or automatically been set. - Only take care of those dives that don't have a position yet. - It makes two assumptions: a.- If the position fix has been taken during the dive time, is correct. If there are more than one inside the dive time, takes the first one (closest to the DC's reported time). b.- If not during diving time, the correct one is the nearest fix before the dive begins (also the usual case if manually fixed from the smartphone just before jump into the water). But will work too if there is only one fix *in SAME_GROUP range* after the dive (another usual case). - Finally, as copy_gps_location() in dive.h is used only here, let it take care of naming the dive if user hasn't named it yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15Improve handling of cylinders with identical gasmixGravatar Dirk Hohndel
In reality we have no concept for handling those, yet. But the UI doesn't prevent the user from entering multiple cylinders with the same gasmix, so we need to help the user to get rid of them as well. If the user attempts to remove a cylinder we check if there's a second cylinder with the same gas. If that's the case then we can proceed and remove the cylinder the user wants to get rid of without losing that gas for the dive. The only tricky issue is that we need to make sure that if we remove the first cylinder that one is actually replaced with one with the same gas. Fixes #622 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>