annotate widgets/Thumbwheel.h @ 294:919740b20cc9

* Better abbreviation modes for layer names in pane (and input model combo of plugin parameter dialog) * Avoid crash when loading SV file containing model derived from nonexistent model (shouldn't happen of course, but see bug #1771769) * Remember last-used input model in plugin parameter dialog * Don't override a layer colour loaded from a session file with the generated default colour when attaching it to a view
author Chris Cannam
date Fri, 10 Aug 2007 16:36:50 +0000
parents c492902dba40
children 06b5f110c5d2
rev   line source
Chris@132 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@132 2
Chris@132 3 /*
Chris@132 4 Sonic Visualiser
Chris@132 5 An audio file viewer and annotation editor.
Chris@132 6 Centre for Digital Music, Queen Mary, University of London.
Chris@182 7 This file copyright 2006 QMUL.
Chris@132 8
Chris@132 9 This program is free software; you can redistribute it and/or
Chris@132 10 modify it under the terms of the GNU General Public License as
Chris@132 11 published by the Free Software Foundation; either version 2 of the
Chris@132 12 License, or (at your option) any later version. See the file
Chris@132 13 COPYING included with this distribution for more information.
Chris@132 14 */
Chris@132 15
Chris@132 16 #ifndef _THUMBWHEEL_H_
Chris@132 17 #define _THUMBWHEEL_H_
Chris@132 18
Chris@132 19 #include <QWidget>
Chris@132 20
Chris@187 21 class RangeMapper;
Chris@187 22
Chris@132 23 class Thumbwheel : public QWidget
Chris@132 24 {
Chris@132 25 Q_OBJECT
Chris@132 26
Chris@132 27 public:
Chris@133 28 Thumbwheel(Qt::Orientation orientation, QWidget *parent = 0);
Chris@132 29 virtual ~Thumbwheel();
Chris@132 30
Chris@133 31 int getMinimumValue() const;
Chris@133 32 int getMaximumValue() const;
Chris@133 33 int getDefaultValue() const;
Chris@132 34 float getSpeed() const;
Chris@132 35 bool getTracking() const;
Chris@132 36 bool getShowScale() const;
Chris@132 37 int getValue() const;
Chris@132 38
Chris@187 39 void setRangeMapper(RangeMapper *mapper); // I take ownership, will delete
Chris@187 40 const RangeMapper *getRangeMapper() const { return m_rangeMapper; }
Chris@187 41 float getMappedValue() const;
Chris@187 42
Chris@187 43 void setShowToolTip(bool show);
Chris@187 44
Chris@132 45 QSize sizeHint() const;
Chris@132 46
Chris@132 47 signals:
Chris@132 48 void valueChanged(int);
Chris@132 49
Chris@189 50 void mouseEntered();
Chris@189 51 void mouseLeft();
Chris@189 52
Chris@133 53 public slots:
Chris@133 54 void setMinimumValue(int min);
Chris@133 55 void setMaximumValue(int max);
Chris@133 56 void setDefaultValue(int deft);
Chris@133 57 void setSpeed(float speed);
Chris@133 58 void setTracking(bool tracking);
Chris@133 59 void setShowScale(bool show);
Chris@133 60 void setValue(int value);
Chris@187 61 void setMappedValue(float mappedValue);
Chris@256 62 void scroll(bool up);
Chris@133 63 void resetToDefault();
Chris@133 64
Chris@187 65 protected slots:
Chris@187 66 void updateMappedValue(int value);
Chris@187 67
Chris@189 68 protected:
Chris@189 69 virtual void mousePressEvent(QMouseEvent *e);
Chris@189 70 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@189 71 virtual void mouseMoveEvent(QMouseEvent *e);
Chris@189 72 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@189 73 virtual void wheelEvent(QWheelEvent *e);
Chris@189 74 virtual void paintEvent(QPaintEvent *e);
Chris@189 75 virtual void enterEvent(QEvent *);
Chris@189 76 virtual void leaveEvent(QEvent *);
Chris@189 77
Chris@132 78 int m_min;
Chris@132 79 int m_max;
Chris@132 80 int m_default;
Chris@132 81 int m_value;
Chris@187 82 float m_mappedValue;
Chris@187 83 bool m_noMappedUpdate;
Chris@165 84 float m_rotation;
Chris@132 85 Qt::Orientation m_orientation;
Chris@132 86 float m_speed;
Chris@132 87 bool m_tracking;
Chris@132 88 bool m_showScale;
Chris@132 89 bool m_clicked;
Chris@133 90 bool m_atDefault;
Chris@132 91 QPoint m_clickPos;
Chris@165 92 float m_clickRotation;
Chris@187 93 bool m_showTooltip;
Chris@187 94 RangeMapper *m_rangeMapper;
Chris@132 95 };
Chris@132 96
Chris@132 97 #endif