aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
AgeCommit message (Collapse)Author
2015-10-11profilewidget2: fix line width when printing on OSX and LinuxGravatar Lubomir I. Ivanov
On OSX and Linux only, the cosmetic width of the QPen on profile axes does not work and is weirdly dependent on the fact if a printer is installed or not. Possible Qt bugs at hand. The same is not present on Win32. To solve the issues we add setPrintMode() in DiveCartesianAxis and call it for all instances of the class in ProfileWidget2. This patch also moves gridPen() as a private member function of PartialGasPressureAxis as it now needs to access member variables. Fixes #943 Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-11profilewidget2: add resetZoom()Gravatar Lubomir I. Ivanov
resetZoom() is now a new method that is called both when 'printMode' is updated or when the dive is re-plotted. Fixes a bug where zooming in on the profile and then printing the dive has the profile at the wrong zoom level (makes the profile look smaller). Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07Preserve profile toggle-button state zoomed_plot across sessions.Gravatar pestophagous
Fixes #912 Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22Add refreshProfile member function to MainWindow classGravatar Dirk Hohndel
While the whole idea of calling these functions through the MainWindow instance is atrocious, until we change the architecture of all this refreshProfile() is a useful function to have. In order to make this cleaner to implement I allowed an argument to ProfileWidget's replot() which allows picking a specific dive. By defaulting this to 0 we get the previous behavior when calling replot() without an argument. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21Display error messages in plannerGravatar Robert C. Helling
After a replot, check if there is an error message to display. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Printing: hide warnings in dive profile while printingGravatar Gehad elrobey
While printing only draw headings, SP changes, gas events or bookmark events, otherwise don't show anything. Many warning logos can hide the useful information especially in templates with small dive profile area. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-09Update the text if DC changesGravatar Miika Turkia
When switching from one DC to the next, the text of DC name is not updated due to commit 487ddce3531f6b738affc84edf066bd0ea4a16bb. This patch re-inserts the call to updateText() for the specific function to get the DC name updated properly. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-29Don't connect to the MainWindowGravatar Dirk Hohndel
We really shouldn't need to connect to the MainWindow in order to get the right scale for the fonts when printing. While printing likely will remain a desktop only function, this is just bad design. And making calls like this from the paint() function is a bad plan, anyway. So instead we make sure that every DiveTextItem knows what the printScale was when it was created (or actually, when the text was first set as they frequently get created before we have a scene which we use to get to the profile), and gets updated whenever that scale changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-29Profile: make sure text is scaled correctly when drawnGravatar Dirk Hohndel
We had all this wonderful code to scale the text correctly, except we went out of our way to make sure the code wouldn't be called unless something changed on this specific text item. But that's bogus because the scaling depends on external factors like the fontPrintScale. So instead of calling updateText() when attributes of this DiveTextItem change simply call it right before the DiveTextItem gets painted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-29Make gradient factor text an independent item on the profileGravatar Dirk Hohndel
Having it as part of the DiveCalculatedCeiling class caused us to manage this text 17 times (and plotting it 17 times) which is rather silly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Address of array is always non-NULLGravatar Dirk Hohndel
We want to test the string instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Address uninitialized member warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Prevent unintended integer divisionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Comparing the address of a member to 0 is pointlessGravatar Dirk Hohndel
Or... this code doesn't do what you think it does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Initialize variable to avoid false positive in coverityGravatar Dirk Hohndel
We now that plotInfo.nr will always be positive. Still, this is cheap and shuts up the "defect". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePlotDataModel to qt-modelsGravatar Tomaz Canabrava
I think with this one I'm finished. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePictureModel to qt-modelsGravatar Tomaz Canabrava
This class will surely be used on the mobile version, and it was very tangled inside divepicturewidget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePlannerModel and CylinderModel to qt-modelsGravatar Tomaz Canabrava
Still trying to make it easier for the Mobile Port: This patch is a bit bigger than I hopped, but it was the smallest that I could get. A lot of TODO items where added where I broke the code because the current implementation would break the QML implementtion on the designer. I'll most probably fix those myself when I finish the transition to the models to the new folder. I only moved both models at once because there's an interdependency between them (seems inevitable, tough, but I'll take a better look at it later). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-08Only print gasname for a segment in planner if it differs from the previous oneGravatar Robert C. Helling
This is to avoid visual clutter when replanning logged dives. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-23Profile context menu: trigger editing of manually added diveGravatar Dirk Hohndel
Right now the way to edit the profile of a manually added dive is really counterintuitive: you have to first make some random change to the dive information, then the profile switches in to editing mode. This commit adds a simple context menu entry on the profile that is only shown when the a manually added dive is displayed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02Introduce recreational planner modeGravatar Robert C. Helling
This adopts the planner to the needs of the recreational diver. Rather than immediately starting to ascent doing deco stops this mode, this mode stays at the last manually entered depth for the maximal time before mandantory stops appear (NDL). It does not change gas but keeps using the last used cylinder. TODO: * Grey out unused UI elements of the planner in this mode * Start ascent before gas runs out (or into reserve) * Do a 3min @ 5m safety stop. Fixes #840 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-19RulerItem2::settingsChanged() - NULL pointer dereferenceGravatar Marcos CARDINOT
The current code is dereferencing the null pointer 'profWidget'. It can cause a segmentation fault. Signed-off-by: Marcos Cardinot <mcardinot@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14Profile: fix a couple of warningsGravatar Lubomir I. Ivanov
profilewidget2.cpp:1398:25: warning: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Wparentheses] profilewidget2.cpp:1403:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14Profile: call clearHandlers() in setAddState()Gravatar Lubomir I. Ivanov
Points (handles) from the last dive ADD operation remain on the profile unless we clear them. fixes #846 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14Profile: fix potential mem leak in pointsInserted()Gravatar Lubomir I. Ivanov
The point graphics are allocated but doens't seem to be deleted anywhere. We attempt to fix that in clearHandlers(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Better testing if the first gas is explicitGravatar Dirk Hohndel
Given that we might be adding a gas change event at t = 0 we need to check for both that and t = time_or_first_sample. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Don't allow two gas changes at the same timeGravatar Dirk Hohndel
t = 0 isn't really special here. We shouldn't allow two gas changes at the same time, period. We also can do away with the special handling to mark the dive list changed and replot things if a gas change gets removed. That's done at the end of this function either way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Make sure no gas changes with negative time can be addedGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Simplify the code that replaces a gas change event at t=0Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Removing gas change events @0:00 when new one is addedGravatar Yousef Hamza
Remove the existing gas change events @0:00 when new one is added @0:00. Signed-off-by: Yousef Hamza <jo.adam.93@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-11Planner: disable mouse interaction when zoomed inGravatar Lubomir I. Ivanov
When zoomed in, things like moving planner points is not possible, but if the user attempts that, replan() -> plotDive() is called and the zoomLevel should be reset to the default value (we don't really want that), but instead it's lost for some reason (as the user reports: "Somes times, it changes to 100% which is ok"). If moving points becomes possible eventually while zoomed in, we need to figure a way to replot without resetting the zoom level in plotDive(). Fixes #851 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27Change the references to ShowError to the new notification object.Gravatar Gehad elrobey
Showing an Error message is better called from the Notification Object, So for consistency old references to showError is replaced by calling the notification object. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Fix broken connectionGravatar Tomaz Canabrava
The old way of creating the mainwindow made things a bit dependent of the order of initialization, and we don't assume that anymore. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Finish the cleanup of mainwindow.uiGravatar Tomaz Canabrava
This is the last patch in the series of clearing up the mainwindo.ui. Now to bugfixing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove the ProfileWidget from mainwindow.uiGravatar Tomaz Canabrava
It is now in mainwindo.cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove information panel from mainwindow.uiGravatar Tomaz Canabrava
Now it's created in the mainwindow.cpp as part of the new way to configure the interface. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove the DiveList from the mainwindow.uiGravatar Tomaz Canabrava
It's now set up from the mainwindow.cpp file. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07Change the tooltip for bailoutGravatar Dirk Hohndel
While this text makes sense if this is a CCR dive and the diver does bail out, the more neutral text "Manual switch to OC" works in all use cases for this event, e.g. at the beginning of a dive when we manually set this dive to be OC. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-07Don't show a setpoint switch event at t=0Gravatar Dirk Hohndel
When using that to indicate the dive type at the start of the dive, it's visually strange to have an event marker. See #826 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-05CCR gas composition and gas pressure labels on dive profile: revisitedGravatar willem ferguson
This patch cleans up code for achieving the above with respect to CCR dives. The code is simplified and shortened. The display of gas lables on the profile is made consistent with the cylinder pressure closest to the graph and the gas composition above/below the cylinder pressure. The patch significantly improves the maintainability of this code. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-03Disable dive component copy/paste shortcuts when no profile showGravatar Dirk Hohndel
Instead of inventing another way to do this (and inevitably forgetting a path where this should be re-enabled) I renamed the DcShortcup related function and made them enable/disable the copy and paste shortcuts as well. Of course there now is one exception (isn't there always?): in "ADD" state we don't want to be able to switch DCs, but we do want to be able to paste. Fixes #825 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-02Don't show the plot_info table in every debug buildGravatar Dirk Hohndel
Instead add a new define SHOW_PLOT_INFO_TABLE that triggers if this debugging aid is shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31Update ceiling when changing dive modeGravatar Robert C. Helling
Without this patch, the user effectively cannot change the dive mode as any change is overwritten by replot copying current_dive over displayed_dive. The way out is not to call replot but only update the deco ceiling directly. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31Hide tooltip when posting a profile to FacebookGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31DiveMeanDepthItem: fix bad translated depth unitsGravatar Lubomir I. Ivanov
probably just a typo; taking the value of a (char *) will return the first char (or byte). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-29Prevent potential access to uninitialized variableGravatar Dirk Hohndel
If we have a dive with no data (e.g. from a failed import), we might never assign a value otherwise. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28Small changes to the mean depth textGravatar Dirk Hohndel
Add a tiny bit of white space to the left and display the unit as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28Implement the mean depth textGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28Remove dead codeGravatar Tomaz Canabrava
We changed this MeanDepthLine to the MeanDepthCurve (or something), no need to keep old code around. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-28Hide ruler when in ADD or PLAN mode.Gravatar Tomaz Canabrava
This ruler shouldn't appear in ADD or PLAN mode, it's a bug and may crash things. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>