aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/models.h
AgeCommit message (Collapse)Author
2013-06-06Try to get rid of unnecessary reloads of the dive listGravatar Dirk Hohndel
Don't call refreshDisplay() after preferences change. This strangely somehow leads to a situation where I need to move the mouse over the dive list before changes to the units are reflected. When calling reload() do not force layout change / resort unless that is the intention. Signed-off-by: Dirk Hohndel <dirk@hohndel.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-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-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-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-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-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-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-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-22Removed the unused add cylinder and add weigthsystem dialogs.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>
2013-05-22Added a 'trash' icon on the Cylinders and Weigthsystem modelsGravatar Tomaz Canabrava
So, the Cylinders and Weigthsystems got a new Trash icon, and the interface already intercepts the clicks ( on all columns ) and send this to the 'remove' method on boch models. On the model I'm just filtering the indexes that are not 'DELETE' and creating a stub method to be filled later. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21Added support for visualization the Weigthssystems on the Equipment Tab.Gravatar Tomaz Canabrava
This patch adds support showing and for editing weigthsystems in the equipment tab, so, now the two things that are missing are 'edit' and 'delete', wich are quite easy to do. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21Added the code to show the cylinders from a dive.Gravatar Tomaz Canabrava
i Added the code to show the cylinders from a dive, this code also already permits additions from the interface, so the user can click 'add' and insert what he wants there. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14Clean up some typosGravatar Henrik Brautaset Aronsen
Cosmetic commit to clean up some of the annoying typos in qt-ui Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02Added code to Select a dive, fixed minor annoyances.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01Minor style updatesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01Merge branch 'Qt' into RenderStarsOnTableGravatar Tomaz Canabrava
2013-05-01Added Support for the Trips and Dives on the DiveList model.Gravatar Tomaz Canabrava
Now the list and dives will work in the same way that the GTK version does. The code got changed heavly because the old one was just looking at the dives and didn't worked like a tree. small adaptations on the list view and model delegates because of the changes done on this model. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-01Hook up adding a weightsystemGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01Add data and add functions for WeightModelGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01Use the existing current_dive macro in Qt codeGravatar Dirk Hohndel
Replicating this with the currentDive member seems to make no sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-28Fixed loading the stars when opening with file as argv. minor cleanupGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-27Added support for showing the Stars on the DiveTableGravatar Tomaz Canabrava
For the stars on the dive table I had to rework a bit my StarRating widget, because it used a pixmap for each widget that were created. Not it uses only 2 pixmaps: the active and inactive ones. A new file was created named modeldelegates(h, cpp) that should hold all delegates of the models. For the GTK / C folks, a 'Delegate' ia s way to bypass the default behavior of the view that's displaying the data. I also added the code to display the stars if no delegate is set ( good for debugging. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-22Move model related code from MainWindow and adjustments.Gravatar Tomaz Canabrava
Moves the DiveTrip model related code to models.h The DiveTripModel was implemented in three parts: DiveTripModel.h DiveTripModel.cpp MainWindow.cpp (the code to populate the model) This patch changes the DiveTripModel from it's original implementation to the file models.h, wich should store all models (Dirk requested the Qt developers to not create 2 files per class, but instead to use a file for functionality, and data-models are one functionality.) Besides that, this code cleans up a bit the style: removed operator<< for .push_back, const references where they apply, moved the internal DiveItem class to the .cpp since it should be visible only to the DiveTripModel class, and redesigned the current interface of the model to be identical of the GTK one (used the UTF8-star and 2 subscribed, for instance). Amit (the creator of the original code) should comment here if it's ok with my changes. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15Added the code that will load and populate the Tank InfoGravatar Tomaz Canabrava
Added the code that will load and populate the Tank Info ComboBox that`s used by the user to select the Cylinder description. Code curerntly implements more than the GTK version since the GTK version of it was a plain-list, this one is a table based model that can be used in ListViews ( like we use now in the ComboBox ) but also in TableViews ( if there`s a need in the future to see everything that`s catalogued in the Tank Info struct. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-13Add Qtr_ macros that uses gettext in a tr() compatible mannerGravatar Dirk Hohndel
This should wrap gettext nicely and replace the "_()" macros we use in C code. Also added comments to the top of all the new files. Suggested-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-13Started the real code on the Qt Interface.Gravatar Tomaz Canabrava
1 - Open File already open files, it tries to not break the Gtk version, but some methods on the GTK version still need to be called inside Qt because the code is too tight-coupled. 2 - Close file already close files, same comments for the open file dialog applies here. 3 - The code for adding new cylinders in the cylinder dialog is done, already works and it's integrated with the system. There's a need to implement the edit and delete now, but it will be easyer since I'm starting to not get lost on the code. 4 - Some functions that were used to convert unities have been moved to convert.h ( can be changed later, put there because it's easyer to find something that converts in a convert.h =p ) because they were static functions that operated in the GTK version but I need those functions in the Qt version too. [Dirk Hohndel: lots and lots of whitespace and coding style changes] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>