annotate widgets/Thumbwheel.h @ 132:5d3a483856ff

* Add Thumbwheel widget for all our zooming needs * Use QSettings to save/restore window size and position -- precursor to switching our preferences to QSettings as well -- wish I'd noticed it sooner * Only suspend writes (not reads from the underlying cache objects) from the fft caches when repainting the spectrogram -- performance should now be significantly better
author Chris Cannam
date Thu, 03 Aug 2006 15:40:11 +0000
parents
children 9e6b3e239b9d
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@132 7 This file copyright 2006 Chris Cannam.
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@132 21 class Thumbwheel : public QWidget
Chris@132 22 {
Chris@132 23 Q_OBJECT
Chris@132 24
Chris@132 25 public:
Chris@132 26 Thumbwheel(int min, int max, int defaultValue,
Chris@132 27 Qt::Orientation orientation, QWidget *parent = 0);
Chris@132 28 virtual ~Thumbwheel();
Chris@132 29
Chris@132 30 void setSpeed(float speed);
Chris@132 31 float getSpeed() const;
Chris@132 32
Chris@132 33 void setTracking(bool tracking);
Chris@132 34 bool getTracking() const;
Chris@132 35
Chris@132 36 void setShowScale(bool show);
Chris@132 37 bool getShowScale() const;
Chris@132 38
Chris@132 39 void setValue(int value);
Chris@132 40 int getValue() const;
Chris@132 41
Chris@132 42 virtual void mousePressEvent(QMouseEvent *e);
Chris@132 43 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@132 44 virtual void mouseMoveEvent(QMouseEvent *e);
Chris@132 45 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@132 46 virtual void wheelEvent(QWheelEvent *e);
Chris@132 47 virtual void paintEvent(QPaintEvent *e);
Chris@132 48
Chris@132 49 QSize sizeHint() const;
Chris@132 50
Chris@132 51 signals:
Chris@132 52 void valueChanged(int);
Chris@132 53
Chris@132 54 private:
Chris@132 55 int m_min;
Chris@132 56 int m_max;
Chris@132 57 int m_default;
Chris@132 58 int m_value;
Chris@132 59 Qt::Orientation m_orientation;
Chris@132 60 float m_speed;
Chris@132 61 bool m_tracking;
Chris@132 62 bool m_showScale;
Chris@132 63 bool m_clicked;
Chris@132 64 QPoint m_clickPos;
Chris@132 65 int m_clickValue;
Chris@132 66 };
Chris@132 67
Chris@132 68 #endif