annotate widgets/Thumbwheel.h @ 1410:d057dcc827e7 fix-static-analysis

Merge from default branch
author Chris Cannam
date Tue, 04 Dec 2018 13:49:09 +0000
parents a18e78b9c78b
children bbc3f537564c
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@1303 16 #ifndef SV_THUMBWHEEL_H
Chris@1303 17 #define SV_THUMBWHEEL_H
Chris@132 18
Chris@132 19 #include <QWidget>
Chris@382 20 #include <QImage>
Chris@382 21
Chris@382 22 #include <map>
Chris@132 23
Chris@1303 24 #include "WheelCounter.h"
Chris@1303 25
Chris@187 26 class RangeMapper;
Chris@187 27
Chris@132 28 class Thumbwheel : public QWidget
Chris@132 29 {
Chris@132 30 Q_OBJECT
Chris@132 31
Chris@132 32 public:
Chris@133 33 Thumbwheel(Qt::Orientation orientation, QWidget *parent = 0);
Chris@132 34 virtual ~Thumbwheel();
Chris@132 35
Chris@133 36 int getMinimumValue() const;
Chris@133 37 int getMaximumValue() const;
Chris@133 38 int getDefaultValue() const;
Chris@132 39 float getSpeed() const;
Chris@132 40 bool getTracking() const;
Chris@132 41 bool getShowScale() const;
Chris@132 42 int getValue() const;
Chris@132 43
Chris@187 44 void setRangeMapper(RangeMapper *mapper); // I take ownership, will delete
Chris@187 45 const RangeMapper *getRangeMapper() const { return m_rangeMapper; }
Chris@908 46 double getMappedValue() const;
Chris@187 47
Chris@187 48 void setShowToolTip(bool show);
Chris@187 49
Chris@1406 50 QSize sizeHint() const override;
Chris@132 51
Chris@132 52 signals:
Chris@132 53 void valueChanged(int);
Chris@132 54
Chris@189 55 void mouseEntered();
Chris@189 56 void mouseLeft();
Chris@189 57
Chris@133 58 public slots:
Chris@133 59 void setMinimumValue(int min);
Chris@133 60 void setMaximumValue(int max);
Chris@133 61 void setDefaultValue(int deft);
Chris@133 62 void setSpeed(float speed);
Chris@133 63 void setTracking(bool tracking);
Chris@133 64 void setShowScale(bool show);
Chris@133 65 void setValue(int value);
Chris@908 66 void setMappedValue(double mappedValue);
Chris@256 67 void scroll(bool up);
Chris@133 68 void resetToDefault();
Chris@133 69
Chris@187 70 protected slots:
Chris@187 71 void updateMappedValue(int value);
Chris@187 72
Chris@189 73 protected:
Chris@1406 74 void mousePressEvent(QMouseEvent *e) override;
Chris@1406 75 void mouseDoubleClickEvent(QMouseEvent *e) override;
Chris@1406 76 void mouseMoveEvent(QMouseEvent *e) override;
Chris@1406 77 void mouseReleaseEvent(QMouseEvent *e) override;
Chris@1406 78 void wheelEvent(QWheelEvent *e) override;
Chris@1406 79 void paintEvent(QPaintEvent *e) override;
Chris@1406 80 void enterEvent(QEvent *) override;
Chris@1406 81 void leaveEvent(QEvent *) override;
Chris@189 82
Chris@132 83 int m_min;
Chris@132 84 int m_max;
Chris@132 85 int m_default;
Chris@132 86 int m_value;
Chris@908 87 double m_mappedValue;
Chris@187 88 bool m_noMappedUpdate;
Chris@165 89 float m_rotation;
Chris@132 90 Qt::Orientation m_orientation;
Chris@132 91 float m_speed;
Chris@132 92 bool m_tracking;
Chris@132 93 bool m_showScale;
Chris@132 94 bool m_clicked;
Chris@133 95 bool m_atDefault;
Chris@132 96 QPoint m_clickPos;
Chris@165 97 float m_clickRotation;
Chris@187 98 bool m_showTooltip;
Chris@187 99 RangeMapper *m_rangeMapper;
Chris@382 100 QImage m_cache;
Chris@1303 101 WheelCounter m_wheelCounter;
Chris@132 102 };
Chris@132 103
Chris@132 104 #endif