mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: remove UUIDs from LocationInformationModel
Replace UUIDs from LocationInformationModel and fix the fallout. Notably, replace the UUID "column" by a DIVESITE "column". Getting pointers through Qt's QVariant is horrible, we'll have to think about a better solution. RECENTLY_ADDED_DIVESITE now defines to a special pointer to struct dive_site (defined as ~0). This fixes an interesting logic bug: The old code checked the uuid of the LocationInformationModel (currUuid) for the value "1", which corresponded to RECENTLY_ADDED_DIVESITE. If equal, currType would be set to NEW_DIVE_SITE. Later, _currType_ was compared against _RECENTLY_ADDED_DIVESITE_. This would only work because NEW_DIVE_SITE and RECENTLY_ADDED_DIVESITE both were defined as 1. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6f98dca26e
commit
b9b1b3146b
8 changed files with 64 additions and 69 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "qt-models/weightsysteminfomodel.h"
|
||||
#include "qt-models/weightmodel.h"
|
||||
#include "qt-models/divetripmodel.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
#include "core/qthelper.h"
|
||||
|
||||
#include <QCompleter>
|
||||
|
@ -452,9 +453,8 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||
QString diveSiteName = index.data().toString();
|
||||
QString bottomText;
|
||||
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
|
||||
struct dive_site *ds = get_dive_site_by_uuid(
|
||||
index.model()->data(index.model()->index(index.row(),0)).toInt()
|
||||
);
|
||||
struct dive_site *ds = (struct dive_site *)
|
||||
index.model()->data(index.model()->index(index.row(), LocationInformationModel::DIVESITE)).value<void *>();
|
||||
struct dive_site *currentDiveSite = current_dive ? get_dive_site_for_dive(current_dive) : nullptr;
|
||||
bool currentDiveSiteHasGPS = currentDiveSite && dive_site_has_gps_location(currentDiveSite);
|
||||
//Special case: do not show name, but instead, show
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue