Mercurial > hg > dmlib
annotate editor/edwaveform.h @ 2294:7f6ba3b32f54
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 03 Jul 2019 10:28:43 +0300 |
parents | e2ac08228a0f |
children |
rev | line source |
---|---|
357 | 1 #ifndef EDWAVEFORM_H |
2 #define EDWAVEFORM_H | |
3 | |
4 #include <QWidget> | |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
5 #include <QLabel> |
357 | 6 #include "dmengine.h" |
7 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
8 class QEDWaveTrackDisplay : public QWidget |
357 | 9 { |
10 Q_OBJECT | |
11 | |
12 public: | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
13 QEDWaveTrackDisplay(QWidget *parent = 0); |
357 | 14 |
391 | 15 void setWaveform(void *mdata, int msize, int mformat, int mchannels, int mfreq); |
16 float getScaledWidth(); | |
357 | 17 void setScale(const float mscale); |
391 | 18 int getBps(); |
19 float getDuration(); | |
20 float getTimeScale(float value); | |
21 float getTimeFromCoord(float value); | |
22 float getTime(); | |
23 float getOffset(); | |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
24 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
25 QSize minimumSizeHint() const |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
26 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
27 return QSize(100, 60); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
28 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
29 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
30 QSize sizeHint() const |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
31 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
32 return QSize(600, 60); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
33 } |
357 | 34 |
391 | 35 public slots: |
36 void setTime(const float mtime); | |
37 void setOffset(const float moffs); | |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
38 void setSelection(const float mstart, const float mend); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
39 void clearSelection(); |
391 | 40 |
41 signals: | |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
42 void selectionChanged(float mstart, float mduration); |
391 | 43 void timeChanged(float value); |
44 void offsetChanged(float value); | |
45 | |
357 | 46 protected: |
47 void mousePressEvent(QMouseEvent *event); | |
48 void mouseMoveEvent(QMouseEvent *event); | |
49 void mouseReleaseEvent(QMouseEvent *event); | |
50 | |
51 void paintEvent(QPaintEvent *event); | |
52 | |
53 private: | |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
54 float scale, time, offs, duration; // in milliseconds |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
393
diff
changeset
|
55 int size, channels, format, freq, sduration; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
56 void *data; |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
57 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
58 bool selectionValid; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
59 float selectionStart, selectionDuration; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
60 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
61 QPoint selectionPoint, dragPoint; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
62 bool selecting, dragging; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
63 float selectionOffs, dragOffs; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
64 }; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
65 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
66 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
67 class QEDWaveTrackView : public QWidget |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
68 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
69 Q_OBJECT |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
70 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
71 private: |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
72 QEDWaveTrackDisplay *wave; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
73 QLabel *infoName, *infoData; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
74 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
75 public: |
391 | 76 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
77 QEDWaveTrackView(QWidget *parent = 0); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
78 void setWaveform(void *mdata, int mlen, int mformat, int mchannels, int mfreq); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
79 void setName(QString name); |
391 | 80 void setTime(const float mtime); |
81 void setOffset(const float moffs); | |
82 float getScaledWidth(); | |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
83 void setScale(const float mscale); |
391 | 84 float getDuration(); |
85 float getTime(); | |
86 float getOffset(); | |
87 | |
88 private slots: | |
89 void slotTimeChanged(float value); | |
90 void slotOffsetChanged(float value); | |
91 | |
92 signals: | |
93 void timeChanged(float value); | |
94 void offsetChanged(float value); | |
357 | 95 }; |
96 | |
97 #endif |