Add DiveItem::displayTags helper method to return Tags as a QString
New Tags column is
by default inserted before "Photos" column
by default disabled
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common
occurrences that they seem worthy of a short helper-function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Replace constructs of the kind
s.toUtf8().data(),
s.toUtf8().constData(),
s.toLocal8Bit().data(),
s.toLocal8Bit.constData() or
qUtf8Printable(s)
by
qPrintable(s).
This is concise, consistent and - in principle - more performant than
the .data() versions.
Sadly, owing to a suboptimal implementation, qPrintable(s) currently
is a pessimization compared to s.toUtf8().data(). A fix is scheduled for
new Qt versions: https://codereview.qt-project.org/#/c/221331/
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
learnHash() was always called in conjunction with add_hash(). The
pattern was that a local filename and a hash were connected in
the hash-to-filename and the filename-to-hash maps. Then, the
original picture-filename or url were registered in the filename-to-hash
map.
This commit changes learnHash() to take three parameters (original-filename,
local-filename and hash) and do all of the above. The new code is
simpler because no dummy picture struct has to be generated in
DiveListView::loadImageFromURL().
The tests were extended to check for all hash<->filename associations.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Don't change into a directory just to see if it exists.
Remove unnecessary braces of one of the changed if statements.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This fixes an actual bug, where the current image dir would only be
remembered on closing the program.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
See referenced issue number. It leads back to an ancient (3 year old)
commit 512c42e. Not sure this issue is introduced there, but that's not
relevant.
Key in reproducing this is the location where the context menu is
requested (using the right mouse button). When it is the row next
to the trip, the add-to-trip succeeds correctly, otherwise
it is a no-op.
The solution is rather trivial (in hindsight). Just loop over the
selected dives, and try to find the trip we want to add to.
Fixes: #522
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
A weird crash occurs if DiveListView creates another local
instance of DiveTripModel inside reload(). Re-use the member
variable tripModel and assign it a new instance of DiveTripModel.
Reported-by: Gaetan Bisson <bisson@archlinux.org>
Tested-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The `static int defaultWidth[]` definition in divelistview.cpp
could potentially end up missing an element which can later result
in out-of-bounds access when iterating through the list of
columns and updating their widths.
Add a couple of methods in DiveTripModel for setting and getting
the widths and use those. The default values are now pre-set in a
QVector in the DiveTripModel() constructor.
Throw warnings if out-of-bounds columns are requested.
Reported-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Fixes#170 on GitHub
Simple catch function for double click events in the divelist,
prevents users from trying to edit the divenumber ithe wrong way.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Please apply this patch on top of the previous patch with the same title.
1) Provide icons with white margin to look more like photos
2) Optimise code, following Robert's suggestions.
3) Column heading for photos column is now: Photos. This takes up extra
horizontal space but makes the user interface more understandable.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1) Add an extra column to dive list, just left of Locality field.
2) For each dive, give summary of photos as follows:
i) no photos: no icon in that column
ii) photos taken during dive: show icon of fish
iii) photos taken before/after dive: show icon of sun
iv) photos taken during as well as before/after dive: show
icon with both fish and sun
3) Provide information for the sort operation to work on
this column of the dive list.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The only block of code that I removed here is because the
QSettings preferences that is being read is the exact one
that we populate on the prefs.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.
And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.
This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>