comparison 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
comparison
equal deleted inserted replaced
131:eaae73b6bd28 132:5d3a483856ff
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _THUMBWHEEL_H_
17 #define _THUMBWHEEL_H_
18
19 #include <QWidget>
20
21 class Thumbwheel : public QWidget
22 {
23 Q_OBJECT
24
25 public:
26 Thumbwheel(int min, int max, int defaultValue,
27 Qt::Orientation orientation, QWidget *parent = 0);
28 virtual ~Thumbwheel();
29
30 void setSpeed(float speed);
31 float getSpeed() const;
32
33 void setTracking(bool tracking);
34 bool getTracking() const;
35
36 void setShowScale(bool show);
37 bool getShowScale() const;
38
39 void setValue(int value);
40 int getValue() const;
41
42 virtual void mousePressEvent(QMouseEvent *e);
43 virtual void mouseDoubleClickEvent(QMouseEvent *e);
44 virtual void mouseMoveEvent(QMouseEvent *e);
45 virtual void mouseReleaseEvent(QMouseEvent *e);
46 virtual void wheelEvent(QWheelEvent *e);
47 virtual void paintEvent(QPaintEvent *e);
48
49 QSize sizeHint() const;
50
51 signals:
52 void valueChanged(int);
53
54 private:
55 int m_min;
56 int m_max;
57 int m_default;
58 int m_value;
59 Qt::Orientation m_orientation;
60 float m_speed;
61 bool m_tracking;
62 bool m_showScale;
63 bool m_clicked;
64 QPoint m_clickPos;
65 int m_clickValue;
66 };
67
68 #endif