aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
AgeCommit message (Collapse)Author
2015-10-07modeldelegates.cpp: add custom highlight drawing in location itemsGravatar Lubomir I. Ivanov
There is a problem in LocationFilterDelegate::paint(), which can manifest as very light background with white text in the combo box from which the user selects a location - a Windows 7 test case. The main offenders are the drawControl() call which draws the selected item background very bright and the fact that the highlightText() is returning white. It seems as if the combination of these is just wrong, theme wise. e5fa424a and 44762c42 fix that by branching Windows by version, but do not cover the case where the user can use a custom theme - e.g. dark selection highlight on Windows 7. This patch skips drawControl() and draws the highlighted item background manually. It makes it look similar to the small tag highlights in TagWidget. The patch adjust slightly the X offset of the drawn text. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Fix typo on string formatting optionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Only check Windows version when building on WindowsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Do not use White font on newer Windows versionsGravatar Tomaz Canabrava
It isn't readable with the very light background. Which Windows versions this should be used on is a guess right now. So far Windows 7 or newer, but that may need adjustment. Fixes #935 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-05Don't use the numerus version of tr()Gravatar Dirk Hohndel
It looks like our tools create a .ts stance that transifex can't deal with. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Use correct colors on selectionGravatar Tomaz Canabrava
I was wondering why the colors where wrong on mac, it took me a while to find the correct spot to fix. It seems that the Brush is not used to paint the fonts, but the Pen is. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Try to fix paint issues on windowsGravatar Tomaz Canabrava
Davide complained about a flickr on windows, I think it has to do with the QPainter now knowing the right size of it's paint rect. this should fix it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Code uneeded because the drawControw does this by itselfGravatar Tomaz Canabrava
Removing dead code. the call above this does that already. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-18Add nr of dives at the site to completion stringGravatar Dirk Hohndel
I'm not convinced that this is useful enough to keep, but let's give it a try and see what people think. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-18Location completion: remove space between '~' and distanceGravatar Dirk Hohndel
Just a minor visual improvement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17Remove buggy codeGravatar Tomaz Canabrava
This code is already implemented as a signal-connection on the maintab.cpp / globe.cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Fix mouse interaction with the Location ListGravatar Tomaz Canabrava
paint methods should be used only to paint, not to trigger other widget behaviours ( we could got ourselves into a bad recursion bug from that ). Also, enabled mouse tracking to correctly track the mouse movement inside the widget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Show only 1 possibility if string is uniqueGravatar Tomaz Canabrava
We should only show one possibility if the dive_site name string is unique - we don't have that dive_site yet - so we pass to the Completer filter a Dummy string that will surelly not be a dive site - konami code. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Location edit: correctly position globe if create dive options are activeGravatar Dirk Hohndel
This way when the user looks through the list of completion options the globe behaves in a consistent way, i.e., if the current dive site has a GPS fix and the user activates one of the two options to create a dive site with that GPS information, the globe show the right area (and the globe zooms out if the current dive site doesn't have a GPS fix). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Change API signature to act on dive_site, not uuidGravatar Dirk Hohndel
This way in the future we can pass in a pointer to a dive site that isn't linked in our dive site list yet (i.e., while we are editing). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Dive site edit: add second "create" line without completionGravatar Dirk Hohndel
We now have TWO special entries. One with just what the user has typed and one with the first completion of that text. This way both Henrik and Linus can get what they want. I'm not sure I love this, but it's easy to revert if the consensus is that this is too confusing. But it's much easier to discuss this if people can actually play with it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-15Better text for dive site completionsGravatar Dirk Hohndel
Also make the explanation text slightly smaller. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Merge branch 'tomaz'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Offer an option to just complete the textGravatar Tomaz Canabrava
Make the kids fight no more. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Location completer: show candidate sites on the globeGravatar Dirk Hohndel
As the user scrolls through the possible completions, show them on the globe as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Location completer: show taxonomy according to preferencesGravatar Dirk Hohndel
The user has picked their preferences of which taxonomy data they want to see. Show them what they asked for. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Location completer: give distance if knownGravatar Dirk Hohndel
If both the displayed dive and the dive site which is shown as a potential completion have a GPS fix, indicate the distance. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Use current dive site to get the informationGravatar Tomaz Canabrava
and not the displayed_dive_site. tsc. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Correctly paint the statesGravatar Tomaz Canabrava
The state handling is a pain to do manually, but I can't really use the style painter because if I do that it would paint the string of the model (and that's something I don't wanna do) so I clear the text, draw the control, then I paint the stuff that I really need. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Use taxonomy or coords on the delegateGravatar Tomaz Canabrava
The Taxonomy text should be used if there's a taxonomy for the dive site. If there isn't, then use coords. If there's none, then nothing will appear on the bottom of the dive site name. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Better spacing on the delegateGravatar Tomaz Canabrava
Makes the location delegate pleasant to the eye. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Correctly display the data on the delegateGravatar Tomaz Canabrava
A bit more complex than I tought it would be (and a ton of trial and error to find the right spot on the delegate to draw stuff) this delegate follows the current style (so it should be okaish on a dark and on a light theme) This is supposed to work on a QCompleter, but it doesn't (I really don't know why, so maybe I'll remove that completer. sigh.) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Create a delegate to display custom dataGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>