summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-05-30Code layout changesGravatar Dirk Hohndel
Tomaz convinced me (with help from Linus) that it might be a good idea to go with the compacter "single line" case statements in some specific instances where this makes the code much more compact and easier to read. While doing that I changed Linus' code to do 'retVal = ...; break;' instead of just 'return ...;' - this is more consistent and makes debugging a little easier. And while doing all that, I also cleaned up divelistview.cpp a little bit. And removed an unused variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Code Cleanup.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29Fixed the regression of selection not being stored from table to treeGravatar Tomaz Canabrava
This fixes the regression that I caused in the last commit, where the selection was being correctly reestored from tree-to-table, but it was incorrectly being restored from table-to-tree. I also added a bit of speedup on the view while changing columns. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29More work on bug 111, Sorting works as it should.Gravatar Tomaz Canabrava
Sorting is now working as it should, changing from table to tree, keeping the selection from table to tree ( but there's a regression on tree to table conversion, I'll try to fix it in the following commit. ). this commit also cleans a lot of boilerplate code that I wrote to bypass a graphics bug, that I seem to have correctly fixed in this version. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29Reimplement the Sort method to change from Tree / List, and remember selection.Gravatar Tomaz Canabrava
Things are working as they should, but I hit on -probably- a Qt bug that makes painting on the table view a bit weird ( it only updates the painting by moving the mouse around ). I'll try to fake the mouse movements in a couple of commits after this one. There's also a few columns that are not being correctly sorted, probably something to do with the SortRole. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29Add a "sort role" for sorting the dive listGravatar Linus Torvalds
By default, sorting is done by the display role, but then we end up sorting by the string we display, which is almost always the wrong thing. So this adds a new "SORT_ROLE" that is used for sorting, and then the data lookup can return the raw data we want to sort by. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Merge branch 'bug111' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-29Fix message widget visibility.Gravatar Sergey Starosek
Hide message widget when closing dive with no GPS coordinates. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Fix default zooming.Gravatar Sergey Starosek
Set default zoom level only when at least one dive selected and user have not changed it. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Fix a mistake naming for the da_dk alias localisationGravatar Henrik Brautaset Aronsen
The country code is da, not dk. Suggested-by: Sylvestre Ledru <sylvestre@debian.org> Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Add --version to command line optionsGravatar Henrik Brautaset Aronsen
Displays Subsurface and libdivecomputer versions. Suggested-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Correct the ceiling preference handlingGravatar Dirk Hohndel
Added the red dc ceiling as preference option. Hooked them all up together so the sub-preferences are enabled when the master preference is set (for 3m and red ceiling). Use the options in the profile plotting functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Correctly enable partial pressure threshold entry in preferencesGravatar Dirk Hohndel
The initial state needs to reflect the value of the checkbox. Once the dialog is run, there is a signal/slot connection in the .ui file that keeps things in sync. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Connect preferences to the rest of the codeGravatar Dirk Hohndel
The biggest problem here was that bool has different sizes in C and C++ code. So using this in a structure shared between the two sides wasn't a smart idea. Instead I went with 'short', but that caused problems with Qt being to smart for its own good and not doing the right thing when dealing with 'boolean' settings and a short value. This may be something in the way I implemented things (as I doubt that something this fundamental would be broken) but the workaround implemented here (explicitly using 0 or 1 depending on the value of the boolean) seems to work. I also decided to get rid of the confusion of where gflow/gfhigh are floating point (0..1) and when they are integers (0..100). We now use integers anywhere outside of deco.c. I also applied some serious spelling corrections to the preferences dialog's ui file. Finally, this enables the code that selects which partial pressure graph to show. Still to do: font size, metric/imperial logic Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-28Saves the selection to select it later.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28Switch between Tree / list on column - click.Gravatar Tomaz Canabrava
This patch adds support for switching Tree / List while clicking on a column header. This triggers a sad-painting bug on the list - I guess I'll have to fix it too. I'd apreciate some help on it, tougth. next: keep the selection. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28Adds the code to make the dive list behave like tree or listGravatar Tomaz Canabrava
This code adds the possibility to make the DiveList behave like a Tree or a List, depending on what layout is set. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28Fix the positioning of text in the dive profileGravatar Dirk Hohndel
This had been bugging me for a while - the label texts were all not quite where I expected them to be. I think this looks much better now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Hook up most of the Preferences dialogGravatar Dirk Hohndel
The imperial/metric super setting doesn't have any effect. But changing the individual units now works and is tracked. And causes the display to change after clicking "OK" (but not yet when clicking "Apply"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Repair the saving and loading of unitsGravatar Dirk Hohndel
This way it should work... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Fix colum visibility selection in the divelistGravatar Dirk Hohndel
Several changes: - split the reload of the DiveListView from the reload of the header - don't include the column title in the name of the setting; the title will change depending on the units and localization chosen by the user - rename the slot that toggles visibility to make the code more readable - use setCollumHidden() method to simplify the code - don't save the width of hidden columns (as they would be saved as zero width and can then no longer be enabled) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Apply some CSS goodness to the Cylinders widgetGravatar Dirk Hohndel
Alternating color and some hover highlighting to make things prettier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25We had an extra column in the model for the dive listGravatar Dirk Hohndel
It doesn't appear to be used anywhere, but it shows up in the UI and confuses things. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Try to make the equipment tab more compactGravatar Dirk Hohndel
My attempts to actually set the width of the columns with the SizeHintRole all failed - so I gave up on that and am forcing things to work by making the texts in the header somewhat longer and then resizing to that. Definitely not what I wanted to do - but that plus reducing the font size gives us a much more reasonable / compact look. I really hope that someone else can explain to me how to get the SizeHintRole to affect the width (and not just the height - that part worked just fine) of a the cells in a column. Then we can replace this hack by a much better solution (that won't fail if the translated strings look different). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Set a pleasant zoom level to start out withGravatar Dirk Hohndel
If the user very quickly switches between dives the zoom level sometimes gets reset to be much more "zoomed out" (basically if you change dives before Marble had time to zoom all the way in to the previous dive it will keep whatever was the last zoom level of the animation - I'd consider that a Marble bug). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Find Google maps in Subsurface's source treeGravatar Dirk Hohndel
This way the user doesn't need to move the two folders googlemaps and googlesat around in the filesystem. This only works if Subsurface is started from the build directory - it doesn't work when Subsurface is installed (and it doesn't at all address the need to install these files and bundle them as well). I'd consider this a hack to show how the real solution should work. There is one more part of this that is a hack: Marble no longer searches its default data directory; the path we set replaces the Marble system search path. Sadly, Marble doesn't support paths the way Unix thinks of them with multiple directories, separated by ':'. So this means that Marble no longer finds any of its default icons. For most of them that seems fine as I don't think lacking the icons for "manned_landing", "robotic_rover", "unmanned_hard_landing" or the various types of places of worship that Marble supports is necessarily a big issues for Subsurface, but at least the default_location icon seemed important. And since we now need to carry our own, I replaced the boring circle with a tiny dive flag. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Fix GPS coordinates rounding.Gravatar Sergey Starosek
Better round the coordinates. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25If we disable the compass, we don't need to place it, eitherGravatar Dirk Hohndel
Just completing commit f1a4edc5497d ("Don't show the compass"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Don't show the compassGravatar Henrik Brautaset Aronsen
North is always up anyway. At least that's the way we've done it so far. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Correct the code to enter dive locationsGravatar Dirk Hohndel
The existing code converted the lat/lon to int before multiplying with 1,000,000 (in order to create udeg). Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Avoid marble widget resize when switching divesGravatar Henrik Brautaset Aronsen
The "no dive location" message box was displayed above the marble widget, which made the layout splitter move horizontally. Made the message box as an overlay on the map instead. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Merge branch 'prefsDialog' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-24Added support for a preliminary Preferences DialogGravatar Tomaz Canabrava
Dirk asked me to try to make it more modern, so I used as a base, the Firefox preferences. currently it saves / loads the preferences, and also smits a signal 'preferencesChanged' that should be connected to anything that uses preferenes, via the PreferencesDialog::intance() object. In the future, I plan to make it have a signal / slot for each member that changes. I also moved the icons to a new folder this time, because the amount of icons is now more than just two, and it was becoming messy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-24Merge branch 'googleEarth' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-24Trying the googlemaps integrationGravatar Tomaz Canabrava
2013-05-24Fix usage of temporary QByteArraysGravatar Alberto Mardegan
This commit fixes three different things: - a memory leak in WeightModel::setData() - getSetting() calling strdup() on a QByteArray - a possible usage of memory after deallocation Here's an explanation of the last issue (taken from the mailing list, slightly adapted): toByteArray(), as well as others "toSomething()" methods, returns a new object which the compiler allocates on the stack. The compiler will consider it a temporary data, and destroy it on the next line. So, when one does char *text= value.toByteArray().data(); // line 1 if (strcmp(description, text)) { // line 2 the compiler creates a QByteArray on line 1, calls ::data() on it, which returns a valid char *, and assigns its value to "text". So far, so good. But before jumping to line 2, the compiler destroys the temporary QByteArray, and this will in turn invoke the QByteArray destructor, which will destroy the internal data. The result is that on line 2, "text" will point to some memory which has already been freed. One solution is to store a copy of the temporary QByteArray into a local variable: the compiler will still destroy the temporary QByteArray it created, but (thanks to the reference-counted data sharing built in QByteArray) now the destructor will see that the data is referenced by another instance of QByteArray (the local variable "ba") and will not free the internal data. In this way, the internal data will be available until the local variable is destroyed, which will happen at the end of the {} block where it is defined. Please note that when one uses the data in the same line, one doesn't need to worry about this issue. In fact, text = strdup(value.toString().toUtf8().data()); works just fine. Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Updated build instructions for MacOSXGravatar Henrik Brautaset Aronsen
Added info about switching from the MacPorts +quartz packages to +x11, as well as adding the Marble and Qt dependencies. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Improve wording in askSaveChanges()Gravatar Henrik Brautaset Aronsen
Don't Save/Cancel/Save is less ambiguous than OK/Cancel/Save. Also being slightly more verbose when creating the QMessageBox. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Improve wording on buttons when editing a diveGravatar Henrik Brautaset Aronsen
Use the more familiar Save/Undo instead of OK/reset Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Align the trashbin icon to centerGravatar Henrik Brautaset Aronsen
The bin was slightly to the right Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Correctly add new weight / cylinder types, even when hitting 'tab'Gravatar Dirk Hohndel
We now detect if a weight / cylinder with this description exists and if not add it on the fly. We also remember the additional values (weight and size / workingpressure) for new entries and take the values for these fields into account when autocompleting. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Add weightsystem delegate to enable editing of weightsystemGravatar Dirk Hohndel
This is very much analogous to the way cylinders are implemented. That means that just like with cylinders, if the user enters a new type and hits 'tab' before hitting 'enter', Subsurface will crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Enable the weightsystem info and move the declarations to dive.hGravatar Dirk Hohndel
Having the tank_info declared in models.cpp seemed unintuitive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Remove a compile warningGravatar Dirk Hohndel
It's cleaner to make this a QString, anyeway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Remove obsolete slotsGravatar Dirk Hohndel
The .ui components were removed in commit 0c7a575f7b3b ("Rework on the Equipment tab to make it look more Modern.") but the "automagic" slots were still here. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Allow the CylindersModel delegate to pass data in without unit conversionsGravatar Dirk Hohndel
With this we should have tank editing mostly done. See #122 (it's not quite fixed, we need the equivalent code for weight systems) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23Also changes the size and working pressure of the cylindersGravatar Tomaz Canabrava
this is more a 'Well, this is how we do it' than an actuall good commit. I'm probably using the wrong conversion paradigm ( none ) to convert the data from psi / bar and such, it changes the model with wrong data. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-23Added support for Completing on the Cylinder Type delegateGravatar Tomaz Canabrava
I had to immprove the TankInfoModel with two new methods, insertRows and setData, because the delegate used this model to show what kind of Tanks we are offering. Since the user can enter a new type of Tank, it's important to add this tank to all lists using the delegates. I Also added two new methods on the delegate itself, to correctly shows the data, and set the data on the model. This also will help dirk with a working example on how to edit things while using a delegate. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Implement default dive computer and deviceGravatar Dirk Hohndel
The data is saved in the settings and the correct dive computer (vendor and product) and device are picked when the download dialog is openend. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22The never ending, futile fight for whitespace consistencyGravatar Dirk Hohndel
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>