summaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2013-06-19Consistently use slots / signalsGravatar Dirk Hohndel
We started out using Q_SLOTS and Q_SIGNALS but then changed our mind. Let's make this consistent again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Fix yearly statisticsGravatar Dirk Hohndel
This commit fixes two issues. One is that there were situations where the code would read an uninitialized parent pointer, the second was that instead of the monthly statistics the tree view would show the yearly statistics again under the yearly entries. I assume that the second part of the fix (initializing the parent pointers) actually takes care of both of them (that patch was suggested by Tomaz), but the first part that just makes sure the pointer is at least initialized to NULL seems to be at least not harmful, so I kept it as well. With this the yearly / monthly statistics seem to be pretty much at feature parity. Fixes: #115 Suggested-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Improve display of yearly statisticsGravatar Dirk Hohndel
Display the units in the header, make the header more consistent looking, convert the values into the right units with appropriate precision. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Reduce the bleeding in my eyesGravatar Dirk Hohndel
This is all just coding style and white space cleanup. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Clean up the last mergeGravatar Dirk Hohndel
While the code is correct, splitting the class like this is silly and will confuse me later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Merge branch 'qtHelper'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Converting the device_info list into a Qt data structureGravatar Dirk Hohndel
This data structure was quite fragile and made 'undo' when editing rather hard to implement. So instead I decided to turn this into a QMultiMap which seemed like the ideal data structure for it. This map holds all the dive computer related data indexed by the model. As QMultiMap it allows multiple entries per key (model string) and disambiguates between them with the deviceId. This commit turned out much larger than I wanted. But I didn't manage to find a clean way to break it up and make the pieces make sense. So this brings back the Ok / Cancel button for the dive computer edit dialog. And it makes those two buttons actually do the right thing (which is what started this whole process). For this to work we simply copy the map to a working copy and do all edits on that one - and then copy that over the 'real' map when we accept the changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17Yearly stats are being displayed.Gravatar Tomaz Canabrava
Yearly stats are being displayed. the code is similar to the GTK one, but I advise the reader that it's a bit risky ( I got an unreproducible crash but it seems to be fixed now. ). The selection behavior is *weird* and I have no idea why, but I'm very sleepy - will try to look at it again tomorrow. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17Create a view for the Statistics Model and Fix displaying the headerGravatar Tomaz Canabrava
This simply creates a view to show the model, while doing that I noticed that the model header wasn't showing, so I fixed it too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17Started to do the Yearly StatisticsGravatar Tomaz Canabrava
This is the fisrt bunch of compilable code for the new Yearly Statistics there's nothing to see here, move along... Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17Changed a lot of code to reduce boilerplate on models in the future.Gravatar Tomaz Canabrava
So, I changed a lot of code to reduce boilerplate on models in the future. Currently we do not have a lot of models, but this can increase quite rapdly. There's a second TreeModel in the works, the Yearly Statistics, this patch will save around 250 LOC for this new model, and more and more models will give us a greater saving. Iwll do that for the table models in the future too - I did the tree models now because they are the most complex case and I didn't wanted to create a second tree model without this. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17Merge branch 'renumberDialog' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17Show the device id in hexGravatar Dirk Hohndel
This is consistent with what we used to do Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17Improve the initial size of the device name editing dialogGravatar Dirk Hohndel
This is not "automagic" as I had hoped but appears to give a good starting point. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17Merge branch '119_divecomputerManagement' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17add forgotten file.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17Addes a simple 'Renumber Dialog', very similar to the GTK one.Gravatar Tomaz Canabrava
This code adds a Renumber Dialog, that's most a copy & paste of the GTK visual, I didn't tried to do anything fance with it, but I still dont like how it looks like. a better management form is needed. :) ( Well, actually my dislike is mostly because it's on a menu and it's on a popup, I think a 'toolbox' should exist to hold all of those widgets that don't belong to the menu - will try that later ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Properly initialize device_data_t when downloadingGravatar Linus Torvalds
The old gtk branch started out with device_data_t explicitly cleared, but the Qt version never did that. And we actually depend on the deviceid in particular being initialized to zero (and then we fill in the details in the divecomputer download callbacks) Not properly initializing it meant that we ended up with random deviceid's that got added to the divecomputer device lists, and then saved to the XML file without actually matching the data in the dive computers in the actual *dives*. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-16Save / Restore the sizes of the columns in Cylinders / Weigth widgetsGravatar Tomaz Canabrava
This patch saves / restores the sizes of the columns in the cylinders and weigth table widgets, so everything is now properly behaved. There 's still other things to do - but I'm tired. i's sunday and there's a protest against the brazilian government to go. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Removed the grid lines of the table views.Gravatar Tomaz Canabrava
Removed the grid lines of the table views, this makes the table view more similar with the dive list - I'm searching for an application identity here. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Remove the Vertical Header on Cylinder and Weigth editGravatar Tomaz Canabrava
Remove the vertical header on the cylinder and weigth edit, It was strange to show, since we don't show a thing there. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Make the columns have a sane default width for 'type'Gravatar Tomaz Canabrava
Make the columns on Cylinders edit and Wheight Edit to have sane values for 'type', this is needed because the old behavior was to set it fixed size, and the default fixed size was silly. this calculates a good predefined value taking the font size in consideration. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Better handling of default sizes on the Cylinder and Weight widgetsGravatar Tomaz Canabrava
Better handling of default sizes on the Cylinder and weight widgets, the weigth widget didn't had a CSS applied so it looked odd compared to the cylinder one, also the default behavior for the combobox delegate didn't worked very well with the css applied, being too small. this patch fixes that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Made all models have the same font.Gravatar Tomaz Canabrava
The models were a bit messy - some of them got the correct font, other didnt. This patch creates a new function 'defaultModelFont()' that is being used to return the font in all cases now. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16Create a 'ComboBoxDelegate' to concentrate the comboboxness of delegates.Gravatar Tomaz Canabrava
This patch creates a ComboBoxDelegate where the other specific delegates should inherit from. this adds a little code cleanup for the current version, and will help as soon as more delegates got added to the code. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-15Partially fix dive downloadingGravatar Linus Torvalds
The Qt branch didn't set the preexisting dive count, so matching old dives didn't work and it always downloaded all of them. Also, we need to autogroup dives before displaying them if autogrouping is on. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14Show & edit trip location and notes when exactly one trip is selectedGravatar Dirk Hohndel
While we still show the selected_dive in the profile and use it for Dive Info and Equipment, in the Dive Notes tab we now show the trip location and trip notes (and none of the other fields), if the user directly selects a whole trip by clicking on the trip header. This clever reuse of the widget now allows trip location and notes to be edited in place. As a side note: the Gtk version has long allowed the user to edit the trip location and trip notes, but nowhere did it ever SHOW the trip notes... so this is more than just feature parity... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14Don't offer "delete dive" context menu for tripGravatar Dirk Hohndel
If we are not on a dive we shouldn't try to delete it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14First deselect, then selectGravatar Dirk Hohndel
For reasons I still don't understand, sometimes (but not always) when clicking on a trip header we appear to get a select notification for the trip and at the same time deselect notifications for every dive in the trip. This seems wrong but I can't seem to figure out why it happens - and of course it causes us to have a mixed up interpretation of what is selected in our internal selection tracking. Simply acting on the new selection after the newly deselected items are handled appears to fix the issue, but I do worry about this change. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14Plot cleanupGravatar Dirk Hohndel
Use a helper to make things easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-13Improve the trip headerGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-13Merge branch 'linusDiveList' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12Fixed the show / hide dialog shortcuts to take the splitter into considerationGravatar Tomaz Canabrava
Fixed the show / hide dialog shortcuts to take the splitter into consideration, So, here's the deal. We have a few QSplitters that takes care of helping us with the size of a few widgets, they are ok, and we should continue using them to manage the visibility of them too. But the way that we did before was to widget->hide(); something, and if you hided something using the splitter, by holding it's handle and collapsing the widget, then you used the 'ctrl+number' shortcut to show it, it whould only show a gray panel. This patch makes everything behave using the splitters. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-12Add fifth view mode "Globe" for main windowGravatar Dirk Hohndel
For consistency I didn't change the meaning of Ctrl-1/2/3/4 and added this as Ctrl-5 - but one could just as easily make the argument that "ViewGlobe" should be Ctrl-4 and "ViewAll" should be Ctrl-5. This ensures that only one of the four widgets is shown in the individual modes, but it doesn't address the drawing issues with the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12Do not plot on showEvent if dive is already plotted.Gravatar Tomaz Canabrava
We do a force-plot on showEvent because the user can have asked to open a dive file via command line, so the app needs to open already with a profile plotted. if the user opens the program, loads a map, hides the profile by hitting ctrl + 1, then shows the profile again by hitting ctrl + 2, we do not want to do all the math to show the profile again, because we already have it in memory. this also fixes dirk's strange behavior of funky profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-12Implements the DiveList to behave like Linus Explained.Gravatar Tomaz Canabrava
Implements the divelist to behave like linus explained, essentially, it filters the layoutChanges of the model, greps for trips, and for each trip that it finds, it set the 'firstColumnSpanned' property, to make the column to have the size of the whole table. e Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-12Display the correct metric SAC rate in divelistGravatar Dirk Hohndel
We were doing integer math by mistake. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12Change title of dive download formGravatar Benjamin Fogel
The title of the form to download dives from a computer was simply "Form". Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-10Added a slot to set the full time of the dive planGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Added a simple "TextEditor" in the graph, for a plan mode.Gravatar Tomaz Canabrava
Added a simple TextEditor in the graph for the 'Dive Plan' mode, this text editor is very simple, so the user can double click on 'depth' or 'duration' to set the depth or duration of the dive. Since this was a test, only 'duration' was done, and I'll add duration on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Added a 'Plan' mode and a 'Dive' mode on the profile.Gravatar Tomaz Canabrava
Added a 'Plan' mode and a 'Dive' mode on the profile. Those modes tell the application what can be done: Plan - the dive's dinamyc and can be changed, 'Dive', the dive is fixed ( most probably downloaded from a dive computer and it's readonly. ) - now I need to properly populate stuff. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Added the option to create a new dive from the menu.Gravatar Tomaz Canabrava
This patch adds a dive from the menu, it's the dive that will be used to add a new dive plan. so, I also removed the option 'add imput plan' from the menu. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Implemented the movement of the ToolTip by Hand.Gravatar Tomaz Canabrava
Reimplement the movement of the tooltip by hand, we were adding / removing childs of the tooltip quite often, wich broke the movement of the item using the default behavior, aparently Qt uses a cache of the transformation of the item, assuming that the bounding box of it will not get modified while dragging. wich in our particular case, is a falacy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Save / Restore toolTip information position on the Profile when switching dives.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Fix memory leakGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Moved the 'create fake dc' to it's own function in device.cGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-09Merge branch 'fileopen' of github.com:heliocastro/subsurfaceGravatar Dirk Hohndel
2013-06-09Ticket 127 - Repopulate context menu on preferences changeGravatar Helio Chissini de Castro
Ticket 127 mention that context menu is fixed on imperial mode, which is partial true. Context menu only not have the changes on header model updated when preferences are chenges during execution. Hard to note because if program is closed and opened again, the context is initialized properly. Since actions aren't bound to the header model, we need iteract of current items and change the title. Signed-off-by: Helio Chissini de Castro <helio@kde.org>
2013-06-08Fix webservice download dialogGravatar Dirk Hohndel
We need to close the dialog after applying what was downloaded, and we should not try to delete the manager in case of cancel (as that reliably causes the SIGSEGV. Suggested-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-08Sort 'dive number' column by date, not numberGravatar Linus Torvalds
Ok, so this sounds insane, but it fixes our currently broken sorting of dive trips vs plain dives not in trips. The reason for that is simple: the dive trips are sorted by date, but that's column #0, and for plain dives is the dive number. So currently the trip-vs-dive sorting looks at the date of the trip, and compares that to the number of the dive. Since the date of the trip is expressed as seconds-since-1970-in-UTC, unsurprisingly the dive number is generally much smaller (even for some very avid divers ;), and so the plain dives end up sorting way at the bottom (or at the top, if you do "oldest trips first" Since the dive number *should* sort as the date, this stupid attached patch just makes us return the dive date instead. Now, there are other possible solutions to this: - make the date of the dive be column 0, and make the dive number be column 1. Quite frankly, while more logical for this particular problem, it probably sucks as a solution. We do want to have a column we can sort dives by that is date-based, but doesn't include trips. And while the dive number *should* sort identically to the date one, the fact is that you can have dives without any numbering, so it doesn't. In contrast, all dives have dates, and sorting numbered dives by date should still result in sane behavior (and if it doesn't, then the insanity comes from the dive numbering, and odd sorting is the fault of the user and indicative of a problem) - We could possibly do something magical like sorting dives by number when they are inside trips, or when no trips exist at all. But then we'd sort by date when there are trips and the dive is outside the trip. But quite frankly, that just sounds insane. So on the whole, I don't love this patch, but it seems to be the least confusing of the possibilities. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>