kwave  18.07.70
SignalWidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  SignalWidget.h - Widget for displaying the signal
3  -------------------
4  begin : Sun Nov 12 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 SIGNAL_WIDGET_H
19 #define SIGNAL_WIDGET_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QGridLayout>
25 #include <QImage>
26 #include <QLabel>
27 #include <QList>
28 #include <QObject>
29 #include <QPainter>
30 #include <QPixmap>
31 #include <QPointer>
32 #include <QPolygon>
33 #include <QQueue>
34 #include <QSize>
35 #include <QTimer>
36 #include <QWidget>
37 
38 #include "libkwave/PluginManager.h"
39 #include "libkwave/SignalManager.h"
40 #include "libkwave/String.h"
41 
42 #include "libgui/SignalView.h"
43 
44 class QBitmap;
45 class QContextMenuEvent;
46 class QDragEnterEvent;
47 class QDragMoveEvent;
48 class QDropEvent;
49 class QDragLeaveEvent;
50 class QEvent;
51 class QMouseEvent;
52 class QMoveEvent;
53 class QPaintEvent;
54 class QPoint;
55 class QVBoxLayout;
56 class QWheelEvent;
57 
58 class QUrl;
59 
60 class LabelType;
61 class TimeOperation;
62 class TrackPixmap;
63 
64 namespace Kwave
65 {
66 
67  class FileContext;
68  class SignalManager;
69  class Track;
70 
75  class Q_DECL_EXPORT SignalWidget: public QWidget,
76  public Kwave::ViewManager
77  {
78  Q_OBJECT
79 
80  public:
81 
89  SignalWidget(QWidget *parent,
90  Kwave::SignalManager *signal_manager,
91  QVBoxLayout *upper_dock, QVBoxLayout *lower_dock);
92 
94  virtual ~SignalWidget() Q_DECL_OVERRIDE;
95 
101  void setZoomAndOffset(double zoom, sample_index_t offset);
102 
107  int mapToViewPort(const QPoint &pos) const;
108 
114  int visibleWidth() const;
115 
122  virtual void insertView(Kwave::SignalView *view, QWidget *controls)
123  Q_DECL_OVERRIDE;
124 
125  signals:
126 
128  void sigRepaint();
129 
130  public slots:
131 
136  void requestRepaint(Kwave::SignalView *view);
137 
139  void forwardCommand(const QString &command);
140 
141  protected slots:
142 
144  virtual void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
145 
146  private slots:
147 
152  void repaintTimerElapsed();
153 
161  void slotTrackInserted(unsigned int index, Kwave::Track *track);
162 
170  void slotTrackDeleted(unsigned int index, Kwave::Track *track);
171 
173  void contextMenuEditUndo() { forwardCommand(_("undo()")); }
174 
176  void contextMenuEditRedo() { forwardCommand(_("redo()")); }
177 
179  void contextMenuEditCut() { forwardCommand(_("cut()")); }
180 
182  void contextMenuEditCopy() { forwardCommand(_("copy()")); }
183 
185  void contextMenuEditPaste() {forwardCommand(_("paste()")); }
186 
189  forwardCommand(_("saveselect()"));
190  }
191 
194  forwardCommand(_("expandtolabel()"));
195  }
196 
199  forwardCommand(_("selectnextlabels()"));
200  }
201 
204  forwardCommand(_("selectprevlabels()"));
205  }
206 
211  void updateMinimumHeight();
212 
213  signals:
214 
222  void selectedTimeInfo(sample_index_t offset, sample_index_t length,
223  double rate);
224 
228  void sigCommand(const QString &command);
229 
231  void sigCursorChanged(sample_index_t pos);
232 
233  protected:
234 
236  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
237 
238  private:
239 
241  void setVerticalZoom(double zoom);
242 
250  void insertRow(int index, Kwave::SignalView *view, QWidget *controls);
251 
257  void deleteRow(int index);
258 
259  private:
260 
263 
270  QList< QPointer<Kwave::SignalView> > m_views;
271 
273  QGridLayout m_layout;
274 
276  QPointer<QVBoxLayout> m_upper_dock;
277 
279  QPointer<QVBoxLayout> m_lower_dock;
280 
286 
288  double m_zoom;
289 
292 
295 
297  QQueue< QPointer<Kwave::SignalView> > m_repaint_queue;
298  };
299 }
300 
301 #endif /* SIGNAL_WIDGET_H */
302 
303 //***************************************************************************
304 //***************************************************************************
QList< QPointer< Kwave::SignalView > > m_views
Definition: SignalWidget.h:270
Definition: App.h:33
void contextMenuSaveSelection()
Definition: SignalWidget.h:188
void contextMenuSelectionPrevLabels()
Definition: SignalWidget.h:203
quint64 sample_index_t
Definition: Sample.h:28
QQueue< QPointer< Kwave::SignalView > > m_repaint_queue
Definition: SignalWidget.h:297
QPointer< QVBoxLayout > m_upper_dock
Definition: SignalWidget.h:276
QGridLayout m_layout
Definition: SignalWidget.h:273
sample_index_t m_offset
Definition: SignalWidget.h:285
#define _(m)
Definition: memcpy.c:66
QPointer< QVBoxLayout > m_lower_dock
Definition: SignalWidget.h:279
Kwave::SignalManager * m_signal_manager
Definition: SignalWidget.h:262
void contextMenuSelectionNextLabels()
Definition: SignalWidget.h:198
void contextMenuSelectionExpandToLabels()
Definition: SignalWidget.h:193