Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[920a14]: src / MainWidget.h Maximize Restore History

Download this file

MainWidget.h    205 lines (153 with data), 5.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/***************************************************************************
MainWidget.h - main widget of the Kwave TopWidget
-------------------
begin : 1999
copyright : (C) 1999 by Martin Wilz
email : Martin Wilz <mwilz@ernie.mi.uni-koeln.de>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _KMAIN_WDIGET_H_
#define _KMAIN_WIDGET_H_ 1
#include <qlist.h>
#include <qwidget.h>
class QAccel;
class QComboBox;
class QFrame;
class QScrollBar;
class KButtonBox;
class KStatusBar;
class MenuManager;
class MultiStateWidget;
class SignalManager;
class OverViewWidget;
class PlaybackController;
class SignalWidget;
//***********************************************************
class MainWidget : public QWidget
{
Q_OBJECT
public:
MainWidget (QWidget *parent, MenuManager &manage, KStatusBar &status);
/**
* Returns true if this instance was successfully initialized, or
* false if something went wrong during initialization.
*/
virtual bool isOK();
~MainWidget ();
void setSignal (const char *filename, int type = 0);
void setSignal (SignalManager *);
void saveSignal (const char *filename, int bits, int type, bool selection);
/**
* Closes the current signal.
*/
void closeSignal();
/**
* Returns the current number of channels of the signal or 0 if
* no signal is loaded.
*/
unsigned int getChannelCount();
int getBitsPerSample();
/** Returns the signal manager of the current signal */
SignalManager *getSignalManager();
/** Returns the playback controller */
PlaybackController *playbackController();
protected:
/**
* Called if the main widget has been resized and resizes/moves
* the signal widget and the channel controls
*/
virtual void resizeEvent(QResizeEvent *);
void refreshChannelControls();
public slots:
bool executeCommand(const char *command);
void forwardCommand(const char *command);
void resetChannels();
void setRateInfo (int);
void setLengthInfo(int);
void setTimeInfo(double ms);
void parseKey(int key);
void setSelectedTimeInfo(double ms);
/** returns the current zoom factor */
double zoom();
/** calls setZoom() of the signal widget */
void setZoom(double new_zoom);
/** calls zoomRange() of the signal widget */
void zoomRange();
/** calls zoomIn() of the signal widget */
void zoomIn();
/** calls zoomOut() of the signal widget */
void zoomOut();
/** calls zoomAll() of the signal widget */
void zoomAll();
/** calls zoomNormal() of the signal widget */
void zoomNormal();
/** Connected to the signal widget's signalChanged() signal */
void slot_SignalChanged(int left,int right);
private slots:
/**
* Forwards the zoomChanged signal of the iternal view window
* by emitting sigZoomChanged.
*/
void forwardZoomChanged(double zoom);
/**
* Called if a channel has been added. Updates the display by
* resizing/re-positioning the channel controls and the signal
* display.
* @see #channelDeleted()
* @param channel index of the added channel [0..n]
*/
void channelAdded(unsigned int channel);
/**
* Called if a channel has been deleted. Updates the display by
* resizing/re-positioning the channel controls and the signal
* display.
* @param #channelAdded()
* @param channel index of the added channel [0..n]
*/
void channelDeleted(unsigned int channel);
/**
* Connected to the vertical scrollbar and called if the value
* has changed so that the signal display and the channel
* controls have to be moved.
*/
void scrollbarMoved(int newval);
signals:
/**
* Will be emitted if the zoom factor of the
* view has changed.
*/
void sigZoomChanged(double zoom);
void sigCommand(const char *command);
void setOperation (int);
void channelInfo (unsigned int);
protected:
/** Updates the menu and buttons. */
void refreshControls();
/** Updates the overview in the horizontal slider */
void refreshOverView();
private:
QAccel *keys;
OverViewWidget *m_slider;
SignalWidget *signalview;
KStatusBar &status;
MenuManager &menu;
QFrame *frmChannelControls;
QFrame *frmSignal;
/** vertical scrollbar, only visible if channels do not fit vertically */
QScrollBar *scrollbar;
/** array of lamps, one for each channel */
QList<MultiStateWidget> lamps;
/** array of speaker icons, one for each channel */
QList<MultiStateWidget> speakers;
/** the last number of channels (for detecting changes) */
unsigned int lastChannels;
int bsize;
};
#endif // _KMAIN_WDIGET_H_