summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
AgeCommit message (Collapse)Author
2013-11-14Sort the dive table after adding a diveGravatar Dirk Hohndel
This commit scares me. Any pointers to dives or indices into the dive table... anything like that is invalid after we resort the table. Well, not technically "invalid" (as in bad pointers), but after re-sorting the table these will possibly not be pointing at what we expected. This starts with the selection being "wrong" after we add a dive that isn't the last dive (once we click OK the chronologically last dive will be selected). But of course without doing this, our #1 assumption about the dive_table is broken. The dive_table is supposed to be in chronological order. Best advice of course would be "don't enter dives out of order" - but of course that's not realistic. Fixes #234 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14Handle tank data correctly in profile editing mode for manually added diveGravatar Dirk Hohndel
This is subtle. Normally you would expect someone to edit the tank data by simply clicking on it in the equipment tab. But a user could conceivably edit the tank data after clicking on the profile editing button instead. This works now as well. This also addresses the issue that start and end pressure were not shown in profile editing mode. Fixes #235 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14Maintain the selection when aborting "dive add"Gravatar Dirk Hohndel
We remember what was selected before and restore it. Maybe there's a more "Qt way" of doing this, but my implementation appears to work :-) Also remove unconditional debug output that snuck into an earlier commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Don't overwrite the new cylinders when adding a diveGravatar Dirk Hohndel
We carefully assembled the correct data in the cylinders - don't replace that data when manually editing a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Correct behavior when adding a dive to an empty list and canceling the addGravatar Dirk Hohndel
We need to leave the widget disabled and the date / time and coordinates cleared. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Partially revert d72c69db7a49f and fix its errorsGravatar Tomaz Canabrava
In the offending commit a QWidget was changed to QTableView, but only in the header - and thus making avaliable all method calls, but the initialization of the widgets was still a QWidget, and nothing of QTableView was used besides an incorrect call to setColumnHidden. This commit fixes that by using the view() method provided by the TableView implementation which returns the true QTableView that should be used for specific nitpicking, like hidding columns. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Only auto-complete gps information when empty.Gravatar Michael Andreen
Previously gps information was always overwritten, unless the user had modified it in the current editing session. This causes problem with some use cases, like when coordinates are provided before the location name by the companion app. Now gps information is only overwritten when it is: - Empty - Auto-completed in the current editing session. (When the user hits accept it is considered hand-edited.) Signed-off-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Make gas selection for add dive workGravatar Dirk Hohndel
This now offers the correct gases for which we have cylinders defined. For both the planner and add dive we still don't end up with the correct cylinders in the resulting dive. But that's for another commit to fix. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Handle add dive cancel correctlyGravatar Dirk Hohndel
This should leave the program in a consistent state after add dive was cancelled (and do the right thing in case the dive list was empty). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12First steps to make add dive work with the correct infrastructureGravatar Dirk Hohndel
This just makes sure that we do the right thing with the staging drive, that we don't mess up the selection, the we are smart about using our helper functions, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Add depth colum to cylinder modelGravatar Dirk Hohndel
To make the planner work this adds a new column to the Cylinder widget (depth - for the depth at which we want to change to a certain gas during deco). This also tries to hide that column in the equipment view and hide the start/end pressure columns in the planner view. Oddly that fails :-( Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11Stop clicks on the globe from changing dive list selection while editingGravatar Dirk Hohndel
This caused us to get royally confused when manually adding a dive and trying to set the location through the marble widget. Fixes # 229 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10Show a cylinder widget in the dive plannerGravatar Dirk Hohndel
This is intended to allow the user to provide the gases / cylinders that she will be diving with. With that information the planner can warn the user about insufficient gases, but more importantly it can show relevant gases in the gas select drop down. Right now the add cylinder button doesn't add a cylinder - that's a problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Merge branch 'addDiveGasFix'Gravatar Dirk Hohndel
2013-11-09Removed inconsistency when user tried to add dive while planning.Gravatar Tomaz Canabrava
The user could add a dive, and in the middle click on the 'plan' button. Since we didn't cared about that on the widget, a lot of inconsistencies could occour. this fixes that by setting a flag on the Planner, that has now three modes: nothing, plan and add. (maybe in the future an edit mode will be valid too.) If in 'NOTHING' mode, user can enter the addition, edition and planning. If in any other mode, user can't do a thing. The mode gets back to NOTHING when user accepts or cancels a plan / add / edition. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08Be consistent when passing around gas data in the plannerGravatar Dirk Hohndel
We need to make sure that the correct segment has the correct gas assigned to it - and that those gases are correctly tracked when editing a manually added dive as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07Fix for equipment tab cancel button bugGravatar Taiane Ramos
On equipment tab, when editing a cell and then clicking on cancel button, it would delete all the cylinders table. Now it performs the original behaviour of recovering the original value of the cell and don't delete the table. Signed-off-by: exhora <exhora.tat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07Hide temperature fields when displaying / editing trip dataGravatar Dirk Hohndel
And show them again when displaying a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05Hide TadWidget and Label when editing a tripGravatar Maximilian Güntner
Also hide ui.CoordinatedLabel when editing a trip, since ui.coordinates is hidden. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05Show a different message when editing more than one diveGravatar Dirk Hohndel
I still wonder if we have all the semantics correct for multi dive editing. This will need more testing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-02Added a custom widget for tagging divesGravatar Maximilian Güntner
A custom tag widget has been added to MainTab. Tags are seperated by a comma ",". The implementation supports escaping a comma by using "\,". While typing, the widget supports the user by suggesting tags using a QCompleter. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-01Enable undo for the Edit mode on Added Dives.Gravatar Tomaz Canabrava
This enables undo for the edit mode on added dives, it uses the premade backup to fill the old dive with data. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01Enable editing a dive that was manually entered.Gravatar Tomaz Canabrava
This patch enables editing a dive that was manually entered, it doesn't cover dive plans yet because on the plan I need to figure out what are the 'user-entered' points, and what are the algorithm point. and I feel lazy. =p One last thing that's missing is to revert the dive to the previous condition if the user cancels the edition, currently canceling and applying ok is the same thing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-10-24Subject: [PATCH] No need to center on dive after editing coordinates.Gravatar Michael Andreen
This is done automatically now. Signed-off-by: Michael Andreen <harv@ruin.nu> 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>
2013-10-10Added salinity to the Dive Info tab.Gravatar Patrick Valsecchi
Took the opportunity to remove some copy&paste. Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-08Fix crash when cancelling 'Add Dive'Gravatar Dirk Hohndel
If selected_dive is -1 get_dive(selected_dive) will return NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Remove info.c/info.hGravatar Dirk Hohndel
The one remaining helper function in there was moved to maintab.cpp (which was the one remaining user). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Maximum depth of a dive/a series of dives is not show correctlyGravatar Benjamin
After selecting a dive or a series of dives, the "Stats" tab shows the minimum, average and maximum stats for the selected dives. The "Depth" section does not display the correct value for the maximum depth. Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Parse GPS text in C++ and re-implement GPS changed checkGravatar Dirk Hohndel
This is SO MUCH easier then the convoluted and fragile C / glib code it replaces. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06First steps towards removing glib dependenciesGravatar Dirk Hohndel
- remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04Correct spelling of "weight" throughout the code.Gravatar Benjamin
"Weight" was misspelled "weigth" in several places in the code and comments. Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Make the classes generated by uic be real members of our classesGravatar Thiago Macieira
This means we don't have to new/delete them, which is a waste of overhead. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Include the ui_*.h headers in the main headers.Gravatar Thiago Macieira
This means we can also remove the forward declarations. This is the first step in removing the memory allocation for the ui sub-classes. Without the second step, this commit is just making the compilation time increase for no good reason :-) Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-01Fix weight adding in the Qt UI & fix the header height for tablesGravatar Patrick Valsecchi
Fixes #203 Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27Hack to make the subsurface work on Gnome3 shellGravatar Tomaz Canabrava
The Gtk+ style on the Gnome shell is somewhat broken on Qt for some reason. This hack pokes the system, checks if it's running gnome-shell, and if the current style is gtk+ ( I couldn't just check for gtk+ since it worked on XFCE and other Gtk based enviro ments. so a double check is needed. ) then I changed the Pallete of the affected widgets by hand. not a pretty hack but worked. [Dirk Hohndel: redid the patch to be simpler and more consistent] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-26Fixed the display of Subsurface in Smaller ScreensGravatar Tomaz Canabrava
This patch fixes the display of subsurface in smaller screens by creating ScrollArea containers that are now englobbing each of the Tab-pages and the Planner Widget. Some of those widgets were pretty big by the amount of things on it and it was too big for small ( 14" and 15" ) screens. This seems to fix it, and looks good both on Gtk+ and Oxygen styles. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26Only set documentMode on tab if in Oxygen style.Gravatar Tomaz Canabrava
This is much better looking in the Oxygen style, and on the other styles it looks like crap - so let`s not use that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26Cleanup the prettyness of subsurface on Gtk+ style.Gravatar Tomaz Canabrava
Fix some stuff concerning the pretyness of subsurface while running on Gnome and XFCE enviroments. This is the kind of stuff that I really didn`t want to put on the code but sometimes it`s for the best. this makes the MainTab much more bearable. There are still things to fix, like the size and positioning of some of the icons. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Hook 'Add' from cylinders and weigths to enable EditionGravatar Tomaz Canabrava
This code hooks the plus button on both cylinders and weigthsystem tables to trigger the enableEdition() and thus the work done when you click on + will be saved / discarted when the user cancels the plan or accepts it. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Code cleanupGravatar Tomaz Canabrava
Fixes a couple of whitespace issues. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Set the Cylinders and Weigths to all selected dives after pressing 'Accept'Gravatar Tomaz Canabrava
This bit of magic actually performs the save on the dive list for the changed weigths and cylinders, it will set the cylinders only if there's a change on the cylinder model, and it will set the weight only if there's a change in the weigth model. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Code cleanup - create a method for cleaning the Palette.Gravatar Tomaz Canabrava
Code cleanup, create a method for cleaning the palette, less code is better in this case. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Only mark dive list as changed if 'Accepted' was clicked.Gravatar Tomaz Canabrava
The old code marked the dive list as changed on any of the changes in the model, this was incorrect since the user could just cancel the edition, wich means that the divelist shouldn't be marked as changed at all. when the user clicks on'accept', and the item is indeed changed on the dive list, then we mark_divelist_changed to TRUE Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Enable Edition by clicking anywhere on the Cylinders and Weigths.Gravatar Tomaz Canabrava
This patch enables edition on the selected dives as soon the user press delete or any other column on the Cylinder / weigthsystem. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Revert to the old values of Cylinders and Weigthsystems on cancelGravatar Tomaz Canabrava
This patch enables canceling the edition of cylinders and weigth systems, as soon as the user press cancel, the old values are re-populated on all selected entries. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Created a placeholder for the Equipment Edition.Gravatar Tomaz Canabrava
This creates a placeholder for the equipment edition, it will ease the 'revert' and 'apply' when editing multi dives. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-24Disable info widget when canceling 'add dive' for a first diveGravatar Dirk Hohndel
One more corner case that we cover correctly. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-23Call refreshDisplay() after editing a diveGravatar Dirk Hohndel
We now can change the dive date and the order of dives could have changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Disable the info widget when no dive is selectedGravatar Dirk Hohndel
This solves the odd case when closing the data file that clicking in the info widget caused the input fields to respond and the little warning icon to show up. Also some minor whitespace cleanup for readability. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>