mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn dive-trip location and notes into std::string
Simpler memory management. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2fd226964c
commit
3ee41328f9
29 changed files with 157 additions and 179 deletions
|
|
@ -620,8 +620,8 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset)
|
|||
int i = a.row() + offset;
|
||||
QModelIndex b = a.sibling(i, 0);
|
||||
|
||||
dive_trip_t *trip_a = a.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
dive_trip_t *trip_b = b.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
dive_trip *trip_a = a.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
dive_trip *trip_b = b.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
if (trip_a == trip_b || !trip_a || !trip_b)
|
||||
return;
|
||||
Command::mergeTrips(trip_a, trip_b);
|
||||
|
|
@ -666,7 +666,7 @@ void DiveListView::addToTrip(int delta)
|
|||
struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value<struct dive *>();
|
||||
int nr = selectionModel()->selectedRows().count();
|
||||
QModelIndex t;
|
||||
dive_trip_t *trip = NULL;
|
||||
dive_trip *trip = NULL;
|
||||
|
||||
// now look for the trip to add to, for this, loop over the selected dives and
|
||||
// check if its sibling is a trip.
|
||||
|
|
@ -708,7 +708,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
|
|||
// let's remember where we are
|
||||
contextMenuIndex = indexAt(event->pos());
|
||||
struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value<struct dive *>();
|
||||
dive_trip_t *trip = contextMenuIndex.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
dive_trip *trip = contextMenuIndex.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>();
|
||||
QMenu popup(this);
|
||||
if (currentLayout == DiveTripModelBase::TREE) {
|
||||
// verify if there is a node that`s not expanded.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#define PROFILEWIDGET_H
|
||||
|
||||
#include "ui_profilewidget.h"
|
||||
#include "core/owning_ptrs.h"
|
||||
#include "core/subsurface-qt/divelistnotifier.h"
|
||||
|
||||
#include <vector>
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ void TabDiveNotes::tripChanged(dive_trip *trip, TripField field)
|
|||
return;
|
||||
|
||||
if (field.notes)
|
||||
ui.notes->setText(currentTrip->notes);
|
||||
ui.notes->setText(QString::fromStdString(currentTrip->notes));
|
||||
if (field.location)
|
||||
ui.diveTripLocation->setText(currentTrip->location);
|
||||
ui.diveTripLocation->setText(QString::fromStdString(currentTrip->location));
|
||||
}
|
||||
|
||||
static bool isHtml(const QString &s)
|
||||
|
|
@ -220,13 +220,13 @@ void TabDiveNotes::updateData(const std::vector<dive *> &, dive *currentDive, in
|
|||
ui.editDiveSiteButton->hide();
|
||||
// rename the remaining fields and fill data from selected trip
|
||||
ui.LocationLabel->setText(tr("Trip location"));
|
||||
ui.diveTripLocation->setText(currentTrip->location);
|
||||
ui.diveTripLocation->setText(QString::fromStdString(currentTrip->location));
|
||||
updateTripDate(currentTrip);
|
||||
ui.locationTags->clear();
|
||||
//TODO: Fix this.
|
||||
//ui.location->setText(currentTrip->location);
|
||||
//ui.location->setText(QString::fromStdSTring(currentTrip->location));
|
||||
ui.NotesLabel->setText(tr("Trip notes"));
|
||||
ui.notes->setText(currentTrip->notes);
|
||||
ui.notes->setText(QString::fromStdString(currentTrip->notes));
|
||||
ui.depth->setVisible(false);
|
||||
ui.depthLabel->setVisible(false);
|
||||
ui.duration->setVisible(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue