summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
AgeCommit message (Collapse)Author
2015-05-29Move DiveTripModel to qt-modelsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move WeightModel to qt-modelsGravatar Tomaz Canabrava
One more step to make it easyer to port the app to Mobile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move WeigthSystem Info model to qt-modelsGravatar Tomaz Canabrava
This is another effort to make it easyer for the mobile interface of Subsurface. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move Tankinfomodel to its own fileGravatar Tomaz Canabrava
Another change to make it easier to program the mobile ui. This was a fairly easy patch: just moved the contents of the file and fixed the includes. 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-03-19Fix a couple of typosGravatar Torstein Husebø
Signed-off-by: Torstein Husebø <torstein@huseboe.net> 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-03Don't allow the Cylinder option be edited in PLAN / ADD modeGravatar Tomaz Canabrava
This sets the combobox to disabled if the profile is in any mode besides PROFILE. Fixes #824 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-31Don't call replot when exiting cylinder combo boxGravatar Robert C. Helling
Commit b72c32da7 turned off replotting while the cylinder combo box was active to speed up editing. After leaving the combo box, replotting was enabled again and a replot was called. This replot is too agressive, as it overwrites the displayed dive with the current dive and thereby resets the cyinder change. This eliminates the replot call. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Clean up the header filesGravatar Dirk Hohndel
Lots and lots and lots of header files were being included without being needed. This attempts to clean some of that crud up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-18Connect TankUseDelegate to its parrentGravatar Anton Lundin
This plugs a memory leak found with valgrind. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-17Turn of replotting while the cylinder type combo box is activeGravatar Robert C. Helling
Since replotting is expensive and it is triggered while scrolling through the list of cylinders, better not do it for improved user experience and replot only after the combo box loses focus. I hope this... Fixes #768 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17Allow translation of the cylinder use strings for the UIGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17Add the ability to modify the cylinder use in the UIGravatar Dirk Hohndel
Thanks to Tomaz for writing a first draft of the delegate. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-14Make sure we always have copies of equipment descriptionsGravatar Dirk Hohndel
Having pointers copied around that might get freed elsewhere could be a problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18Unify icon metricsGravatar Giuseppe Bilotta
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18Dynamic dive trip list column widthsGravatar Giuseppe Bilotta
Compute the default widths for the columns in the dive trip list from their header and (expected) content length rather than some fixed pixel sizes. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18Dynamic StarWidget metricsGravatar Giuseppe Bilotta
The default IMG_SIZE and SPACING in the StarWidget are not appropriate for HiDPI displays. Replace them with StarMetrics which are auto-computed from the (default) font size (which Qt determines from the display DPI settings). Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-29Revert hacks now that we use Qt5 on MacGravatar Dirk Hohndel
Commits a24eb8ac120bf and 0b0860d24a81b introduced a nasty hack that was needed back then to make tank and weight selection work on the Mac. But it caused other unpleasant issues (as mentioned in the commit messages). I re-tested this with the current Qt5.3 based builds on Mac and this hack is no longer needed. Fixes #638 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-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-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-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-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-15Selects the delegate text on Cylinder editionGravatar Tomaz Canabrava
The text selection was not being set, bummer. See #628 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Add step size in our SpinBox delegatesGravatar Anton Lundin
For the Set point spinbox, it was kinda hard just stepping by the default 1.0, so setting it to step by 0.1 makes much more sense. The int SpinBox got a step size parameter for consistency. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Use doubles in DoubleSpinBoxDelegateGravatar Anton Lundin
The previous code used qreals, but it feels clearer to use doubles when the name of the class contains the word double. The performance loss of using doubles instead of floats on arm is non-existent in this case. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11Fixed input in the DivePlanner tableGravatar Tomaz Canabrava
Based on Glance's idea on rewritting the Delegates, but we don't need to redo the wheel as Qt already gives us the correct Delegate, we just need to set some boundaries on it before returning. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-20Change the Star Widget to use QImage instead of QPixmapGravatar Tomaz Canabrava
Also, clean a few calls, this should make the widget a tiny bit faster. This patch also moves the grayImage function from the star widget to the global scope, so I can use it on the Calendar widget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Better handling of mouse on the delegates ( Equipment Edition )Gravatar Tomaz Canabrava
This adds more handling of missing actions for the mouse on the equipment edition. It complements the stuff talked about on bug 359, but it's a different issue. 359 seems already fixed. See #359 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20Better handling of keyboard on the inline edition on equipmentGravatar Tomaz Canabrava
The handling of keyboard is broken on Qt inside QComboBoxes. I'm trying ( and losing ) to make it less broken. This patch makes the code work reasonably well if you press Key_down or Key_up after having displayed the filter popup, which is different from the combobox popup for some reason. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Update #include statement for QStringListModelGravatar Boris Barbulovski
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Whitespace and coding style updatesGravatar Dirk Hohndel
Another futile attempt to cleanup the code and make coding style and whitespace consistent. I tried to add a file that describes the key points of our coding style. I have no illusions that this will help the least bit... This commit should ONLY change whitespace Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Copyed the code from Dirk that solved the mac issue on cylinders.Gravatar Tomaz Canabrava
This is the same code that Dirk used on the Mac to fix the bad-behavior of Cylinder Selection, this time applyed to Weigthsystem selection. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Fix TableWidget ( equipment ones ) on dark scheme.Gravatar Tomaz Canabrava
This patch uses the class created by the previous patch to get rid of the CSS and be really desktop native. it fixes a lot of stuff in non-blue-styles and throws a lot of code away. <3 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Kill the use of CSS - Fixes a Lot of issues on dark color schemes.Gravatar Tomaz Canabrava
The css was done by me in the first days of subsurface for Qt, and it was a code that I was never proud of. Mostly because I tougth at the time that it was better to write it into CSS than to create a new class just to take care of the size of the default cell height on a tree view. Now I see that it was a biased approach since it created issues on dark color schemes and it also didn't make a 'native' experience on Gnome or OSX, only on KDE. This fixes that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30Print: fix missing vertical line at the last columnGravatar Lubomir I. Ivanov
There was a line missing in the right-most column wrapping the table for the profile print. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-11-30Print: update drawing of the profile table gridGravatar Lubomir I. Ivanov
The new table layout requires that we draw the vertical and horizontal lines differently. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-11-21Hack to make tank selection work on MacGravatar Dirk Hohndel
This is an ugly hack as it partially breaks the ability to abort a selection (so if you click outside of the combobox, the last value you hovered over is selected). But this seems much better than not being able to select a different tank at all. Fixes #275 (and by 'Fixes' I mean "hacks to sort of make work"... but the trac automation is rather inflexible in which words it understands...) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Correctly handle changes on the CylinderModel to update the AirModel.Gravatar Tomaz Canabrava
What happened before was that the AirTypes model was only being updated when the user requested to change the air by clicking directly on the Air, in the planner ( but not on the Air Table. ). This fixes it by calling 'repopulate' whenever the cylinder model changes ( by adding, removing and changing something.) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11Connect cylinders entered in planner with the gases availableGravatar Dirk Hohndel
Now the gases for which we have cylinders are offered in the gas selection list and correctly recognized and added for the plan. Still tons of work to be done to make this work the way it is designed, but we are getting closer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15Fixed the Tab behavior on the QCombobox DelegateGravatar Tomaz Canabrava
This Patch fixes the tab behavior on the QComboBox delegate. For a QComboBox, tab was being treated as 'cancel' action on edit, but since it will send a editingFinished() signal, and the Qt::Key_Return will also send a editingFinished() signal, I couldn't use that method and had to do a little hack around it. The code is mostly clean and works. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Good deal of whitespace fixes and code cleanup.Gravatar Tomaz Canabrava
I just went thru all of subsurface code removing some whitespaces issues and trying to make the code prettyer, I also removed a few QString issues.d Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>