aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
AgeCommit message (Collapse)Author
2017-12-13Dive pictures show pictures of all selected divesGravatar Stefan Fuchs
In the dive picture tab show pictures of all selected dive. But at the same moment take care that in the profile only pictures from displayed_dive are displayed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13Remove unused divesitepicturemodel from qt-modelsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-10Remove outdated commentGravatar Berthold Stoeger
The removed comment in qt-models/divepicturemodel.h described todo items which were already implemented. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10Make thumbnail code threadsafeGravatar Berthold Stoeger
The thumbnailing in qt-models/divepicturemodel.cpp was performed concurrently, but the thumbnailCache was not protected from races. Resolve this by guarding the thumbnalCache accesses with mutexes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10Simplify DivePictureModelGravatar Berthold Stoeger
The code of DivePictureModel used a QHash to keep track of thumbnails. Not only was the code rather complex - it also had the consequence that pictures are sorted according to the hash function, i.e. seemingly random. This commit replaces the QHash by a simple QList which keeps track of thumbnails and some meta-data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10Whitespace fixes in qt-models/divepicturemodel.cppGravatar Berthold Stoeger
Note that constructs like QList<QFuture<void>> is incompatible with pre-C++11 compilers. But the code base is so full of C++11isms that we may just as well remove asymmetric eye-sores of the kind "QList<QFuture<void> >". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-08Cleanup: mark parameter as potentially unusedGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-02In planner variations use variables for delta valuesGravatar Stefan Fuchs
Plus a small layout change: Add a colon behind "Stop time". Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-02Planner variations stop time calculation cover all stopsGravatar Stefan Fuchs
Simplify the sum up of the deco stop times for analysis of the planner variations. Plus rename define for deco stop variations debug output Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01Remove unnecessary #include and correct whitespaceGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Change #include line to make Linux builds happyGravatar Robert C. Helling
Let's see if this helps the Linux build on TravisCI. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Document background computation of variationsGravatar Robert C. Helling
Update changelog, update user manual, clarify meaning in dive notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Prevent redundant replanningGravatar Robert C. Helling
Planning dives is heavy on CPU, so better be sure we only do it when needed. In particular, when moving around dive points, we only want a new plan once per move and not three times (triggered at various points in the chain of events). This should significantly improve planner snappiness. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Disable plan variation in recreational modeGravatar Rick Walsh
Calculating variations when in recreational mode doesn't make sense, and can prevent variations from being calculated when switching back to Buhlmann or VPM-B modes. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-12-01Add imperial units to variations computationGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Don't block profile updates in variations computationGravatar Robert C. Helling
We needed to prevent updates when we messed with the diveplannerpointsmodel as those would trigger starting planning from scratch causing infinite loops. Now, the variations calculation operates on a copy of the diveplan, so the model is no longer involved and we should not block recalculations (as those might be triggered by the UI). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Make background calculation optionalGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Actually compute variations in backgroundGravatar Robert C. Helling
This reenables the computation of plan variations but now in a separate thread. Once finieshed, a signal is sent to update the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-30Use better aliases for icons.Gravatar Martin Měřinský
Icon aliases were complete mess. Some icons had alias some didn't. Named with underscores vs. hyphens vs. camelCase. Lower vs. upper case. "ICON" prefix vs. suffix vs. nothing. With vs. without filename suffix. Some didn't make sence. Eg. mapwidget-marker-gray (I can see, it's grey, but what does it represent?) Some were duplicated, eg warning vs. warning-icon. Some were name after widget, which is wrong. Do not reinvent wheel. Use widely used naming scheme close to Freedesktop Icon Naming Specification. This will enable usage of common icons from current set in the future. Thus Subsurface will fit nicely to GUI. This changes icon aliases to one, easy grep-able style. Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29Revert "Use consistent aliases for all icons."Gravatar Dirk Hohndel
This reverts commit 92e9c6606f6ef3ad16d2e31f9f9a8f5fa14f2c1a.
2017-11-29Use consistent aliases for all icons.Gravatar Martin Měřinský
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase. With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs. prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some icons didn't have alias at all. This changes all icon aliases to one, easy grep-able style which complies to Freedesktop Icon Naming Specification (Guidelines). Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-27Add debug function dump_cylindersGravatar Stefan Fuchs
This function can be used to dump print all cylinder data. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-26Inform LocationFilterModel of added dive site nameGravatar Berthold Stoeger
If the user implicitly adds a dive site by editing a dive, and a location filter is active, check the new dive site in the location filter. This is done by informing the LocationFilterModel of the new dive site name prior to repopulation. The LocationFilterModel then adds a corresponding entry and marks it as checked. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-26Inform LocationFilterModel of changed dive site nameGravatar Berthold Stoeger
Since commit 01d961086c1d175732c597dc9acdba7cc4cd2d26, the location filter list is updated if a dive site is edited. The problem is that if the name of a selected dive site is changed, the selection is lost. Therefore, before repopulating, inform the location filter that a dive site changed its name. The location filter then internally changes the name and can properly transfer the old selection on repopulate. This is performed via the new LocationInformationWidget::nameChanged signal, which is connected to the new LocationFilterModel::changeName slot. A special case to be handled is the following: [ ] Site 1 [x] Site 2 and "Site 2" being renamed to "Site 1", i.e. both sites being merged. Here, the merging is detected and "Site 1" will likewise be checked: [x] Site 1 [x] Site 1 No merging is performed, as the list will be repopulated anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-26Fix comparison function in qt-models/divelocationmodel.cppGravatar Berthold Stoeger
The function dive_site_less_than() in qt-models/divelocationmodel.cpp does not what it promises: it uses less-or-equal instead of less-than comparison. Note that, even though this may sound pedantic, this is an actual bug. Usually, sorting functions suppose that they are provided with strict weak ordering, which <= does *not* provide. This is the actual reason for the crash mentioned in commit f8a3a8521003a26525b658840ce8e7bfd3f7b141. While touching this function, make it of static linkage, since its usage is local to this translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-26Remove unused method LocationInformationModel::addDiveSite()Gravatar Berthold Stoeger
The call to this method was removed in commit f4c31f110fc98eb6d5d18c806e6b0f2ccc762d54 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Use equality instead of substring comparison in suits and buddy filterGravatar Berthold Stoeger
This commit is a continuation of commit 739b27427cfb5119eebe214c984843cd5d155620, in which a substring comparison was replaced by equality comparison to avoid confusing UI behavior of the filter interface. The suit and buddy filters were plagued by the same problem, so change their code in analogy. Fixes #551 (in conjunction with commit dd2466f51899aae406dc8c13904787710f30ec1c). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Hand planner variables to profileGravatar Robert C. Helling
Pass the planner state struct to the profile computation so it can use deco_time and first ceiling to display VPM-B ceiling. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Localize global planner stateGravatar Robert C. Helling
For UI responsiveness, we need to be able to run the planner in the background. This needs the planner state to be localized (and we need to pass a pointer around). In order to not let too many lines overrun (and to save typing in the future) I have renamed instances of struct deco_state to ds. Yes this should have gone to a separate commit but I accidentally commit --amend'ed it. Computing of planner variations is temporarily disabled. Unlock the planner when returning early So we don't deadlock in add dive and recreational mode (which use the planner without actually planning). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Run variations calculation in backgroundGravatar Robert C. Helling
but there are still side effects and thus it crashes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Update filters on refreshDisplay and remember old selecttionsGravatar Berthold Stoeger
Update the filters if the list of dives is updated by calling MultiFilterSortModel::instance()->myInvalidate(); This had the side effect of clearing all selections. Thus, in the repopulate() methods of the FilterModels, check those entries that were checked previously. Since all the filter models use the same code, introduce a base class FilterModelBase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Replace bool * array by std::vector<char> in MultiFilterInterfaceGravatar Berthold Stoeger
This replaces a dynamically allocated array of bool by std::vector<char>. 1) This makes the code shorter and less error prone, because memory management has not to be done by hand. 2) It fixes a bug in the old code: memset(checkState, false, list.count()) is wrong, because bool is not guaranteed to be the same size as char! Two notes: 1) QMap<>, QVector<>, etc. are used numerous times in the code, so this doesn't introduce a new C++ concept. Here, the std:: version is used, because there is no need for reference counting, COW semantics, etc. 2) std::vector<char> is used instead of std::vector<bool>, because the latter does a pessimization where a bitfield is used! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25LocationFilter: use equality instead of substring comparisonGravatar Berthold Stoeger
The location filter used a substring comparison, which had the side effect that dives with the location "Test 1" were shown when filtering for "Test 12". Moreover, avoid a deep copy of the location list. This is done by looping over one item less than rowCount() instead of removing the last item. While doing this, remove an unnecessary if-statement. This commit partially fixes #675. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Only call autogroup when it's enabledGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-19Fix indentationGravatar Berthold Stoeger
Fix an indentation issue in qt-models/diveplannermodel.cpp. An if was indented as if it were part of an outer if. Correct indentation confirmed by Stefan Fuchs <sfuchs@gmx.de>. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-09map-widget: allow real-time updates of edited markersGravatar Lubomir I. Ivanov
This patch allows updating the location of map markers while editing a dive site and updating the text in the LocationInformationWidget in real-time. Currently it is only possible to see the marker changes by clicking 'Apply'. The modification required the following changes: - add the MapWidget::updateCurrentDiveSiteCoordinatesToMap() slot and call it each time the GPS text updates - separate the updateCurrentDiveSiteCoordinates(FromMap/ToMap) logic by having the FromMap/ToMap suffix to method names - make MapWidgetHelper::updateCurrentDiveSiteCoordinatesToMap() call a new MapLocationModel::updateMapLocationCoordinates() method, which updates selected location coordinates and the model - add MapLocation::setCoordinateNoEmit() that does not emit a signal when updating a coordinate Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-30Tidy up code for cylinder remove decision in cylindermodel.cppGravatar Stefan Fuchs
Replace currentMode() != ...:NOTHING with equivalent in_planner() Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-23Respect autogroup in Subsurface-mobileGravatar Dirk Hohndel
After we download new dives we need to try to autogroup them. In Subsurface this is done when we refresh the dive list. Here we might be better off doing it right after processing the new dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-21When removing a cylinder completely fill the mapping tableGravatar Stefan Fuchs
When deleting a cylinder the mapping was not filled with all necessary values. Values for cylinders before deleted cylinder were missing. Plus do the endRemoveRows at the right time. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-20Silence random warningsGravatar Dirk Hohndel
None of these seem to point to actual issues, so let's quiet them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-20Update dive planner points cylinder names also when cyl is addedGravatar Stefan Fuchs
Amendment to c29456f0bb11f07befc3af66ee7973258b491d20 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-20Do cylinder renumber for dive data points only when in planner modeGravatar Stefan Fuchs
Amendment to 73d2ab8099ce08ab20f119a126334463ffd41b1e Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18Planner: Autom. move first datapoint gas to first gaslist position p2Gravatar Stefan Fuchs
This is a amendment to 24bd5a8dcebec886b8fbbf077fabfb2106dc7dcd Move the cylinder also to first position if first planner datapoint cylinder change because a row is added or deleted to the dive datapoints. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18init_deco correctly identify previous dives and report overlapping divesGravatar Stefan Fuchs
When changing the date/time of a dive in the planner the dive may end up in a totaly new position in respect to date/time of other dives in dive list table. It can be moved to the past or the future before or after other existing dives. It also could overlap with an existing dive. This change enables identification of a new "virtual" dive list position and based on this starts looking for previous dives. Then it (as before the change) does init the deco calculation with any applicable previous dive and surface interval. If some of these applicable dives overlap it returns a neg. surface time which is then used in the planner notes to prohibit display of results. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18Find current gasmix for heatmapGravatar Robert C. Helling
To compute the heatmap value, we need the current gasmix but the current cylinderindex is no longer available. Fixes #562 Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-16Correctly name member function gasChange of DivePlannerPointsModelGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Planner: Autom. move first datapoint gas to first gaslist positionGravatar Stefan Fuchs
In the planner it is best practise to start the dive with the first gas in the gaslist. Otherwise one would get a gaschange event at the very beginning of a dive. This change implements the following feature: Automatically move a gas to position 0 in the gaslist if the user selects this gas for the first dive data point. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Update diveplannerpoints cylinderidx when deleting a cylinderGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Used gas in dive planner points: Support for multiple cyl with same gasGravatar Stefan Fuchs
In the planner if one adds two or more cylinders with the same gasmix (e.g. back gas and bottom stage 18/45) the drop down and data in the used gas column of the planner points table will be filled with a more verbose string mentioning also the cyl number and the cyl type description. Makes it easier in such a case to select the right cylinder. Introduces also a helper function which tells you if there is another cylinder with the same gasmix as the provided cylinder. This also has an option if it should consider unused cylinders or not. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Removing cylinders in planner: Be more restrictiveGravatar Stefan Fuchs
Be even more restrictive regarding which cylinders can be removed from the cylinder table in the planner. Only if a cyliner is not used in the planned part of the dive it can be removed. It doesn't matter if there is another cylinder with same gasmix. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>