Mercurial > hg > svgui
comparison view/Pane.cpp @ 1408:c8a6fd3f9dff fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:33:54 +0000 |
parents | a33d38247631 |
children | ce5f80a7c697 |
comparison
equal
deleted
inserted
replaced
1407:05d614f6e46d | 1408:c8a6fd3f9dff |
---|---|
60 | 60 |
61 #include "widgets/KeyReference.h" //!!! should probably split KeyReference into a data class in base and another that shows the widget | 61 #include "widgets/KeyReference.h" //!!! should probably split KeyReference into a data class in base and another that shows the widget |
62 | 62 |
63 //#define DEBUG_PANE | 63 //#define DEBUG_PANE |
64 | 64 |
65 QCursor *Pane::m_measureCursor1 = 0; | 65 QCursor *Pane::m_measureCursor1 = nullptr; |
66 QCursor *Pane::m_measureCursor2 = 0; | 66 QCursor *Pane::m_measureCursor2 = nullptr; |
67 | 67 |
68 Pane::Pane(QWidget *w) : | 68 Pane::Pane(QWidget *w) : |
69 View(w, true), | 69 View(w, true), |
70 m_identifyFeatures(false), | 70 m_identifyFeatures(false), |
71 m_clickedInRange(false), | 71 m_clickedInRange(false), |
77 m_editing(false), | 77 m_editing(false), |
78 m_releasing(false), | 78 m_releasing(false), |
79 m_centreLineVisible(true), | 79 m_centreLineVisible(true), |
80 m_scaleWidth(0), | 80 m_scaleWidth(0), |
81 m_pendingWheelAngle(0), | 81 m_pendingWheelAngle(0), |
82 m_headsUpDisplay(0), | 82 m_headsUpDisplay(nullptr), |
83 m_vpan(0), | 83 m_vpan(nullptr), |
84 m_hthumb(0), | 84 m_hthumb(nullptr), |
85 m_vthumb(0), | 85 m_vthumb(nullptr), |
86 m_reset(0), | 86 m_reset(nullptr), |
87 m_mouseInWidget(false), | 87 m_mouseInWidget(false), |
88 m_playbackFrameMoveScheduled(false), | 88 m_playbackFrameMoveScheduled(false), |
89 m_playbackFrameMoveTo(0) | 89 m_playbackFrameMoveTo(0) |
90 { | 90 { |
91 setObjectName("Pane"); | 91 setObjectName("Pane"); |
105 { | 105 { |
106 Profiler profiler("Pane::updateHeadsUpDisplay"); | 106 Profiler profiler("Pane::updateHeadsUpDisplay"); |
107 | 107 |
108 if (!isVisible()) return; | 108 if (!isVisible()) return; |
109 | 109 |
110 Layer *layer = 0; | 110 Layer *layer = nullptr; |
111 if (getLayerCount() > 0) { | 111 if (getLayerCount() > 0) { |
112 layer = getLayer(getLayerCount() - 1); | 112 layer = getLayer(getLayerCount() - 1); |
113 } | 113 } |
114 | 114 |
115 if (!m_headsUpDisplay) { | 115 if (!m_headsUpDisplay) { |
250 // have no vertical scroll wheel, we should remove the panner as | 250 // have no vertical scroll wheel, we should remove the panner as |
251 // well. Ideally any layer that implements display extents should | 251 // well. Ideally any layer that implements display extents should |
252 // implement vertical zoom steps as well, but they don't all at | 252 // implement vertical zoom steps as well, but they don't all at |
253 // the moment. | 253 // the moment. |
254 | 254 |
255 Layer *layer = 0; | 255 Layer *layer = nullptr; |
256 if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1); | 256 if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1); |
257 int discard; | 257 int discard; |
258 if (layer && layer->getVerticalZoomSteps(discard) == 0) { | 258 if (layer && layer->getVerticalZoomSteps(discard) == 0) { |
259 m_vpan->hide(); | 259 m_vpan->hide(); |
260 return; | 260 return; |
365 // Locate some relevant layers and models | 365 // Locate some relevant layers and models |
366 | 366 |
367 Layer *topLayer = getTopLayer(); | 367 Layer *topLayer = getTopLayer(); |
368 bool haveSomeTimeXAxis = false; | 368 bool haveSomeTimeXAxis = false; |
369 | 369 |
370 const Model *waveformModel = 0; // just for reporting purposes | 370 const Model *waveformModel = nullptr; // just for reporting purposes |
371 const Model *workModel = 0; | 371 const Model *workModel = nullptr; |
372 | 372 |
373 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { | 373 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
374 --vi; | 374 --vi; |
375 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) { | 375 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) { |
376 haveSomeTimeXAxis = true; | 376 haveSomeTimeXAxis = true; |
509 } | 509 } |
510 | 510 |
511 void | 511 void |
512 Pane::drawVerticalScale(QRect r, Layer *topLayer, QPainter &paint) | 512 Pane::drawVerticalScale(QRect r, Layer *topLayer, QPainter &paint) |
513 { | 513 { |
514 Layer *scaleLayer = 0; | 514 Layer *scaleLayer = nullptr; |
515 | 515 |
516 // cerr << "Pane::drawVerticalScale[" << this << "]" << endl; | 516 // cerr << "Pane::drawVerticalScale[" << this << "]" << endl; |
517 | 517 |
518 double min, max; | 518 double min, max; |
519 bool log; | 519 bool log; |
1129 | 1129 |
1130 QPainter *paint = new QPainter(image); | 1130 QPainter *paint = new QPainter(image); |
1131 if (!render(*paint, 0, f0, f1)) { | 1131 if (!render(*paint, 0, f0, f1)) { |
1132 delete paint; | 1132 delete paint; |
1133 delete image; | 1133 delete image; |
1134 return 0; | 1134 return nullptr; |
1135 } else { | 1135 } else { |
1136 delete paint; | 1136 delete paint; |
1137 return image; | 1137 return image; |
1138 } | 1138 } |
1139 } | 1139 } |
1265 if (LayerFactory::getInstance()->getLayerType(m_layerStack[i]) == | 1265 if (LayerFactory::getInstance()->getLayerType(m_layerStack[i]) == |
1266 LayerFactory::FlexiNotes) { | 1266 LayerFactory::FlexiNotes) { |
1267 return m_layerStack[i]; | 1267 return m_layerStack[i]; |
1268 } | 1268 } |
1269 } | 1269 } |
1270 return 0; | 1270 return nullptr; |
1271 } | 1271 } |
1272 | 1272 |
1273 void | 1273 void |
1274 Pane::mousePressEvent(QMouseEvent *e) | 1274 Pane::mousePressEvent(QMouseEvent *e) |
1275 { | 1275 { |
1867 setStartFrame(newStartFrame); | 1867 setStartFrame(newStartFrame); |
1868 | 1868 |
1869 QString unit; | 1869 QString unit; |
1870 double min, max; | 1870 double min, max; |
1871 bool log; | 1871 bool log; |
1872 Layer *layer = 0; | 1872 Layer *layer = nullptr; |
1873 for (LayerList::const_iterator i = m_layerStack.begin(); | 1873 for (LayerList::const_iterator i = m_layerStack.begin(); |
1874 i != m_layerStack.end(); ++i) { | 1874 i != m_layerStack.end(); ++i) { |
1875 if ((*i)->getValueExtents(min, max, log, unit) && | 1875 if ((*i)->getValueExtents(min, max, log, unit) && |
1876 (*i)->getDisplayExtents(min, max)) { | 1876 (*i)->getDisplayExtents(min, max)) { |
1877 layer = *i; | 1877 layer = *i; |
2403 } | 2403 } |
2404 | 2404 |
2405 void | 2405 void |
2406 Pane::verticalThumbwheelMoved(int value) | 2406 Pane::verticalThumbwheelMoved(int value) |
2407 { | 2407 { |
2408 Layer *layer = 0; | 2408 Layer *layer = nullptr; |
2409 if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1); | 2409 if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1); |
2410 if (layer) { | 2410 if (layer) { |
2411 int defaultStep = 0; | 2411 int defaultStep = 0; |
2412 int max = layer->getVerticalZoomSteps(defaultStep); | 2412 int max = layer->getVerticalZoomSteps(defaultStep); |
2413 if (max == 0) { | 2413 if (max == 0) { |
2679 } | 2679 } |
2680 | 2680 |
2681 void | 2681 void |
2682 Pane::propertyContainerSelected(View *v, PropertyContainer *pc) | 2682 Pane::propertyContainerSelected(View *v, PropertyContainer *pc) |
2683 { | 2683 { |
2684 Layer *layer = 0; | 2684 Layer *layer = nullptr; |
2685 | 2685 |
2686 if (getLayerCount() > 0) { | 2686 if (getLayerCount() > 0) { |
2687 layer = getLayer(getLayerCount() - 1); | 2687 layer = getLayer(getLayerCount() - 1); |
2688 disconnect(layer, SIGNAL(verticalZoomChanged()), | 2688 disconnect(layer, SIGNAL(verticalZoomChanged()), |
2689 this, SLOT(verticalZoomChanged())); | 2689 this, SLOT(verticalZoomChanged())); |
2691 | 2691 |
2692 View::propertyContainerSelected(v, pc); | 2692 View::propertyContainerSelected(v, pc); |
2693 updateHeadsUpDisplay(); | 2693 updateHeadsUpDisplay(); |
2694 | 2694 |
2695 if (m_vthumb) { | 2695 if (m_vthumb) { |
2696 RangeMapper *rm = 0; | 2696 RangeMapper *rm = nullptr; |
2697 if (layer) rm = layer->getNewVerticalZoomRangeMapper(); | 2697 if (layer) rm = layer->getNewVerticalZoomRangeMapper(); |
2698 if (rm) m_vthumb->setRangeMapper(rm); | 2698 if (rm) m_vthumb->setRangeMapper(rm); |
2699 } | 2699 } |
2700 | 2700 |
2701 if (getLayerCount() > 0) { | 2701 if (getLayerCount() > 0) { |
2706 } | 2706 } |
2707 | 2707 |
2708 void | 2708 void |
2709 Pane::verticalZoomChanged() | 2709 Pane::verticalZoomChanged() |
2710 { | 2710 { |
2711 Layer *layer = 0; | 2711 Layer *layer = nullptr; |
2712 | 2712 |
2713 if (getLayerCount() > 0) { | 2713 if (getLayerCount() > 0) { |
2714 | 2714 |
2715 layer = getLayer(getLayerCount() - 1); | 2715 layer = getLayer(getLayerCount() - 1); |
2716 | 2716 |