annotate view/View.h @ 1040:25b035362c44 spectrogram-minor-refactor

Truncate edges when about to paint beyond limits of cache
author Chris Cannam
date Wed, 03 Feb 2016 16:51:37 +0000
parents 0be17aafa935
children 4e5c1c326794
rev   line source
Chris@127 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@127 2
Chris@127 3 /*
Chris@127 4 Sonic Visualiser
Chris@127 5 An audio file viewer and annotation editor.
Chris@127 6 Centre for Digital Music, Queen Mary, University of London.
Chris@127 7 This file copyright 2006 Chris Cannam.
Chris@127 8
Chris@127 9 This program is free software; you can redistribute it and/or
Chris@127 10 modify it under the terms of the GNU General Public License as
Chris@127 11 published by the Free Software Foundation; either version 2 of the
Chris@127 12 License, or (at your option) any later version. See the file
Chris@127 13 COPYING included with this distribution for more information.
Chris@127 14 */
Chris@127 15
Chris@226 16 #ifndef _VIEW_H_
Chris@226 17 #define _VIEW_H_
Chris@127 18
Chris@127 19 #include <QFrame>
Chris@127 20 #include <QProgressBar>
Chris@127 21
Chris@916 22 #include "LayerGeometryProvider.h"
Chris@916 23
Chris@127 24 #include "base/ZoomConstraint.h"
Chris@127 25 #include "base/PropertyContainer.h"
Chris@128 26 #include "ViewManager.h"
Chris@127 27 #include "base/XmlExportable.h"
Chris@902 28 #include "base/BaseTypes.h"
Chris@127 29
Chris@127 30 // #define DEBUG_VIEW_WIDGET_PAINT 1
Chris@127 31
Chris@127 32 class Layer;
Chris@127 33 class ViewPropertyContainer;
Chris@127 34
Chris@797 35 class QPushButton;
Chris@797 36
Chris@127 37 #include <map>
Chris@315 38 #include <set>
Chris@127 39
Chris@127 40 /**
Chris@127 41 * View is the base class of widgets that display one or more
Chris@127 42 * overlaid views of data against a horizontal time scale.
Chris@127 43 *
Chris@127 44 * A View may have any number of attached Layers, each of which
Chris@127 45 * is expected to have one data Model (although multiple views may
Chris@127 46 * share the same model).
Chris@127 47 *
Chris@127 48 * A View may be panned in time and zoomed, although the
Chris@127 49 * mechanisms for doing so (as well as any other operations and
Chris@127 50 * properties available) depend on the subclass.
Chris@127 51 */
Chris@127 52
Chris@127 53 class View : public QFrame,
Chris@916 54 public XmlExportable,
Chris@916 55 public LayerGeometryProvider
Chris@127 56 {
Chris@127 57 Q_OBJECT
Chris@127 58
Chris@127 59 public:
Chris@127 60 /**
Chris@127 61 * Deleting a View does not delete any of its layers. They should
Chris@127 62 * be managed elsewhere (e.g. by the Document).
Chris@127 63 */
Chris@127 64 virtual ~View();
Chris@1030 65
Chris@127 66 /**
Chris@127 67 * Retrieve the first visible sample frame on the widget.
Chris@127 68 * This is a calculated value based on the centre-frame, widget
Chris@127 69 * width and zoom level. The result may be negative.
Chris@127 70 */
Chris@902 71 sv_frame_t getStartFrame() const;
Chris@127 72
Chris@127 73 /**
Chris@127 74 * Set the widget pan based on the given first visible frame. The
Chris@127 75 * frame value may be negative.
Chris@127 76 */
Chris@902 77 void setStartFrame(sv_frame_t);
Chris@127 78
Chris@127 79 /**
Chris@127 80 * Return the centre frame of the visible widget. This is an
Chris@127 81 * exact value that does not depend on the zoom block size. Other
Chris@127 82 * frame values (start, end) are calculated from this based on the
Chris@127 83 * zoom and other factors.
Chris@127 84 */
Chris@902 85 sv_frame_t getCentreFrame() const { return m_centreFrame; }
Chris@127 86
Chris@127 87 /**
Chris@127 88 * Set the centre frame of the visible widget.
Chris@127 89 */
Chris@902 90 void setCentreFrame(sv_frame_t f) { setCentreFrame(f, true); }
Chris@127 91
Chris@127 92 /**
Chris@127 93 * Retrieve the last visible sample frame on the widget.
Chris@127 94 * This is a calculated value based on the centre-frame, widget
Chris@127 95 * width and zoom level.
Chris@127 96 */
Chris@902 97 sv_frame_t getEndFrame() const;
Chris@127 98
Chris@127 99 /**
Chris@127 100 * Return the pixel x-coordinate corresponding to a given sample
Chris@127 101 * frame (which may be negative).
Chris@127 102 */
Chris@902 103 int getXForFrame(sv_frame_t frame) const;
Chris@127 104
Chris@127 105 /**
Chris@127 106 * Return the closest frame to the given pixel x-coordinate.
Chris@127 107 */
Chris@902 108 sv_frame_t getFrameForX(int x) const;
Chris@127 109
Chris@127 110 /**
Chris@1030 111 * Return the closest pixel x-coordinate corresponding to a given
Chris@1030 112 * view x-coordinate. Default is no scaling, ViewProxy handles
Chris@1030 113 * scaling case.
Chris@1030 114 */
Chris@1030 115 int getXForViewX(int viewx) const { return viewx; }
Chris@1030 116
Chris@1030 117 /**
Chris@1030 118 * Return the closest view x-coordinate corresponding to a given
Chris@1030 119 * pixel x-coordinate. Default is no scaling, ViewProxy handles
Chris@1030 120 * scaling case.
Chris@1030 121 */
Chris@1030 122 int getViewXForX(int x) const { return x; }
Chris@1030 123
Chris@1030 124 /**
Chris@127 125 * Return the pixel y-coordinate corresponding to a given
Chris@127 126 * frequency, if the frequency range is as specified. This does
Chris@127 127 * not imply any policy about layer frequency ranges, but it might
Chris@127 128 * be useful for layers to match theirs up if desired.
Chris@127 129 *
Chris@127 130 * Not thread-safe in logarithmic mode. Call only from GUI thread.
Chris@127 131 */
Chris@904 132 double getYForFrequency(double frequency, double minFreq, double maxFreq,
Chris@127 133 bool logarithmic) const;
Chris@127 134
Chris@127 135 /**
Chris@127 136 * Return the closest frequency to the given pixel y-coordinate,
Chris@127 137 * if the frequency range is as specified.
Chris@127 138 *
Chris@127 139 * Not thread-safe in logarithmic mode. Call only from GUI thread.
Chris@127 140 */
Chris@904 141 double getFrequencyForY(int y, double minFreq, double maxFreq,
Chris@127 142 bool logarithmic) const;
Chris@127 143
Chris@127 144 /**
Chris@127 145 * Return the zoom level, i.e. the number of frames per pixel
Chris@127 146 */
Chris@127 147 int getZoomLevel() const;
Chris@127 148
Chris@127 149 /**
Chris@127 150 * Set the zoom level, i.e. the number of frames per pixel. The
Chris@127 151 * centre frame will be unchanged; the start and end frames will
Chris@127 152 * change.
Chris@127 153 */
Chris@806 154 virtual void setZoomLevel(int z);
Chris@127 155
Chris@127 156 /**
Chris@127 157 * Zoom in or out.
Chris@127 158 */
Chris@127 159 virtual void zoom(bool in);
Chris@127 160
Chris@127 161 /**
Chris@127 162 * Scroll left or right by a smallish or largish amount.
Chris@127 163 */
Chris@510 164 virtual void scroll(bool right, bool lots, bool doEmit = true);
Chris@127 165
Chris@834 166 /**
Chris@834 167 * Add a layer to the view. (Normally this should be handled
Chris@834 168 * through some command abstraction instead of using this function
Chris@834 169 * directly.)
Chris@834 170 */
Chris@127 171 virtual void addLayer(Layer *v);
Chris@834 172
Chris@834 173 /**
Chris@834 174 * Remove a layer from the view. Does not delete the
Chris@834 175 * layer. (Normally this should be handled through some command
Chris@834 176 * abstraction instead of using this function directly.)
Chris@834 177 */
Chris@834 178 virtual void removeLayer(Layer *v);
Chris@834 179
Chris@834 180 /**
Chris@834 181 * Return the number of layers, regardless of whether visible or
Chris@834 182 * dormant, i.e. invisible, in this view.
Chris@834 183 */
Chris@902 184 virtual int getLayerCount() const { return int(m_layerStack.size()); }
Chris@127 185
Chris@127 186 /**
Chris@834 187 * Return the nth layer, counted in stacking order. That is,
Chris@834 188 * layer 0 is the bottom layer and layer "getLayerCount()-1" is
Chris@834 189 * the top one. The returned layer may be visible or it may be
Chris@834 190 * dormant, i.e. invisible.
Chris@127 191 */
Chris@277 192 virtual Layer *getLayer(int n) {
Chris@902 193 if (in_range_for(m_layerStack, n)) return m_layerStack[n];
Chris@835 194 else return 0;
Chris@277 195 }
Chris@127 196
Chris@127 197 /**
Chris@835 198 * Return the nth layer, counted in the order they were
Chris@835 199 * added. Unlike the stacking order used in getLayer(), which
Chris@835 200 * changes each time a layer is selected, this ordering remains
Chris@835 201 * fixed. The returned layer may be visible or it may be dormant,
Chris@835 202 * i.e. invisible.
Chris@268 203 */
Chris@835 204 virtual Layer *getFixedOrderLayer(int n) {
Chris@835 205 if (n < int(m_fixedOrderLayers.size())) return m_fixedOrderLayers[n];
Chris@835 206 else return 0;
Chris@268 207 }
Chris@268 208
Chris@268 209 /**
Chris@834 210 * Return the layer currently active for tool interaction. This is
Chris@834 211 * the topmost non-dormant (i.e. visible) layer in the view. If
Chris@834 212 * there are no visible layers in the view, return 0.
Chris@834 213 */
Chris@834 214 virtual Layer *getInteractionLayer();
Chris@834 215
Chris@841 216 virtual const Layer *getInteractionLayer() const;
Chris@841 217
Chris@834 218 /**
Chris@835 219 * Return the layer most recently selected by the user. This is
Chris@835 220 * the layer that any non-tool-driven commands should operate on,
Chris@835 221 * in the case where this view is the "current" one.
Chris@835 222 *
Chris@835 223 * If the user has selected the view itself more recently than any
Chris@835 224 * of the layers on it, this function will return 0, and any
Chris@835 225 * non-tool-driven layer commands should be deactivated while this
Chris@835 226 * view is current. It will also return 0 if there are no layers
Chris@835 227 * in the view.
Chris@834 228 *
Chris@834 229 * Note that, unlike getInteractionLayer(), this could return an
Chris@834 230 * invisible (dormant) layer.
Chris@127 231 */
Chris@127 232 virtual Layer *getSelectedLayer();
Chris@834 233
Chris@127 234 virtual const Layer *getSelectedLayer() const;
Chris@127 235
Chris@835 236 /**
Chris@835 237 * Return the "top" layer in the view, whether visible or dormant.
Chris@835 238 * This is the same as getLayer(getLayerCount()-1) if there is at
Chris@835 239 * least one layer, and 0 otherwise.
Chris@835 240 *
Chris@835 241 * For most purposes involving interaction or commands, you
Chris@835 242 * probably want either getInteractionLayer() or
Chris@835 243 * getSelectedLayer() instead.
Chris@835 244 */
Chris@835 245 virtual Layer *getTopLayer() {
Chris@835 246 return m_layerStack.empty() ? 0 : m_layerStack[m_layerStack.size()-1];
Chris@835 247 }
Chris@835 248
Chris@127 249 virtual void setViewManager(ViewManager *m);
Chris@908 250 virtual void setViewManager(ViewManager *m, sv_frame_t initialFrame);
Chris@127 251 virtual ViewManager *getViewManager() const { return m_manager; }
Chris@127 252
Chris@127 253 virtual void setFollowGlobalPan(bool f);
Chris@127 254 virtual bool getFollowGlobalPan() const { return m_followPan; }
Chris@127 255
Chris@127 256 virtual void setFollowGlobalZoom(bool f);
Chris@127 257 virtual bool getFollowGlobalZoom() const { return m_followZoom; }
Chris@127 258
Chris@224 259 virtual bool hasLightBackground() const;
Chris@287 260 virtual QColor getForeground() const;
Chris@287 261 virtual QColor getBackground() const;
Chris@127 262
Chris@127 263 virtual void drawVisibleText(QPainter &p, int x, int y,
Chris@267 264 QString text, TextStyle style) const;
Chris@267 265
Chris@270 266 virtual void drawMeasurementRect(QPainter &p, const Layer *,
Chris@270 267 QRect rect, bool focus) const;
Chris@127 268
Chris@741 269 virtual bool shouldShowFeatureLabels() const {
Chris@741 270 return m_manager && m_manager->shouldShowFeatureLabels();
Chris@741 271 }
Chris@127 272 virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const {
Chris@127 273 return false;
Chris@127 274 }
Chris@127 275 virtual bool shouldIlluminateLocalSelection(QPoint &, bool &, bool &) const {
Chris@127 276 return false;
Chris@127 277 }
Chris@127 278
Chris@127 279 virtual void setPlaybackFollow(PlaybackFollowMode m);
Chris@127 280 virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; }
Chris@127 281
Chris@127 282 typedef PropertyContainer::PropertyName PropertyName;
Chris@127 283
Chris@127 284 // We implement the PropertyContainer API, although we don't
Chris@127 285 // actually subclass PropertyContainer. We have our own
Chris@127 286 // PropertyContainer that we can return on request that just
Chris@127 287 // delegates back to us.
Chris@127 288 virtual PropertyContainer::PropertyList getProperties() const;
Chris@127 289 virtual QString getPropertyLabel(const PropertyName &) const;
Chris@127 290 virtual PropertyContainer::PropertyType getPropertyType(const PropertyName &) const;
Chris@127 291 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@216 292 int *min, int *max, int *deflt) const;
Chris@127 293 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@127 294 int value) const;
Chris@127 295 virtual void setProperty(const PropertyName &, int value);
Chris@127 296 virtual QString getPropertyContainerName() const {
Chris@127 297 return objectName();
Chris@127 298 }
Chris@127 299 virtual QString getPropertyContainerIconName() const = 0;
Chris@127 300
Chris@806 301 virtual int getPropertyContainerCount() const;
Chris@127 302
Chris@837 303 // The 0th property container is the view's own; the rest are the
Chris@837 304 // layers in fixed-order series
Chris@806 305 virtual const PropertyContainer *getPropertyContainer(int i) const;
Chris@806 306 virtual PropertyContainer *getPropertyContainer(int i);
Chris@127 307
Chris@229 308 // Render the contents on a wide canvas
Chris@908 309 virtual QImage *toNewImage(sv_frame_t f0, sv_frame_t f1);
Chris@226 310 virtual QImage *toNewImage();
Chris@908 311 virtual QSize getImageSize(sv_frame_t f0, sv_frame_t f1);
Chris@229 312 virtual QSize getImageSize();
Chris@226 313
Chris@127 314 virtual int getTextLabelHeight(const Layer *layer, QPainter &) const;
Chris@127 315
Chris@904 316 virtual bool getValueExtents(QString unit, double &min, double &max,
Chris@127 317 bool &log) const;
Chris@127 318
Chris@316 319 virtual void toXml(QTextStream &stream, QString indent = "",
Chris@316 320 QString extraAttributes = "") const;
Chris@127 321
Chris@222 322 // First frame actually in model, to right of scale, if present
Chris@902 323 virtual sv_frame_t getFirstVisibleFrame() const;
Chris@902 324 virtual sv_frame_t getLastVisibleFrame() const;
Chris@222 325
Chris@902 326 sv_frame_t getModelsStartFrame() const;
Chris@902 327 sv_frame_t getModelsEndFrame() const;
Chris@127 328
Chris@915 329 /**
Chris@915 330 * To be called from a layer, to obtain the extent of the surface
Chris@915 331 * that the layer is currently painting to. This may be the extent
Chris@915 332 * of the view (if 1x display scaling is in effect) or of a larger
Chris@915 333 * cached pixmap (if greater display scaling is in effect).
Chris@915 334 */
Chris@915 335 QRect getPaintRect() const;
Chris@915 336
Chris@915 337 QSize getPaintSize() const { return getPaintRect().size(); }
Chris@915 338 int getPaintWidth() const { return getPaintRect().width(); }
Chris@915 339 int getPaintHeight() const { return getPaintRect().height(); }
Chris@915 340
Chris@315 341 typedef std::set<Model *> ModelSet;
Chris@315 342 ModelSet getModels();
Chris@315 343
Chris@301 344 //!!!
Chris@320 345 Model *getAligningModel() const;
Chris@902 346 sv_frame_t alignFromReference(sv_frame_t) const;
Chris@902 347 sv_frame_t alignToReference(sv_frame_t) const;
Chris@902 348 sv_frame_t getAlignedPlaybackFrame() const;
Chris@301 349
Chris@1030 350 void updatePaintRect(QRect r) { update(r); }
Chris@1030 351
Chris@918 352 View *getView() { return this; }
Chris@918 353 const View *getView() const { return this; }
Chris@918 354
Chris@127 355 signals:
Chris@127 356 void propertyContainerAdded(PropertyContainer *pc);
Chris@127 357 void propertyContainerRemoved(PropertyContainer *pc);
Chris@127 358 void propertyContainerPropertyChanged(PropertyContainer *pc);
Chris@197 359 void propertyContainerPropertyRangeChanged(PropertyContainer *pc);
Chris@127 360 void propertyContainerNameChanged(PropertyContainer *pc);
Chris@298 361 void propertyContainerSelected(PropertyContainer *pc);
Chris@127 362 void propertyChanged(PropertyContainer::PropertyName);
Chris@127 363
Chris@336 364 void layerModelChanged();
Chris@336 365
Chris@902 366 void centreFrameChanged(sv_frame_t frame,
Chris@211 367 bool globalScroll,
Chris@211 368 PlaybackFollowMode followMode);
Chris@211 369
Chris@806 370 void zoomLevelChanged(int, bool);
Chris@127 371
Chris@189 372 void contextHelpChanged(const QString &);
Chris@189 373
Chris@127 374 public slots:
Chris@127 375 virtual void modelChanged();
Chris@902 376 virtual void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame);
Chris@127 377 virtual void modelCompletionChanged();
Chris@320 378 virtual void modelAlignmentCompletionChanged();
Chris@127 379 virtual void modelReplaced();
Chris@127 380 virtual void layerParametersChanged();
Chris@197 381 virtual void layerParameterRangesChanged();
Chris@268 382 virtual void layerMeasurementRectsChanged();
Chris@127 383 virtual void layerNameChanged();
Chris@127 384
Chris@902 385 virtual void globalCentreFrameChanged(sv_frame_t);
Chris@902 386 virtual void viewCentreFrameChanged(View *, sv_frame_t);
Chris@902 387 virtual void viewManagerPlaybackFrameChanged(sv_frame_t);
Chris@806 388 virtual void viewZoomLevelChanged(View *, int, bool);
Chris@127 389
Chris@127 390 virtual void propertyContainerSelected(View *, PropertyContainer *pc);
Chris@127 391
Chris@127 392 virtual void selectionChanged();
Chris@127 393 virtual void toolModeChanged();
Chris@133 394 virtual void overlayModeChanged();
Chris@133 395 virtual void zoomWheelsEnabledChanged();
Chris@127 396
Chris@797 397 virtual void cancelClicked();
Chris@797 398
Chris@555 399 virtual void progressCheckStalledTimerElapsed();
Chris@555 400
Chris@127 401 protected:
Chris@127 402 View(QWidget *, bool showProgress);
Chris@1030 403
Chris@1030 404 int m_id;
Chris@1030 405
Chris@127 406 virtual void paintEvent(QPaintEvent *e);
Chris@127 407 virtual void drawSelections(QPainter &);
Chris@127 408 virtual bool shouldLabelSelections() const { return true; }
Chris@908 409 virtual bool render(QPainter &paint, int x0, sv_frame_t f0, sv_frame_t f1);
Chris@339 410 virtual void setPaintFont(QPainter &paint);
Chris@952 411
Chris@952 412 QSize scaledSize(const QSize &s, int factor) {
Chris@952 413 return QSize(s.width() * factor, s.height() * factor);
Chris@952 414 }
Chris@952 415 QRect scaledRect(const QRect &r, int factor) {
Chris@952 416 return QRect(r.x() * factor, r.y() * factor,
Chris@952 417 r.width() * factor, r.height() * factor);
Chris@952 418 }
Chris@339 419
Chris@127 420 typedef std::vector<Layer *> LayerList;
Chris@127 421
Chris@908 422 sv_samplerate_t getModelsSampleRate() const;
Chris@127 423 bool areLayersScrollable() const;
Chris@127 424 LayerList getScrollableBackLayers(bool testChanged, bool &changed) const;
Chris@127 425 LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const;
Chris@806 426 int getZoomConstraintBlockSize(int blockSize,
Chris@127 427 ZoomConstraint::RoundingDirection dir =
Chris@127 428 ZoomConstraint::RoundNearest) const;
Chris@127 429
Chris@183 430 // True if the top layer(s) use colours for meaningful things. If
Chris@183 431 // this is the case, selections will be shown using unfilled boxes
Chris@183 432 // rather than with a translucent fill.
Chris@183 433 bool areLayerColoursSignificant() const;
Chris@183 434
Chris@217 435 // True if the top layer has a time axis on the x coordinate (this
Chris@217 436 // is generally the case except for spectrum/slice layers). It
Chris@217 437 // will not be possible to make or display selections if this is
Chris@217 438 // false.
Chris@217 439 bool hasTopLayerTimeXAxis() const;
Chris@217 440
Chris@902 441 bool setCentreFrame(sv_frame_t f, bool doEmit);
Chris@127 442
Chris@902 443 void movePlayPointer(sv_frame_t f);
Chris@511 444
Chris@127 445 void checkProgress(void *object);
Chris@384 446 int getProgressBarWidth() const; // if visible
Chris@127 447
Chris@956 448 int effectiveDevicePixelRatio() const;
Chris@956 449
Chris@902 450 sv_frame_t m_centreFrame;
Chris@127 451 int m_zoomLevel;
Chris@127 452 bool m_followPan;
Chris@127 453 bool m_followZoom;
Chris@127 454 PlaybackFollowMode m_followPlay;
Chris@789 455 bool m_followPlayIsDetached;
Chris@902 456 sv_frame_t m_playPointerFrame;
Chris@127 457 bool m_lightBackground;
Chris@127 458 bool m_showProgress;
Chris@127 459
Chris@127 460 QPixmap *m_cache;
Chris@952 461 QPixmap *m_buffer;
Chris@902 462 sv_frame_t m_cacheCentreFrame;
Chris@127 463 int m_cacheZoomLevel;
Chris@127 464 bool m_selectionCached;
Chris@127 465
Chris@127 466 bool m_deleting;
Chris@127 467
Chris@835 468 LayerList m_layerStack; // I don't own these, but see dtor note above
Chris@835 469 LayerList m_fixedOrderLayers;
Chris@127 470 bool m_haveSelectedLayer;
Chris@127 471
Chris@583 472 QString m_lastError;
Chris@583 473
Chris@127 474 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers
Chris@127 475 mutable LayerList m_lastScrollableBackLayers;
Chris@127 476 mutable LayerList m_lastNonScrollableBackLayers;
Chris@127 477
Chris@555 478 struct ProgressBarRec {
Chris@797 479 QPushButton *cancel;
Chris@555 480 QProgressBar *bar;
Chris@555 481 int lastCheck;
Chris@555 482 QTimer *checkTimer;
Chris@555 483 };
Chris@555 484 typedef std::map<Layer *, ProgressBarRec> ProgressMap;
Chris@127 485 ProgressMap m_progressBars; // I own the ProgressBars
Chris@127 486
Chris@127 487 ViewManager *m_manager; // I don't own this
Chris@127 488 ViewPropertyContainer *m_propertyContainer; // I own this
Chris@127 489 };
Chris@127 490
Chris@127 491
Chris@127 492 // Use this for delegation, because we can't subclass from
Chris@127 493 // PropertyContainer (which is a QObject) ourselves because of
Chris@127 494 // ambiguity with QFrame parent
Chris@127 495
Chris@127 496 class ViewPropertyContainer : public PropertyContainer
Chris@127 497 {
Chris@127 498 Q_OBJECT
Chris@127 499
Chris@127 500 public:
Chris@127 501 ViewPropertyContainer(View *v);
Chris@728 502 virtual ~ViewPropertyContainer();
Chris@728 503
Chris@127 504 PropertyList getProperties() const { return m_v->getProperties(); }
Chris@127 505 QString getPropertyLabel(const PropertyName &n) const {
Chris@127 506 return m_v->getPropertyLabel(n);
Chris@127 507 }
Chris@127 508 PropertyType getPropertyType(const PropertyName &n) const {
Chris@127 509 return m_v->getPropertyType(n);
Chris@127 510 }
Chris@216 511 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max,
Chris@216 512 int *deflt) const {
Chris@216 513 return m_v->getPropertyRangeAndValue(n, min, max, deflt);
Chris@127 514 }
Chris@127 515 QString getPropertyValueLabel(const PropertyName &n, int value) const {
Chris@127 516 return m_v->getPropertyValueLabel(n, value);
Chris@127 517 }
Chris@127 518 QString getPropertyContainerName() const {
Chris@127 519 return m_v->getPropertyContainerName();
Chris@127 520 }
Chris@127 521 QString getPropertyContainerIconName() const {
Chris@127 522 return m_v->getPropertyContainerIconName();
Chris@127 523 }
Chris@127 524
Chris@127 525 public slots:
Chris@127 526 virtual void setProperty(const PropertyName &n, int value) {
Chris@127 527 m_v->setProperty(n, value);
Chris@127 528 }
Chris@127 529
Chris@127 530 protected:
Chris@127 531 View *m_v;
Chris@127 532 };
Chris@127 533
Chris@127 534 #endif
Chris@127 535