diff options
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/divecartesianaxis.cpp | 5 | ||||
-rw-r--r-- | profile-widget/divecartesianaxis.h | 2 | ||||
-rw-r--r-- | profile-widget/diveeventitem.cpp | 8 | ||||
-rw-r--r-- | profile-widget/divepixmapitem.cpp | 3 | ||||
-rw-r--r-- | profile-widget/diveprofileitem.cpp | 34 | ||||
-rw-r--r-- | profile-widget/divetooltipitem.cpp | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 11 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 14 | ||||
-rw-r--r-- | profile-widget/tankitem.cpp | 4 |
9 files changed, 63 insertions, 20 deletions
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp index 2c3b7fe79..a453d69ea 100644 --- a/profile-widget/divecartesianaxis.cpp +++ b/profile-widget/divecartesianaxis.cpp @@ -109,6 +109,7 @@ void DiveCartesianAxis::setOrientation(Orientation o) QColor DiveCartesianAxis::colorForValue(double value) { + Q_UNUSED(value) return QColor(Qt::black); } @@ -414,9 +415,9 @@ QString TimeAxis::textForValue(double value) return QString::number(nr); } -void TimeAxis::updateTicks() +void TimeAxis::updateTicks(color_indice_t color) { - DiveCartesianAxis::updateTicks(); + DiveCartesianAxis::updateTicks(color); if (maximum() > 600) { for (int i = 0; i < labels.count(); i++) { labels[i]->setVisible(i % 2); diff --git a/profile-widget/divecartesianaxis.h b/profile-widget/divecartesianaxis.h index 4e06b9a82..a603cebc7 100644 --- a/profile-widget/divecartesianaxis.h +++ b/profile-widget/divecartesianaxis.h @@ -95,7 +95,7 @@ class TimeAxis : public DiveCartesianAxis { Q_OBJECT public: TimeAxis(ProfileWidget2 *widget); - virtual void updateTicks(); + void updateTicks(color_indice_t color = TIME_GRID); protected: QString textForValue(double value); diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 1986015f7..3e1de48f3 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -66,8 +66,13 @@ void DiveEventItem::setupPixmap() #ifndef SUBSURFACE_MOBILE int sz_bigger = metrics.sz_med + metrics.sz_small; // ex 40px #else +#if defined(Q_OS_IOS) + // on iOS devices we need to adjust for Device Pixel Ratio + int sz_bigger = metrics.sz_med * metrics.dpr; +#else int sz_bigger = metrics.sz_med; #endif +#endif int sz_pix = sz_bigger/2; // ex 20px #define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation) @@ -134,6 +139,9 @@ void DiveEventItem::setupToolTipString() void DiveEventItem::eventVisibilityChanged(const QString &eventName, bool visible) { + //WARN: lookslike we should implement this. + Q_UNUSED(eventName); + Q_UNUSED(visible); } bool DiveEventItem::shouldBeHidden() diff --git a/profile-widget/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp index 698172cc6..39c41d19d 100644 --- a/profile-widget/divepixmapitem.cpp +++ b/profile-widget/divepixmapitem.cpp @@ -83,6 +83,7 @@ void DivePictureItem::setPixmap(const QPixmap &pix) CloseButtonItem *button = NULL; void DivePictureItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { + Q_UNUSED(event); Animations::scaleTo(this, 1.0); setZValue(5); @@ -109,6 +110,7 @@ void DivePictureItem::setFileUrl(const QString &s) void DivePictureItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { + Q_UNUSED(event); Animations::scaleTo(this, 0.2); setZValue(0); if(button){ @@ -126,6 +128,7 @@ DivePictureItem::~DivePictureItem(){ void DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { + Q_UNUSED(event); QDesktopServices::openUrl(QUrl::fromLocalFile(fileUrl)); } diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp index 93c954fd4..022616ef1 100644 --- a/profile-widget/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -56,6 +56,9 @@ void AbstractProfilePolygonItem::setModel(DivePlotDataModel *model) void AbstractProfilePolygonItem::modelDataRemoved(const QModelIndex &parent, int from, int to) { + Q_UNUSED(from); + Q_UNUSED(parent); + Q_UNUSED(to); setPolygon(QPolygonF()); qDeleteAll(texts); texts.clear(); @@ -94,8 +97,8 @@ bool AbstractProfilePolygonItem::shouldCalculateStuff(const QModelIndex &topLeft void AbstractProfilePolygonItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { - // We don't have enougth data to calculate things, quit. - + Q_UNUSED(topLeft); + Q_UNUSED(bottomRight); // Calculate the polygon. This is the polygon that will be painted on screen // on the ::paint method. Here we calculate the correct position of the points // regarting our cartesian plane ( made by the hAxis and vAxis ), the QPolygonF @@ -340,6 +343,8 @@ void DiveHeartrateItem::createTextItem(int sec, int hr) void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); if (polygon().isEmpty()) return; painter->save(); @@ -386,6 +391,9 @@ void DivePercentageItem::modelDataChanged(const QModelIndex &topLeft, const QMod void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; painter->save(); @@ -431,6 +439,9 @@ void DiveAmbPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo void DiveAmbPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; painter->save(); @@ -476,6 +487,9 @@ void DiveGFLineItem::modelDataChanged(const QModelIndex &topLeft, const QModelIn void DiveGFLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; painter->save(); @@ -557,6 +571,9 @@ void DiveTemperatureItem::createTextItem(int sec, int mkelvin) void DiveTemperatureItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; painter->save(); @@ -601,6 +618,9 @@ void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QMode void DiveMeanDepthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; painter->save(); @@ -646,7 +666,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo if (displayed_dive.dc.divemode == CCR) o2mbar = GET_O2CYLINDER_PRESSURE(entry); - if (entry->cylinderindex != last_index) { + if ((int)entry->cylinderindex != last_index) { polygons.append(QPolygonF()); // this is the polygon that will be actually drawn on screen. last_index = entry->cylinderindex; } @@ -722,7 +742,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo if (!mbar) continue; - if (cyl != entry->cylinderindex) { // Pressure value near the left hand edge of the profile - other cylinders: + if (cyl != (int)entry->cylinderindex) { // Pressure value near the left hand edge of the profile - other cylinders: cyl = entry->cylinderindex; // For each other cylinder, write the gas lable and pressure if (!seen_cyl[cyl]) { plotPressureValue(mbar, entry->sec, alignVar, print_y_offset[cyl][1]); @@ -767,6 +787,9 @@ void DiveGasPressureItem::plotGasValue(int mbar, int sec, struct gasmix gasmix, void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + if (polygon().isEmpty()) return; QPen pen; @@ -940,6 +963,9 @@ void PartialPressureGasItem::modelDataChanged(const QModelIndex &topLeft, const void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); + const qreal pWidth = 0.0; painter->save(); painter->setPen(QPen(normalColor, pWidth)); diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp index 78de4641b..6d6405056 100644 --- a/profile-widget/divetooltipitem.cpp +++ b/profile-widget/divetooltipitem.cpp @@ -243,7 +243,7 @@ void ToolTipItem::refresh(const QPointF &pos) struct plot_data *entry; static QPixmap tissues(16,60); static QPainter painter(&tissues); - static struct membuffer mb = { 0 }; + static struct membuffer mb = {}; if(refreshTime.elapsed() < 40) return; diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 38276b235..e4b03ebcb 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -573,7 +573,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) if (prefs.deco_mode == VPMB) decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.conservatism_level)); else - decoModelParameters->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh)); + decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh)); #endif } @@ -605,9 +605,9 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) currentdc = fake_dc(currentdc, false); } +#ifndef SUBSURFACE_MOBILE bool setpointflag = (currentdc->divemode == CCR) && prefs.pp_graphs.po2 && current_dive; bool sensorflag = setpointflag && prefs.show_ccr_sensors; -#ifndef SUBSURFACE_MOBILE o2SetpointGasItem->setVisible(setpointflag && prefs.show_ccr_setpoint); ccrsensor1GasItem->setVisible(sensorflag); ccrsensor2GasItem->setVisible(sensorflag && (currentdc->no_o2sensors > 1)); @@ -723,8 +723,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) event->setVisible(!event->shouldBeHidden()); } QString dcText = get_dc_nickname(currentdc->model, currentdc->deviceid); - int nr; #ifndef SUBSURFACE_MOBILE + int nr; if ((nr = number_of_computers(&displayed_dive)) > 1) dcText += tr(" (#%1 of %2)").arg(dc_number + 1).arg(nr); #endif @@ -1302,7 +1302,7 @@ struct plot_data *ProfileWidget2::getEntryFromPos(QPointF pos) for (int i = 0; i < plotInfo.nr; i++) { entry = plotInfo.entry + i; - if (entry->sec >= seconds) + if ((int)entry->sec >= seconds) break; } return entry; @@ -1674,6 +1674,9 @@ void ProfileWidget2::disconnectTemporaryConnections() #ifndef SUBSURFACE_MOBILE void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end) { + Q_UNUSED(parent) + Q_UNUSED(start) + Q_UNUSED(end) DiveHandler *item = new DiveHandler(); scene()->addItem(item); handles << item; diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 438523340..5e05b14f8 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -141,14 +141,14 @@ slots: // Necessary to call from QAction's signals. protected: virtual ~ProfileWidget2(); - virtual void resizeEvent(QResizeEvent *event); + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; #ifndef SUBSURFACE_MOBILE - virtual void wheelEvent(QWheelEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void contextMenuEvent(QContextMenuEvent *event); - virtual void mouseDoubleClickEvent(QMouseEvent *event); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; #endif void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; diff --git a/profile-widget/tankitem.cpp b/profile-widget/tankitem.cpp index c0e75a371..aba41d660 100644 --- a/profile-widget/tankitem.cpp +++ b/profile-widget/tankitem.cpp @@ -5,6 +5,7 @@ #include <QPen> TankItem::TankItem(QObject *parent) : + QObject(parent), QGraphicsRectItem(), dataModel(0), pInfoEntry(0), @@ -78,8 +79,9 @@ void TankItem::createBar(qreal x, qreal w, struct gasmix *gas) void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { + Q_UNUSED(topLeft); + Q_UNUSED(bottomRight); // We don't have enougth data to calculate things, quit. - if (!dataModel || !pInfoEntry || !pInfoNr) return; |