summaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2014-08-04Fix the layout on the Print DialogGravatar Tomaz Canabrava
The layout was a hardcoded position without layouts, that would only work on english language since other languages can have bigger strings than the current ones. Also removed the 'setFixedSize' stuff and let the widget find it's best size for itself. Fixes #656 Fixes #396 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Fix unresizable DiveListGravatar Tomaz Canabrava
The issue with the dive list was actually the Planner Settings widget that was in the same space as the dive list but hidden, but since it had a minimum width we couldn't resize the dive list to be below the planner settings minimum. Fixed by inserting the contents of the Planner Settings into a QScroll Area. Fixes #679 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Disable the Toolbox when in edit mode.Gravatar Tomaz Canabrava
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>
2014-08-04Print: display an error message if no printers are foundGravatar Lubomir I. Ivanov
When pressing Print or Preview from the PrintDialog, we need to first check if there are printers installed. If not we abort and show an error message. This is needed because if no printers are installed, things like the reported page height could be zero and the profile and table print code in PrintLayout will break. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Print: enable the vector table print only for Qt5.0 and newerGravatar Lubomir I. Ivanov
In #671 a user reported that the table print outputs a blank page if there are dives for one page or less to be printed. This doesn't really makes any sense. A possible bug in Qt4's QPicture is suspected, so we only enable the vector print for Qt 5.0 and newer versions. See #671 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Planner: show mean depthGravatar Dirk Hohndel
Almost invisible, mostly looking like an odd bug in the profile code, there was a tiny red line at depth 0 in the planned profile. Turns out that was the missing mean depth. We didn't populate enough data in the dive computer of the dive we generated from the plan (and the length of the depth line was incorrectly determined by the duration of the dive instead of the duration stored in the dive computer). Fixes #570 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03Update altitude properly when changing unit systemsGravatar Robert C. Helling
We need to change the displayed numeric value of the altitutde and not just the unit suffix when changing unit systems. Fixes #681 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03Try to fix divelogs upload on WindowsGravatar Miika Turkia
zip_open needs correct directory separators. QFile::encodeName does not do this conversion, so we must call it explicitly. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02Update pictures when entering/exiting plannerGravatar Robert C. Helling
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>
2014-08-02Enforce end pressures to be not above starting pressures.Gravatar Robert C. Helling
We don't blow into our cylinders under water. Negative pressures should be allowed as they might arise from dive planning without taking care of gas consumption. fixes #644 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02In recent files use native directory separatorsGravatar Robert C. Helling
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>
2014-07-31Keep edited profile after editing a manually added diveGravatar Dirk Hohndel
This is yet another unintended side effect of the UI restructure changes. I stared at this code for so long - I can't believe I kept missing this. Fixes #668 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31Give Subsurface a distinct User Agent stringGravatar Dirk Hohndel
When accessing websites (divelogs.de, subsurface website) we shouldn't pretend to be Mozilla 5. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31When exporting to XML and no extension given, default to .ssrfGravatar Dirk Hohndel
See #646 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Mark divelist changed after removing a pictureGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Add a new 'show' Animation, and use it on the close button.Gravatar Tomaz Canabrava
The error with 'ungrabMouse' warning that we got was because we were removing an item that had the mouse grab instead of waiting a few milisseconds so it won't be the mouse grabber anymore. So I'v used the Animations::hide() to get rid of it, and since it worked well, I'v also added a Animations::show() method to display it in a good fade-in way. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Implement the functionality of remove_picture.Gravatar Tomaz Canabrava
Added the remove_picture functionality, with code shamelessy stolen from remove_event, and hoock it up with the interface. Fixes #650 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Instead of holding the index, hold the URL.Gravatar Tomaz Canabrava
Since the idea is to remove the picture in the future, we need to not hold the row on the model, as when we delete one, the other pictures will change the row. but the QUrl is unique. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Added a button to hide a picture from the dive.Gravatar Tomaz Canabrava
This patch hides a picture from the dive, it should actually remove it, but because I didn't found a quick way to remove a picture from the dive yet, it just hides it. To remove a picture from the dive, the DivePictureItem has to remember the QUrl of the original file, to remove that from the model, and currently it only has the QPixmap. this can be for 4.2.1 or we can postpone 4.2 a tiny bit since this is a important feature. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Planner / Add dive: hide handler after removing itGravatar Dirk Hohndel
Otherwise users can still interact with it. Fixes #648 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30Maintab: fix trip location / notes editingGravatar Dirk Hohndel
Reusing the displayed_dive for this caused all kind of odd problems that were hard to reproduce, because the behavior depended on what was in the corresponding fields of the current_dive. Worse: the GPS location handling prevented us from reliably removing the location of a trip. The solution isn't ideal and certainly isn't elegant. Maybe we simply shouldn't reuse the widget here. But I think what I have now works - I tried hard to make it break again and couldn't. Fixes #659 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Do not show the heartrate info unconditionally.Gravatar Tomaz Canabrava
use the preferences instead. Fixes #664 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Make the Axis set the changed flag when a new line is setGravatar Tomaz Canabrava
This was preventing the recalculation of the ticks, making the line static when we enabled or disabled the PP graphs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Change the Ruler text values when metric system changes.Gravatar Tomaz Canabrava
"ups", as I did this in Metric system I forgot to update to imperial when the user selected it. Fixes #665 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Retain the start time when creating plan from diveGravatar Dirk Hohndel
We need to make sure that the start time is set before we start adding points. Fixes #661 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Fix time zone conversionsGravatar Dirk Hohndel
I know I tested this - no idea how I missed this. Anyway, this was of course utterly bogus. Whenever we get a time from a time_t into a Qt Date or Time datastructure, we need to adjust it by the timezone offset as otherwise Qt will assume it's in local time and helpfully change it to the wrong values for us. See #655 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Remove unused variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Another string to translateGravatar Sergey Starosek
[Dirk Hohndel: took only one of the two parts and adjusted commit message accordingly] Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29C++ Correctness and code cleanup.Gravatar Tomaz Canabrava
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>
2014-07-29Don't mess with the selection when closing a fileGravatar Dirk Hohndel
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>
2014-07-26Add dive: initialize start time of diveGravatar Dirk Hohndel
commit f29f41ae9ea8 ("Planner: fix start time handling") broke the start time handling for Add dive. While in actual planner mode we set the start time for the plan, we did not do this when simply adding a dive. The moment the time / date was changed (which admittedly in real life a user would most likely do) all was well, but if the user just accepted the "now + 1h" default, things went badly wrong. Fixes #658 See #655 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25PrintLayout: fix a potential bug in the recent table print updateGravatar Lubomir I. Ivanov
There is a weird QPicture dependency; we need to offset a page by headingRowHeightD2, which is half the heading height. The same doesn't make sense if we are rendering the table widget directly to the printer-painter. Moving the offset inside 'pageIndexes' is less desirable. The bug itself manifests when a top margin is set on Win32, while on Linux it's more obvious. On new page start, a fixed height from the last dive on the previous page becomes visible even if the math seems correct. Offsetting both the page index and the vertical position at which the QPicture is placed fixes that. If 'table.render(&painter...)' is used the bug also goes away and our 'pageIndexes' start to make sense again, but we want to use QPicture so that the table is in vector. I don't have a good explanation why this happens! Tested on Ubuntu 12.04 and Win7. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25PrintDialog: make "print only selected" the default optionGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: vectorize the table printGravatar Lubomir I. Ivanov
Use QPicture to do that. QPainter::drawPicture() requires offsetting the target QPoint's Y value by two times the headingRow height. This can be improved the hardcodding the offset when the 'pageIndexes' are calculated, but is a bit complicated. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: reduce the scope of 'pic' and 'picPainter'Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: modify the profile font size based on the #dives per pageGravatar Lubomir I. Ivanov
For the profile print, the number of dives per page is: divesPerRow * divesPerColumn If we have more 3, 0.6 seems optimal, while for less we can pretty much use the default scale of 1.0. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: draw the profile to a QImage only on LinuxGravatar Lubomir I. Ivanov
The QImage fix for the recently reported "huge-vector-lines-in-PDF-printouts" bug is only needed on Linux. For Win32 and OSx we can render to vector. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: fix the ProfilePrintModel fontGravatar Lubomir I. Ivanov
Fixing the font size is required, because we don't really support a dynamic row height, as the row height is set in the class constructor. 7 seems optimal for all print modes. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: disable the QPainter scalingGravatar Lubomir I. Ivanov
This is wrong because we don't really need to scale. We already have the estimated page dimentions in pixels, so taking the quotient of the printer DPI and screen DPI and then scaling (probably up) our rendered widgets via the QPainter introduces blur (due to the oversampling), and a performance penalty. By rendering at the exact dimensions we ensure that the widgets are crisp at a 100% printout. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: a whitespace fixGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Printing: add 1 dive per page optionGravatar Lubomir I. Ivanov
With this option there is an exception, which makes the notes section of the profile table occupy half the page. This way dive plans can reasonably be printed. Fixes #636 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Planner: fix start time handlingGravatar Dirk Hohndel
We setup the startTime for the dive plan in too many places... but never actually copied it into the planned dive. Fixes #640 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Sort dive table after adding a diveGravatar Dirk Hohndel
The dive might not be the newest dive in the dive list. Fixes #637 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Translate progressbar textGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Align progressbar text to center of the widgetGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Update strings for translationsGravatar Dirk Hohndel
Including a tiny change for one of the new strings to be consistent with the capitalization rules we recently established. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Planner: fix an enduring assert on startupGravatar Lubomir I. Ivanov
qt 5.3, win7 64bit. beginRemoveRows() asserts in removeSelectedPoints() because rowCount() - 1, becomes less than firstRow. This needs a check in removeSelectedPoints() if the number of passed rows is zero. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Only repopulate the dive info once ( we were repopulating 4 times )Gravatar Tomaz Canabrava
This makes the screen repopulate itself after a dive change only one time instead of the old 4. we were repopulateing when we removed the actual selection to reset the old selection previously stored, sigh. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>