mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'latestmaster'
This commit is contained in:
commit
de9acbd30d
10 changed files with 72 additions and 60 deletions
|
@ -181,6 +181,7 @@ DiveHandler::DiveHandler() : QGraphicsEllipseItem()
|
|||
setFlags(ItemIgnoresTransformations | ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges);
|
||||
setBrush(Qt::white);
|
||||
setZValue(2);
|
||||
t.start();
|
||||
}
|
||||
|
||||
int DiveHandler::parentIndex()
|
||||
|
@ -225,9 +226,14 @@ void DiveHandler::changeGas()
|
|||
|
||||
void DiveHandler::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (t.elapsed() < 40)
|
||||
return;
|
||||
t.start();
|
||||
|
||||
ProfileWidget2 *view = qobject_cast<ProfileWidget2*>(scene()->views().first());
|
||||
if(view->isPointOutOfBoundaries(event->scenePos()))
|
||||
return;
|
||||
|
||||
QGraphicsEllipseItem::mouseMoveEvent(event);
|
||||
emit moved();
|
||||
}
|
||||
|
|
|
@ -133,6 +133,8 @@ public
|
|||
slots:
|
||||
void selfRemove();
|
||||
void changeGas();
|
||||
private:
|
||||
QTime t;
|
||||
};
|
||||
|
||||
#include "ui_diveplanner.h"
|
||||
|
|
|
@ -187,9 +187,17 @@ void GlobeGPS::repopulateLabels()
|
|||
loadedDives = new GeoDataDocument;
|
||||
QMap<QString, GeoDataPlacemark *> locationMap;
|
||||
|
||||
int idx = 0;
|
||||
int idx = -2;
|
||||
struct dive *dive;
|
||||
for_each_dive (idx, dive) {
|
||||
// normally we use for_each_dive (idx, dive) to loop over all dives,
|
||||
// but we need to include the displayed_dive while things are
|
||||
// edited, so let's hand roll this loop
|
||||
while (++idx < dive_table.nr) {
|
||||
dive = (idx == -1 ? &displayed_dive : get_dive(idx));
|
||||
if (dive == current_dive)
|
||||
// don't show that flag, it's either already shown as displayed_dive
|
||||
// or it's the one that we are moving right now...
|
||||
continue;
|
||||
if (dive_has_gps_location(dive)) {
|
||||
GeoDataPlacemark *place = new GeoDataPlacemark(dive->location);
|
||||
place->setCoordinate(dive->longitude.udeg / 1000000.0, dive->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree);
|
||||
|
@ -307,21 +315,14 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
|
|||
lon = lon * 180 / M_PI;
|
||||
lat = lat * 180 / M_PI;
|
||||
}
|
||||
|
||||
// right now we try to only ever do this with one dive selected,
|
||||
// but we keep the code here that changes the coordinates for each selected dive
|
||||
int i;
|
||||
struct dive *dive;
|
||||
for_each_dive (i, dive) {
|
||||
if (!dive->selected)
|
||||
continue;
|
||||
dive->latitude.udeg = lrint(lat * 1000000.0);
|
||||
dive->longitude.udeg = lrint(lon * 1000000.0);
|
||||
}
|
||||
centerOn(lon, lat, true);
|
||||
|
||||
// change the location of the displayed_dive and put the UI in edit mode
|
||||
displayed_dive.latitude.udeg = lrint(lat * 1000000.0);
|
||||
displayed_dive.longitude.udeg = lrint(lon * 1000000.0);
|
||||
emit(coordinatesChanged());
|
||||
repopulateLabels();
|
||||
editingDiveLocation = false;
|
||||
mark_divelist_changed(true);
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
||||
void GlobeGPS::mousePressEvent(QMouseEvent *event)
|
||||
|
|
|
@ -39,6 +39,9 @@ private:
|
|||
bool editingDiveLocation;
|
||||
bool doubleClick;
|
||||
|
||||
signals:
|
||||
void coordinatesChanged(void);
|
||||
|
||||
public
|
||||
slots:
|
||||
void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit);
|
||||
|
|
|
@ -428,7 +428,7 @@ void MainTab::updateDiveInfo(bool clear)
|
|||
ui.DiveType->setCurrentIndex(displayed_dive.dc.divemode);
|
||||
|
||||
if (!clear) {
|
||||
updateGpsCoordinates(&displayed_dive);
|
||||
updateGpsCoordinates();
|
||||
// Subsurface always uses "local time" as in "whatever was the local time at the location"
|
||||
// so all time stamps have no time zone information and are in UTC
|
||||
QDateTime localTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
|
||||
|
@ -750,7 +750,7 @@ void MainTab::acceptChanges()
|
|||
}
|
||||
struct dive *cd = current_dive;
|
||||
//Reset coordinates field, in case it contains garbage.
|
||||
updateGpsCoordinates(&displayed_dive);
|
||||
updateGpsCoordinates();
|
||||
// now check if something has changed and if yes, edit the selected dives that
|
||||
// were identical with the master dive shown (and mark the divelist as changed)
|
||||
if (!same_string(displayed_dive.buddy, cd->buddy))
|
||||
|
@ -1137,7 +1137,7 @@ void MainTab::on_location_editingFinished()
|
|||
displayed_dive.latitude = dive->latitude;
|
||||
displayed_dive.longitude = dive->longitude;
|
||||
MainWindow::instance()->globe()->reload();
|
||||
updateGpsCoordinates(&displayed_dive);
|
||||
updateGpsCoordinates();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1244,14 +1244,13 @@ void MainTab::updateCoordinatesText(qreal lat, qreal lon)
|
|||
ui.coordinates->setText(printGPSCoords(ulat, ulon));
|
||||
}
|
||||
|
||||
void MainTab::updateGpsCoordinates(const struct dive *dive)
|
||||
void MainTab::updateGpsCoordinates()
|
||||
{
|
||||
if (dive) {
|
||||
ui.coordinates->setText(printGPSCoords(dive->latitude.udeg, dive->longitude.udeg));
|
||||
ui.coordinates->setModified(dive->latitude.udeg || dive->longitude.udeg);
|
||||
} else {
|
||||
ui.coordinates->clear();
|
||||
}
|
||||
if (editMode == NONE)
|
||||
enableEdition();
|
||||
|
||||
ui.coordinates->setText(printGPSCoords(displayed_dive.latitude.udeg, displayed_dive.longitude.udeg));
|
||||
ui.coordinates->setModified(displayed_dive.latitude.udeg || displayed_dive.longitude.udeg);
|
||||
}
|
||||
|
||||
void MainTab::escDetected()
|
||||
|
@ -1300,7 +1299,7 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
|
|||
if (what.visibility)
|
||||
ui.visibility->setCurrentStars(displayed_dive.visibility);
|
||||
if (what.gps)
|
||||
updateGpsCoordinates(&displayed_dive);
|
||||
updateGpsCoordinates();
|
||||
if (what.tags) {
|
||||
char buf[1024];
|
||||
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
||||
|
|
|
@ -92,6 +92,8 @@ slots:
|
|||
void escDetected(void);
|
||||
void photoDoubleClicked(const QString filePath);
|
||||
void removeSelectedPhotos();
|
||||
void updateGpsCoordinates();
|
||||
|
||||
private:
|
||||
Ui::MainTab ui;
|
||||
WeightModel *weightModel;
|
||||
|
@ -109,7 +111,6 @@ private:
|
|||
bool copyPaste;
|
||||
void resetPallete();
|
||||
void saveTags();
|
||||
void updateGpsCoordinates(const struct dive *dive);
|
||||
void markChangedWidget(QWidget *w);
|
||||
dive_trip_t *currentTrip;
|
||||
dive_trip_t displayedTrip;
|
||||
|
|
|
@ -96,6 +96,8 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
#ifdef NO_MARBLE
|
||||
ui.globePane->hide();
|
||||
ui.menuView->removeAction(ui.actionViewGlobe);
|
||||
#else
|
||||
connect(ui.globe, SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates()));
|
||||
#endif
|
||||
#ifdef NO_USERMANUAL
|
||||
ui.menuHelp->removeAction(ui.actionUserManual);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <QPicture>
|
||||
#include <QMessageBox>
|
||||
#include <QPointer>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "printdialog.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QtCore/qmath.h>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QDebug>
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
#include <QTableView>
|
||||
|
@ -55,7 +56,7 @@ static struct _ItemPos {
|
|||
_Axis temperature;
|
||||
_Axis temperatureAll;
|
||||
_Axis heartBeat;
|
||||
_Axis heartBeatAll;
|
||||
_Axis heartBeatWithTankBar;
|
||||
} itemPos;
|
||||
|
||||
ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||
|
@ -396,13 +397,11 @@ void ProfileWidget2::setupItemSizes()
|
|||
|
||||
// Heartbeat axis config
|
||||
itemPos.heartBeat.pos.on.setX(3);
|
||||
itemPos.heartBeat.pos.on.setY(65);
|
||||
itemPos.heartBeat.pos.on.setY(82);
|
||||
itemPos.heartBeat.expanded.setP1(QPointF(0, 0));
|
||||
itemPos.heartBeat.expanded.setP2(QPointF(0, 10));
|
||||
itemPos.heartBeatAll = itemPos.heartBeat;
|
||||
itemPos.heartBeatAll.pos.on.setX(3);
|
||||
itemPos.heartBeatAll.pos.on.setY(55);
|
||||
itemPos.heartBeatAll.expanded.setP2(QPointF(0, 7));
|
||||
itemPos.heartBeatWithTankBar = itemPos.heartBeat;
|
||||
itemPos.heartBeatWithTankBar.expanded.setP2(QPointF(0, 7));
|
||||
|
||||
// Percentage axis config
|
||||
itemPos.percentage.pos.on.setX(3);
|
||||
|
@ -635,7 +634,7 @@ void ProfileWidget2::settingsChanged()
|
|||
// if we are showing calculated ceilings then we have to replot()
|
||||
// because the GF could have changed; otherwise we try to avoid replot()
|
||||
bool needReplot = prefs.calcceiling;
|
||||
if (prefs.percentagegraph && PP_GRAPHS_ENABLED) {
|
||||
if ((prefs.percentagegraph||prefs.hrgraph) && PP_GRAPHS_ENABLED) {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.shrinked);
|
||||
temperatureAxis->setPos(itemPos.temperatureAll.pos.on);
|
||||
temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
|
||||
|
@ -644,37 +643,36 @@ void ProfileWidget2::settingsChanged()
|
|||
if (prefs.tankbar) {
|
||||
percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
|
||||
percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
|
||||
} else {
|
||||
heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
|
||||
}else {
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
percentageAxis->animateChangeLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
|
||||
}
|
||||
gasYAxis->setPos(itemPos.partialPressureTissue.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressureTissue.expanded);
|
||||
if (prefs.hrgraph) {
|
||||
heartBeatAxis->setPos(itemPos.heartBeatAll.pos.on);
|
||||
heartBeatAxis->setLine(itemPos.heartBeatAll.expanded);
|
||||
}
|
||||
|
||||
} else if (PP_GRAPHS_ENABLED || prefs.hrgraph || prefs.percentagegraph) {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.intermediate);
|
||||
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
||||
temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
|
||||
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
|
||||
gasYAxis->setPos(itemPos.partialPressure.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
|
||||
if (prefs.tankbar) {
|
||||
percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
|
||||
percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
|
||||
gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
|
||||
gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
|
||||
} else {
|
||||
gasYAxis->setPos(itemPos.partialPressure.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
|
||||
}
|
||||
} else {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.expanded);
|
||||
|
@ -907,7 +905,7 @@ void ProfileWidget2::setProfileState()
|
|||
cylinderPressureAxis->setVisible(true);
|
||||
|
||||
profileYAxis->setPos(itemPos.depth.pos.on);
|
||||
if (prefs.percentagegraph && PP_GRAPHS_ENABLED) {
|
||||
if ((prefs.percentagegraph||prefs.hrgraph) && PP_GRAPHS_ENABLED) {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.shrinked);
|
||||
temperatureAxis->setPos(itemPos.temperatureAll.pos.on);
|
||||
temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
|
||||
|
@ -916,37 +914,36 @@ void ProfileWidget2::setProfileState()
|
|||
if (prefs.tankbar) {
|
||||
percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
|
||||
percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
|
||||
} else {
|
||||
heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
|
||||
}else {
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
percentageAxis->animateChangeLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
|
||||
}
|
||||
gasYAxis->setPos(itemPos.partialPressureTissue.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressureTissue.expanded);
|
||||
if (prefs.hrgraph) {
|
||||
heartBeatAxis->setPos(itemPos.heartBeatAll.pos.on);
|
||||
heartBeatAxis->setLine(itemPos.heartBeatAll.expanded);
|
||||
}
|
||||
|
||||
} else if (PP_GRAPHS_ENABLED || prefs.hrgraph || prefs.percentagegraph) {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.intermediate);
|
||||
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
||||
temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
|
||||
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
|
||||
gasYAxis->setPos(itemPos.partialPressure.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
|
||||
if (prefs.tankbar) {
|
||||
percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
|
||||
percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
|
||||
gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
|
||||
gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeatWithTankBar.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeatWithTankBar.expanded);
|
||||
} else {
|
||||
gasYAxis->setPos(itemPos.partialPressure.pos.on);
|
||||
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
|
||||
percentageAxis->setPos(itemPos.percentage.pos.on);
|
||||
percentageAxis->setLine(itemPos.percentage.expanded);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->animateChangeLine(itemPos.heartBeat.expanded);
|
||||
}
|
||||
} else {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.expanded);
|
||||
|
|
|
@ -50,7 +50,7 @@ void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, str
|
|||
memcpy(pInfoEntry, plotInfo->entry, size);
|
||||
copy_cylinders(d, &diveCylinderStore, false);
|
||||
dataModel = model;
|
||||
connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex)));
|
||||
connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
||||
modelDataChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue