Mercurial > hg > svgui
comparison view/View.h @ 1406:a18e78b9c78b fix-static-analysis
Use override throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 13:52:27 +0000 |
parents | b0eeec95ab5b |
children | 8d5bf4ab98ef |
comparison
equal
deleted
inserted
replaced
1405:4c359c2b220c | 1406:a18e78b9c78b |
---|---|
65 | 65 |
66 /** | 66 /** |
67 * Retrieve the id of this object. Views have their own unique | 67 * Retrieve the id of this object. Views have their own unique |
68 * ids, but ViewProxy objects share the id of their View. | 68 * ids, but ViewProxy objects share the id of their View. |
69 */ | 69 */ |
70 int getId() const { return m_id; } | 70 int getId() const override { return m_id; } |
71 | 71 |
72 /** | 72 /** |
73 * Retrieve the first visible sample frame on the widget. | 73 * Retrieve the first visible sample frame on the widget. |
74 * This is a calculated value based on the centre-frame, widget | 74 * This is a calculated value based on the centre-frame, widget |
75 * width and zoom level. The result may be negative. | 75 * width and zoom level. The result may be negative. |
76 */ | 76 */ |
77 sv_frame_t getStartFrame() const; | 77 sv_frame_t getStartFrame() const override; |
78 | 78 |
79 /** | 79 /** |
80 * Set the widget pan based on the given first visible frame. The | 80 * Set the widget pan based on the given first visible frame. The |
81 * frame value may be negative. | 81 * frame value may be negative. |
82 */ | 82 */ |
86 * Return the centre frame of the visible widget. This is an | 86 * Return the centre frame of the visible widget. This is an |
87 * exact value that does not depend on the zoom block size. Other | 87 * exact value that does not depend on the zoom block size. Other |
88 * frame values (start, end) are calculated from this based on the | 88 * frame values (start, end) are calculated from this based on the |
89 * zoom and other factors. | 89 * zoom and other factors. |
90 */ | 90 */ |
91 sv_frame_t getCentreFrame() const { return m_centreFrame; } | 91 sv_frame_t getCentreFrame() const override { return m_centreFrame; } |
92 | 92 |
93 /** | 93 /** |
94 * Set the centre frame of the visible widget. | 94 * Set the centre frame of the visible widget. |
95 */ | 95 */ |
96 void setCentreFrame(sv_frame_t f) { setCentreFrame(f, true); } | 96 void setCentreFrame(sv_frame_t f) { setCentreFrame(f, true); } |
98 /** | 98 /** |
99 * Retrieve the last visible sample frame on the widget. | 99 * Retrieve the last visible sample frame on the widget. |
100 * This is a calculated value based on the centre-frame, widget | 100 * This is a calculated value based on the centre-frame, widget |
101 * width and zoom level. | 101 * width and zoom level. |
102 */ | 102 */ |
103 sv_frame_t getEndFrame() const; | 103 sv_frame_t getEndFrame() const override; |
104 | 104 |
105 /** | 105 /** |
106 * Return the pixel x-coordinate corresponding to a given sample | 106 * Return the pixel x-coordinate corresponding to a given sample |
107 * frame. The frame is permitted to be negative, and the result | 107 * frame. The frame is permitted to be negative, and the result |
108 * may be outside the currently visible area. But this should not | 108 * may be outside the currently visible area. But this should not |
109 * be called with frame values very far away from the currently | 109 * be called with frame values very far away from the currently |
110 * visible area, as that could lead to overflow. In that situation | 110 * visible area, as that could lead to overflow. In that situation |
111 * an error will be logged and 0 returned. | 111 * an error will be logged and 0 returned. |
112 */ | 112 */ |
113 int getXForFrame(sv_frame_t frame) const; | 113 int getXForFrame(sv_frame_t frame) const override; |
114 | 114 |
115 /** | 115 /** |
116 * Return the closest frame to the given pixel x-coordinate. | 116 * Return the closest frame to the given pixel x-coordinate. |
117 */ | 117 */ |
118 sv_frame_t getFrameForX(int x) const; | 118 sv_frame_t getFrameForX(int x) const override; |
119 | 119 |
120 /** | 120 /** |
121 * Return the closest pixel x-coordinate corresponding to a given | 121 * Return the closest pixel x-coordinate corresponding to a given |
122 * view x-coordinate. Default is no scaling, ViewProxy handles | 122 * view x-coordinate. Default is no scaling, ViewProxy handles |
123 * scaling case. | 123 * scaling case. |
124 */ | 124 */ |
125 int getXForViewX(int viewx) const { return viewx; } | 125 int getXForViewX(int viewx) const override { return viewx; } |
126 | 126 |
127 /** | 127 /** |
128 * Return the closest view x-coordinate corresponding to a given | 128 * Return the closest view x-coordinate corresponding to a given |
129 * pixel x-coordinate. Default is no scaling, ViewProxy handles | 129 * pixel x-coordinate. Default is no scaling, ViewProxy handles |
130 * scaling case. | 130 * scaling case. |
131 */ | 131 */ |
132 int getViewXForX(int x) const { return x; } | 132 int getViewXForX(int x) const override { return x; } |
133 | 133 |
134 /** | 134 /** |
135 * Return the pixel y-coordinate corresponding to a given | 135 * Return the pixel y-coordinate corresponding to a given |
136 * frequency, if the frequency range is as specified. This does | 136 * frequency, if the frequency range is as specified. This does |
137 * not imply any policy about layer frequency ranges, but it might | 137 * not imply any policy about layer frequency ranges, but it might |
138 * be useful for layers to match theirs up if desired. | 138 * be useful for layers to match theirs up if desired. |
139 * | 139 * |
140 * Not thread-safe in logarithmic mode. Call only from GUI thread. | 140 * Not thread-safe in logarithmic mode. Call only from GUI thread. |
141 */ | 141 */ |
142 double getYForFrequency(double frequency, double minFreq, double maxFreq, | 142 double getYForFrequency(double frequency, double minFreq, double maxFreq, |
143 bool logarithmic) const; | 143 bool logarithmic) const override; |
144 | 144 |
145 /** | 145 /** |
146 * Return the closest frequency to the given pixel y-coordinate, | 146 * Return the closest frequency to the given pixel y-coordinate, |
147 * if the frequency range is as specified. | 147 * if the frequency range is as specified. |
148 * | 148 * |
149 * Not thread-safe in logarithmic mode. Call only from GUI thread. | 149 * Not thread-safe in logarithmic mode. Call only from GUI thread. |
150 */ | 150 */ |
151 double getFrequencyForY(double y, double minFreq, double maxFreq, | 151 double getFrequencyForY(double y, double minFreq, double maxFreq, |
152 bool logarithmic) const; | 152 bool logarithmic) const override; |
153 | 153 |
154 /** | 154 /** |
155 * Return the zoom level, i.e. the number of frames per pixel or | 155 * Return the zoom level, i.e. the number of frames per pixel or |
156 * pixels per frame | 156 * pixels per frame |
157 */ | 157 */ |
158 ZoomLevel getZoomLevel() const; | 158 ZoomLevel getZoomLevel() const override; |
159 | 159 |
160 /** | 160 /** |
161 * Set the zoom level, i.e. the number of frames per pixel or | 161 * Set the zoom level, i.e. the number of frames per pixel or |
162 * pixels per frame. The centre frame will be unchanged; the | 162 * pixels per frame. The centre frame will be unchanged; the |
163 * start and end frames will change. | 163 * start and end frames will change. |
257 return m_layerStack.empty() ? 0 : m_layerStack[m_layerStack.size()-1]; | 257 return m_layerStack.empty() ? 0 : m_layerStack[m_layerStack.size()-1]; |
258 } | 258 } |
259 | 259 |
260 virtual void setViewManager(ViewManager *m); | 260 virtual void setViewManager(ViewManager *m); |
261 virtual void setViewManager(ViewManager *m, sv_frame_t initialFrame); | 261 virtual void setViewManager(ViewManager *m, sv_frame_t initialFrame); |
262 virtual ViewManager *getViewManager() const { return m_manager; } | 262 ViewManager *getViewManager() const override { return m_manager; } |
263 | 263 |
264 virtual void setFollowGlobalPan(bool f); | 264 virtual void setFollowGlobalPan(bool f); |
265 virtual bool getFollowGlobalPan() const { return m_followPan; } | 265 virtual bool getFollowGlobalPan() const { return m_followPan; } |
266 | 266 |
267 virtual void setFollowGlobalZoom(bool f); | 267 virtual void setFollowGlobalZoom(bool f); |
268 virtual bool getFollowGlobalZoom() const { return m_followZoom; } | 268 virtual bool getFollowGlobalZoom() const { return m_followZoom; } |
269 | 269 |
270 virtual bool hasLightBackground() const; | 270 bool hasLightBackground() const override; |
271 virtual QColor getForeground() const; | 271 QColor getForeground() const override; |
272 virtual QColor getBackground() const; | 272 QColor getBackground() const override; |
273 | 273 |
274 virtual void drawMeasurementRect(QPainter &p, const Layer *, | 274 void drawMeasurementRect(QPainter &p, const Layer *, |
275 QRect rect, bool focus) const; | 275 QRect rect, bool focus) const override; |
276 | 276 |
277 virtual bool shouldShowFeatureLabels() const { | 277 bool shouldShowFeatureLabels() const override { |
278 return m_manager && m_manager->shouldShowFeatureLabels(); | 278 return m_manager && m_manager->shouldShowFeatureLabels(); |
279 } | 279 } |
280 virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const { | 280 bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const override { |
281 return false; | 281 return false; |
282 } | 282 } |
283 virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) const { | 283 virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) const { |
284 return false; | 284 return false; |
285 } | 285 } |
347 * new SVG file. | 347 * new SVG file. |
348 */ | 348 */ |
349 virtual bool renderPartToSvgFile(QString filename, | 349 virtual bool renderPartToSvgFile(QString filename, |
350 sv_frame_t f0, sv_frame_t f1); | 350 sv_frame_t f0, sv_frame_t f1); |
351 | 351 |
352 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const; | 352 int getTextLabelHeight(const Layer *layer, QPainter &) const override; |
353 | 353 |
354 virtual bool getValueExtents(QString unit, double &min, double &max, | 354 bool getValueExtents(QString unit, double &min, double &max, |
355 bool &log) const; | 355 bool &log) const override; |
356 | 356 |
357 virtual void toXml(QTextStream &stream, QString indent = "", | 357 void toXml(QTextStream &stream, QString indent = "", |
358 QString extraAttributes = "") const; | 358 QString extraAttributes = "") const override; |
359 | 359 |
360 // First frame actually in model, to right of scale, if present | 360 // First frame actually in model, to right of scale, if present |
361 virtual sv_frame_t getFirstVisibleFrame() const; | 361 virtual sv_frame_t getFirstVisibleFrame() const; |
362 virtual sv_frame_t getLastVisibleFrame() const; | 362 virtual sv_frame_t getLastVisibleFrame() const; |
363 | 363 |
364 sv_frame_t getModelsStartFrame() const; | 364 sv_frame_t getModelsStartFrame() const override; |
365 sv_frame_t getModelsEndFrame() const; | 365 sv_frame_t getModelsEndFrame() const override; |
366 | 366 |
367 /** | 367 /** |
368 * To be called from a layer, to obtain the extent of the surface | 368 * To be called from a layer, to obtain the extent of the surface |
369 * that the layer is currently painting to. This may be the extent | 369 * that the layer is currently painting to. This may be the extent |
370 * of the view (if 1x display scaling is in effect) or of a larger | 370 * of the view (if 1x display scaling is in effect) or of a larger |
371 * cached pixmap (if greater display scaling is in effect). | 371 * cached pixmap (if greater display scaling is in effect). |
372 */ | 372 */ |
373 QRect getPaintRect() const; | 373 QRect getPaintRect() const override; |
374 | 374 |
375 QSize getPaintSize() const { return getPaintRect().size(); } | 375 QSize getPaintSize() const override { return getPaintRect().size(); } |
376 int getPaintWidth() const { return getPaintRect().width(); } | 376 int getPaintWidth() const override { return getPaintRect().width(); } |
377 int getPaintHeight() const { return getPaintRect().height(); } | 377 int getPaintHeight() const override { return getPaintRect().height(); } |
378 | 378 |
379 double scaleSize(double size) const; | 379 double scaleSize(double size) const override; |
380 int scalePixelSize(int size) const; | 380 int scalePixelSize(int size) const override; |
381 double scalePenWidth(double width) const; | 381 double scalePenWidth(double width) const override; |
382 QPen scalePen(QPen pen) const; | 382 QPen scalePen(QPen pen) const override; |
383 | 383 |
384 typedef std::set<Model *> ModelSet; | 384 typedef std::set<Model *> ModelSet; |
385 ModelSet getModels(); | 385 ModelSet getModels(); |
386 | 386 |
387 //!!! | 387 //!!! |
388 Model *getAligningModel() const; | 388 Model *getAligningModel() const; |
389 sv_frame_t alignFromReference(sv_frame_t) const; | 389 sv_frame_t alignFromReference(sv_frame_t) const; |
390 sv_frame_t alignToReference(sv_frame_t) const; | 390 sv_frame_t alignToReference(sv_frame_t) const; |
391 sv_frame_t getAlignedPlaybackFrame() const; | 391 sv_frame_t getAlignedPlaybackFrame() const; |
392 | 392 |
393 void updatePaintRect(QRect r) { update(r); } | 393 void updatePaintRect(QRect r) override { update(r); } |
394 | 394 |
395 View *getView() { return this; } | 395 View *getView() override { return this; } |
396 const View *getView() const { return this; } | 396 const View *getView() const override { return this; } |
397 | 397 |
398 signals: | 398 signals: |
399 void propertyContainerAdded(PropertyContainer *pc); | 399 void propertyContainerAdded(PropertyContainer *pc); |
400 void propertyContainerRemoved(PropertyContainer *pc); | 400 void propertyContainerRemoved(PropertyContainer *pc); |
401 void propertyContainerPropertyChanged(PropertyContainer *pc); | 401 void propertyContainerPropertyChanged(PropertyContainer *pc); |
444 protected: | 444 protected: |
445 View(QWidget *, bool showProgress); | 445 View(QWidget *, bool showProgress); |
446 | 446 |
447 int m_id; | 447 int m_id; |
448 | 448 |
449 virtual void paintEvent(QPaintEvent *e); | 449 void paintEvent(QPaintEvent *e) override; |
450 virtual void drawSelections(QPainter &); | 450 virtual void drawSelections(QPainter &); |
451 virtual bool shouldLabelSelections() const { return true; } | 451 virtual bool shouldLabelSelections() const { return true; } |
452 virtual void drawPlayPointer(QPainter &); | 452 virtual void drawPlayPointer(QPainter &); |
453 virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1); | 453 virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1); |
454 virtual void setPaintFont(QPainter &paint); | 454 virtual void setPaintFont(QPainter &paint); |
550 | 550 |
551 public: | 551 public: |
552 ViewPropertyContainer(View *v); | 552 ViewPropertyContainer(View *v); |
553 virtual ~ViewPropertyContainer(); | 553 virtual ~ViewPropertyContainer(); |
554 | 554 |
555 PropertyList getProperties() const { return m_v->getProperties(); } | 555 PropertyList getProperties() const override { return m_v->getProperties(); } |
556 QString getPropertyLabel(const PropertyName &n) const { | 556 QString getPropertyLabel(const PropertyName &n) const override { |
557 return m_v->getPropertyLabel(n); | 557 return m_v->getPropertyLabel(n); |
558 } | 558 } |
559 PropertyType getPropertyType(const PropertyName &n) const { | 559 PropertyType getPropertyType(const PropertyName &n) const override { |
560 return m_v->getPropertyType(n); | 560 return m_v->getPropertyType(n); |
561 } | 561 } |
562 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max, | 562 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max, |
563 int *deflt) const { | 563 int *deflt) const override { |
564 return m_v->getPropertyRangeAndValue(n, min, max, deflt); | 564 return m_v->getPropertyRangeAndValue(n, min, max, deflt); |
565 } | 565 } |
566 QString getPropertyValueLabel(const PropertyName &n, int value) const { | 566 QString getPropertyValueLabel(const PropertyName &n, int value) const override { |
567 return m_v->getPropertyValueLabel(n, value); | 567 return m_v->getPropertyValueLabel(n, value); |
568 } | 568 } |
569 QString getPropertyContainerName() const { | 569 QString getPropertyContainerName() const override { |
570 return m_v->getPropertyContainerName(); | 570 return m_v->getPropertyContainerName(); |
571 } | 571 } |
572 QString getPropertyContainerIconName() const { | 572 QString getPropertyContainerIconName() const override { |
573 return m_v->getPropertyContainerIconName(); | 573 return m_v->getPropertyContainerIconName(); |
574 } | 574 } |
575 | 575 |
576 public slots: | 576 public slots: |
577 virtual void setProperty(const PropertyName &n, int value) { | 577 void setProperty(const PropertyName &n, int value) override { |
578 m_v->setProperty(n, value); | 578 m_v->setProperty(n, value); |
579 } | 579 } |
580 | 580 |
581 protected: | 581 protected: |
582 View *m_v; | 582 View *m_v; |