aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
AgeCommit message (Collapse)Author
2015-12-26QML UI: get add dive closer to being usefulGravatar Dirk Hohndel
Now we at least start out with the corret date, time and number. This still isn't functional as a lot of the data aren't used and the way you save the data is completely silly, but it's another step in the right direction. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: set up time and dive number when adding diveGravatar Dirk Hohndel
Most likely when you manually add a dive on a device it is just about to happen or just ended, so starting out with the current time is likely a good guess. Which makes it the last dive in the dive list, so give it the next sequential number. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26Dive list model: add GPS string accessGravatar Dirk Hohndel
If the QML UI needs the GPS information, we need a way to get to it. I'm not convinced that having it as comma separated string is the best way to go, but that's what I need for the Google API so that's what I picked for now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-17Unselect source dive when saving a copy in replanGravatar Robert.Helling
Then the user can select the two copies and merge them as two different computers. Without this, the selection could is screwd up and there is no option to merge in the context menu. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-07QML-UI: we need a way to update the dive modelGravatar Dirk Hohndel
Otherwise our UI will get out of sync with our dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Fix crasherGravatar Sebastian Kügler
m_dives can be empty, so make sure we don't push an invalid QModelIndex into the mode. Signed-off-by: Sebastian Kügler <sebas@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-30Clear the Dive model before repopulating itGravatar Dirk Hohndel
Otherwise we could get duplicate dives in the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16Make Subsurface-mobile compile againGravatar Dirk Hohndel
This is a quick fix but it changes semantice. Previously weight() gave you the total weight carried, now it just gives you the first weight item on the list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-10qt-models: remove obsolete printer related classesGravatar Lubomir I. Ivanov
The profileprintmodel.cpp/.h and the tableprintmode.cpp/.h pairs are obsolete. The print layouting is now handled via the Grantlee library and HTML. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-09Store Thumbnails with image hashesGravatar Robert C. Helling
This drastically improves the time it takes to select a dive with several pictures at the expense of longer startup and bigger hash files. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07diveplannermodel.cpp: move unused variables into a commented sectionGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07filtermodels.cpp: fix an argument order warningGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07divelocationmodel: fix some signed/unsigned warningsGravatar Lubomir I. Ivanov
Use uint32_t for divesite UUIDs. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-06Move ImageDownloader out of the desktop widgetsGravatar Dirk Hohndel
This required a bit more untangling, but with this it seems we can build subsurface-mobile again (at least on the desktop). Interesting is the removal from inside the ImageDownloader of the call to DivePictureModel::instance()->updateDivePictures() - which actually could cause some interesting recursion issues. If it turns out we did indeed need this, it needs to be re-architected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-03Context menu for images: change DivePicture modelGravatar Guido Lerch
Altering DivePicture model to allow deleting images from the QListView without immediate updating of the list. Updating is determined by an additioanl parameter Signed-off-by: Guido Lerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Move Profile widget out of desktop-widgetsGravatar Tomaz Canabrava
The reason for that is, even if profile widget is made with qpainter and for that reason it should be a desktop widget, it's being used on the mobile version because of a lack of QML plotting library that is fast and reliable. We discovered that it was faster just to encapsulate our Profile in a QML class and call it directly. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Single CMake to handle the modelsGravatar Tomaz Canabrava
This one was pretty easy because of the work I did a few months ago to separate the models from the UI. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Move qt-ui to desktop-widgetsGravatar Tomaz Canabrava
Since we have now destkop and mobile versions, 'qt-ui' was a very poor name choice for a folder that contains only destkop-enabled widgets. Also, move the graphicsview-common.h/cpp to subsurface-core because it doesn't depend on qgraphicsview, it merely implements all the colors that we use throughout Subsurface, and we will use colors on both desktop and mobile versions Same thing applies for metrics.h/cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Modify code to make it compile after rebaseGravatar Tomaz Canabrava
Did a git rebase and some stuff changed in the meantime; This is a compatibility commit: Add a few include directories on the cmake to quiet some ui_headers.h not being found (the ones that are created automatically by uic) and a few noiseances like models requiring interface functionality. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Move all core-functionality to subsurface-coreGravatar Tomaz Canabrava
And adapt a new CMakeLists.txt file for it. On the way I've also found out that we where double-compilling a few files. I've also set the subsurface-core as a include_path but that was just to reduce the noise on this commit, since I plan to remove it from the include path to make it obligatory to specify something like include "subsurface-core/dive.h" for the header files. Since the app is growing quite a bit we ended up having a few different files with almost same name that did similar things, I want to kill that (for instance Dive.h, dive.h, PrintDive.h and such). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-23Add missing tr() implementationsGravatar Jan Mulder
One specific string did not translate. First, Dirk and I (via IRC) suspected a leading space was the issue (see commit eccac1321f512d8). However, I found out that the problem was still there. A non translated string "%1 shown", when applying a filter on the divelist, and looking at a trip line. It shows always untranslated "%1 shown". Extracting to-be-translated strings from the code, I found 2 errors: Class <classname> lacks Q_OBJECT macro. This patch adds a missing tr() definition and implementation to 2 structs. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-23Set a cylinder if the default cylinder is bogusGravatar Robert C. Helling
Apparently, it can happen that the default cylinder is not set even though same_string(prefs.default_cylinder, "") is false. Then we fall back to the 11.1l air cylinder. This should silence a warnign about "Too many gases". Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-22Fixing annoying compiler warningGravatar Guido Lerch
Adding { } to if clause to avoid dangling warning /Users/guidolerch/src/subsurface/qt-models/cylindermodel.cpp:117: warning: add explicit braces to avoid dangling else [-Wdangling-else] [Dirk Hohndel: combined two of Guido's patches to one that is simpler] Signed-off-by: Guido Lerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-20Always make sure the planner starts with at least one cylinderGravatar Robert C. Helling
void DivePlannerPointsModel::setupCylinders() in diveplannermodel.cpp handles setting up cylinders for the planner. If there is a current dive, cylinders form that dive are copied. Otherwise the default cylinder is added and lacking that a standard size cylinder. If the current dive does not have any cylinders, we could end up without cylinders. This patch adds a test for this case and delegates to the other two sources of a cylinder in that case. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-19Show correct icon when only one gasmix in the listGravatar Joakim Bygdell
When there is only one gasmix in the list we should show the icon that tells the user that they can't remove the last gasmix from the list. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18Display day number in trips longer than 1 dayGravatar Giorgio Marzano
Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-09Do not show lack of coordinates as having same gps informationGravatar Tomaz Canabrava
The filter that takes care to show the dive sites that have the same gps information should not take into account dives that have no gps information. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08Fix a crash when editing manually added diveGravatar Miika Turkia
I have manually added dives from an ancient version of Subsurface. Trying to edit these caused Subsurface to crash due to comparison of string of dc.model that did not exist (to a static string). And further down the execution path we were crashing as there were no samples associated with the dive. See #941 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08Deal with weird transifex issue involving leading spaceGravatar Dirk Hohndel
Apparently transifex drops the leading space in the translation string and then at runtime the string no longer matches. So let's just code this differently. This of course creates a new string but that new string should be the string that transifex already asks people to translate... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-03Make logical block match indentationGravatar Dirk Hohndel
Coverity CID 1325519 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-18Spelling correctionsGravatar Robert C. Helling
Spell Setpoint without space in user visable strings. Explain authorized_paired. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-17Planner: show new icon to indicate that last point can't be deletedGravatar Dirk Hohndel
Having the trash can disappear is somewhat intuitive, but I'd argue this is even more so. Fixes #789 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12Hide current dive site from dive sites with same coordinates.Gravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12Remove id from divelocation selection listGravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09Do not ignore the first tag on autocompletion.Gravatar Sander Kleijwegt
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31UI code to merge dive sitesGravatar Tomaz Canabrava
Get the Qt data structures and convert to something that we can use in our C - core. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Display dive sites with same gps as the currentGravatar Tomaz Canabrava
So we can merge them later - currently we are showing only the ID, ugly - fixing next. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Fix recursive stack-overflowGravatar Tomaz Canabrava
Only call this when needed, if there's no function set as callback, always return true. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Add function to filter same-gps dive sitesGravatar Tomaz Canabrava
This should be userfull to show dive sites that are mergeable. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31Add a new model: SsrfFilterProxyModelGravatar Tomaz Canabrava
Add a new Model, it's the QSortFilterProxyModel that accepts functions to filter / sort. so instead of creating a new class for each different sorting (overkill), now we can just create a function and pass to this class. I'll rework the filtering system of subsurface to use this - in the meantime I've created this to ease the creation of another filter: the dive sites by gps coordinates. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31QML UI: Remove unneeded MobileDive classGravatar Grace Karanja
The MobileDive class in divelistmodel.h is a duplication of the Dive class in templatelayout.h. This patch moves the Dive to the qthelper file. [Dirk Hohndel: merged with upstream master - let's hope I didn't mess anything up] Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31QML UI: Use AddDive instead of clear diveGravatar Grace Karanja
No need to clear the dives when adding a new one. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31QML UI: Clear divelist model before starting new diveGravatar Grace Karanja
When user clicks on AddDive, we should clear the model. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-25Create a new dive site and edit it automaticallyGravatar Tomaz Canabrava
If the user clicks on the first or second option of the drop down list, subsurface will move him to the dive site edit panel automatically, since it's a new dive site and there's no information about it yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25Make created dive site uuid deterministicGravatar Dirk Hohndel
Having random uuids seemed like a good idea, but there are several situations where they really cause problems. One is merging dive file imports from V2 logfiles. Another is testing such imports. Instead of making the uuid random we now hash the name and add the timestamp of the first dive associated with this dive site to the hash (first in this context is "first encountered" with no guarantee that it is the chronologically first). This way V2 imports create deterministic uuids but uuid conflicts are still extremely unlikely, even if the user has multiple dive sites with the same name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Display dives from the same location on the listGravatar Tomaz Canabrava
Some dive sites are separated in more than one real dive site (for instance, a 'blue hole' dive site that has different entry points on the gps), so instead of checking only the dive_site id, also check it's name. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurfaceGravatar Dirk Hohndel
Fixed merge conflicts in deco.c dive.h planner.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15VPM-B: Add conservatism levels to the ui. Fix planner settings disabling.Gravatar Jan Darowski
Conservatism level can now be changed from gui, is saved in settings. Also way of disabling the planner settings in the ui was improved to support more deco models and be called at the widget creation. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15Remove obsolete commentGravatar Tomaz Canabrava
We don't allow building against Qt4 anymore. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Add DiveSitePicturesModelGravatar Tomaz Canabrava
This model should be used inside the Edit Dive Site mode. It should display all photos from all dives that are part of this dive site, ignoring trips. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>