aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
AgeCommit message (Collapse)Author
2014-03-03Whitespace cleanupGravatar Dirk Hohndel
Minor change to the perl postprocessing script and resulting changes to the affected source files. This deals with two issues: - "foreach"-like structures were not always treated correctly - some longer calculations that ended on "+ constant" were reformatted in a rather unatractive manner In one source file (divelist.c) I ended up adding braces to the sources... trying to cascade the indentation further down without having the block there seemed a lot more trouble than it's worth. 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-20Clear edit mode for manually added divesGravatar Miika Turkia
Edit mode must be cleared for manually added dives as well when one hits cancel or save. Fixes #437 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Replace mainWindow() with MainWindow::instance()Gravatar Boris Barbulovski
C++ style of accessing single instance class object. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12More variable scope confusionsGravatar Dirk Hohndel
Don't have nested loops with the same loop variable. Really. Even if it is legal C++. And don't declare local variables more than once. This will only cause issues later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Fix ATM-vs-bar confusionGravatar Linus Torvalds
SAC should be calculated in relationship to surface pressure, not "1 bar". I also realize that we have a few other cases where we do the same mistake: the partial pressure calculations do things like po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive); which is wrong as well - the partial pressure is also relative to standard atmospheric pressures. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Migrate MainTab models(QStringListModel)Gravatar Boris Barbulovski
Migrate MainTab models from static xxxCompletioModel::instance() to private MainTab variable members. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09maintab.cpp improvements.Gravatar Boris Barbulovski
* Initialize(lazy) MainTab::multiEditEquipmentPlaceholder struct Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-26Disable the switching depth column for cylindersGravatar Dirk Hohndel
Since the planner is disabled this column isn't needed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22Allow manually added dives to have their location changedGravatar Robert Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Enter dive edit mode on divemaster field focusGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Expand tags approach to divemaster fieldGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Use focus policy setting from widget constructorGravatar Sergey Starosek
Since we use tags widget for several input fields (tags, buddy, divemaster), it makes sense to keep focus policy setting in one place. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Ignore mouse wheel events on tags widgetGravatar Sergey Starosek
This prevents tags widgets (dive tags and buddy) from grabbing focus on mouse wheel events but allows entering dive edit mode on mouse click. It was attempted earlier by Dirk (commit d117beca), but edit mode did not work properly. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Remove duplicate method callGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Fix some memory leaks.Gravatar Boris Barbulovski
Memory leaks were caused by broken parent/child relations. 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>
2014-01-16Enter dive edit mode on buddy field focusGravatar Sergey Starosek
Seems it's related to bug #390. Not sure whether this fix is correct. See #390 Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Extend tags model to Buddy fieldGravatar Sergey Starosek
This doesn't change storage format. Instead it parses buddy strings and converts them to string list which is supplied to tags widget. This feature was requested in ticket #311 Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15Don't downgrade tags to AsciiGravatar Anton Lundin
Use Utf8 everywhere, and toAscii is depricated in Qt5 Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15Convert to TRUE/FALSE to stdbools true/falseGravatar Anton Lundin
I had problems with this one on Qt5. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Add CaseInsensitivity to all of the completers.Gravatar Tomaz Canabrava
Just one of the completers had Qt::CaseInsentitive set, setting for all of them. Fixes #400 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03Maintab: prevent a segfault in the 'Equipment' tabGravatar Lubomir I. Ivanov
When a dive contains no cylinders, clicking the '+' button could SIGSEGV if current_dive->dc.model is NULL. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03MainTab location coordinates displayed in ISO6709 formatGravatar Tim Wootton
changes the location coordinates display in the main tab to use ISO6709(2008) Annex D suggested format. Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Clear equipment tab for trips displayGravatar Dirk Hohndel
And prevent the user from editing equipment in trip edit mode (those edits are both meaningless and of course will be ignored once we save the changes to the trip). Also moved some code for setting up tanks, weights, tags, etc, into the "this is not a trip-edit" part of the updateDiveInfo() function. Fixes #392 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Handle editing a manually added dive consistentlyGravatar Dirk Hohndel
Regardless of whether the user clicks in the info tab, makes a change to equipment or starts by editing the profile (i.e., clicking on the little penguin), we should get into the same state and behave the same way. This means that when editing a manually added dive we are always in editMode == MANUALLY_ADDED_DIVE - and editMode == DIVE means we are editing a dive that came from another source. Fixes #379 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-25Don't reset panels while editing a diveGravatar Dirk Hohndel
MANUALLY_ADDED_DIVE is a different flavor of ADD mode (in both cases we are in "planner mode"), so bail out for that as well. See #379 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Fix subsurface on dark themes.Gravatar Tomaz Canabrava
This patch fixes my last annoyances with dark themes on subsurface. It changes the background color of the edited info tab to a darker yellow if the theme is dark, and a light yellow if the theme is light. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-23Improve GPS string handlingGravatar Dirk Hohndel
This adds support for two more GPS coordinate formats and also fixes a couple of issues with the previous implementation. We used to only support full degrees and decimal minutes. We now also support fully decimal and degrees, minutes and decimal seconds. The previous implementation would color the input field red if either it couldn't parse the string, or if it was able to parse it but it was the same as the previous location. That's misleading. The previous implementation also changed all gps coordinates to the new coordinates in a multi-dive edit - instead of just changing the ones that are the same as the master dive. Fixes #387 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20When saving / canceling edition, focus back to the Dive ListGravatar Tomaz Canabrava
When saving / canceling the edition, focus was still being kept on the current selected widget. not good. :) this patch makes the DiveList keep the focus after a edit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20Fix the cursor problem on the TagWidgetGravatar Tomaz Canabrava
The problem was the Focus Prevention system on the EventFilter. Instead of that we can pass the setFocusPolicy ( strongFocus ) that ignores the mousewheel. simpler and cleaner. Fixes #376 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20Simplify the code by removing a few options from the if.Gravatar Tomaz Canabrava
There was some options on the 'if' that didn't really belonged there, so I create a if before those to quit earlier if the condition is true. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-19Fix a missing parentheses warningGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-16Use UTF-8 for text strings.Gravatar Michael Andreen
Fixes #371 Signed-off-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-14When editing multiple dives, only copy the cylinder typeGravatar Dirk Hohndel
Previously we would overwrite the gasmix as well as start and end pressure even when editing multiple dives, which clearly is wrong. Fixes #364 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-13Improve MainTab behavior when using the scroll wheelGravatar Dirk Hohndel
This gets the behavior close to what we really want. - scroll wheel no longer enters edit mode when over the tabWidget - scroll wheel doesn't modify dateTimeEdit, nor does it enter edit mode - scroll wheel still scrolls both the notes and the full widget The only oddity is that when clicking on either the dateTimeEdit or the tabWidget we don't immediately turn on the 'being edited' warning (as we do for all the other widgets). For those two widgets the user has to press a key before edit mode starts. I think this Fixes #176 Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Ideas-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Save and reestore scrollbar position on editing the items.Gravatar Tomaz Canabrava
Save and restore scrollbar position on editing the dives. I think this is not the best place for it, but I'll leave it here for a while untill I find a better place. Fixes: #343 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10Fix selection tracking bugGravatar Dirk Hohndel
When trying to remember a newly manually created dive across the sort_table() call I abused the dive->selected flag and didn't clear it out afterwards (most likely thinking "hey, I'm calling selectDive() on this anyway"). This caused the UI code to correctly mark the dive as selected, but when it called down to the C code to keep the internal data structures in sync, that code didn't update amount_selected as it thought this dive had already been selected. And that caused other parts of the code to get confused, which manifested for example in the failed upload to divelogs.de. So this clears out the flag after abusing it to remember a dive. Maybe we should add a 'remembered' flag instead, but for now this fixes the issue. Fixes #351 Initial-fix-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-09Use implicit zero initialize for the whole array.Gravatar Anton Lundin
Clang yelled about it, and it looks prettier. It also felt kinda strange to explicit initialize the first element to zero and the rest to zero implicit. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07Fix typo in colorGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04Make Gnome3 be bearableGravatar Tomaz Canabrava
The layout of Subsurface on Gnome 3 had a few flaws, since Qt and Gtk are not really compatible. This implements a CSS that makes the use of Gnome 3 more pleasant to the eyes. Fixes #318 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Attempt to fix the 'click goes to 0,0' thing on the globe.Gravatar Tomaz Canabrava
This patch attempts to fix the 'click goes to 0,0' bug on the globe. it moves a bit of code around and I particulary don't like the way that we are dealing with 'EditMode', I think I'll refactor that for 4.1. We are alredy dealing with a bunch of states, maybe a State Machine will help on removing code-complexity. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Select the newly added dive after adding it.Gravatar Tomaz Canabrava
Selects the newly added dive after adding it, it uses a rather ugly hack that forced a unselected dive to be marked as 'selected' so we can remember what was the newly added dive, and select it after. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Don't call fixup_dive when editing a tripGravatar Dirk Hohndel
When editing a trip the key for the notesBackup is NULL. Don't call fixup_dive() on that... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Make sure the save/cancel message is always shownGravatar Henrik Brautaset Aronsen
An addition to the "Move dive notes edit message above the scrollable widget" commit: Make sure the save/cancel message is always displayed on top, regardless of which tab is selected. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02Make dive edit message box tex more conciseGravatar Dirk Hohndel
commit 3c064d58578f ("Make the message when editing a dive fit better") kinda fixed the wrong problem. A better solution was suggested - just drop the instructions regarding Cancel / Safe. It's quite obvious what to do mow that the buttons are part of the message. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02Make the message when editing a dive fit betterGravatar Dirk Hohndel
This should keep the message widget visible without horizontal scroll bar, even on fairly small screens. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02Removed The button box from mainwindow, buttons are now on the message.Gravatar Tomaz Canabrava
The button box on the bottom of the window made it a bit cluttered on small screens, this patch uses the window of the MessageWidget to show the butons - this way less space is used and things are better spaced on screen. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02Fixes Setting the dive-location via the map.Gravatar Tomaz Canabrava
This patch adds a context menu to set the dive location via the globe, being the dive with a coordinate or not. It also fixes setting the dive location on edit mode. Fixes: #315 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-01Reflect air and water temperature changes in dive infoGravatar Dirk Hohndel
When editing air or water temperature, you are actually editing the information in the active divecomputer structure. But the Dive Info shows the summary data created from the temperature data in all dive computers. For most people who will only ever have one divecomputer per dive this may seem like an artificial distinction, but it's very important if you track more than one computer. So in order to have an edit reflected in what's shown, we must redo the "summary creation" for data from the different divecomputers into the summary fields of the dive. Fixes #313 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>