aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
AgeCommit message (Collapse)Author
2014-05-22Profile now correctly displays the planned dive.Gravatar Tomaz Canabrava
But it doesn't move the handlers yet, and when you confirm it you also must click on the dive to select it or the profile will show garbage. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Disconnect temporary connections on the Profile.Gravatar Tomaz Canabrava
This code adds the disconnections of temporaries. A temporary connection is a connection that should be active only on a certain state, and we need to clean that for the new state that will enter after. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Move two necessary functions for the Planner behavior to the Profile code.Gravatar Tomaz Canabrava
Those two functions are important and necessary for the Planner, they create and remove the little balls that act as handlers so the profile can be edited with the mouse. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Back to profile or empty state when finishing addition.Gravatar Tomaz Canabrava
This patch adds a signal to MainTab, that should be removed from there when we finish the rework on the edit part, to go to the edit classes, but in the meantime, let's keep it there. The signal is connected to the ProfileWidget in a way that the end of the edit will also trigger the profile to go back to ProfileState (show the dive, if there's any) or empty Profile (if there's none). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Enable editing the 'Add dive' from the new profile.Gravatar Tomaz Canabrava
This is highly broken in many ways - but it's the right first step. I ported two of the most important methods from the old profile and now if you are in add dive mode, double clicking on the new profile will correctly add a handler on the planned dive. To see and move the handler around, however, you need to activate the old planner. Next step: add the handlers on the new profile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Move settings of the Ruler to the Ruler.Gravatar Tomaz Canabrava
As with any other graphics object, the settings for the ruler should be managed by the ruler, clearing up the Profile logic and making the code easier to read. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22PreferencesChanged -> settingsChanged.Gravatar Tomaz Canabrava
We used both preferencesChanged and settingsChanged in different methods and classes to mean the same thing, this adds consistency. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Don't replot every time a pref changes, regardless of what preferences.Gravatar Tomaz Canabrava
The list of preferences that should trigger a full repaint are at the top of this method, *if* this introduces a bug it is because some of the preferences are not being correctly triaged yet and that needs to be fixed. Regardless of that, now the profile will only enable / disable the *ruler* instead of replotting everything. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Remove use of QSettings for ruler visibility, use prefs.rulergraph instead.Gravatar Tomaz Canabrava
The QSettings is a bit bloated on its use, so we are trying to narrow down the amount of calls to it. We have a preferences struct, use that instead. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Code Cleanup: Move the Hide/Show ruler to an internal methodGravatar Tomaz Canabrava
By moving the Hide/Show of the ruler to an internal method, we gain a bit of codecleanuperism by removing a lot of unnecessary calls to their dest and source drag-handlers. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Create a 'remove_event' function that removes an event.Gravatar Tomaz Canabrava
The logic of removing the event was in the UI, and this makes the code harder to test because we need to take into account also the events that the interface is receiving, instead of only relying on the algorithm to test. so, now it lives in dive.h/.c and a unittest is easyer to make. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Speed Improvement: Unhide all events by calling event->show()Gravatar Tomaz Canabrava
The old code replotted the whole dive, while what we really wanted was to show the events. so just ->show() them. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Speed Improvement: hide events instead of replotting everythingGravatar Tomaz Canabrava
The 'Hide Similar Events' function asked the Profile to replot eveything, only because some events were hidden from the interface. Instead of that we can simply hide the events since the graph will be the same. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Only set the state to profile if it's empty, not if it's Add or Plan.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Add ability to make a dive computer the first dive computer of a diveGravatar Dirk Hohndel
If a dive has multiple dive computers we enable a special context menu when the user right-clicks on the dive computer name AND is not already showing the first dive computer. In that case we offer to make the currently shown dive computer the first one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Show the dive computer number (if a dive has more than one)Gravatar Dirk Hohndel
For most users this is no change at all. For the few who download from multiple dive computers this now shows them which of them is the primary dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Change get_dive_by_diveid to get_dive_by_uniq_idGravatar Dirk Hohndel
The original name was a really bad choice as we have a 'diveid' as part of struct divecomputer - and that is not the diveid that is being used here. Instead we use the 'id' member of struct dive which holds the "unique ID" for this dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-13Rename getDiveById to get_dive_by_id to keep current c code organized.Gravatar Tomaz Canabrava
This commit renames getDiveById to get_dive_by_id, and it also removes the Q_ASSERTS and if(!dive) return that the callers of this function were calling. If it has a Q_ASSERT this means that the dive must exist, so checking for nullness was bogus too. I've changed the assert (done in a silly C-Way. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Fix another dangling pointerGravatar Thiago Macieira
Same problem as the previous commit: toStdString() returns a temporary, and c_str() will return a pointer to internal data, freed at the end of the statement. So get the pointer to be strcpy'ed in the same statement. Changed to toUtf8() to be more explicit about the encoding and to avoid std::string Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-05Change the profile redraw logic after preferences were changedGravatar Dirk Hohndel
I we are showing a calculated ceiling, then we have to replot the profile after a preferences change as the gradient factors could have changed which might change a calculated ceiling. Also use the rulergraph preference instead of checking the settings directly. Fixes #511 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-28Make heartrate grid less confusingGravatar Dirk Hohndel
Having all the grid lines in the same color made things visually confusing. To clean this up a little make the heartrate lines a light gray color. Fixes #484 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16Renaming the prefs struct members to be consistent with the QSettings.Gravatar Gehad Elrobey
-Renaming prefs members for consistency. -Changing references of QSettings to the prefs structure instead. -Removing unused functions in pref.h were left over from an old version. -Changing the data-type of bool members to short for consistency with other members. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11Change some references of QSettings to the pref struct.Gravatar Gehad elrobey
After adding the animation member in the preference struct, it is very resonable to change these references of QSettings to the preference structure instead. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10Feature to show or hide heart rate graphGravatar Lakshman
Adds new push button "HR" to the button bar on the dive profile to toggle display of heart rate. TODO: New icon for the heart rate button is needed. Fixes #485 Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-07Change position of heart rate labels on y-axisGravatar Willem Ferguson
The lettering of the heart rate numbers on the lefthand exis "fall off" the left hand of the profile panel when the panel is a bit narrow. This minute change moves the letters a bit closer to the Y-axis so that their left-hand extreme is more or less in line with those of the depth-labels on the Y-axis. This is a partial response to Ticket # 484. See #484 Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03Random small whitespace cleanupsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03Edit name option for bookmarksGravatar Yosef Hamza
Add the option to edit the name of a bookmark to be more meaningful for the user they prefer. It works just as simple bookmarks and can be removed and hidden. It won't accept names longer than 22 characters because longer names will display as garbage text. Also changed the code from displaying flag depending on event name to depending on event type. Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-28Toggle showing average depthGravatar Lakshman
Add additional check box in "preferences->graph" section that allows users to hide average depth on dive profile. By default this option is checked to show average depth. Fixes #475 Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27Profile2: hide the tooltip and ruler if we are printingGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27Profile2: add use of the isGrayscale flag when getting a colorGravatar Lubomir I. Ivanov
getColor() has a default argument for grayscale set to false. With this patch we pass it the local isGrayscale flag, which can only be set during printing. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27Profile2: add some print related flagsGravatar Lubomir I. Ivanov
Some flags like printMode and isGrayscale are missing yet needed. The flag printMode is required so that we know *when* to hide certain elements such as the ruler and tool tip (e.g. not needed while printing). isGrayscale should be passed to all getColor() calls, so that the greyscale color table is respected. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27Repaint ruler when enable/disabling itGravatar Jan Mulder
Repaint ruler when enable/disabling it. Straightforward replot() added. Fixes #479 Signed-off-by: Jan Mulder <jlmulder@planet.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21Make pp graphs visible at startup according to settingsGravatar Jan Mulder
Changeset a90818671 introduces a small inconvenience. The pp graphs at startup are not shown according to the visibility settings. Requiring to toggle the icons to show the desired pp graph. Trivial fix. Signed-off-by: Jan Mulder <jlmulder@planet.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20Remove a bit of space from the Axis and its labels.Gravatar Tomaz Canabrava
This should make the layout work better on smaller screens. Fixes #458 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18Profile2: use unsigned int for the divecomputer numberGravatar Lubomir I. Ivanov
display.h: dc_number is unsigned int, thus a couple of warnings may pop-out. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18Clear PN2 PO2 PHE GasItemGravatar Hugle
After the dive log has been closed, the ProfileWidget2 does not clear the pn2 po2 and ph2 gas line. This patch cleared the three lines after dive log closed. Acked-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Hugle <wulong@comp.nus.edu.sg> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Be more careful about dive computer selectionGravatar Linus Torvalds
The selection logic was a bit random: some places would return NULL if the dive computer index was out of range, others would return the primary dive computer, and actually moving between dive computers would just blindly increment and decrement the number. This always selects the primary computer if the index is out of bounds, and makes sure we stay in bound when switching beteen dive computers (but switching between dives can then turn an in-bound number into an out-of-bounds one) Fixes #464 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Silly change to a commentGravatar Dirk Hohndel
I had intended to amend the previous commit with this before pushing it out. This changes the comment that pointed out the bug that the previous commit fixed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-16New profile: fix event hiding logicGravatar Dirk Hohndel
Turns out we unconditionally set all events as visible when redrawing the dive - even with a comment that this should take into account if the event is visible. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15New profile: add event manipulation to context menuGravatar Dirk Hohndel
This got lost when we switched to the new profile. Remove event works. Hide events does call hide() on the DiveEventItem but for some reason it stays visible. I'll hope for one of the more experienced Qt people to fix that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13New profile: fix Information overlay locationGravatar Dirk Hohndel
By simply storing the coordinates based on the scene (instead of trying to map them to real coordinates) the overlay position is correctly restored. Also remove the redundant positioning before readPos is called. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Profile2: place the ruler and tooltip on top (Z order)Gravatar Lubomir I. Ivanov
The topmost Z order of items in the profile should be: - background (poster / logo) - toolTipItem - rulerItem ... This mostly fixes the ruler being under other elements. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Only anim if not first dive when openning subsurface with a divelog.Gravatar Tomaz Canabrava
The animation appeared when the user started subsurface with a default file, wich was a little annoying since it didn't had a 'from' position to go and it was also increasing it's size on some window managers that do subtle windows animations when a program starts. This patch treats the first dive opened when the program loads with a divelog pa rameter differently as the following ones storing the velocity value on a temporary, and reassigning it later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Profile2: provide means to disable the tool buttonsGravatar Lubomir I. Ivanov
Once the poster is displayed when there are no dives in the list, we may also want to disable the QToolButtons (PO2, SAC, etc..), until a new dive is loaded and the profile is redrawn. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10Profile2: reset the zoom level when a new profile is drawnGravatar Lubomir I. Ivanov
If the user has zoomed in but then changes to a new dive, we may want to reset the scale back to the original value (1.0) based on the current zoomLevel, so that the profile is not stuck in zoomed mode. This patch adds a snippet that resets the QGraphicsView scale, zoomLevel variable and also the toolTip position. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10Profile2: use a different image when no profile is visibleGravatar Lubomir I. Ivanov
This patch adds a new image resource named poster.png which, is shown instead of the 3 posters. The main reason for that is due to the poster text not being visible. This new image is pretty much the Subsurface logo only. It also removes the grid lines, while the poster is visible. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10Profile2: fix some initializer list order warningsGravatar Lubomir I. Ivanov
Such can be disabled with -Wno-reorder and are clearly more of a nuisance, but C++98 12.6.2.5 says the order should be the same as in the class declaration. On theory this would only speed the compile times a tiny amount. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09Fix retrieving the initial position of the Notification Area.Gravatar Tomaz Canabrava
We had all in place, all that was missing was to actually load the position stored on the settings for the tooltips. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09Code Cleanup ( that fix 2 bugs )Gravatar Tomaz Canabrava
This code cleanup fixes the two issues that I raised on my last e-mail. hurrah. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07Remove the old profile from the main screen of SubsurfaceGravatar Tomaz Canabrava
This patch partially removes the code for the old profile from Subsurface. It removes the use of the old profile on the mainwindow, but keeping the code in the tree for now. A bit of code-cleanup also entered this commit because I had to change every instance of the code that used the old profile. Now to the real code-cleanup Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>