kwave  18.07.70
OverViewWidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  OverViewWidget.h - horizontal slider with overview over a signal
3  -------------------
4  begin : Tue Oct 21 2000
5  copyright : (C) 2000 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef OVER_VIEW_WIDGET_H
19 #define OVER_VIEW_WIDGET_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QBitmap>
25 #include <QColor>
26 #include <QSize>
27 #include <QThread>
28 #include <QTimer>
29 #include <QWidget>
30 
31 #include "libkwave/LabelList.h"
32 #include "libkwave/MetaDataList.h"
33 
34 #include "libgui/ImageView.h"
35 #include "libgui/OverViewCache.h"
36 
37 class QMouseEvent;
38 class QPainter;
39 class QResizeEvent;
40 
41 namespace Kwave
42 {
43 
44  class SignalManager;
45  class Track;
46 
47  class Q_DECL_EXPORT OverViewWidget: public Kwave::ImageView
48  {
49  Q_OBJECT
50  public:
52  explicit OverViewWidget(Kwave::SignalManager &signal,
53  QWidget *parent = Q_NULLPTR);
54 
56  virtual ~OverViewWidget() Q_DECL_OVERRIDE;
57 
59  virtual QSize minimumSize() const;
60 
62  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
63 
64  public slots:
65 
74  void setRange(sample_index_t offset, sample_index_t viewport,
75  sample_index_t total);
76 
82  void setSelection(sample_index_t offset, sample_index_t length);
83 
88  void metaDataChanged(Kwave::MetaDataList meta);
89 
94  void showCursor(sample_index_t pos = SAMPLE_INDEX_MAX);
95 
96  protected:
97 
99  virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
100 
105  virtual void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
106 
111  virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
112 
122  virtual void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
123 
124  protected slots:
125 
127  void refreshBitmap();
128 
133  void overviewChanged();
134 
135  signals:
136 
141  void valueChanged(sample_index_t new_value);
142 
144  void sigCommand(const QString &command);
145 
147  void newImage(QImage image);
148 
149  protected:
150 
157  sample_index_t pixels2offset(int pixels);
158 
167  void drawMark(QPainter &p, int x, int height, QColor color);
168 
169  private:
170 
172  void calculateBitmap();
173 
174  private:
175 
177  class WorkerThread: public QThread
178  {
179  public:
181  explicit WorkerThread(Kwave::OverViewWidget *widget);
182 
184  virtual ~WorkerThread() Q_DECL_OVERRIDE;
185 
187  virtual void run() Q_DECL_OVERRIDE;
188 
189  private:
190 
193  };
194 
195  private:
196 
199 
202 
205 
208 
211 
214 
217 
220 
223 
226 
229 
230  };
231 }
232 
233 #endif // _OVER_VIEW_WIDGET_H_
234 
235 //***************************************************************************
236 //***************************************************************************
Definition: App.h:33
sample_index_t m_cursor_position
quint64 sample_index_t
Definition: Sample.h:28
Kwave::OverViewCache m_cache
sample_index_t m_view_width
Kwave::LabelList m_labels
Kwave::OverViewWidget * m_overview
sample_index_t m_last_offset
sample_index_t m_selection_length
sample_index_t m_view_offset
sample_index_t m_selection_start
WorkerThread m_worker_thread
sample_index_t m_signal_length
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31