summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2013-05-22Re-enable dive computer selectiomGravatar Dirk Hohndel
This had been disabled by some redraw optimizations in commit 81406b80c6ec ("Fix loading a second dive, after the first file was loaded."). We need to redraw the plot not only if the dive changed but also if the selected divecomputer changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Start editing Dive Notes when clicking on Rating or VisibilityGravatar Dirk Hohndel
Those widgets respond to MouseButtonPress and not FocusIn. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Merge branch 'fixResizeEvent' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-22Small fixes to the modelGravatar Dirk Hohndel
Prevent a crash when no cylinder type description is set. Correctly calculate the cylinder volume. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Get the math right for cylinder model setData functionGravatar Dirk Hohndel
This is a fun one. We only want to mark the divelist changed if the user actually changed something. So we try really hard to compare what was entered with what was there and only if it is different do we overwrite existing values and record this as a change to the divelist. An additional challenge here is the fact that the user needs to enter a working pressure before they can enter a size (when in cuft mode). That is not really intuitive. We work around this by assuming working pressure is 3000psi if a size is given in cuft - but then if the user changes the working pressure, that changes the volume. Now going back and changing the volume again does the trick. Or enter the working pressure FIRST and then the volume... This also changes the incorrect MAXPRESSURE to WORKINGPRESSURE and uses the text WorkPress in English (Gtk code used MaxPress which was simply wrong - this is just the design pressure or working pressure, not some hard maximum. In fact, people quite commonly "overfill" these tanks. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Fixed update the plot as we resize the view.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-22Removed the unused add cylinder and add weigthsystem dialogs.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Removed unused debug, and set the correct data on the delegates.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-22Added the trash.png file that was missing.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Actually remove cylinders and weightsystems from the data structuresGravatar Dirk Hohndel
The UI had only stubbed this code out. This adds the implementation of the helpers and calls them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Added a Delegate for editing CylindersGravatar Tomaz Canabrava
Now when you edit 'Type', a drop-down list will appear and will enable you to choose from it's contents. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22Shorten the 'set location' textGravatar Dirk Hohndel
The old text was quite verbose and caused issues on smaller screens Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Merge branch 'randomFixes' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-22Added basic editing functionality for Cylinders and WeigthsystemsGravatar Tomaz Canabrava
This patch adds basic editing functionality for Cylinders and Weigthsystems, it still doesn't use delegates to show the data to the user in a better way, and it does not take in consideration user preferences yet, but it's a starting point. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>