aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
AgeCommit message (Collapse)Author
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>
2013-09-22Hack to clear the date when no dive is displayedGravatar Dirk Hohndel
This mostly happens with no XML file or when closing the current XML file. Sadly the user still can click on the empty date field (even if nothing else is active on the screen) and a date reappears. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Fix crash when closing the data fileGravatar Dirk Hohndel
Only dereference the dive pointer if there actually is a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Fix crash when adding dive to empty dive listGravatar Dirk Hohndel
Only look up the dive number of a previous dive if there is a previous dive. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Fix enabling info widget when closing a diveGravatar Alexandre Dupas
If the close action is triggered while there is no current dive (empty history), the info widget is enabled. To avoid this behavior, we only enable the info widget during update if the dive index is valid. Signed-off-by: Alexandre Dupas <alexandre.dupas@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21Allow editing of date & time and air & water temperaturesGravatar Dirk Hohndel
Add two more rows to the widget - this is getting quite busy. There still is some weirdness where the focus isn't returned where it should be and a few other details, but overall getting there. Added helper functions to parse a temperature and to deal with the timezone offset - with that latter one I also fixed the time offset bug in the planner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20Adding a dive changes the dive listGravatar Dirk Hohndel
Duh. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20Simplistic solution to add dive number to dive addedGravatar Dirk Hohndel
If this is the last dive and if the previous dive had a number, give this dive the next number. Of course there are a couple of issues with the current implementation. We have no way of changing the date / time of the added dive, so we KNOW that it will be the last one. But I put that check there so that once we add the ability to change the date / time (and hopefully remember to then move the dive to the correct spot in the dive_table), we only assign a number if it is the last dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Merge branch 'addDive'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Hook up cancelling out of adding a diveGravatar Dirk Hohndel
This was surprisingly easy - which of course has me worried that I'm missing something that I should do when cancelling out of this dialog. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Hook up adding a diveGravatar Dirk Hohndel
This gets things mostly right. It creates a dive and uses the planner widget to create samples which are copied into the dive. It fills in some reasonable defaults (DC model, timestamp), but doesn't allow editing the timestamp (or the temperatures and air pressure). On accept the planner gets reset and the dive appears correctly in the dive list. Cancel still needs to be handled. And I bet there are many subtle bugs lurking here and there. But it's a start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Fixes for gps coordinates handling.Gravatar Michael Andreen
Reset coordinates properly when clicking undo. When auto-completing location, only copy coordinates if they have not been manually edited. Set the background to red if the gps coordinates won't change, e.g. there is a parse error, the change is too small or only whitespace changes. Signed-off-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Fix updateDiveInfo to clear coordinates when called with invalid diveGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Added the Message and the Buttons on the Equipment TabGravatar Tomaz Canabrava
Added the Message and the ok/cancel buttons on the Equipment Tab, they don't control the Equipment edition yet, but already does the same as the Notes one, Now I need to merge the other part - the actuall Equipment Edition. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-18Add a Warning icon on the changed tabs, for edition of dives.Gravatar Tomaz Canabrava
Adds a Warning icon on the changed tabs, this is important as usability, for you could change something on the 'notes' tab, change the tab and did't realized that something was changed ( by forgotting or something ), then clicking on the cancel button. so now there's a friendly reminder that you actually changed something. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-18Good deal of Code Cleanup for the maintabGravatar Tomaz Canabrava
Some cleanup was needed in the MainTab code for ages, now the Edition / Cancel / Ok of the Notes tab is way more intuitive on the code level. This is needed to support multidive edition on the Cylinders and Weigths too, since it's a bit more complicated, I didn't want to start with a Spaguetti Code. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-17Improved handling of latitude and longitude.Gravatar Michael Andreen
Coordinates are copied when auto-completing location, they are also displayed and editable in maintab. Signed-off-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-16Merge branch 'multiDiveEdition' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: qt-ui/maintab.h
2013-09-02Code Cleanup: Merged the three TableViews shared codeGravatar Tomaz Canabrava
Merged the shared code for the three table views into one code, this way less code is needed if we need to construct another tableview in the future. I still need to clean some of the models too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-28Made the TableViews share a bit of code, code cleanup.Gravatar Tomaz Canabrava
Made the tableviews share a bit of code, and code cleanup. The tableviews for Cylinders, Weigth and Dive Planner Points now shares the CSS and I also implemented the save / load methods for the dive planner points, so the functionality is mostly done on the vieualization side. - since we are now using three tables maybe it's a better idea to create one class SubSurfaceTable that knows how to handle saving / loading of the columns... TODO for the future. ;) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16Good deal of code cleanup.Gravatar Tomaz Canabrava
This is a bit of code cleanup that I'm not sure that will pass, since it's all macro-based, but I don't have a thing against macros at all. Sometimes they helps us keep a better and cleaner code base. I think I managed to remove around 120 lines of code, wich isn't much, but I replaced it by 14. and the code is now easyer to maintain, so hooray. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16Change bg of edited parts of the dive on the interfaceGravatar Tomaz Canabrava
Change the background color of edited parts of the dive on the interface. Specially util if you are editing multi dives in a single step, and went to eat something or did anything else for five minutes, then come back and don't quite remember what did you changed. now it's in a cute yellowish background. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16Enable Multi Dive Editing.Gravatar Tomaz Canabrava
This patch enables multi dive editing on the selected dives. It's a bit of big patch where I reworked how it worked since it was written just for a single dive. this means that this can introduce bugs - I'v tested it quite a bit but a thing could slip thru my fingers. :) How this is supposed to work: Select a few dives that you want ( one or more ) then click on the field that you wanna edit / multi edit, and press 'accept'. *only* the edited field will be modified thru all dives. Next patch - I'll change the bg color of the edited fields.A Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13Fixed a bug where the auto-completion would not work via commandline.Gravatar Tomaz Canabrava
Fixed a bug where the auto-completion would not work via command line, I fixed it by reloading the information of dives when a dive file is open via command line or via UI. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13Added completion for buddy, divemaster, location and suit.Gravatar Tomaz Canabrava
Added completion for buddy, divemaster, location and suit. The completions uses some models that I created in the last commit - everytime that a divelog file is loaded, it creates a list of completion items. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13Fixes showing the labels of divemaster and buddy after a trip selectionGravatar Tomaz Canabrava
This patches fixes showing back the labels 'Dive master' and 'Buddy' after a trip selection was done, then back to single dive selection. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13Makes the 'auto' edition behave in a better way.Gravatar Tomaz Canabrava
This patch makes the auto editon behave in a better way, now you can scroll the notes widget without marking it as editable, and also adds a bit of code cleanup, and a better logic for editing the other widgets. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-17Adds Single-Click editions on the TableViewGravatar Tomaz Canabrava
This is a linus request, adds a Single-click edition on the tableview to make it more consistent with the rest of the interface where edition is permitted. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Coordinate some mark_divelist_changed() callsGravatar Lubomir I. Ivanov
1) Make a call mark_divelist_changed(TRUE) when the user adds new cylinder or weight entries. 2) Call mark_divelist_changed(FALSE) in MainWindow::on_actionClose_triggered() so that each time after a file is closed or a new one is created it does not ask immediately the user for a save confirmation for the blank file/divelist. 3) Call mark_divelist_changed(TRUE) once a dive's geo location has changed in GlobeGPS::changeDiveGeoPosition(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Better positioning of the plus sign icons in the Equip. tabGravatar Lubomir I. Ivanov
There are a couple of problems with said icons: - When the Equip. tab is first seen, no relative event is monitored so that the correct position is updated and the icons are positioned. To solve that we connect the signal MainTab::currentChanged(int) and call MainTab::equipmentPlusUpdate(). - When the info-profile QSplitter resizes with a snap towards/from the edges of the main window, no resize handler is called such as MainTab::resizeEvent(). A solution is to monitor the resize of the info-profile splitter with MainWindow::on_infoProfileSplitter_splitterMoved() and again call MainTab::equipmentPlusUpdate() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>